34 #ifndef _RTE_ETHDEV_H_
35 #define _RTE_ETHDEV_H_
178 #define RTE_ETHDEV_HAS_LRO_SUPPORT
187 #include "rte_dev_info.h"
224 uint64_t
q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
226 uint64_t
q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
228 uint64_t
q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
230 uint64_t
q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
232 uint64_t
q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];
251 }__attribute__((aligned(8)));
253 #define ETH_LINK_SPEED_AUTONEG 0
254 #define ETH_LINK_SPEED_10 10
255 #define ETH_LINK_SPEED_100 100
256 #define ETH_LINK_SPEED_1000 1000
257 #define ETH_LINK_SPEED_10000 10000
258 #define ETH_LINK_SPEED_10G 10000
259 #define ETH_LINK_SPEED_20G 20000
260 #define ETH_LINK_SPEED_40G 40000
262 #define ETH_LINK_AUTONEG_DUPLEX 0
263 #define ETH_LINK_HALF_DUPLEX 1
264 #define ETH_LINK_FULL_DUPLEX 2
270 struct rte_eth_thresh {
279 #define ETH_MQ_RX_RSS_FLAG 0x1
280 #define ETH_MQ_RX_DCB_FLAG 0x2
281 #define ETH_MQ_RX_VMDQ_FLAG 0x4
312 #define ETH_RSS ETH_MQ_RX_RSS
313 #define VMDQ_DCB ETH_MQ_RX_VMDQ_DCB
314 #define ETH_DCB_RX ETH_MQ_RX_DCB
330 #define ETH_DCB_NONE ETH_MQ_TX_NONE
331 #define ETH_VMDQ_DCB_TX ETH_MQ_TX_VMDQ_DCB
332 #define ETH_DCB_TX ETH_MQ_TX_DCB
382 #define ETH_RSS_IPV4 (1ULL << RTE_ETH_FLOW_IPV4)
383 #define ETH_RSS_FRAG_IPV4 (1ULL << RTE_ETH_FLOW_FRAG_IPV4)
384 #define ETH_RSS_NONFRAG_IPV4_TCP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_TCP)
385 #define ETH_RSS_NONFRAG_IPV4_UDP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_UDP)
386 #define ETH_RSS_NONFRAG_IPV4_SCTP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP)
387 #define ETH_RSS_NONFRAG_IPV4_OTHER (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER)
388 #define ETH_RSS_IPV6 (1ULL << RTE_ETH_FLOW_IPV6)
389 #define ETH_RSS_FRAG_IPV6 (1ULL << RTE_ETH_FLOW_FRAG_IPV6)
390 #define ETH_RSS_NONFRAG_IPV6_TCP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_TCP)
391 #define ETH_RSS_NONFRAG_IPV6_UDP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_UDP)
392 #define ETH_RSS_NONFRAG_IPV6_SCTP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP)
393 #define ETH_RSS_NONFRAG_IPV6_OTHER (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER)
394 #define ETH_RSS_L2_PAYLOAD (1ULL << RTE_ETH_FLOW_L2_PAYLOAD)
395 #define ETH_RSS_IPV6_EX (1ULL << RTE_ETH_FLOW_IPV6_EX)
396 #define ETH_RSS_IPV6_TCP_EX (1ULL << RTE_ETH_FLOW_IPV6_TCP_EX)
397 #define ETH_RSS_IPV6_UDP_EX (1ULL << RTE_ETH_FLOW_IPV6_UDP_EX)
399 #define ETH_RSS_IP ( \
401 ETH_RSS_FRAG_IPV4 | \
402 ETH_RSS_NONFRAG_IPV4_OTHER | \
404 ETH_RSS_FRAG_IPV6 | \
405 ETH_RSS_NONFRAG_IPV6_OTHER | \
408 #define ETH_RSS_UDP ( \
409 ETH_RSS_NONFRAG_IPV4_UDP | \
410 ETH_RSS_NONFRAG_IPV6_UDP | \
413 #define ETH_RSS_TCP ( \
414 ETH_RSS_NONFRAG_IPV4_TCP | \
415 ETH_RSS_NONFRAG_IPV6_TCP | \
418 #define ETH_RSS_SCTP ( \
419 ETH_RSS_NONFRAG_IPV4_SCTP | \
420 ETH_RSS_NONFRAG_IPV6_SCTP)
423 #define ETH_RSS_PROTO_MASK ( \
425 ETH_RSS_FRAG_IPV4 | \
426 ETH_RSS_NONFRAG_IPV4_TCP | \
427 ETH_RSS_NONFRAG_IPV4_UDP | \
428 ETH_RSS_NONFRAG_IPV4_SCTP | \
429 ETH_RSS_NONFRAG_IPV4_OTHER | \
431 ETH_RSS_FRAG_IPV6 | \
432 ETH_RSS_NONFRAG_IPV6_TCP | \
433 ETH_RSS_NONFRAG_IPV6_UDP | \
434 ETH_RSS_NONFRAG_IPV6_SCTP | \
435 ETH_RSS_NONFRAG_IPV6_OTHER | \
436 ETH_RSS_L2_PAYLOAD | \
438 ETH_RSS_IPV6_TCP_EX | \
446 #define ETH_RSS_RETA_SIZE_64 64
447 #define ETH_RSS_RETA_SIZE_128 128
448 #define ETH_RSS_RETA_SIZE_512 512
449 #define RTE_RETA_GROUP_SIZE 64
452 #define ETH_VMDQ_MAX_VLAN_FILTERS 64
453 #define ETH_DCB_NUM_USER_PRIORITIES 8
454 #define ETH_VMDQ_DCB_NUM_QUEUES 128
455 #define ETH_DCB_NUM_QUEUES 128
458 #define ETH_DCB_PG_SUPPORT 0x00000001
459 #define ETH_DCB_PFC_SUPPORT 0x00000002
462 #define ETH_VLAN_STRIP_OFFLOAD 0x0001
463 #define ETH_VLAN_FILTER_OFFLOAD 0x0002
464 #define ETH_VLAN_EXTEND_OFFLOAD 0x0004
467 #define ETH_VLAN_STRIP_MASK 0x0001
468 #define ETH_VLAN_FILTER_MASK 0x0002
469 #define ETH_VLAN_EXTEND_MASK 0x0004
470 #define ETH_VLAN_ID_MAX 0x0FFF
473 #define ETH_NUM_RECEIVE_MAC_ADDR 128
476 #define ETH_VMDQ_NUM_UC_HASH_ARRAY 128
479 #define ETH_VMDQ_ACCEPT_UNTAG 0x0001
480 #define ETH_VMDQ_ACCEPT_HASH_MC 0x0002
481 #define ETH_VMDQ_ACCEPT_HASH_UC 0x0004
482 #define ETH_VMDQ_ACCEPT_BROADCAST 0x0008
483 #define ETH_VMDQ_ACCEPT_MULTICAST 0x0010
486 #define ETH_MIRROR_MAX_VLANS 64
488 #define ETH_MIRROR_VIRTUAL_POOL_UP 0x01
489 #define ETH_MIRROR_UPLINK_PORT 0x02
490 #define ETH_MIRROR_DOWNLINK_PORT 0x04
491 #define ETH_MIRROR_VLAN 0x08
492 #define ETH_MIRROR_VIRTUAL_POOL_DOWN 0x10
497 struct rte_eth_vlan_mirror {
523 uint8_t
reta[RTE_RETA_GROUP_SIZE];
548 struct rte_eth_dcb_rx_conf {
554 struct rte_eth_vmdq_dcb_tx_conf {
560 struct rte_eth_dcb_tx_conf {
566 struct rte_eth_vmdq_tx_conf {
594 struct rte_eth_vmdq_rx_conf {
596 uint8_t enable_default_pool;
597 uint8_t default_pool;
598 uint8_t enable_loop_back;
599 uint8_t nb_pool_maps;
633 #define ETH_TXQ_FLAGS_NOMULTSEGS 0x0001
634 #define ETH_TXQ_FLAGS_NOREFCOUNT 0x0002
635 #define ETH_TXQ_FLAGS_NOMULTMEMP 0x0004
636 #define ETH_TXQ_FLAGS_NOVLANOFFL 0x0100
637 #define ETH_TXQ_FLAGS_NOXSUMSCTP 0x0200
638 #define ETH_TXQ_FLAGS_NOXSUMUDP 0x0400
639 #define ETH_TXQ_FLAGS_NOXSUMTCP 0x0800
640 #define ETH_TXQ_FLAGS_NOOFFLOADS \
641 (ETH_TXQ_FLAGS_NOVLANOFFL | ETH_TXQ_FLAGS_NOXSUMSCTP | \
642 ETH_TXQ_FLAGS_NOXSUMUDP | ETH_TXQ_FLAGS_NOXSUMTCP)
643 #define ETH_TXQ_FLAGS_NOXSUMS \
644 (ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \
645 ETH_TXQ_FLAGS_NOXSUMTCP)
807 #define DEV_RX_OFFLOAD_VLAN_STRIP 0x00000001
808 #define DEV_RX_OFFLOAD_IPV4_CKSUM 0x00000002
809 #define DEV_RX_OFFLOAD_UDP_CKSUM 0x00000004
810 #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008
811 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010
812 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020
817 #define DEV_TX_OFFLOAD_VLAN_INSERT 0x00000001
818 #define DEV_TX_OFFLOAD_IPV4_CKSUM 0x00000002
819 #define DEV_TX_OFFLOAD_UDP_CKSUM 0x00000004
820 #define DEV_TX_OFFLOAD_TCP_CKSUM 0x00000008
821 #define DEV_TX_OFFLOAD_SCTP_CKSUM 0x00000010
822 #define DEV_TX_OFFLOAD_TCP_TSO 0x00000020
823 #define DEV_TX_OFFLOAD_UDP_TSO 0x00000040
824 #define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080
825 #define DEV_TX_OFFLOAD_QINQ_INSERT 0x00000100
827 struct rte_eth_dev_info {
829 const char *driver_name;
830 unsigned int if_index;
832 uint32_t min_rx_bufsize;
833 uint32_t max_rx_pktlen;
834 uint16_t max_rx_queues;
835 uint16_t max_tx_queues;
836 uint32_t max_mac_addrs;
837 uint32_t max_hash_mac_addrs;
840 uint16_t max_vmdq_pools;
841 uint32_t rx_offload_capa;
842 uint32_t tx_offload_capa;
845 uint8_t hash_key_size;
847 uint64_t flow_type_rss_offloads;
850 uint16_t vmdq_queue_base;
851 uint16_t vmdq_queue_num;
852 uint16_t vmdq_pool_base;
878 #define RTE_ETH_XSTATS_NAME_SIZE 64
892 #define ETH_DCB_NUM_TCS 8
893 #define ETH_MAX_VMDQ_POOL 64
904 }
tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
909 }
tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
927 #define RTE_ETH_QUEUE_STATE_STOPPED 0
928 #define RTE_ETH_QUEUE_STATE_STARTED 1
932 struct rte_eth_dev_callback;
934 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
937 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
938 #define RTE_PMD_DEBUG_TRACE(...) \
939 rte_pmd_debug_trace(__func__, __VA_ARGS__)
941 #define RTE_PMD_DEBUG_TRACE(...)
946 #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
947 if (!rte_eth_dev_is_valid_port(port_id)) { \
948 RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
953 #define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
954 if (!rte_eth_dev_is_valid_port(port_id)) { \
955 RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
966 typedef int (*eth_dev_configure_t)(
struct rte_eth_dev *dev);
969 typedef int (*eth_dev_start_t)(
struct rte_eth_dev *dev);
972 typedef void (*eth_dev_stop_t)(
struct rte_eth_dev *dev);
975 typedef int (*eth_dev_set_link_up_t)(
struct rte_eth_dev *dev);
978 typedef int (*eth_dev_set_link_down_t)(
struct rte_eth_dev *dev);
981 typedef void (*eth_dev_close_t)(
struct rte_eth_dev *dev);
984 typedef void (*eth_promiscuous_enable_t)(
struct rte_eth_dev *dev);
987 typedef void (*eth_promiscuous_disable_t)(
struct rte_eth_dev *dev);
990 typedef void (*eth_allmulticast_enable_t)(
struct rte_eth_dev *dev);
993 typedef void (*eth_allmulticast_disable_t)(
struct rte_eth_dev *dev);
996 typedef int (*eth_link_update_t)(
struct rte_eth_dev *dev,
997 int wait_to_complete);
1000 typedef void (*eth_stats_get_t)(
struct rte_eth_dev *dev,
1004 typedef void (*eth_stats_reset_t)(
struct rte_eth_dev *dev);
1007 typedef int (*eth_xstats_get_t)(
struct rte_eth_dev *dev,
1011 typedef void (*eth_xstats_reset_t)(
struct rte_eth_dev *dev);
1014 typedef int (*eth_queue_stats_mapping_set_t)(
struct rte_eth_dev *dev,
1020 typedef void (*eth_dev_infos_get_t)(
struct rte_eth_dev *dev,
1021 struct rte_eth_dev_info *dev_info);
1024 typedef int (*eth_queue_start_t)(
struct rte_eth_dev *dev,
1028 typedef int (*eth_queue_stop_t)(
struct rte_eth_dev *dev,
1032 typedef int (*eth_rx_queue_setup_t)(
struct rte_eth_dev *dev,
1033 uint16_t rx_queue_id,
1034 uint16_t nb_rx_desc,
1035 unsigned int socket_id,
1040 typedef int (*eth_tx_queue_setup_t)(
struct rte_eth_dev *dev,
1041 uint16_t tx_queue_id,
1042 uint16_t nb_tx_desc,
1043 unsigned int socket_id,
1047 typedef int (*eth_rx_enable_intr_t)(
struct rte_eth_dev *dev,
1048 uint16_t rx_queue_id);
1051 typedef int (*eth_rx_disable_intr_t)(
struct rte_eth_dev *dev,
1052 uint16_t rx_queue_id);
1055 typedef void (*eth_queue_release_t)(
void *queue);
1058 typedef uint32_t (*eth_rx_queue_count_t)(
struct rte_eth_dev *dev,
1059 uint16_t rx_queue_id);
1062 typedef int (*eth_rx_descriptor_done_t)(
void *rxq, uint16_t offset);
1065 typedef void (*eth_rxq_info_get_t)(
struct rte_eth_dev *dev,
1068 typedef void (*eth_txq_info_get_t)(
struct rte_eth_dev *dev,
1071 typedef int (*mtu_set_t)(
struct rte_eth_dev *dev, uint16_t mtu);
1074 typedef int (*vlan_filter_set_t)(
struct rte_eth_dev *dev,
1079 typedef void (*vlan_tpid_set_t)(
struct rte_eth_dev *dev,
1083 typedef void (*vlan_offload_set_t)(
struct rte_eth_dev *dev,
int mask);
1086 typedef int (*vlan_pvid_set_t)(
struct rte_eth_dev *dev,
1091 typedef void (*vlan_strip_queue_set_t)(
struct rte_eth_dev *dev,
1092 uint16_t rx_queue_id,
1096 typedef uint16_t (*eth_rx_burst_t)(
void *rxq,
1101 typedef uint16_t (*eth_tx_burst_t)(
void *txq,
1106 typedef int (*flow_ctrl_get_t)(
struct rte_eth_dev *dev,
1110 typedef int (*flow_ctrl_set_t)(
struct rte_eth_dev *dev,
1114 typedef int (*priority_flow_ctrl_set_t)(
struct rte_eth_dev *dev,
1118 typedef int (*reta_update_t)(
struct rte_eth_dev *dev,
1120 uint16_t reta_size);
1123 typedef int (*reta_query_t)(
struct rte_eth_dev *dev,
1125 uint16_t reta_size);
1128 typedef int (*rss_hash_update_t)(
struct rte_eth_dev *dev,
1132 typedef int (*rss_hash_conf_get_t)(
struct rte_eth_dev *dev,
1136 typedef int (*eth_dev_led_on_t)(
struct rte_eth_dev *dev);
1139 typedef int (*eth_dev_led_off_t)(
struct rte_eth_dev *dev);
1142 typedef void (*eth_mac_addr_remove_t)(
struct rte_eth_dev *dev, uint32_t index);
1145 typedef void (*eth_mac_addr_add_t)(
struct rte_eth_dev *dev,
1151 typedef void (*eth_mac_addr_set_t)(
struct rte_eth_dev *dev,
1155 typedef int (*eth_uc_hash_table_set_t)(
struct rte_eth_dev *dev,
1160 typedef int (*eth_uc_all_hash_table_set_t)(
struct rte_eth_dev *dev,
1164 typedef int (*eth_set_vf_rx_mode_t)(
struct rte_eth_dev *dev,
1170 typedef int (*eth_set_vf_rx_t)(
struct rte_eth_dev *dev,
1175 typedef int (*eth_set_vf_tx_t)(
struct rte_eth_dev *dev,
1180 typedef int (*eth_set_vf_vlan_filter_t)(
struct rte_eth_dev *dev,
1186 typedef int (*eth_set_queue_rate_limit_t)(
struct rte_eth_dev *dev,
1191 typedef int (*eth_set_vf_rate_limit_t)(
struct rte_eth_dev *dev,
1197 typedef int (*eth_mirror_rule_set_t)(
struct rte_eth_dev *dev,
1203 typedef int (*eth_mirror_rule_reset_t)(
struct rte_eth_dev *dev,
1207 typedef int (*eth_udp_tunnel_add_t)(
struct rte_eth_dev *dev,
1211 typedef int (*eth_udp_tunnel_del_t)(
struct rte_eth_dev *dev,
1215 typedef int (*eth_set_mc_addr_list_t)(
struct rte_eth_dev *dev,
1217 uint32_t nb_mc_addr);
1220 typedef int (*eth_timesync_enable_t)(
struct rte_eth_dev *dev);
1223 typedef int (*eth_timesync_disable_t)(
struct rte_eth_dev *dev);
1226 typedef int (*eth_timesync_read_rx_timestamp_t)(
struct rte_eth_dev *dev,
1227 struct timespec *timestamp,
1231 typedef int (*eth_timesync_read_tx_timestamp_t)(
struct rte_eth_dev *dev,
1232 struct timespec *timestamp);
1235 typedef int (*eth_timesync_adjust_time)(
struct rte_eth_dev *dev, int64_t);
1238 typedef int (*eth_timesync_read_time)(
struct rte_eth_dev *dev,
1239 struct timespec *timestamp);
1242 typedef int (*eth_timesync_write_time)(
struct rte_eth_dev *dev,
1243 const struct timespec *timestamp);
1246 typedef int (*eth_get_reg_length_t)(
struct rte_eth_dev *dev);
1249 typedef int (*eth_get_reg_t)(
struct rte_eth_dev *dev,
1250 struct rte_dev_reg_info *info);
1253 typedef int (*eth_get_eeprom_length_t)(
struct rte_eth_dev *dev);
1256 typedef int (*eth_get_eeprom_t)(
struct rte_eth_dev *dev,
1257 struct rte_dev_eeprom_info *info);
1260 typedef int (*eth_set_eeprom_t)(
struct rte_eth_dev *dev,
1261 struct rte_dev_eeprom_info *info);
1264 #ifdef RTE_NIC_BYPASS
1267 RTE_BYPASS_MODE_NONE,
1268 RTE_BYPASS_MODE_NORMAL,
1269 RTE_BYPASS_MODE_BYPASS,
1270 RTE_BYPASS_MODE_ISOLATE,
1271 RTE_BYPASS_MODE_NUM,
1274 #define RTE_BYPASS_MODE_VALID(x) \
1275 ((x) > RTE_BYPASS_MODE_NONE && (x) < RTE_BYPASS_MODE_NUM)
1278 RTE_BYPASS_EVENT_NONE,
1279 RTE_BYPASS_EVENT_START,
1280 RTE_BYPASS_EVENT_OS_ON = RTE_BYPASS_EVENT_START,
1281 RTE_BYPASS_EVENT_POWER_ON,
1282 RTE_BYPASS_EVENT_OS_OFF,
1283 RTE_BYPASS_EVENT_POWER_OFF,
1284 RTE_BYPASS_EVENT_TIMEOUT,
1285 RTE_BYPASS_EVENT_NUM
1288 #define RTE_BYPASS_EVENT_VALID(x) \
1289 ((x) > RTE_BYPASS_EVENT_NONE && (x) < RTE_BYPASS_MODE_NUM)
1293 RTE_BYPASS_TMT_1_5_SEC,
1294 RTE_BYPASS_TMT_2_SEC,
1295 RTE_BYPASS_TMT_3_SEC,
1296 RTE_BYPASS_TMT_4_SEC,
1297 RTE_BYPASS_TMT_8_SEC,
1298 RTE_BYPASS_TMT_16_SEC,
1299 RTE_BYPASS_TMT_32_SEC,
1303 #define RTE_BYPASS_TMT_VALID(x) \
1304 ((x) == RTE_BYPASS_TMT_OFF || \
1305 ((x) > RTE_BYPASS_TMT_OFF && (x) < RTE_BYPASS_TMT_NUM))
1307 typedef void (*bypass_init_t)(
struct rte_eth_dev *dev);
1308 typedef int32_t (*bypass_state_set_t)(
struct rte_eth_dev *dev, uint32_t *new_state);
1309 typedef int32_t (*bypass_state_show_t)(
struct rte_eth_dev *dev, uint32_t *state);
1310 typedef int32_t (*bypass_event_set_t)(
struct rte_eth_dev *dev, uint32_t state, uint32_t event);
1311 typedef int32_t (*bypass_event_show_t)(
struct rte_eth_dev *dev, uint32_t event_shift, uint32_t *event);
1312 typedef int32_t (*bypass_wd_timeout_set_t)(
struct rte_eth_dev *dev, uint32_t timeout);
1313 typedef int32_t (*bypass_wd_timeout_show_t)(
struct rte_eth_dev *dev, uint32_t *wd_timeout);
1314 typedef int32_t (*bypass_ver_show_t)(
struct rte_eth_dev *dev, uint32_t *ver);
1315 typedef int32_t (*bypass_wd_reset_t)(
struct rte_eth_dev *dev);
1318 typedef int (*eth_filter_ctrl_t)(
struct rte_eth_dev *dev,
1324 typedef int (*eth_get_dcb_info)(
struct rte_eth_dev *dev,
1331 struct eth_dev_ops {
1332 eth_dev_configure_t dev_configure;
1333 eth_dev_start_t dev_start;
1334 eth_dev_stop_t dev_stop;
1335 eth_dev_set_link_up_t dev_set_link_up;
1336 eth_dev_set_link_down_t dev_set_link_down;
1337 eth_dev_close_t dev_close;
1338 eth_promiscuous_enable_t promiscuous_enable;
1339 eth_promiscuous_disable_t promiscuous_disable;
1340 eth_allmulticast_enable_t allmulticast_enable;
1341 eth_allmulticast_disable_t allmulticast_disable;
1342 eth_link_update_t link_update;
1343 eth_stats_get_t stats_get;
1344 eth_stats_reset_t stats_reset;
1345 eth_xstats_get_t xstats_get;
1346 eth_xstats_reset_t xstats_reset;
1347 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1349 eth_dev_infos_get_t dev_infos_get;
1351 vlan_filter_set_t vlan_filter_set;
1352 vlan_tpid_set_t vlan_tpid_set;
1353 vlan_strip_queue_set_t vlan_strip_queue_set;
1354 vlan_offload_set_t vlan_offload_set;
1355 vlan_pvid_set_t vlan_pvid_set;
1356 eth_queue_start_t rx_queue_start;
1357 eth_queue_stop_t rx_queue_stop;
1358 eth_queue_start_t tx_queue_start;
1359 eth_queue_stop_t tx_queue_stop;
1360 eth_rx_queue_setup_t rx_queue_setup;
1361 eth_queue_release_t rx_queue_release;
1362 eth_rx_queue_count_t rx_queue_count;
1363 eth_rx_descriptor_done_t rx_descriptor_done;
1365 eth_rx_enable_intr_t rx_queue_intr_enable;
1367 eth_rx_disable_intr_t rx_queue_intr_disable;
1368 eth_tx_queue_setup_t tx_queue_setup;
1369 eth_queue_release_t tx_queue_release;
1370 eth_dev_led_on_t dev_led_on;
1371 eth_dev_led_off_t dev_led_off;
1372 flow_ctrl_get_t flow_ctrl_get;
1373 flow_ctrl_set_t flow_ctrl_set;
1374 priority_flow_ctrl_set_t priority_flow_ctrl_set;
1375 eth_mac_addr_remove_t mac_addr_remove;
1376 eth_mac_addr_add_t mac_addr_add;
1377 eth_mac_addr_set_t mac_addr_set;
1378 eth_uc_hash_table_set_t uc_hash_table_set;
1379 eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1380 eth_mirror_rule_set_t mirror_rule_set;
1381 eth_mirror_rule_reset_t mirror_rule_reset;
1382 eth_set_vf_rx_mode_t set_vf_rx_mode;
1383 eth_set_vf_rx_t set_vf_rx;
1384 eth_set_vf_tx_t set_vf_tx;
1385 eth_set_vf_vlan_filter_t set_vf_vlan_filter;
1386 eth_udp_tunnel_add_t udp_tunnel_add;
1387 eth_udp_tunnel_del_t udp_tunnel_del;
1388 eth_set_queue_rate_limit_t set_queue_rate_limit;
1389 eth_set_vf_rate_limit_t set_vf_rate_limit;
1391 reta_update_t reta_update;
1393 reta_query_t reta_query;
1395 eth_get_reg_length_t get_reg_length;
1397 eth_get_reg_t get_reg;
1399 eth_get_eeprom_length_t get_eeprom_length;
1401 eth_get_eeprom_t get_eeprom;
1403 eth_set_eeprom_t set_eeprom;
1406 #ifdef RTE_NIC_BYPASS
1407 bypass_init_t bypass_init;
1408 bypass_state_set_t bypass_state_set;
1409 bypass_state_show_t bypass_state_show;
1410 bypass_event_set_t bypass_event_set;
1411 bypass_event_show_t bypass_event_show;
1412 bypass_wd_timeout_set_t bypass_wd_timeout_set;
1413 bypass_wd_timeout_show_t bypass_wd_timeout_show;
1414 bypass_ver_show_t bypass_ver_show;
1415 bypass_wd_reset_t bypass_wd_reset;
1419 rss_hash_update_t rss_hash_update;
1421 rss_hash_conf_get_t rss_hash_conf_get;
1422 eth_filter_ctrl_t filter_ctrl;
1424 eth_set_mc_addr_list_t set_mc_addr_list;
1425 eth_rxq_info_get_t rxq_info_get;
1427 eth_txq_info_get_t txq_info_get;
1430 eth_timesync_enable_t timesync_enable;
1432 eth_timesync_disable_t timesync_disable;
1434 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1436 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1439 eth_get_dcb_info get_dcb_info;
1441 eth_timesync_adjust_time timesync_adjust_time;
1443 eth_timesync_read_time timesync_read_time;
1445 eth_timesync_write_time timesync_write_time;
1471 struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts,
1495 struct rte_mbuf *pkts[], uint16_t nb_pkts,
void *user_param);
1502 struct rte_eth_rxtx_callback {
1503 struct rte_eth_rxtx_callback *next;
1532 struct rte_eth_dev {
1533 eth_rx_burst_t rx_pkt_burst;
1534 eth_tx_burst_t tx_pkt_burst;
1535 struct rte_eth_dev_data *data;
1536 const struct eth_driver *driver;
1537 const struct eth_dev_ops *dev_ops;
1540 struct rte_eth_dev_cb_list link_intr_cbs;
1545 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1550 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1555 struct rte_eth_dev_sriov {
1557 uint8_t nb_q_per_pool;
1558 uint16_t def_vmdq_idx;
1559 uint16_t def_pool_q_idx;
1561 #define RTE_ETH_DEV_SRIOV(dev) ((dev)->data->sriov)
1563 #define RTE_ETH_NAME_MAX_LEN (32)
1572 struct rte_eth_dev_data {
1573 char name[RTE_ETH_NAME_MAX_LEN];
1577 uint16_t nb_rx_queues;
1578 uint16_t nb_tx_queues;
1580 struct rte_eth_dev_sriov sriov;
1590 uint32_t min_rx_buf_size;
1593 uint64_t rx_mbuf_alloc_failed;
1600 uint8_t promiscuous : 1,
1605 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1607 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1610 enum rte_kernel_driver kdrv;
1612 const char *drv_name;
1616 #define RTE_ETH_DEV_DETACHABLE 0x0001
1618 #define RTE_ETH_DEV_INTR_LSC 0x0002
1625 extern struct rte_eth_dev rte_eth_devices[];
1651 extern struct rte_eth_dev *rte_eth_dev_allocated(
const char *name);
1663 struct rte_eth_dev *rte_eth_dev_allocate(
const char *name,
1675 int rte_eth_dev_release_port(
struct rte_eth_dev *eth_dev);
1736 typedef int (*eth_dev_init_t)(
struct rte_eth_dev *eth_dev);
1753 typedef int (*eth_dev_uninit_t)(
struct rte_eth_dev *eth_dev);
1772 eth_dev_init_t eth_dev_init;
1773 eth_dev_uninit_t eth_dev_uninit;
1774 unsigned int dev_private_size;
1787 extern void rte_eth_driver_register(
struct eth_driver *eth_drv);
1819 uint16_t nb_rx_queue,
1820 uint16_t nb_tx_queue,
1863 uint16_t nb_rx_desc,
unsigned int socket_id,
1911 uint16_t nb_tx_desc,
unsigned int socket_id,
1924 extern int rte_eth_dev_socket_id(uint8_t port_id);
1935 extern int rte_eth_dev_is_valid_port(uint8_t port_id);
1953 extern int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
1969 extern int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
1986 extern int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);
2002 extern int rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id);
2228 uint16_t tx_queue_id,
2249 uint16_t rx_queue_id,
2273 struct rte_eth_dev_info *dev_info);
2343 uint16_t rx_queue_id,
int on);
2495 static inline uint16_t
2497 struct rte_mbuf **rx_pkts,
const uint16_t nb_pkts)
2499 struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2501 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2502 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2503 RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
2505 if (queue_id >= dev->data->nb_rx_queues) {
2506 RTE_PMD_DEBUG_TRACE(
"Invalid RX queue_id=%d\n", queue_id);
2510 int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
2513 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2514 struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
2518 nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
2519 nb_pkts, cb->param);
2521 }
while (cb != NULL);
2543 struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2544 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
2545 RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
2546 return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
2567 struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2568 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
2569 RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
2570 return (*dev->dev_ops->rx_descriptor_done)( \
2571 dev->data->rx_queues[queue_id], offset);
2632 static inline uint16_t
2634 struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
2636 struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2638 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2639 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2640 RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
2642 if (queue_id >= dev->data->nb_tx_queues) {
2643 RTE_PMD_DEBUG_TRACE(
"Invalid TX queue_id=%d\n", queue_id);
2648 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2649 struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id];
2653 nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
2656 }
while (cb != NULL);
2660 return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
2732 void _rte_eth_dev_callback_process(
struct rte_eth_dev *dev,
2819 int epfd,
int op,
void *data);
2968 uint16_t reta_size);
2987 uint16_t reta_size);
3194 uint16_t tx_rate, uint64_t q_msk);
3565 struct rte_eth_rxtx_callback *user_cb);
3598 struct rte_eth_rxtx_callback *user_cb);
3651 int rte_eth_dev_get_reg_length(uint8_t port_id);
3732 uint32_t nb_mc_addr);
3778 struct timespec *timestamp,
3796 struct timespec *timestamp);
3850 const struct timespec *time);
3887 uint16_t queue_id,
size_t size,
3888 unsigned align,
int socket_id);