34 #ifndef _RTE_ETHDEV_H_
35 #define _RTE_ETHDEV_H_
178 #define RTE_ETHDEV_HAS_LRO_SUPPORT
188 #include "rte_dev_info.h"
210 uint64_t
q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
212 uint64_t
q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
214 uint64_t
q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
216 uint64_t
q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
218 uint64_t
q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];
225 #define ETH_LINK_SPEED_AUTONEG (0 << 0)
226 #define ETH_LINK_SPEED_FIXED (1 << 0)
227 #define ETH_LINK_SPEED_10M_HD (1 << 1)
228 #define ETH_LINK_SPEED_10M (1 << 2)
229 #define ETH_LINK_SPEED_100M_HD (1 << 3)
230 #define ETH_LINK_SPEED_100M (1 << 4)
231 #define ETH_LINK_SPEED_1G (1 << 5)
232 #define ETH_LINK_SPEED_2_5G (1 << 6)
233 #define ETH_LINK_SPEED_5G (1 << 7)
234 #define ETH_LINK_SPEED_10G (1 << 8)
235 #define ETH_LINK_SPEED_20G (1 << 9)
236 #define ETH_LINK_SPEED_25G (1 << 10)
237 #define ETH_LINK_SPEED_40G (1 << 11)
238 #define ETH_LINK_SPEED_50G (1 << 12)
239 #define ETH_LINK_SPEED_56G (1 << 13)
240 #define ETH_LINK_SPEED_100G (1 << 14)
245 #define ETH_SPEED_NUM_NONE 0
246 #define ETH_SPEED_NUM_10M 10
247 #define ETH_SPEED_NUM_100M 100
248 #define ETH_SPEED_NUM_1G 1000
249 #define ETH_SPEED_NUM_2_5G 2500
250 #define ETH_SPEED_NUM_5G 5000
251 #define ETH_SPEED_NUM_10G 10000
252 #define ETH_SPEED_NUM_20G 20000
253 #define ETH_SPEED_NUM_25G 25000
254 #define ETH_SPEED_NUM_40G 40000
255 #define ETH_SPEED_NUM_50G 50000
256 #define ETH_SPEED_NUM_56G 56000
257 #define ETH_SPEED_NUM_100G 100000
268 } __attribute__((aligned(8)));
271 #define ETH_LINK_HALF_DUPLEX 0
272 #define ETH_LINK_FULL_DUPLEX 1
273 #define ETH_LINK_DOWN 0
274 #define ETH_LINK_UP 1
275 #define ETH_LINK_FIXED 0
276 #define ETH_LINK_AUTONEG 1
282 struct rte_eth_thresh {
291 #define ETH_MQ_RX_RSS_FLAG 0x1
292 #define ETH_MQ_RX_DCB_FLAG 0x2
293 #define ETH_MQ_RX_VMDQ_FLAG 0x4
324 #define ETH_RSS ETH_MQ_RX_RSS
325 #define VMDQ_DCB ETH_MQ_RX_VMDQ_DCB
326 #define ETH_DCB_RX ETH_MQ_RX_DCB
342 #define ETH_DCB_NONE ETH_MQ_TX_NONE
343 #define ETH_VMDQ_DCB_TX ETH_MQ_TX_VMDQ_DCB
344 #define ETH_DCB_TX ETH_MQ_TX_DCB
371 ETH_VLAN_TYPE_UNKNOWN = 0,
406 #define ETH_RSS_IPV4 (1ULL << RTE_ETH_FLOW_IPV4)
407 #define ETH_RSS_FRAG_IPV4 (1ULL << RTE_ETH_FLOW_FRAG_IPV4)
408 #define ETH_RSS_NONFRAG_IPV4_TCP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_TCP)
409 #define ETH_RSS_NONFRAG_IPV4_UDP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_UDP)
410 #define ETH_RSS_NONFRAG_IPV4_SCTP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP)
411 #define ETH_RSS_NONFRAG_IPV4_OTHER (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER)
412 #define ETH_RSS_IPV6 (1ULL << RTE_ETH_FLOW_IPV6)
413 #define ETH_RSS_FRAG_IPV6 (1ULL << RTE_ETH_FLOW_FRAG_IPV6)
414 #define ETH_RSS_NONFRAG_IPV6_TCP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_TCP)
415 #define ETH_RSS_NONFRAG_IPV6_UDP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_UDP)
416 #define ETH_RSS_NONFRAG_IPV6_SCTP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP)
417 #define ETH_RSS_NONFRAG_IPV6_OTHER (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER)
418 #define ETH_RSS_L2_PAYLOAD (1ULL << RTE_ETH_FLOW_L2_PAYLOAD)
419 #define ETH_RSS_IPV6_EX (1ULL << RTE_ETH_FLOW_IPV6_EX)
420 #define ETH_RSS_IPV6_TCP_EX (1ULL << RTE_ETH_FLOW_IPV6_TCP_EX)
421 #define ETH_RSS_IPV6_UDP_EX (1ULL << RTE_ETH_FLOW_IPV6_UDP_EX)
422 #define ETH_RSS_PORT (1ULL << RTE_ETH_FLOW_PORT)
423 #define ETH_RSS_VXLAN (1ULL << RTE_ETH_FLOW_VXLAN)
424 #define ETH_RSS_GENEVE (1ULL << RTE_ETH_FLOW_GENEVE)
425 #define ETH_RSS_NVGRE (1ULL << RTE_ETH_FLOW_NVGRE)
427 #define ETH_RSS_IP ( \
429 ETH_RSS_FRAG_IPV4 | \
430 ETH_RSS_NONFRAG_IPV4_OTHER | \
432 ETH_RSS_FRAG_IPV6 | \
433 ETH_RSS_NONFRAG_IPV6_OTHER | \
436 #define ETH_RSS_UDP ( \
437 ETH_RSS_NONFRAG_IPV4_UDP | \
438 ETH_RSS_NONFRAG_IPV6_UDP | \
441 #define ETH_RSS_TCP ( \
442 ETH_RSS_NONFRAG_IPV4_TCP | \
443 ETH_RSS_NONFRAG_IPV6_TCP | \
446 #define ETH_RSS_SCTP ( \
447 ETH_RSS_NONFRAG_IPV4_SCTP | \
448 ETH_RSS_NONFRAG_IPV6_SCTP)
450 #define ETH_RSS_TUNNEL ( \
457 #define ETH_RSS_PROTO_MASK ( \
459 ETH_RSS_FRAG_IPV4 | \
460 ETH_RSS_NONFRAG_IPV4_TCP | \
461 ETH_RSS_NONFRAG_IPV4_UDP | \
462 ETH_RSS_NONFRAG_IPV4_SCTP | \
463 ETH_RSS_NONFRAG_IPV4_OTHER | \
465 ETH_RSS_FRAG_IPV6 | \
466 ETH_RSS_NONFRAG_IPV6_TCP | \
467 ETH_RSS_NONFRAG_IPV6_UDP | \
468 ETH_RSS_NONFRAG_IPV6_SCTP | \
469 ETH_RSS_NONFRAG_IPV6_OTHER | \
470 ETH_RSS_L2_PAYLOAD | \
472 ETH_RSS_IPV6_TCP_EX | \
473 ETH_RSS_IPV6_UDP_EX | \
484 #define ETH_RSS_RETA_SIZE_64 64
485 #define ETH_RSS_RETA_SIZE_128 128
486 #define ETH_RSS_RETA_SIZE_256 256
487 #define ETH_RSS_RETA_SIZE_512 512
488 #define RTE_RETA_GROUP_SIZE 64
491 #define ETH_VMDQ_MAX_VLAN_FILTERS 64
492 #define ETH_DCB_NUM_USER_PRIORITIES 8
493 #define ETH_VMDQ_DCB_NUM_QUEUES 128
494 #define ETH_DCB_NUM_QUEUES 128
497 #define ETH_DCB_PG_SUPPORT 0x00000001
498 #define ETH_DCB_PFC_SUPPORT 0x00000002
501 #define ETH_VLAN_STRIP_OFFLOAD 0x0001
502 #define ETH_VLAN_FILTER_OFFLOAD 0x0002
503 #define ETH_VLAN_EXTEND_OFFLOAD 0x0004
506 #define ETH_VLAN_STRIP_MASK 0x0001
507 #define ETH_VLAN_FILTER_MASK 0x0002
508 #define ETH_VLAN_EXTEND_MASK 0x0004
509 #define ETH_VLAN_ID_MAX 0x0FFF
512 #define ETH_NUM_RECEIVE_MAC_ADDR 128
515 #define ETH_VMDQ_NUM_UC_HASH_ARRAY 128
518 #define ETH_VMDQ_ACCEPT_UNTAG 0x0001
519 #define ETH_VMDQ_ACCEPT_HASH_MC 0x0002
520 #define ETH_VMDQ_ACCEPT_HASH_UC 0x0004
521 #define ETH_VMDQ_ACCEPT_BROADCAST 0x0008
522 #define ETH_VMDQ_ACCEPT_MULTICAST 0x0010
525 #define ETH_MIRROR_MAX_VLANS 64
527 #define ETH_MIRROR_VIRTUAL_POOL_UP 0x01
528 #define ETH_MIRROR_UPLINK_PORT 0x02
529 #define ETH_MIRROR_DOWNLINK_PORT 0x04
530 #define ETH_MIRROR_VLAN 0x08
531 #define ETH_MIRROR_VIRTUAL_POOL_DOWN 0x10
536 struct rte_eth_vlan_mirror {
562 uint16_t
reta[RTE_RETA_GROUP_SIZE];
587 struct rte_eth_dcb_rx_conf {
593 struct rte_eth_vmdq_dcb_tx_conf {
599 struct rte_eth_dcb_tx_conf {
605 struct rte_eth_vmdq_tx_conf {
633 struct rte_eth_vmdq_rx_conf {
635 uint8_t enable_default_pool;
636 uint8_t default_pool;
637 uint8_t enable_loop_back;
638 uint8_t nb_pool_maps;
673 #define ETH_TXQ_FLAGS_NOMULTSEGS 0x0001
674 #define ETH_TXQ_FLAGS_NOREFCOUNT 0x0002
675 #define ETH_TXQ_FLAGS_NOMULTMEMP 0x0004
676 #define ETH_TXQ_FLAGS_NOVLANOFFL 0x0100
677 #define ETH_TXQ_FLAGS_NOXSUMSCTP 0x0200
678 #define ETH_TXQ_FLAGS_NOXSUMUDP 0x0400
679 #define ETH_TXQ_FLAGS_NOXSUMTCP 0x0800
680 #define ETH_TXQ_FLAGS_NOOFFLOADS \
681 (ETH_TXQ_FLAGS_NOVLANOFFL | ETH_TXQ_FLAGS_NOXSUMSCTP | \
682 ETH_TXQ_FLAGS_NOXSUMUDP | ETH_TXQ_FLAGS_NOXSUMTCP)
683 #define ETH_TXQ_FLAGS_NOXSUMS \
684 (ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \
685 ETH_TXQ_FLAGS_NOXSUMTCP)
877 #define DEV_RX_OFFLOAD_VLAN_STRIP 0x00000001
878 #define DEV_RX_OFFLOAD_IPV4_CKSUM 0x00000002
879 #define DEV_RX_OFFLOAD_UDP_CKSUM 0x00000004
880 #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008
881 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010
882 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020
883 #define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040
884 #define DEV_RX_OFFLOAD_MACSEC_STRIP 0x00000080
889 #define DEV_TX_OFFLOAD_VLAN_INSERT 0x00000001
890 #define DEV_TX_OFFLOAD_IPV4_CKSUM 0x00000002
891 #define DEV_TX_OFFLOAD_UDP_CKSUM 0x00000004
892 #define DEV_TX_OFFLOAD_TCP_CKSUM 0x00000008
893 #define DEV_TX_OFFLOAD_SCTP_CKSUM 0x00000010
894 #define DEV_TX_OFFLOAD_TCP_TSO 0x00000020
895 #define DEV_TX_OFFLOAD_UDP_TSO 0x00000040
896 #define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080
897 #define DEV_TX_OFFLOAD_QINQ_INSERT 0x00000100
898 #define DEV_TX_OFFLOAD_VXLAN_TNL_TSO 0x00000200
899 #define DEV_TX_OFFLOAD_GRE_TNL_TSO 0x00000400
900 #define DEV_TX_OFFLOAD_IPIP_TNL_TSO 0x00000800
901 #define DEV_TX_OFFLOAD_GENEVE_TNL_TSO 0x00001000
902 #define DEV_TX_OFFLOAD_MACSEC_INSERT 0x00002000
917 uint32_t max_hash_mac_addrs;
962 #define RTE_ETH_XSTATS_NAME_SIZE 64
989 #define ETH_DCB_NUM_TCS 8
990 #define ETH_MAX_VMDQ_POOL 64
1001 }
tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
1006 }
tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
1024 #define RTE_ETH_QUEUE_STATE_STOPPED 0
1025 #define RTE_ETH_QUEUE_STATE_STARTED 1
1029 struct rte_eth_dev_callback;
1031 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
1034 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
1035 #define RTE_PMD_DEBUG_TRACE(...) \
1036 rte_pmd_debug_trace(__func__, __VA_ARGS__)
1038 #define RTE_PMD_DEBUG_TRACE(...)
1043 #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
1044 if (!rte_eth_dev_is_valid_port(port_id)) { \
1045 RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
1050 #define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
1051 if (!rte_eth_dev_is_valid_port(port_id)) { \
1052 RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
1062 #define ETH_L2_TUNNEL_ENABLE_MASK 0x00000001
1064 #define ETH_L2_TUNNEL_INSERTION_MASK 0x00000002
1066 #define ETH_L2_TUNNEL_STRIPPING_MASK 0x00000004
1068 #define ETH_L2_TUNNEL_FORWARDING_MASK 0x00000008
1076 typedef int (*eth_dev_configure_t)(
struct rte_eth_dev *dev);
1079 typedef int (*eth_dev_start_t)(
struct rte_eth_dev *dev);
1082 typedef void (*eth_dev_stop_t)(
struct rte_eth_dev *dev);
1085 typedef int (*eth_dev_set_link_up_t)(
struct rte_eth_dev *dev);
1088 typedef int (*eth_dev_set_link_down_t)(
struct rte_eth_dev *dev);
1091 typedef void (*eth_dev_close_t)(
struct rte_eth_dev *dev);
1094 typedef void (*eth_promiscuous_enable_t)(
struct rte_eth_dev *dev);
1097 typedef void (*eth_promiscuous_disable_t)(
struct rte_eth_dev *dev);
1100 typedef void (*eth_allmulticast_enable_t)(
struct rte_eth_dev *dev);
1103 typedef void (*eth_allmulticast_disable_t)(
struct rte_eth_dev *dev);
1106 typedef int (*eth_link_update_t)(
struct rte_eth_dev *dev,
1107 int wait_to_complete);
1110 typedef void (*eth_stats_get_t)(
struct rte_eth_dev *dev,
1114 typedef void (*eth_stats_reset_t)(
struct rte_eth_dev *dev);
1117 typedef int (*eth_xstats_get_t)(
struct rte_eth_dev *dev,
1121 typedef void (*eth_xstats_reset_t)(
struct rte_eth_dev *dev);
1124 typedef int (*eth_xstats_get_names_t)(
struct rte_eth_dev *dev,
1128 typedef int (*eth_queue_stats_mapping_set_t)(
struct rte_eth_dev *dev,
1134 typedef void (*eth_dev_infos_get_t)(
struct rte_eth_dev *dev,
1138 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(
struct rte_eth_dev *dev);
1141 typedef int (*eth_queue_start_t)(
struct rte_eth_dev *dev,
1145 typedef int (*eth_queue_stop_t)(
struct rte_eth_dev *dev,
1149 typedef int (*eth_rx_queue_setup_t)(
struct rte_eth_dev *dev,
1150 uint16_t rx_queue_id,
1151 uint16_t nb_rx_desc,
1152 unsigned int socket_id,
1157 typedef int (*eth_tx_queue_setup_t)(
struct rte_eth_dev *dev,
1158 uint16_t tx_queue_id,
1159 uint16_t nb_tx_desc,
1160 unsigned int socket_id,
1164 typedef int (*eth_rx_enable_intr_t)(
struct rte_eth_dev *dev,
1165 uint16_t rx_queue_id);
1168 typedef int (*eth_rx_disable_intr_t)(
struct rte_eth_dev *dev,
1169 uint16_t rx_queue_id);
1172 typedef void (*eth_queue_release_t)(
void *queue);
1175 typedef uint32_t (*eth_rx_queue_count_t)(
struct rte_eth_dev *dev,
1176 uint16_t rx_queue_id);
1179 typedef int (*eth_rx_descriptor_done_t)(
void *rxq, uint16_t offset);
1182 typedef int (*eth_fw_version_get_t)(
struct rte_eth_dev *dev,
1183 char *fw_version,
size_t fw_size);
1186 typedef void (*eth_rxq_info_get_t)(
struct rte_eth_dev *dev,
1189 typedef void (*eth_txq_info_get_t)(
struct rte_eth_dev *dev,
1192 typedef int (*mtu_set_t)(
struct rte_eth_dev *dev, uint16_t mtu);
1195 typedef int (*vlan_filter_set_t)(
struct rte_eth_dev *dev,
1200 typedef int (*vlan_tpid_set_t)(
struct rte_eth_dev *dev,
1204 typedef void (*vlan_offload_set_t)(
struct rte_eth_dev *dev,
int mask);
1207 typedef int (*vlan_pvid_set_t)(
struct rte_eth_dev *dev,
1212 typedef void (*vlan_strip_queue_set_t)(
struct rte_eth_dev *dev,
1213 uint16_t rx_queue_id,
1217 typedef uint16_t (*eth_rx_burst_t)(
void *rxq,
1222 typedef uint16_t (*eth_tx_burst_t)(
void *txq,
1227 typedef uint16_t (*eth_tx_prep_t)(
void *txq,
1232 typedef int (*flow_ctrl_get_t)(
struct rte_eth_dev *dev,
1236 typedef int (*flow_ctrl_set_t)(
struct rte_eth_dev *dev,
1240 typedef int (*priority_flow_ctrl_set_t)(
struct rte_eth_dev *dev,
1244 typedef int (*reta_update_t)(
struct rte_eth_dev *dev,
1246 uint16_t reta_size);
1249 typedef int (*reta_query_t)(
struct rte_eth_dev *dev,
1251 uint16_t reta_size);
1254 typedef int (*rss_hash_update_t)(
struct rte_eth_dev *dev,
1258 typedef int (*rss_hash_conf_get_t)(
struct rte_eth_dev *dev,
1262 typedef int (*eth_dev_led_on_t)(
struct rte_eth_dev *dev);
1265 typedef int (*eth_dev_led_off_t)(
struct rte_eth_dev *dev);
1268 typedef void (*eth_mac_addr_remove_t)(
struct rte_eth_dev *dev, uint32_t index);
1271 typedef void (*eth_mac_addr_add_t)(
struct rte_eth_dev *dev,
1277 typedef void (*eth_mac_addr_set_t)(
struct rte_eth_dev *dev,
1281 typedef int (*eth_uc_hash_table_set_t)(
struct rte_eth_dev *dev,
1286 typedef int (*eth_uc_all_hash_table_set_t)(
struct rte_eth_dev *dev,
1290 typedef int (*eth_set_queue_rate_limit_t)(
struct rte_eth_dev *dev,
1295 typedef int (*eth_mirror_rule_set_t)(
struct rte_eth_dev *dev,
1301 typedef int (*eth_mirror_rule_reset_t)(
struct rte_eth_dev *dev,
1305 typedef int (*eth_udp_tunnel_port_add_t)(
struct rte_eth_dev *dev,
1309 typedef int (*eth_udp_tunnel_port_del_t)(
struct rte_eth_dev *dev,
1313 typedef int (*eth_set_mc_addr_list_t)(
struct rte_eth_dev *dev,
1315 uint32_t nb_mc_addr);
1318 typedef int (*eth_timesync_enable_t)(
struct rte_eth_dev *dev);
1321 typedef int (*eth_timesync_disable_t)(
struct rte_eth_dev *dev);
1324 typedef int (*eth_timesync_read_rx_timestamp_t)(
struct rte_eth_dev *dev,
1325 struct timespec *timestamp,
1329 typedef int (*eth_timesync_read_tx_timestamp_t)(
struct rte_eth_dev *dev,
1330 struct timespec *timestamp);
1333 typedef int (*eth_timesync_adjust_time)(
struct rte_eth_dev *dev, int64_t);
1336 typedef int (*eth_timesync_read_time)(
struct rte_eth_dev *dev,
1337 struct timespec *timestamp);
1340 typedef int (*eth_timesync_write_time)(
struct rte_eth_dev *dev,
1341 const struct timespec *timestamp);
1344 typedef int (*eth_get_reg_t)(
struct rte_eth_dev *dev,
1345 struct rte_dev_reg_info *info);
1348 typedef int (*eth_get_eeprom_length_t)(
struct rte_eth_dev *dev);
1351 typedef int (*eth_get_eeprom_t)(
struct rte_eth_dev *dev,
1352 struct rte_dev_eeprom_info *info);
1355 typedef int (*eth_set_eeprom_t)(
struct rte_eth_dev *dev,
1356 struct rte_dev_eeprom_info *info);
1359 typedef int (*eth_l2_tunnel_eth_type_conf_t)
1363 typedef int (*eth_l2_tunnel_offload_set_t)
1364 (
struct rte_eth_dev *dev,
1370 #ifdef RTE_NIC_BYPASS
1373 RTE_BYPASS_MODE_NONE,
1374 RTE_BYPASS_MODE_NORMAL,
1375 RTE_BYPASS_MODE_BYPASS,
1376 RTE_BYPASS_MODE_ISOLATE,
1377 RTE_BYPASS_MODE_NUM,
1380 #define RTE_BYPASS_MODE_VALID(x) \
1381 ((x) > RTE_BYPASS_MODE_NONE && (x) < RTE_BYPASS_MODE_NUM)
1384 RTE_BYPASS_EVENT_NONE,
1385 RTE_BYPASS_EVENT_START,
1386 RTE_BYPASS_EVENT_OS_ON = RTE_BYPASS_EVENT_START,
1387 RTE_BYPASS_EVENT_POWER_ON,
1388 RTE_BYPASS_EVENT_OS_OFF,
1389 RTE_BYPASS_EVENT_POWER_OFF,
1390 RTE_BYPASS_EVENT_TIMEOUT,
1391 RTE_BYPASS_EVENT_NUM
1394 #define RTE_BYPASS_EVENT_VALID(x) \
1395 ((x) > RTE_BYPASS_EVENT_NONE && (x) < RTE_BYPASS_MODE_NUM)
1399 RTE_BYPASS_TMT_1_5_SEC,
1400 RTE_BYPASS_TMT_2_SEC,
1401 RTE_BYPASS_TMT_3_SEC,
1402 RTE_BYPASS_TMT_4_SEC,
1403 RTE_BYPASS_TMT_8_SEC,
1404 RTE_BYPASS_TMT_16_SEC,
1405 RTE_BYPASS_TMT_32_SEC,
1409 #define RTE_BYPASS_TMT_VALID(x) \
1410 ((x) == RTE_BYPASS_TMT_OFF || \
1411 ((x) > RTE_BYPASS_TMT_OFF && (x) < RTE_BYPASS_TMT_NUM))
1413 typedef void (*bypass_init_t)(
struct rte_eth_dev *dev);
1414 typedef int32_t (*bypass_state_set_t)(
struct rte_eth_dev *dev, uint32_t *new_state);
1415 typedef int32_t (*bypass_state_show_t)(
struct rte_eth_dev *dev, uint32_t *state);
1416 typedef int32_t (*bypass_event_set_t)(
struct rte_eth_dev *dev, uint32_t state, uint32_t event);
1417 typedef int32_t (*bypass_event_show_t)(
struct rte_eth_dev *dev, uint32_t event_shift, uint32_t *event);
1418 typedef int32_t (*bypass_wd_timeout_set_t)(
struct rte_eth_dev *dev, uint32_t timeout);
1419 typedef int32_t (*bypass_wd_timeout_show_t)(
struct rte_eth_dev *dev, uint32_t *wd_timeout);
1420 typedef int32_t (*bypass_ver_show_t)(
struct rte_eth_dev *dev, uint32_t *ver);
1421 typedef int32_t (*bypass_wd_reset_t)(
struct rte_eth_dev *dev);
1424 typedef int (*eth_filter_ctrl_t)(
struct rte_eth_dev *dev,
1430 typedef int (*eth_get_dcb_info)(
struct rte_eth_dev *dev,
1437 struct eth_dev_ops {
1438 eth_dev_configure_t dev_configure;
1439 eth_dev_start_t dev_start;
1440 eth_dev_stop_t dev_stop;
1441 eth_dev_set_link_up_t dev_set_link_up;
1442 eth_dev_set_link_down_t dev_set_link_down;
1443 eth_dev_close_t dev_close;
1444 eth_link_update_t link_update;
1446 eth_promiscuous_enable_t promiscuous_enable;
1447 eth_promiscuous_disable_t promiscuous_disable;
1448 eth_allmulticast_enable_t allmulticast_enable;
1449 eth_allmulticast_disable_t allmulticast_disable;
1450 eth_mac_addr_remove_t mac_addr_remove;
1451 eth_mac_addr_add_t mac_addr_add;
1452 eth_mac_addr_set_t mac_addr_set;
1453 eth_set_mc_addr_list_t set_mc_addr_list;
1456 eth_stats_get_t stats_get;
1457 eth_stats_reset_t stats_reset;
1458 eth_xstats_get_t xstats_get;
1459 eth_xstats_reset_t xstats_reset;
1460 eth_xstats_get_names_t xstats_get_names;
1462 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1465 eth_dev_infos_get_t dev_infos_get;
1466 eth_rxq_info_get_t rxq_info_get;
1467 eth_txq_info_get_t txq_info_get;
1468 eth_fw_version_get_t fw_version_get;
1469 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
1472 vlan_filter_set_t vlan_filter_set;
1473 vlan_tpid_set_t vlan_tpid_set;
1474 vlan_strip_queue_set_t vlan_strip_queue_set;
1475 vlan_offload_set_t vlan_offload_set;
1476 vlan_pvid_set_t vlan_pvid_set;
1478 eth_queue_start_t rx_queue_start;
1479 eth_queue_stop_t rx_queue_stop;
1480 eth_queue_start_t tx_queue_start;
1481 eth_queue_stop_t tx_queue_stop;
1482 eth_rx_queue_setup_t rx_queue_setup;
1483 eth_queue_release_t rx_queue_release;
1484 eth_rx_queue_count_t rx_queue_count;
1485 eth_rx_descriptor_done_t rx_descriptor_done;
1486 eth_rx_enable_intr_t rx_queue_intr_enable;
1487 eth_rx_disable_intr_t rx_queue_intr_disable;
1488 eth_tx_queue_setup_t tx_queue_setup;
1489 eth_queue_release_t tx_queue_release;
1491 eth_dev_led_on_t dev_led_on;
1492 eth_dev_led_off_t dev_led_off;
1494 flow_ctrl_get_t flow_ctrl_get;
1495 flow_ctrl_set_t flow_ctrl_set;
1496 priority_flow_ctrl_set_t priority_flow_ctrl_set;
1498 eth_uc_hash_table_set_t uc_hash_table_set;
1499 eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1501 eth_mirror_rule_set_t mirror_rule_set;
1502 eth_mirror_rule_reset_t mirror_rule_reset;
1504 eth_udp_tunnel_port_add_t udp_tunnel_port_add;
1505 eth_udp_tunnel_port_del_t udp_tunnel_port_del;
1506 eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
1508 eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
1511 eth_set_queue_rate_limit_t set_queue_rate_limit;
1513 rss_hash_update_t rss_hash_update;
1514 rss_hash_conf_get_t rss_hash_conf_get;
1515 reta_update_t reta_update;
1516 reta_query_t reta_query;
1518 eth_get_reg_t get_reg;
1519 eth_get_eeprom_length_t get_eeprom_length;
1520 eth_get_eeprom_t get_eeprom;
1521 eth_set_eeprom_t set_eeprom;
1524 #ifdef RTE_NIC_BYPASS
1525 bypass_init_t bypass_init;
1526 bypass_state_set_t bypass_state_set;
1527 bypass_state_show_t bypass_state_show;
1528 bypass_event_set_t bypass_event_set;
1529 bypass_event_show_t bypass_event_show;
1530 bypass_wd_timeout_set_t bypass_wd_timeout_set;
1531 bypass_wd_timeout_show_t bypass_wd_timeout_show;
1532 bypass_ver_show_t bypass_ver_show;
1533 bypass_wd_reset_t bypass_wd_reset;
1536 eth_filter_ctrl_t filter_ctrl;
1538 eth_get_dcb_info get_dcb_info;
1540 eth_timesync_enable_t timesync_enable;
1542 eth_timesync_disable_t timesync_disable;
1544 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1546 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1548 eth_timesync_adjust_time timesync_adjust_time;
1549 eth_timesync_read_time timesync_read_time;
1550 eth_timesync_write_time timesync_write_time;
1576 struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts,
1600 struct rte_mbuf *pkts[], uint16_t nb_pkts,
void *user_param);
1607 struct rte_eth_rxtx_callback {
1608 struct rte_eth_rxtx_callback *next;
1626 struct rte_eth_dev {
1627 eth_rx_burst_t rx_pkt_burst;
1628 eth_tx_burst_t tx_pkt_burst;
1629 eth_tx_prep_t tx_pkt_prepare;
1630 struct rte_eth_dev_data *data;
1631 const struct eth_driver *driver;
1632 const struct eth_dev_ops *dev_ops;
1634 struct rte_intr_handle *intr_handle;
1636 struct rte_eth_dev_cb_list link_intr_cbs;
1641 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1646 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1650 struct rte_eth_dev_sriov {
1652 uint8_t nb_q_per_pool;
1653 uint16_t def_vmdq_idx;
1654 uint16_t def_pool_q_idx;
1656 #define RTE_ETH_DEV_SRIOV(dev) ((dev)->data->sriov)
1658 #define RTE_ETH_NAME_MAX_LEN (32)
1667 struct rte_eth_dev_data {
1668 char name[RTE_ETH_NAME_MAX_LEN];
1672 uint16_t nb_rx_queues;
1673 uint16_t nb_tx_queues;
1675 struct rte_eth_dev_sriov sriov;
1685 uint32_t min_rx_buf_size;
1688 uint64_t rx_mbuf_alloc_failed;
1696 uint8_t promiscuous : 1,
1701 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1703 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1706 enum rte_kernel_driver kdrv;
1708 const char *drv_name;
1712 #define RTE_ETH_DEV_DETACHABLE 0x0001
1714 #define RTE_ETH_DEV_INTR_LSC 0x0002
1716 #define RTE_ETH_DEV_BONDED_SLAVE 0x0004
1723 extern struct rte_eth_dev rte_eth_devices[];
1749 struct rte_eth_dev *rte_eth_dev_allocated(
const char *name);
1761 struct rte_eth_dev *rte_eth_dev_allocate(
const char *name);
1772 int rte_eth_dev_release_port(
struct rte_eth_dev *eth_dev);
1833 typedef int (*eth_dev_init_t)(
struct rte_eth_dev *eth_dev);
1850 typedef int (*eth_dev_uninit_t)(
struct rte_eth_dev *eth_dev);
1869 eth_dev_init_t eth_dev_init;
1870 eth_dev_uninit_t eth_dev_uninit;
1871 unsigned int dev_private_size;
1917 uint16_t nb_tx_queue,
const struct rte_eth_conf *eth_conf);
1930 void _rte_eth_dev_reset(
struct rte_eth_dev *dev);
1972 uint16_t nb_rx_desc,
unsigned int socket_id,
2020 uint16_t nb_tx_desc,
unsigned int socket_id,
2360 uint16_t tx_queue_id, uint8_t stat_idx);
2380 uint16_t rx_queue_id,
2424 char *fw_version,
size_t fw_size);
2465 uint32_t *ptypes,
int num);
2692 static inline uint16_t
2694 struct rte_mbuf **rx_pkts,
const uint16_t nb_pkts)
2696 struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2698 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2699 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2700 RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
2702 if (queue_id >= dev->data->nb_rx_queues) {
2703 RTE_PMD_DEBUG_TRACE(
"Invalid RX queue_id=%d\n", queue_id);
2707 int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
2710 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2711 struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
2715 nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
2716 nb_pkts, cb->param);
2718 }
while (cb != NULL);
2740 struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2741 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
2742 RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
2743 return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
2764 struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2765 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
2766 RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
2767 return (*dev->dev_ops->rx_descriptor_done)( \
2768 dev->data->rx_queues[queue_id], offset);
2830 static inline uint16_t
2832 struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
2834 struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2836 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2837 RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2838 RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
2840 if (queue_id >= dev->data->nb_tx_queues) {
2841 RTE_PMD_DEBUG_TRACE(
"Invalid TX queue_id=%d\n", queue_id);
2846 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2847 struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id];
2851 nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
2854 }
while (cb != NULL);
2858 return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
2917 #ifndef RTE_ETHDEV_TX_PREPARE_NOOP
2919 static inline uint16_t
2921 struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
2923 struct rte_eth_dev *dev;
2925 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2927 RTE_PMD_DEBUG_TRACE(
"Invalid TX port_id=%d\n", port_id);
2933 dev = &rte_eth_devices[port_id];
2935 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2936 if (queue_id >= dev->data->nb_tx_queues) {
2937 RTE_PMD_DEBUG_TRACE(
"Invalid TX queue_id=%d\n", queue_id);
2943 if (!dev->tx_pkt_prepare)
2946 return (*dev->tx_pkt_prepare)(dev->data->tx_queues[queue_id],
2961 static inline uint16_t
2970 typedef void (*buffer_tx_error_fn)(
struct rte_mbuf **unsent, uint16_t count,
2978 buffer_tx_error_fn error_callback;
2979 void *error_userdata;
2992 #define RTE_ETH_TX_BUFFER_SIZE(sz) \
2993 (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *))
3030 static inline uint16_t
3035 uint16_t to_send = buffer->
length;
3046 buffer->error_callback(&buffer->
pkts[sent], to_send - sent,
3047 buffer->error_userdata);
3082 static inline uint16_t __attribute__((always_inline))
3086 buffer->pkts[buffer->length++] = tx_pkt;
3087 if (buffer->length < buffer->size)
3119 buffer_tx_error_fn callback,
void *
userdata);
3258 void _rte_eth_dev_callback_process(
struct rte_eth_dev *dev,
3345 int epfd,
int op,
void *data);
3494 uint16_t reta_size);
3513 uint16_t reta_size);
3959 void *rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id,
4020 struct rte_eth_rxtx_callback *user_cb);
4053 struct rte_eth_rxtx_callback *user_cb);
4177 uint32_t nb_mc_addr);
4223 struct timespec *timestamp, uint32_t flags);
4240 struct timespec *timestamp);
4330 uint16_t queue_id,
size_t size,
4331 unsigned align,
int socket_id);