DPDK  17.11.1
rte_ethdev.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of Intel Corporation nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _RTE_ETHDEV_H_
35 #define _RTE_ETHDEV_H_
36 
169 #ifdef __cplusplus
170 extern "C" {
171 #endif
172 
173 #include <stdint.h>
174 
175 /* Use this macro to check if LRO API is supported */
176 #define RTE_ETHDEV_HAS_LRO_SUPPORT
177 
178 #include <rte_log.h>
179 #include <rte_interrupts.h>
180 #include <rte_dev.h>
181 #include <rte_devargs.h>
182 #include <rte_errno.h>
183 #include <rte_common.h>
184 #include <rte_config.h>
185 
186 #include "rte_ether.h"
187 #include "rte_eth_ctrl.h"
188 #include "rte_dev_info.h"
189 
190 struct rte_mbuf;
191 
199  uint64_t ipackets;
200  uint64_t opackets;
201  uint64_t ibytes;
202  uint64_t obytes;
203  uint64_t imissed;
207  uint64_t ierrors;
208  uint64_t oerrors;
209  uint64_t rx_nombuf;
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];
220 };
221 
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
262 __extension__
263 struct rte_eth_link {
264  uint32_t link_speed;
265  uint16_t link_duplex : 1;
266  uint16_t link_autoneg : 1;
267  uint16_t link_status : 1;
268 } __attribute__((aligned(8)));
270 /* Utility constants */
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 {
283  uint8_t pthresh;
284  uint8_t hthresh;
285  uint8_t wthresh;
286 };
287 
291 #define ETH_MQ_RX_RSS_FLAG 0x1
292 #define ETH_MQ_RX_DCB_FLAG 0x2
293 #define ETH_MQ_RX_VMDQ_FLAG 0x4
294 
302 
306  ETH_MQ_RX_DCB = ETH_MQ_RX_DCB_FLAG,
308  ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG,
309 
311  ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG,
313  ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_VMDQ_FLAG,
315  ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG | ETH_MQ_RX_DCB_FLAG,
318  ETH_MQ_RX_VMDQ_FLAG,
319 };
320 
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
327 
337 };
338 
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
345 
351  enum rte_eth_rx_mq_mode mq_mode;
352  uint32_t max_rx_pkt_len;
353  uint16_t split_hdr_size;
359  uint64_t offloads;
360  __extension__
366  uint16_t header_split : 1,
367  hw_ip_checksum : 1,
368  hw_vlan_filter : 1,
369  hw_vlan_strip : 1,
370  hw_vlan_extend : 1,
371  jumbo_frame : 1,
372  hw_strip_crc : 1,
373  enable_scatter : 1,
374  enable_lro : 1,
375  hw_timestamp : 1,
376  security : 1,
386  ignore_offload_bitfield : 1;
387 };
388 
394  ETH_VLAN_TYPE_UNKNOWN = 0,
397  ETH_VLAN_TYPE_MAX,
398 };
399 
405  uint64_t ids[64];
406 };
407 
426  uint8_t *rss_key;
427  uint8_t rss_key_len;
428  uint64_t rss_hf;
429 };
430 
431 /*
432  * The RSS offload types are defined based on flow types which are defined
433  * in rte_eth_ctrl.h. Different NIC hardwares may support different RSS offload
434  * types. The supported flow types or RSS offload types can be queried by
435  * rte_eth_dev_info_get().
436  */
437 #define ETH_RSS_IPV4 (1ULL << RTE_ETH_FLOW_IPV4)
438 #define ETH_RSS_FRAG_IPV4 (1ULL << RTE_ETH_FLOW_FRAG_IPV4)
439 #define ETH_RSS_NONFRAG_IPV4_TCP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_TCP)
440 #define ETH_RSS_NONFRAG_IPV4_UDP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_UDP)
441 #define ETH_RSS_NONFRAG_IPV4_SCTP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP)
442 #define ETH_RSS_NONFRAG_IPV4_OTHER (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER)
443 #define ETH_RSS_IPV6 (1ULL << RTE_ETH_FLOW_IPV6)
444 #define ETH_RSS_FRAG_IPV6 (1ULL << RTE_ETH_FLOW_FRAG_IPV6)
445 #define ETH_RSS_NONFRAG_IPV6_TCP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_TCP)
446 #define ETH_RSS_NONFRAG_IPV6_UDP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_UDP)
447 #define ETH_RSS_NONFRAG_IPV6_SCTP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP)
448 #define ETH_RSS_NONFRAG_IPV6_OTHER (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER)
449 #define ETH_RSS_L2_PAYLOAD (1ULL << RTE_ETH_FLOW_L2_PAYLOAD)
450 #define ETH_RSS_IPV6_EX (1ULL << RTE_ETH_FLOW_IPV6_EX)
451 #define ETH_RSS_IPV6_TCP_EX (1ULL << RTE_ETH_FLOW_IPV6_TCP_EX)
452 #define ETH_RSS_IPV6_UDP_EX (1ULL << RTE_ETH_FLOW_IPV6_UDP_EX)
453 #define ETH_RSS_PORT (1ULL << RTE_ETH_FLOW_PORT)
454 #define ETH_RSS_VXLAN (1ULL << RTE_ETH_FLOW_VXLAN)
455 #define ETH_RSS_GENEVE (1ULL << RTE_ETH_FLOW_GENEVE)
456 #define ETH_RSS_NVGRE (1ULL << RTE_ETH_FLOW_NVGRE)
457 
458 #define ETH_RSS_IP ( \
459  ETH_RSS_IPV4 | \
460  ETH_RSS_FRAG_IPV4 | \
461  ETH_RSS_NONFRAG_IPV4_OTHER | \
462  ETH_RSS_IPV6 | \
463  ETH_RSS_FRAG_IPV6 | \
464  ETH_RSS_NONFRAG_IPV6_OTHER | \
465  ETH_RSS_IPV6_EX)
466 
467 #define ETH_RSS_UDP ( \
468  ETH_RSS_NONFRAG_IPV4_UDP | \
469  ETH_RSS_NONFRAG_IPV6_UDP | \
470  ETH_RSS_IPV6_UDP_EX)
471 
472 #define ETH_RSS_TCP ( \
473  ETH_RSS_NONFRAG_IPV4_TCP | \
474  ETH_RSS_NONFRAG_IPV6_TCP | \
475  ETH_RSS_IPV6_TCP_EX)
476 
477 #define ETH_RSS_SCTP ( \
478  ETH_RSS_NONFRAG_IPV4_SCTP | \
479  ETH_RSS_NONFRAG_IPV6_SCTP)
480 
481 #define ETH_RSS_TUNNEL ( \
482  ETH_RSS_VXLAN | \
483  ETH_RSS_GENEVE | \
484  ETH_RSS_NVGRE)
485 
486 
488 #define ETH_RSS_PROTO_MASK ( \
489  ETH_RSS_IPV4 | \
490  ETH_RSS_FRAG_IPV4 | \
491  ETH_RSS_NONFRAG_IPV4_TCP | \
492  ETH_RSS_NONFRAG_IPV4_UDP | \
493  ETH_RSS_NONFRAG_IPV4_SCTP | \
494  ETH_RSS_NONFRAG_IPV4_OTHER | \
495  ETH_RSS_IPV6 | \
496  ETH_RSS_FRAG_IPV6 | \
497  ETH_RSS_NONFRAG_IPV6_TCP | \
498  ETH_RSS_NONFRAG_IPV6_UDP | \
499  ETH_RSS_NONFRAG_IPV6_SCTP | \
500  ETH_RSS_NONFRAG_IPV6_OTHER | \
501  ETH_RSS_L2_PAYLOAD | \
502  ETH_RSS_IPV6_EX | \
503  ETH_RSS_IPV6_TCP_EX | \
504  ETH_RSS_IPV6_UDP_EX | \
505  ETH_RSS_PORT | \
506  ETH_RSS_VXLAN | \
507  ETH_RSS_GENEVE | \
508  ETH_RSS_NVGRE)
509 
510 /*
511  * Definitions used for redirection table entry size.
512  * Some RSS RETA sizes may not be supported by some drivers, check the
513  * documentation or the description of relevant functions for more details.
514  */
515 #define ETH_RSS_RETA_SIZE_64 64
516 #define ETH_RSS_RETA_SIZE_128 128
517 #define ETH_RSS_RETA_SIZE_256 256
518 #define ETH_RSS_RETA_SIZE_512 512
519 #define RTE_RETA_GROUP_SIZE 64
520 
521 /* Definitions used for VMDQ and DCB functionality */
522 #define ETH_VMDQ_MAX_VLAN_FILTERS 64
523 #define ETH_DCB_NUM_USER_PRIORITIES 8
524 #define ETH_VMDQ_DCB_NUM_QUEUES 128
525 #define ETH_DCB_NUM_QUEUES 128
527 /* DCB capability defines */
528 #define ETH_DCB_PG_SUPPORT 0x00000001
529 #define ETH_DCB_PFC_SUPPORT 0x00000002
531 /* Definitions used for VLAN Offload functionality */
532 #define ETH_VLAN_STRIP_OFFLOAD 0x0001
533 #define ETH_VLAN_FILTER_OFFLOAD 0x0002
534 #define ETH_VLAN_EXTEND_OFFLOAD 0x0004
536 /* Definitions used for mask VLAN setting */
537 #define ETH_VLAN_STRIP_MASK 0x0001
538 #define ETH_VLAN_FILTER_MASK 0x0002
539 #define ETH_VLAN_EXTEND_MASK 0x0004
540 #define ETH_VLAN_ID_MAX 0x0FFF
542 /* Definitions used for receive MAC address */
543 #define ETH_NUM_RECEIVE_MAC_ADDR 128
545 /* Definitions used for unicast hash */
546 #define ETH_VMDQ_NUM_UC_HASH_ARRAY 128
548 /* Definitions used for VMDQ pool rx mode setting */
549 #define ETH_VMDQ_ACCEPT_UNTAG 0x0001
550 #define ETH_VMDQ_ACCEPT_HASH_MC 0x0002
551 #define ETH_VMDQ_ACCEPT_HASH_UC 0x0004
552 #define ETH_VMDQ_ACCEPT_BROADCAST 0x0008
553 #define ETH_VMDQ_ACCEPT_MULTICAST 0x0010
556 #define ETH_MIRROR_MAX_VLANS 64
557 
558 #define ETH_MIRROR_VIRTUAL_POOL_UP 0x01
559 #define ETH_MIRROR_UPLINK_PORT 0x02
560 #define ETH_MIRROR_DOWNLINK_PORT 0x04
561 #define ETH_MIRROR_VLAN 0x08
562 #define ETH_MIRROR_VIRTUAL_POOL_DOWN 0x10
567 struct rte_eth_vlan_mirror {
568  uint64_t vlan_mask;
570  uint16_t vlan_id[ETH_MIRROR_MAX_VLANS];
571 };
572 
577  uint8_t rule_type;
578  uint8_t dst_pool;
579  uint64_t pool_mask;
581  struct rte_eth_vlan_mirror vlan;
582 };
583 
591  uint64_t mask;
593  uint16_t reta[RTE_RETA_GROUP_SIZE];
595 };
596 
602  ETH_4_TCS = 4,
604 };
605 
615 };
616 
617 /* This structure may be extended in future. */
618 struct rte_eth_dcb_rx_conf {
619  enum rte_eth_nb_tcs nb_tcs;
621  uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
622 };
623 
624 struct rte_eth_vmdq_dcb_tx_conf {
625  enum rte_eth_nb_pools nb_queue_pools;
627  uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
628 };
629 
630 struct rte_eth_dcb_tx_conf {
631  enum rte_eth_nb_tcs nb_tcs;
633  uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
634 };
635 
636 struct rte_eth_vmdq_tx_conf {
637  enum rte_eth_nb_pools nb_queue_pools;
638 };
639 
652  enum rte_eth_nb_pools nb_queue_pools;
654  uint8_t default_pool;
655  uint8_t nb_pool_maps;
656  struct {
657  uint16_t vlan_id;
658  uint64_t pools;
659  } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS];
662 };
663 
683  enum rte_eth_nb_pools nb_queue_pools;
685  uint8_t default_pool;
687  uint8_t nb_pool_maps;
688  uint32_t rx_mode;
689  struct {
690  uint16_t vlan_id;
691  uint64_t pools;
692  } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS];
693 };
694 
699  enum rte_eth_tx_mq_mode mq_mode;
705  uint64_t offloads;
706 
707  /* For i40e specifically */
708  uint16_t pvid;
709  __extension__
710  uint8_t hw_vlan_reject_tagged : 1,
712  hw_vlan_reject_untagged : 1,
714  hw_vlan_insert_pvid : 1;
716 };
717 
722  struct rte_eth_thresh rx_thresh;
723  uint16_t rx_free_thresh;
724  uint8_t rx_drop_en;
731  uint64_t offloads;
732 };
733 
734 #define ETH_TXQ_FLAGS_NOMULTSEGS 0x0001
735 #define ETH_TXQ_FLAGS_NOREFCOUNT 0x0002
736 #define ETH_TXQ_FLAGS_NOMULTMEMP 0x0004
737 #define ETH_TXQ_FLAGS_NOVLANOFFL 0x0100
738 #define ETH_TXQ_FLAGS_NOXSUMSCTP 0x0200
739 #define ETH_TXQ_FLAGS_NOXSUMUDP 0x0400
740 #define ETH_TXQ_FLAGS_NOXSUMTCP 0x0800
741 #define ETH_TXQ_FLAGS_NOOFFLOADS \
742  (ETH_TXQ_FLAGS_NOVLANOFFL | ETH_TXQ_FLAGS_NOXSUMSCTP | \
743  ETH_TXQ_FLAGS_NOXSUMUDP | ETH_TXQ_FLAGS_NOXSUMTCP)
744 #define ETH_TXQ_FLAGS_NOXSUMS \
745  (ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \
746  ETH_TXQ_FLAGS_NOXSUMTCP)
747 
754 #define ETH_TXQ_FLAGS_IGNORE 0x8000
755 
760  struct rte_eth_thresh tx_thresh;
761  uint16_t tx_rs_thresh;
762  uint16_t tx_free_thresh;
765  uint32_t txq_flags;
772  uint64_t offloads;
773 };
774 
779  uint16_t nb_max;
780  uint16_t nb_min;
781  uint16_t nb_align;
791  uint16_t nb_seg_max;
792 
804  uint16_t nb_mtu_seg_max;
805 };
806 
815 };
816 
823  uint32_t high_water;
824  uint32_t low_water;
825  uint16_t pause_time;
826  uint16_t send_xon;
827  enum rte_eth_fc_mode mode;
829  uint8_t autoneg;
830 };
831 
838  struct rte_eth_fc_conf fc;
839  uint8_t priority;
840 };
841 
850 };
851 
859 };
860 
868  enum rte_fdir_mode mode;
869  enum rte_fdir_pballoc_type pballoc;
870  enum rte_fdir_status_mode status;
872  uint8_t drop_queue;
873  struct rte_eth_fdir_masks mask;
874  struct rte_eth_fdir_flex_conf flex_conf;
876 };
877 
886  uint16_t udp_port;
887  uint8_t prot_type;
888 };
889 
895  uint32_t lsc:1;
897  uint32_t rxq:1;
899  uint32_t rmv:1;
900 };
901 
907 struct rte_eth_conf {
908  uint32_t link_speeds;
915  struct rte_eth_rxmode rxmode;
916  struct rte_eth_txmode txmode;
917  uint32_t lpbk_mode;
922  struct {
923  struct rte_eth_rss_conf rss_conf;
924  struct rte_eth_vmdq_dcb_conf vmdq_dcb_conf;
926  struct rte_eth_dcb_rx_conf dcb_rx_conf;
928  struct rte_eth_vmdq_rx_conf vmdq_rx_conf;
930  } rx_adv_conf;
931  union {
932  struct rte_eth_vmdq_dcb_tx_conf vmdq_dcb_tx_conf;
934  struct rte_eth_dcb_tx_conf dcb_tx_conf;
936  struct rte_eth_vmdq_tx_conf vmdq_tx_conf;
938  } tx_adv_conf;
942  struct rte_fdir_conf fdir_conf;
943  struct rte_intr_conf intr_conf;
944 };
945 
955 #define DEV_RX_OFFLOAD_VLAN_STRIP 0x00000001
956 #define DEV_RX_OFFLOAD_IPV4_CKSUM 0x00000002
957 #define DEV_RX_OFFLOAD_UDP_CKSUM 0x00000004
958 #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008
959 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010
960 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020
961 #define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040
962 #define DEV_RX_OFFLOAD_MACSEC_STRIP 0x00000080
963 #define DEV_RX_OFFLOAD_HEADER_SPLIT 0x00000100
964 #define DEV_RX_OFFLOAD_VLAN_FILTER 0x00000200
965 #define DEV_RX_OFFLOAD_VLAN_EXTEND 0x00000400
966 #define DEV_RX_OFFLOAD_JUMBO_FRAME 0x00000800
967 #define DEV_RX_OFFLOAD_CRC_STRIP 0x00001000
968 #define DEV_RX_OFFLOAD_SCATTER 0x00002000
969 #define DEV_RX_OFFLOAD_TIMESTAMP 0x00004000
970 #define DEV_RX_OFFLOAD_SECURITY 0x00008000
971 #define DEV_RX_OFFLOAD_CHECKSUM (DEV_RX_OFFLOAD_IPV4_CKSUM | \
972  DEV_RX_OFFLOAD_UDP_CKSUM | \
973  DEV_RX_OFFLOAD_TCP_CKSUM)
974 #define DEV_RX_OFFLOAD_VLAN (DEV_RX_OFFLOAD_VLAN_STRIP | \
975  DEV_RX_OFFLOAD_VLAN_FILTER | \
976  DEV_RX_OFFLOAD_VLAN_EXTEND)
977 
981 #define DEV_TX_OFFLOAD_VLAN_INSERT 0x00000001
982 #define DEV_TX_OFFLOAD_IPV4_CKSUM 0x00000002
983 #define DEV_TX_OFFLOAD_UDP_CKSUM 0x00000004
984 #define DEV_TX_OFFLOAD_TCP_CKSUM 0x00000008
985 #define DEV_TX_OFFLOAD_SCTP_CKSUM 0x00000010
986 #define DEV_TX_OFFLOAD_TCP_TSO 0x00000020
987 #define DEV_TX_OFFLOAD_UDP_TSO 0x00000040
988 #define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080
989 #define DEV_TX_OFFLOAD_QINQ_INSERT 0x00000100
990 #define DEV_TX_OFFLOAD_VXLAN_TNL_TSO 0x00000200
991 #define DEV_TX_OFFLOAD_GRE_TNL_TSO 0x00000400
992 #define DEV_TX_OFFLOAD_IPIP_TNL_TSO 0x00000800
993 #define DEV_TX_OFFLOAD_GENEVE_TNL_TSO 0x00001000
994 #define DEV_TX_OFFLOAD_MACSEC_INSERT 0x00002000
995 #define DEV_TX_OFFLOAD_MT_LOCKFREE 0x00004000
996 
999 #define DEV_TX_OFFLOAD_MULTI_SEGS 0x00008000
1000 
1001 #define DEV_TX_OFFLOAD_MBUF_FAST_FREE 0x00010000
1002 
1006 #define DEV_TX_OFFLOAD_SECURITY 0x00020000
1007 
1008 struct rte_pci_device;
1009 
1014  struct rte_pci_device *pci_dev;
1015  const char *driver_name;
1016  unsigned int if_index;
1018  uint32_t min_rx_bufsize;
1019  uint32_t max_rx_pktlen;
1020  uint16_t max_rx_queues;
1021  uint16_t max_tx_queues;
1022  uint32_t max_mac_addrs;
1023  uint32_t max_hash_mac_addrs;
1025  uint16_t max_vfs;
1026  uint16_t max_vmdq_pools;
1035  uint16_t reta_size;
1037  uint8_t hash_key_size;
1040  struct rte_eth_rxconf default_rxconf;
1041  struct rte_eth_txconf default_txconf;
1042  uint16_t vmdq_queue_base;
1043  uint16_t vmdq_queue_num;
1044  uint16_t vmdq_pool_base;
1045  struct rte_eth_desc_lim rx_desc_lim;
1046  struct rte_eth_desc_lim tx_desc_lim;
1047  uint32_t speed_capa;
1049  uint16_t nb_rx_queues;
1050  uint16_t nb_tx_queues;
1051 };
1052 
1058  struct rte_mempool *mp;
1059  struct rte_eth_rxconf conf;
1060  uint8_t scattered_rx;
1061  uint16_t nb_desc;
1063 
1069  struct rte_eth_txconf conf;
1070  uint16_t nb_desc;
1072 
1074 #define RTE_ETH_XSTATS_NAME_SIZE 64
1075 
1086  uint64_t id;
1087  uint64_t value;
1088 };
1089 
1099 };
1100 
1101 #define ETH_DCB_NUM_TCS 8
1102 #define ETH_MAX_VMDQ_POOL 64
1103 
1110  struct {
1111  uint8_t base;
1112  uint8_t nb_queue;
1113  } tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
1115  struct {
1116  uint8_t base;
1117  uint8_t nb_queue;
1118  } tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
1119 };
1120 
1126  uint8_t nb_tcs;
1127  uint8_t prio_tc[ETH_DCB_NUM_USER_PRIORITIES];
1128  uint8_t tc_bws[ETH_DCB_NUM_TCS];
1131 };
1132 
1136 #define RTE_ETH_QUEUE_STATE_STOPPED 0
1137 #define RTE_ETH_QUEUE_STATE_STARTED 1
1138 
1139 struct rte_eth_dev;
1140 
1141 struct rte_eth_dev_callback;
1143 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
1144 
1145 /* Macros to check for valid port */
1146 #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
1147  if (!rte_eth_dev_is_valid_port(port_id)) { \
1148  RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
1149  return retval; \
1150  } \
1151 } while (0)
1152 
1153 #define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
1154  if (!rte_eth_dev_is_valid_port(port_id)) { \
1155  RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
1156  return; \
1157  } \
1158 } while (0)
1159 
1165 #define ETH_L2_TUNNEL_ENABLE_MASK 0x00000001
1166 
1167 #define ETH_L2_TUNNEL_INSERTION_MASK 0x00000002
1168 
1169 #define ETH_L2_TUNNEL_STRIPPING_MASK 0x00000004
1170 
1171 #define ETH_L2_TUNNEL_FORWARDING_MASK 0x00000008
1172 
1173 /*
1174  * Definitions of all functions exported by an Ethernet driver through the
1175  * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
1176  * structure associated with an Ethernet device.
1177  */
1178 
1179 typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
1182 typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
1185 typedef void (*eth_dev_stop_t)(struct rte_eth_dev *dev);
1188 typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
1191 typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
1194 typedef void (*eth_dev_close_t)(struct rte_eth_dev *dev);
1197 typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
1200 typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
1203 typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
1206 typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
1209 typedef void (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
1212 typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
1213  int wait_to_complete);
1216 typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
1217  struct rte_eth_stats *igb_stats);
1220 typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
1223 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
1224  struct rte_eth_xstat *stats, unsigned n);
1227 typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
1228  const uint64_t *ids,
1229  uint64_t *values,
1230  unsigned int n);
1233 typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
1236 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
1237  struct rte_eth_xstat_name *xstats_names, unsigned size);
1240 typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
1241  struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
1242  unsigned int size);
1245 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
1246  uint16_t queue_id,
1247  uint8_t stat_idx,
1248  uint8_t is_rx);
1251 typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
1252  struct rte_eth_dev_info *dev_info);
1255 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
1258 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
1259  uint16_t queue_id);
1262 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
1263  uint16_t queue_id);
1266 typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
1267  uint16_t rx_queue_id,
1268  uint16_t nb_rx_desc,
1269  unsigned int socket_id,
1270  const struct rte_eth_rxconf *rx_conf,
1271  struct rte_mempool *mb_pool);
1274 typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
1275  uint16_t tx_queue_id,
1276  uint16_t nb_tx_desc,
1277  unsigned int socket_id,
1278  const struct rte_eth_txconf *tx_conf);
1281 typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
1282  uint16_t rx_queue_id);
1285 typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
1286  uint16_t rx_queue_id);
1289 typedef void (*eth_queue_release_t)(void *queue);
1292 typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
1293  uint16_t rx_queue_id);
1296 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
1299 typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
1302 typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
1305 typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
1306  char *fw_version, size_t fw_size);
1309 typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
1312 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
1313  uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
1314 
1315 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
1316  uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
1317 
1318 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
1321 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
1322  uint16_t vlan_id,
1323  int on);
1326 typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
1327  enum rte_vlan_type type, uint16_t tpid);
1330 typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
1333 typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
1334  uint16_t vlan_id,
1335  int on);
1338 typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
1339  uint16_t rx_queue_id,
1340  int on);
1343 typedef uint16_t (*eth_rx_burst_t)(void *rxq,
1344  struct rte_mbuf **rx_pkts,
1345  uint16_t nb_pkts);
1348 typedef uint16_t (*eth_tx_burst_t)(void *txq,
1349  struct rte_mbuf **tx_pkts,
1350  uint16_t nb_pkts);
1353 typedef uint16_t (*eth_tx_prep_t)(void *txq,
1354  struct rte_mbuf **tx_pkts,
1355  uint16_t nb_pkts);
1358 typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
1359  struct rte_eth_fc_conf *fc_conf);
1362 typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
1363  struct rte_eth_fc_conf *fc_conf);
1366 typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
1367  struct rte_eth_pfc_conf *pfc_conf);
1370 typedef int (*reta_update_t)(struct rte_eth_dev *dev,
1371  struct rte_eth_rss_reta_entry64 *reta_conf,
1372  uint16_t reta_size);
1375 typedef int (*reta_query_t)(struct rte_eth_dev *dev,
1376  struct rte_eth_rss_reta_entry64 *reta_conf,
1377  uint16_t reta_size);
1380 typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
1381  struct rte_eth_rss_conf *rss_conf);
1384 typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
1385  struct rte_eth_rss_conf *rss_conf);
1388 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
1391 typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
1394 typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
1397 typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
1398  struct ether_addr *mac_addr,
1399  uint32_t index,
1400  uint32_t vmdq);
1403 typedef void (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
1404  struct ether_addr *mac_addr);
1407 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
1408  struct ether_addr *mac_addr,
1409  uint8_t on);
1412 typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
1413  uint8_t on);
1416 typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
1417  uint16_t queue_idx,
1418  uint16_t tx_rate);
1421 typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,
1422  struct rte_eth_mirror_conf *mirror_conf,
1423  uint8_t rule_id,
1424  uint8_t on);
1427 typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,
1428  uint8_t rule_id);
1431 typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
1432  struct rte_eth_udp_tunnel *tunnel_udp);
1435 typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
1436  struct rte_eth_udp_tunnel *tunnel_udp);
1439 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
1440  struct ether_addr *mc_addr_set,
1441  uint32_t nb_mc_addr);
1444 typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
1447 typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
1450 typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
1451  struct timespec *timestamp,
1452  uint32_t flags);
1455 typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
1456  struct timespec *timestamp);
1459 typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
1462 typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
1463  struct timespec *timestamp);
1466 typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
1467  const struct timespec *timestamp);
1470 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
1471  struct rte_dev_reg_info *info);
1474 typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
1477 typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
1478  struct rte_dev_eeprom_info *info);
1481 typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
1482  struct rte_dev_eeprom_info *info);
1485 typedef int (*eth_l2_tunnel_eth_type_conf_t)
1486  (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
1489 typedef int (*eth_l2_tunnel_offload_set_t)
1490  (struct rte_eth_dev *dev,
1491  struct rte_eth_l2_tunnel_conf *l2_tunnel,
1492  uint32_t mask,
1493  uint8_t en);
1497 typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
1498  enum rte_filter_type filter_type,
1499  enum rte_filter_op filter_op,
1500  void *arg);
1503 typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
1506 typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
1509 typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
1510  struct rte_eth_dcb_info *dcb_info);
1513 typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
1514  const char *pool);
1520 struct eth_dev_ops {
1521  eth_dev_configure_t dev_configure;
1522  eth_dev_start_t dev_start;
1523  eth_dev_stop_t dev_stop;
1524  eth_dev_set_link_up_t dev_set_link_up;
1525  eth_dev_set_link_down_t dev_set_link_down;
1526  eth_dev_close_t dev_close;
1527  eth_dev_reset_t dev_reset;
1528  eth_link_update_t link_update;
1530  eth_promiscuous_enable_t promiscuous_enable;
1531  eth_promiscuous_disable_t promiscuous_disable;
1532  eth_allmulticast_enable_t allmulticast_enable;
1533  eth_allmulticast_disable_t allmulticast_disable;
1534  eth_mac_addr_remove_t mac_addr_remove;
1535  eth_mac_addr_add_t mac_addr_add;
1536  eth_mac_addr_set_t mac_addr_set;
1537  eth_set_mc_addr_list_t set_mc_addr_list;
1538  mtu_set_t mtu_set;
1540  eth_stats_get_t stats_get;
1541  eth_stats_reset_t stats_reset;
1542  eth_xstats_get_t xstats_get;
1543  eth_xstats_reset_t xstats_reset;
1544  eth_xstats_get_names_t xstats_get_names;
1546  eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1549  eth_dev_infos_get_t dev_infos_get;
1550  eth_rxq_info_get_t rxq_info_get;
1551  eth_txq_info_get_t txq_info_get;
1552  eth_fw_version_get_t fw_version_get;
1553  eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
1556  vlan_filter_set_t vlan_filter_set;
1557  vlan_tpid_set_t vlan_tpid_set;
1558  vlan_strip_queue_set_t vlan_strip_queue_set;
1559  vlan_offload_set_t vlan_offload_set;
1560  vlan_pvid_set_t vlan_pvid_set;
1562  eth_queue_start_t rx_queue_start;
1563  eth_queue_stop_t rx_queue_stop;
1564  eth_queue_start_t tx_queue_start;
1565  eth_queue_stop_t tx_queue_stop;
1566  eth_rx_queue_setup_t rx_queue_setup;
1567  eth_queue_release_t rx_queue_release;
1568  eth_rx_queue_count_t rx_queue_count;
1570  eth_rx_descriptor_done_t rx_descriptor_done;
1571  eth_rx_descriptor_status_t rx_descriptor_status;
1573  eth_tx_descriptor_status_t tx_descriptor_status;
1575  eth_rx_enable_intr_t rx_queue_intr_enable;
1576  eth_rx_disable_intr_t rx_queue_intr_disable;
1577  eth_tx_queue_setup_t tx_queue_setup;
1578  eth_queue_release_t tx_queue_release;
1579  eth_tx_done_cleanup_t tx_done_cleanup;
1581  eth_dev_led_on_t dev_led_on;
1582  eth_dev_led_off_t dev_led_off;
1584  flow_ctrl_get_t flow_ctrl_get;
1585  flow_ctrl_set_t flow_ctrl_set;
1586  priority_flow_ctrl_set_t priority_flow_ctrl_set;
1588  eth_uc_hash_table_set_t uc_hash_table_set;
1589  eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1591  eth_mirror_rule_set_t mirror_rule_set;
1592  eth_mirror_rule_reset_t mirror_rule_reset;
1594  eth_udp_tunnel_port_add_t udp_tunnel_port_add;
1595  eth_udp_tunnel_port_del_t udp_tunnel_port_del;
1596  eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
1598  eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
1601  eth_set_queue_rate_limit_t set_queue_rate_limit;
1603  rss_hash_update_t rss_hash_update;
1604  rss_hash_conf_get_t rss_hash_conf_get;
1605  reta_update_t reta_update;
1606  reta_query_t reta_query;
1608  eth_get_reg_t get_reg;
1609  eth_get_eeprom_length_t get_eeprom_length;
1610  eth_get_eeprom_t get_eeprom;
1611  eth_set_eeprom_t set_eeprom;
1614  eth_filter_ctrl_t filter_ctrl;
1616  eth_get_dcb_info get_dcb_info;
1618  eth_timesync_enable_t timesync_enable;
1620  eth_timesync_disable_t timesync_disable;
1622  eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1624  eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1626  eth_timesync_adjust_time timesync_adjust_time;
1627  eth_timesync_read_time timesync_read_time;
1628  eth_timesync_write_time timesync_write_time;
1630  eth_xstats_get_by_id_t xstats_get_by_id;
1632  eth_xstats_get_names_by_id_t xstats_get_names_by_id;
1635  eth_tm_ops_get_t tm_ops_get;
1638  eth_mtr_ops_get_t mtr_ops_get;
1641  eth_pool_ops_supported_t pool_ops_supported;
1643 };
1644 
1667 typedef uint16_t (*rte_rx_callback_fn)(uint16_t port, uint16_t queue,
1668  struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts,
1669  void *user_param);
1670 
1691 typedef uint16_t (*rte_tx_callback_fn)(uint16_t port, uint16_t queue,
1692  struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param);
1693 
1699 struct rte_eth_rxtx_callback {
1700  struct rte_eth_rxtx_callback *next;
1701  union{
1702  rte_rx_callback_fn rx;
1703  rte_tx_callback_fn tx;
1704  } fn;
1705  void *param;
1706 };
1707 
1712  RTE_ETH_DEV_UNUSED = 0,
1713  RTE_ETH_DEV_ATTACHED,
1714  RTE_ETH_DEV_DEFERRED,
1715 };
1716 
1727 struct rte_eth_dev {
1728  eth_rx_burst_t rx_pkt_burst;
1729  eth_tx_burst_t tx_pkt_burst;
1730  eth_tx_prep_t tx_pkt_prepare;
1731  struct rte_eth_dev_data *data;
1732  const struct eth_dev_ops *dev_ops;
1733  struct rte_device *device;
1734  struct rte_intr_handle *intr_handle;
1736  struct rte_eth_dev_cb_list link_intr_cbs;
1741  struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1746  struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1747  enum rte_eth_dev_state state;
1748  void *security_ctx;
1750 
1751 void *
1752 rte_eth_dev_get_sec_ctx(uint8_t port_id);
1753 
1754 struct rte_eth_dev_sriov {
1755  uint8_t active;
1756  uint8_t nb_q_per_pool;
1757  uint16_t def_vmdq_idx;
1758  uint16_t def_pool_q_idx;
1759 };
1760 #define RTE_ETH_DEV_SRIOV(dev) ((dev)->data->sriov)
1761 
1762 #define RTE_ETH_NAME_MAX_LEN RTE_DEV_NAME_MAX_LEN
1763 
1771 struct rte_eth_dev_data {
1772  char name[RTE_ETH_NAME_MAX_LEN];
1774  void **rx_queues;
1775  void **tx_queues;
1776  uint16_t nb_rx_queues;
1777  uint16_t nb_tx_queues;
1779  struct rte_eth_dev_sriov sriov;
1781  void *dev_private;
1783  struct rte_eth_link dev_link;
1786  struct rte_eth_conf dev_conf;
1787  uint16_t mtu;
1789  uint32_t min_rx_buf_size;
1792  uint64_t rx_mbuf_alloc_failed;
1793  struct ether_addr* mac_addrs;
1794  uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
1796  struct ether_addr* hash_mac_addrs;
1798  uint16_t port_id;
1799  __extension__
1800  uint8_t promiscuous : 1,
1801  scattered_rx : 1,
1802  all_multicast : 1,
1803  dev_started : 1,
1804  lro : 1;
1805  uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1807  uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1809  uint32_t dev_flags;
1810  enum rte_kernel_driver kdrv;
1811  int numa_node;
1812  struct rte_vlan_filter_conf vlan_filter_conf;
1814 };
1815 
1817 #define RTE_ETH_DEV_INTR_LSC 0x0002
1818 
1819 #define RTE_ETH_DEV_BONDED_SLAVE 0x0004
1820 
1821 #define RTE_ETH_DEV_INTR_RMV 0x0008
1822 
1828 extern struct rte_eth_dev rte_eth_devices[];
1829 
1838 uint16_t rte_eth_find_next(uint16_t port_id);
1839 
1843 #define RTE_ETH_FOREACH_DEV(p) \
1844  for (p = rte_eth_find_next(0); \
1845  (unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS; \
1846  p = rte_eth_find_next(p + 1))
1847 
1848 
1861 uint16_t rte_eth_dev_count(void);
1862 
1872 struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
1873 
1884 struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
1885 
1897 struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name);
1898 
1908 int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
1909 
1922 int rte_eth_dev_attach(const char *devargs, uint16_t *port_id);
1923 
1937 int rte_eth_dev_detach(uint16_t port_id, char *devname);
1938 
1950 uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex);
1951 
1984 int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue,
1985  uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf);
1986 
1998 void _rte_eth_dev_reset(struct rte_eth_dev *dev);
1999 
2041 int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
2042  uint16_t nb_rx_desc, unsigned int socket_id,
2043  const struct rte_eth_rxconf *rx_conf,
2044  struct rte_mempool *mb_pool);
2045 
2094 int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id,
2095  uint16_t nb_tx_desc, unsigned int socket_id,
2096  const struct rte_eth_txconf *tx_conf);
2097 
2108 int rte_eth_dev_socket_id(uint16_t port_id);
2109 
2119 int rte_eth_dev_is_valid_port(uint16_t port_id);
2120 
2136 int rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id);
2137 
2152 int rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id);
2153 
2169 int rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id);
2170 
2185 int rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id);
2186 
2187 
2188 
2204 int rte_eth_dev_start(uint16_t port_id);
2205 
2213 void rte_eth_dev_stop(uint16_t port_id);
2214 
2215 
2228 int rte_eth_dev_set_link_up(uint16_t port_id);
2229 
2239 int rte_eth_dev_set_link_down(uint16_t port_id);
2240 
2249 void rte_eth_dev_close(uint16_t port_id);
2250 
2288 int rte_eth_dev_reset(uint16_t port_id);
2289 
2296 void rte_eth_promiscuous_enable(uint16_t port_id);
2297 
2304 void rte_eth_promiscuous_disable(uint16_t port_id);
2305 
2316 int rte_eth_promiscuous_get(uint16_t port_id);
2317 
2324 void rte_eth_allmulticast_enable(uint16_t port_id);
2325 
2332 void rte_eth_allmulticast_disable(uint16_t port_id);
2333 
2344 int rte_eth_allmulticast_get(uint16_t port_id);
2345 
2357 void rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link);
2358 
2370 void rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *link);
2371 
2389 int rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats);
2390 
2401 int rte_eth_stats_reset(uint16_t port_id);
2402 
2423 int rte_eth_xstats_get_names(uint16_t port_id,
2424  struct rte_eth_xstat_name *xstats_names,
2425  unsigned int size);
2426 
2449 int rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,
2450  unsigned int n);
2451 
2474 int
2475 rte_eth_xstats_get_names_by_id(uint16_t port_id,
2476  struct rte_eth_xstat_name *xstats_names, unsigned int size,
2477  uint64_t *ids);
2478 
2502 int rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids,
2503  uint64_t *values, unsigned int size);
2504 
2522 int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name,
2523  uint64_t *id);
2524 
2531 void rte_eth_xstats_reset(uint16_t port_id);
2532 
2550 int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id,
2551  uint16_t tx_queue_id, uint8_t stat_idx);
2552 
2570 int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id,
2571  uint16_t rx_queue_id,
2572  uint8_t stat_idx);
2573 
2583 void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr);
2584 
2594 void rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info);
2595 
2614 int rte_eth_dev_fw_version_get(uint16_t port_id,
2615  char *fw_version, size_t fw_size);
2616 
2655 int rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,
2656  uint32_t *ptypes, int num);
2657 
2669 int rte_eth_dev_get_mtu(uint16_t port_id, uint16_t *mtu);
2670 
2685 int rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu);
2686 
2705 int rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on);
2706 
2726 int rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id,
2727  int on);
2728 
2745 int rte_eth_dev_set_vlan_ether_type(uint16_t port_id,
2746  enum rte_vlan_type vlan_type,
2747  uint16_t tag_type);
2748 
2769 int rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask);
2770 
2783 int rte_eth_dev_get_vlan_offload(uint16_t port_id);
2784 
2799 int rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on);
2800 
2883 static inline uint16_t
2884 rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
2885  struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
2886 {
2887  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2888 
2889 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2890  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2891  RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
2892 
2893  if (queue_id >= dev->data->nb_rx_queues) {
2894  RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
2895  return 0;
2896  }
2897 #endif
2898  int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
2899  rx_pkts, nb_pkts);
2900 
2901 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2902  struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
2903 
2904  if (unlikely(cb != NULL)) {
2905  do {
2906  nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
2907  nb_pkts, cb->param);
2908  cb = cb->next;
2909  } while (cb != NULL);
2910  }
2911 #endif
2912 
2913  return nb_rx;
2914 }
2915 
2928 static inline int
2929 rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
2930 {
2931  struct rte_eth_dev *dev;
2932 
2933  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
2934  dev = &rte_eth_devices[port_id];
2935  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
2936  if (queue_id >= dev->data->nb_rx_queues)
2937  return -EINVAL;
2938 
2939  return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
2940 }
2941 
2957 static inline int
2958 rte_eth_rx_descriptor_done(uint16_t port_id, uint16_t queue_id, uint16_t offset)
2959 {
2960  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2961  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
2962  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
2963  return (*dev->dev_ops->rx_descriptor_done)( \
2964  dev->data->rx_queues[queue_id], offset);
2965 }
2966 
2967 #define RTE_ETH_RX_DESC_AVAIL 0
2968 #define RTE_ETH_RX_DESC_DONE 1
2969 #define RTE_ETH_RX_DESC_UNAVAIL 2
3004 static inline int
3005 rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id,
3006  uint16_t offset)
3007 {
3008  struct rte_eth_dev *dev;
3009  void *rxq;
3010 
3011 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
3012  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
3013 #endif
3014  dev = &rte_eth_devices[port_id];
3015 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
3016  if (queue_id >= dev->data->nb_rx_queues)
3017  return -ENODEV;
3018 #endif
3019  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_status, -ENOTSUP);
3020  rxq = dev->data->rx_queues[queue_id];
3021 
3022  return (*dev->dev_ops->rx_descriptor_status)(rxq, offset);
3023 }
3024 
3025 #define RTE_ETH_TX_DESC_FULL 0
3026 #define RTE_ETH_TX_DESC_DONE 1
3027 #define RTE_ETH_TX_DESC_UNAVAIL 2
3062 static inline int rte_eth_tx_descriptor_status(uint16_t port_id,
3063  uint16_t queue_id, uint16_t offset)
3064 {
3065  struct rte_eth_dev *dev;
3066  void *txq;
3067 
3068 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
3069  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
3070 #endif
3071  dev = &rte_eth_devices[port_id];
3072 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
3073  if (queue_id >= dev->data->nb_tx_queues)
3074  return -ENODEV;
3075 #endif
3076  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_descriptor_status, -ENOTSUP);
3077  txq = dev->data->tx_queues[queue_id];
3078 
3079  return (*dev->dev_ops->tx_descriptor_status)(txq, offset);
3080 }
3081 
3145 static inline uint16_t
3146 rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id,
3147  struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
3148 {
3149  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
3150 
3151 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
3152  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
3153  RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
3154 
3155  if (queue_id >= dev->data->nb_tx_queues) {
3156  RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
3157  return 0;
3158  }
3159 #endif
3160 
3161 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
3162  struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id];
3163 
3164  if (unlikely(cb != NULL)) {
3165  do {
3166  nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
3167  cb->param);
3168  cb = cb->next;
3169  } while (cb != NULL);
3170  }
3171 #endif
3172 
3173  return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
3174 }
3175 
3232 #ifndef RTE_ETHDEV_TX_PREPARE_NOOP
3233 
3234 static inline uint16_t
3235 rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id,
3236  struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
3237 {
3238  struct rte_eth_dev *dev;
3239 
3240 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
3241  if (!rte_eth_dev_is_valid_port(port_id)) {
3242  RTE_PMD_DEBUG_TRACE("Invalid TX port_id=%d\n", port_id);
3243  rte_errno = -EINVAL;
3244  return 0;
3245  }
3246 #endif
3247 
3248  dev = &rte_eth_devices[port_id];
3249 
3250 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
3251  if (queue_id >= dev->data->nb_tx_queues) {
3252  RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
3253  rte_errno = -EINVAL;
3254  return 0;
3255  }
3256 #endif
3257 
3258  if (!dev->tx_pkt_prepare)
3259  return nb_pkts;
3260 
3261  return (*dev->tx_pkt_prepare)(dev->data->tx_queues[queue_id],
3262  tx_pkts, nb_pkts);
3263 }
3264 
3265 #else
3266 
3267 /*
3268  * Native NOOP operation for compilation targets which doesn't require any
3269  * preparations steps, and functional NOOP may introduce unnecessary performance
3270  * drop.
3271  *
3272  * Generally this is not a good idea to turn it on globally and didn't should
3273  * be used if behavior of tx_preparation can change.
3274  */
3275 
3276 static inline uint16_t
3277 rte_eth_tx_prepare(__rte_unused uint16_t port_id,
3278  __rte_unused uint16_t queue_id,
3279  __rte_unused struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
3280 {
3281  return nb_pkts;
3282 }
3283 
3284 #endif
3285 
3286 typedef void (*buffer_tx_error_fn)(struct rte_mbuf **unsent, uint16_t count,
3287  void *userdata);
3288 
3294  buffer_tx_error_fn error_callback;
3295  void *error_userdata;
3296  uint16_t size;
3297  uint16_t length;
3298  struct rte_mbuf *pkts[];
3300 };
3301 
3308 #define RTE_ETH_TX_BUFFER_SIZE(sz) \
3309  (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *))
3310 
3321 int
3322 rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size);
3323 
3346 static inline uint16_t
3347 rte_eth_tx_buffer_flush(uint16_t port_id, uint16_t queue_id,
3348  struct rte_eth_dev_tx_buffer *buffer)
3349 {
3350  uint16_t sent;
3351  uint16_t to_send = buffer->length;
3352 
3353  if (to_send == 0)
3354  return 0;
3355 
3356  sent = rte_eth_tx_burst(port_id, queue_id, buffer->pkts, to_send);
3357 
3358  buffer->length = 0;
3359 
3360  /* All packets sent, or to be dealt with by callback below */
3361  if (unlikely(sent != to_send))
3362  buffer->error_callback(&buffer->pkts[sent], to_send - sent,
3363  buffer->error_userdata);
3364 
3365  return sent;
3366 }
3367 
3398 static __rte_always_inline uint16_t
3399 rte_eth_tx_buffer(uint16_t port_id, uint16_t queue_id,
3400  struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
3401 {
3402  buffer->pkts[buffer->length++] = tx_pkt;
3403  if (buffer->length < buffer->size)
3404  return 0;
3405 
3406  return rte_eth_tx_buffer_flush(port_id, queue_id, buffer);
3407 }
3408 
3433 int
3435  buffer_tx_error_fn callback, void *userdata);
3436 
3459 void
3460 rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent,
3461  void *userdata);
3462 
3486 void
3487 rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent,
3488  void *userdata);
3489 
3514 int
3515 rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt);
3516 
3531 };
3532 
3533 typedef int (*rte_eth_dev_cb_fn)(uint16_t port_id,
3534  enum rte_eth_event_type event, void *cb_arg, void *ret_param);
3555 int rte_eth_dev_callback_register(uint16_t port_id,
3556  enum rte_eth_event_type event,
3557  rte_eth_dev_cb_fn cb_fn, void *cb_arg);
3558 
3576 int rte_eth_dev_callback_unregister(uint16_t port_id,
3577  enum rte_eth_event_type event,
3578  rte_eth_dev_cb_fn cb_fn, void *cb_arg);
3579 
3599 int _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
3600  enum rte_eth_event_type event, void *cb_arg, void *ret_param);
3601 
3622 int rte_eth_dev_rx_intr_enable(uint16_t port_id, uint16_t queue_id);
3623 
3643 int rte_eth_dev_rx_intr_disable(uint16_t port_id, uint16_t queue_id);
3644 
3662 int rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data);
3663 
3685 int rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id,
3686  int epfd, int op, void *data);
3687 
3700 int rte_eth_led_on(uint16_t port_id);
3701 
3714 int rte_eth_led_off(uint16_t port_id);
3715 
3728 int rte_eth_dev_flow_ctrl_get(uint16_t port_id,
3729  struct rte_eth_fc_conf *fc_conf);
3730 
3745 int rte_eth_dev_flow_ctrl_set(uint16_t port_id,
3746  struct rte_eth_fc_conf *fc_conf);
3747 
3763 int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id,
3764  struct rte_eth_pfc_conf *pfc_conf);
3765 
3784 int rte_eth_dev_mac_addr_add(uint16_t port, struct ether_addr *mac_addr,
3785  uint32_t pool);
3786 
3800 int rte_eth_dev_mac_addr_remove(uint16_t port, struct ether_addr *mac_addr);
3801 
3815 int rte_eth_dev_default_mac_addr_set(uint16_t port,
3816  struct ether_addr *mac_addr);
3817 
3833 int rte_eth_dev_rss_reta_update(uint16_t port,
3834  struct rte_eth_rss_reta_entry64 *reta_conf,
3835  uint16_t reta_size);
3836 
3852 int rte_eth_dev_rss_reta_query(uint16_t port,
3853  struct rte_eth_rss_reta_entry64 *reta_conf,
3854  uint16_t reta_size);
3855 
3874 int rte_eth_dev_uc_hash_table_set(uint16_t port, struct ether_addr *addr,
3875  uint8_t on);
3876 
3894 int rte_eth_dev_uc_all_hash_table_set(uint16_t port, uint8_t on);
3895 
3917 int rte_eth_mirror_rule_set(uint16_t port_id,
3918  struct rte_eth_mirror_conf *mirror_conf,
3919  uint8_t rule_id,
3920  uint8_t on);
3921 
3935 int rte_eth_mirror_rule_reset(uint16_t port_id,
3936  uint8_t rule_id);
3937 
3953 int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx,
3954  uint16_t tx_rate);
3955 
3969 int rte_eth_dev_rss_hash_update(uint16_t port_id,
3970  struct rte_eth_rss_conf *rss_conf);
3971 
3985 int
3986 rte_eth_dev_rss_hash_conf_get(uint16_t port_id,
3987  struct rte_eth_rss_conf *rss_conf);
3988 
4006 int
4007 rte_eth_dev_udp_tunnel_port_add(uint16_t port_id,
4008  struct rte_eth_udp_tunnel *tunnel_udp);
4009 
4028 int
4029 rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id,
4030  struct rte_eth_udp_tunnel *tunnel_udp);
4031 
4045 int rte_eth_dev_filter_supported(uint16_t port_id,
4046  enum rte_filter_type filter_type);
4047 
4066 int rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type,
4067  enum rte_filter_op filter_op, void *arg);
4068 
4081 int rte_eth_dev_get_dcb_info(uint16_t port_id,
4082  struct rte_eth_dcb_info *dcb_info);
4083 
4108 void *rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
4109  rte_rx_callback_fn fn, void *user_param);
4110 
4136 void *rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
4137  rte_rx_callback_fn fn, void *user_param);
4138 
4163 void *rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
4164  rte_tx_callback_fn fn, void *user_param);
4165 
4196 int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
4197  struct rte_eth_rxtx_callback *user_cb);
4198 
4229 int rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id,
4230  struct rte_eth_rxtx_callback *user_cb);
4231 
4249 int rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
4250  struct rte_eth_rxq_info *qinfo);
4251 
4269 int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
4270  struct rte_eth_txq_info *qinfo);
4271 
4288 int rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info);
4289 
4301 int rte_eth_dev_get_eeprom_length(uint16_t port_id);
4302 
4317 int rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info);
4318 
4333 int rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info);
4334 
4352 int rte_eth_dev_set_mc_addr_list(uint16_t port_id,
4353  struct ether_addr *mc_addr_set,
4354  uint32_t nb_mc_addr);
4355 
4367 int rte_eth_timesync_enable(uint16_t port_id);
4368 
4380 int rte_eth_timesync_disable(uint16_t port_id);
4381 
4399 int rte_eth_timesync_read_rx_timestamp(uint16_t port_id,
4400  struct timespec *timestamp, uint32_t flags);
4401 
4416 int rte_eth_timesync_read_tx_timestamp(uint16_t port_id,
4417  struct timespec *timestamp);
4418 
4435 int rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta);
4436 
4451 int rte_eth_timesync_read_time(uint16_t port_id, struct timespec *time);
4452 
4470 int rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *time);
4471 
4491 const struct rte_memzone *
4492 rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
4493  uint16_t queue_id, size_t size,
4494  unsigned align, int socket_id);
4495 
4510 int
4511 rte_eth_dev_l2_tunnel_eth_type_conf(uint16_t port_id,
4512  struct rte_eth_l2_tunnel_conf *l2_tunnel);
4513 
4537 int
4538 rte_eth_dev_l2_tunnel_offload_set(uint16_t port_id,
4539  struct rte_eth_l2_tunnel_conf *l2_tunnel,
4540  uint32_t mask,
4541  uint8_t en);
4542 
4555 int
4556 rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id);
4557 
4569 int
4570 rte_eth_dev_get_name_by_port(uint16_t port_id, char *name);
4571 
4588 int rte_eth_dev_adjust_nb_rx_tx_desc(uint16_t port_id,
4589  uint16_t *nb_rx_desc,
4590  uint16_t *nb_tx_desc);
4591 
4592 
4607 int
4608 rte_eth_dev_pool_ops_supported(uint16_t port_id, const char *pool);
4609 
4610 #ifdef __cplusplus
4611 }
4612 #endif
4613 
4614 #endif /* _RTE_ETHDEV_H_ */
int rte_eth_dev_uc_all_hash_table_set(uint16_t port, uint8_t on)
uint16_t nb_rx_queues
Definition: rte_ethdev.h:1049
int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, struct rte_eth_pfc_conf *pfc_conf)
int rte_eth_dev_mac_addr_add(uint16_t port, struct ether_addr *mac_addr, uint32_t pool)
uint32_t txq_flags
Definition: rte_ethdev.h:765
#define ETH_VMDQ_MAX_VLAN_FILTERS
Definition: rte_ethdev.h:522
int rte_eth_dev_l2_tunnel_eth_type_conf(uint16_t port_id, struct rte_eth_l2_tunnel_conf *l2_tunnel)
#define __rte_always_inline
Definition: rte_common.h:139
uint16_t tx_rs_thresh
Definition: rte_ethdev.h:761
int rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *time)
uint16_t(* rte_rx_callback_fn)(uint16_t port, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts, void *user_param)
Definition: rte_ethdev.h:1667
uint16_t nb_desc
Definition: rte_ethdev.h:1070
uint64_t rx_offload_capa
Definition: rte_ethdev.h:1027
int rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
int rte_eth_timesync_read_time(uint16_t port_id, struct timespec *time)
void rte_eth_dev_stop(uint16_t port_id)
int rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_queue, uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf)
int rte_eth_dev_get_name_by_port(uint16_t port_id, char *name)
static uint16_t rte_eth_tx_prepare(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
Definition: rte_ethdev.h:3235
int rte_eth_mirror_rule_reset(uint16_t port_id, uint8_t rule_id)
rte_eth_nb_tcs
Definition: rte_ethdev.h:601
uint64_t q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:218
uint16_t rte_eth_find_next(uint16_t port_id)
int rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on)
int rte_eth_led_off(uint16_t port_id)
rte_fdir_pballoc_type
Definition: rte_ethdev.h:846
int rte_eth_dev_udp_tunnel_port_delete(uint16_t port_id, struct rte_eth_udp_tunnel *tunnel_udp)
static int rte_eth_rx_descriptor_status(uint16_t port_id, uint16_t queue_id, uint16_t offset)
Definition: rte_ethdev.h:3005
uint64_t imissed
Definition: rte_ethdev.h:203
static int rte_eth_rx_descriptor_done(uint16_t port_id, uint16_t queue_id, uint16_t offset)
Definition: rte_ethdev.h:2958
uint32_t low_water
Definition: rte_ethdev.h:824
uint32_t max_rx_pkt_len
Definition: rte_ethdev.h:352
uint16_t(* rte_tx_callback_fn)(uint16_t port, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param)
Definition: rte_ethdev.h:1691
uint8_t rss_key_len
Definition: rte_ethdev.h:427
void rte_eth_dev_close(uint16_t port_id)
int rte_eth_set_queue_rate_limit(uint16_t port_id, uint16_t queue_idx, uint16_t tx_rate)
uint8_t hthresh
Definition: rte_ethdev.h:284
int rte_eth_dev_rss_hash_update(uint16_t port_id, struct rte_eth_rss_conf *rss_conf)
uint64_t rx_queue_offload_capa
Definition: rte_ethdev.h:1031
int rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats, unsigned int n)
const struct rte_memzone * rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name, uint16_t queue_id, size_t size, unsigned align, int socket_id)
uint16_t reta_size
Definition: rte_ethdev.h:1035
int rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id, int epfd, int op, void *data)
void * userdata
Definition: rte_mbuf.h:547
uint32_t lpbk_mode
Definition: rte_ethdev.h:917
#define rte_errno
Definition: rte_errno.h:58
uint32_t link_speeds
Definition: rte_ethdev.h:908
uint64_t tx_queue_offload_capa
Definition: rte_ethdev.h:1033
rte_eth_tx_mq_mode
Definition: rte_ethdev.h:332
rte_eth_fc_mode
Definition: rte_ethdev.h:810
int rte_eth_mirror_rule_set(uint16_t port_id, struct rte_eth_mirror_conf *mirror_conf, uint8_t rule_id, uint8_t on)
uint8_t enable_default_pool
Definition: rte_ethdev.h:653
uint16_t nb_mtu_seg_max
Definition: rte_ethdev.h:804
#define __rte_unused
Definition: rte_common.h:105
uint64_t q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:216
int rte_eth_dev_get_eeprom_length(uint16_t port_id)
uint64_t opackets
Definition: rte_ethdev.h:200
rte_filter_op
Definition: rte_eth_ctrl.h:109
uint8_t hash_key_size
Definition: rte_ethdev.h:1037
void * rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param)
int rte_eth_dev_rx_intr_enable(uint16_t port_id, uint16_t queue_id)
int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id, uint8_t stat_idx)
int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_txq_info *qinfo)
uint16_t split_hdr_size
Definition: rte_ethdev.h:353
struct rte_mempool * mp
Definition: rte_ethdev.h:1058
uint32_t dcb_capability_en
Definition: rte_ethdev.h:941
#define ETH_NUM_RECEIVE_MAC_ADDR
Definition: rte_ethdev.h:543
uint64_t q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:214
struct rte_mbuf __rte_cache_aligned
int rte_eth_dev_flow_ctrl_get(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
int rte_eth_dev_callback_unregister(uint16_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg)
int rte_eth_dev_rx_queue_stop(uint16_t port_id, uint16_t rx_queue_id)
int rte_eth_dev_pool_ops_supported(uint16_t port_id, const char *pool)
void rte_eth_allmulticast_enable(uint16_t port_id)
int rte_eth_dev_set_link_up(uint16_t port_id)
int rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec *timestamp, uint32_t flags)
uint16_t rte_eth_dev_count(void)
int rte_eth_dev_get_vlan_offload(uint16_t port_id)
int rte_eth_tx_queue_setup(uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf)
uint16_t vmdq_queue_num
Definition: rte_ethdev.h:1043
uint8_t rx_deferred_start
Definition: rte_ethdev.h:725
void(* eth_promiscuous_enable_t)(struct rte_eth_dev *dev)
Definition: rte_ethdev.h:1200
struct rte_mbuf * pkts[]
Definition: rte_ethdev.h:3298
int(* rte_eth_dev_cb_fn)(uint16_t port_id, enum rte_eth_event_type event, void *cb_arg, void *ret_param)
Definition: rte_ethdev.h:3533
uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:210
uint32_t high_water
Definition: rte_ethdev.h:823
uint16_t port
Definition: rte_mbuf.h:463
uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex)
#define RTE_ETH_XSTATS_NAME_SIZE
Definition: rte_ethdev.h:1074
int rte_eth_dev_rss_hash_conf_get(uint16_t port_id, struct rte_eth_rss_conf *rss_conf)
int rte_eth_timesync_disable(uint16_t port_id)
uint64_t offloads
Definition: rte_ethdev.h:731
int rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg)
uint16_t send_xon
Definition: rte_ethdev.h:826
int rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id, struct rte_eth_rxtx_callback *user_cb)
struct rte_pci_device * pci_dev
Definition: rte_ethdev.h:1014
int rte_eth_stats_reset(uint16_t port_id)
#define unlikely(x)
uint16_t nb_max
Definition: rte_ethdev.h:779
int rte_eth_dev_rss_reta_query(uint16_t port, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)
uint64_t ibytes
Definition: rte_ethdev.h:201
uint64_t offloads
Definition: rte_ethdev.h:772
uint64_t oerrors
Definition: rte_ethdev.h:208
void rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent, void *userdata)
int rte_eth_dev_udp_tunnel_port_add(uint16_t port_id, struct rte_eth_udp_tunnel *tunnel_udp)
int rte_eth_dev_set_mc_addr_list(uint16_t port_id, struct ether_addr *mc_addr_set, uint32_t nb_mc_addr)
int rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)
void rte_eth_promiscuous_enable(uint16_t port_id)
int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id, struct rte_eth_rxtx_callback *user_cb)
uint64_t offloads
Definition: rte_ethdev.h:359
int rte_eth_dev_callback_register(uint16_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg)
int rte_eth_dev_tx_queue_stop(uint16_t port_id, uint16_t tx_queue_id)
uint16_t tx_free_thresh
Definition: rte_ethdev.h:762
uint16_t nb_desc
Definition: rte_ethdev.h:1061
void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr)
static uint16_t rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
Definition: rte_ethdev.h:2884
int rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id, int on)
int rte_eth_dev_start(uint16_t port_id)
uint16_t max_vmdq_pools
Definition: rte_ethdev.h:1026
int rte_eth_dev_mac_addr_remove(uint16_t port, struct ether_addr *mac_addr)
uint8_t scattered_rx
Definition: rte_ethdev.h:1060
int rte_eth_dev_reset(uint16_t port_id)
int rte_eth_xstats_get_by_id(uint16_t port_id, const uint64_t *ids, uint64_t *values, unsigned int size)
uint64_t offloads
Definition: rte_ethdev.h:705
void * rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id, rte_tx_callback_fn fn, void *user_param)
uint16_t vmdq_pool_base
Definition: rte_ethdev.h:1044
uint64_t tx_offload_capa
Definition: rte_ethdev.h:1029
int rte_eth_dev_rx_intr_disable(uint16_t port_id, uint16_t queue_id)
int rte_eth_tx_buffer_set_err_callback(struct rte_eth_dev_tx_buffer *buffer, buffer_tx_error_fn callback, void *userdata)
void rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent, void *userdata)
uint64_t q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:212
int rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size)
int rte_eth_dev_attach(const char *devargs, uint16_t *port_id)
uint64_t obytes
Definition: rte_ethdev.h:202
uint8_t enable_loop_back
Definition: rte_ethdev.h:686
int rte_eth_dev_adjust_nb_rx_tx_desc(uint16_t port_id, uint16_t *nb_rx_desc, uint16_t *nb_tx_desc)
rte_kernel_driver
Definition: rte_dev.h:120
void rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link)
int rte_eth_dev_default_mac_addr_set(uint16_t port, struct ether_addr *mac_addr)
#define ETH_DCB_NUM_USER_PRIORITIES
Definition: rte_ethdev.h:523
void rte_eth_promiscuous_disable(uint16_t port_id)
uint16_t max_tx_queues
Definition: rte_ethdev.h:1021
int rte_eth_dev_tx_queue_start(uint16_t port_id, uint16_t tx_queue_id)
rte_eth_dev_state
Definition: rte_ethdev.h:1711
uint16_t rx_free_thresh
Definition: rte_ethdev.h:723
uint64_t ierrors
Definition: rte_ethdev.h:207
int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name, uint64_t *id)
int rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
uint8_t priority
Definition: rte_ethdev.h:839
uint64_t flow_type_rss_offloads
Definition: rte_ethdev.h:1039
int rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data)
rte_vlan_type
Definition: rte_ethdev.h:393
uint16_t nb_seg_max
Definition: rte_ethdev.h:791
uint64_t ipackets
Definition: rte_ethdev.h:199
uint16_t max_vfs
Definition: rte_ethdev.h:1025
uint16_t pause_time
Definition: rte_ethdev.h:825
rte_filter_type
Definition: rte_eth_ctrl.h:91
int rte_eth_dev_l2_tunnel_offload_set(uint16_t port_id, struct rte_eth_l2_tunnel_conf *l2_tunnel, uint32_t mask, uint8_t en)
uint64_t rx_nombuf
Definition: rte_ethdev.h:209
static __rte_always_inline uint16_t rte_eth_tx_buffer(uint16_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
Definition: rte_ethdev.h:3399
struct rte_mempool * pool
Definition: rte_mbuf.h:551
int rte_eth_dev_detach(uint16_t port_id, char *devname)
int rte_eth_dev_get_dcb_info(uint16_t port_id, struct rte_eth_dcb_info *dcb_info)
#define __rte_cache_min_aligned
Definition: rte_memory.h:96
#define ETH_MQ_RX_RSS_FLAG
Definition: rte_ethdev.h:291
uint16_t vmdq_queue_base
Definition: rte_ethdev.h:1042
rte_eth_nb_pools
Definition: rte_ethdev.h:610
void rte_eth_xstats_reset(uint16_t port_id)
#define ETH_MIRROR_MAX_VLANS
Definition: rte_ethdev.h:556
uint16_t nb_align
Definition: rte_ethdev.h:781
int rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id, uint8_t stat_idx)
int rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
rte_eth_rx_mq_mode
Definition: rte_ethdev.h:299
const char * driver_name
Definition: rte_ethdev.h:1015
int rte_eth_dev_rss_reta_update(uint16_t port, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)
static int rte_eth_rx_queue_count(uint16_t port_id, uint16_t queue_id)
Definition: rte_ethdev.h:2929
int rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_rxq_info *qinfo)
int rte_eth_dev_socket_id(uint16_t port_id)
uint8_t enable_default_pool
Definition: rte_ethdev.h:684
int rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
uint16_t nb_tx_queues
Definition: rte_ethdev.h:1050
int rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
int rte_eth_dev_set_vlan_ether_type(uint16_t port_id, enum rte_vlan_type vlan_type, uint16_t tag_type)
int rte_eth_dev_filter_supported(uint16_t port_id, enum rte_filter_type filter_type)
uint32_t max_mac_addrs
Definition: rte_ethdev.h:1022
int rte_eth_xstats_get_names_by_id(uint16_t port_id, struct rte_eth_xstat_name *xstats_names, unsigned int size, uint64_t *ids)
uint64_t value
Definition: rte_ethdev.h:1087
int rte_eth_promiscuous_get(uint16_t port_id)
int rte_eth_led_on(uint16_t port_id)
int rte_eth_timesync_read_tx_timestamp(uint16_t port_id, struct timespec *timestamp)
uint32_t max_rx_pktlen
Definition: rte_ethdev.h:1019
int rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask, uint32_t *ptypes, int num)
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_memzone.h:79
uint64_t rss_hf
Definition: rte_ethdev.h:428
uint64_t id
Definition: rte_ethdev.h:1086
int rte_eth_dev_uc_hash_table_set(uint16_t port, struct ether_addr *addr, uint8_t on)
int rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats)
unsigned int if_index
Definition: rte_ethdev.h:1016
void rte_eth_allmulticast_disable(uint16_t port_id)
uint8_t mac_ctrl_frame_fwd
Definition: rte_ethdev.h:828
int rte_eth_dev_get_mtu(uint16_t port_id, uint16_t *mtu)
rte_fdir_mode
Definition: rte_eth_ctrl.h:686
uint8_t * rss_key
Definition: rte_ethdev.h:426
rte_fdir_status_mode
Definition: rte_ethdev.h:855
uint8_t tx_deferred_start
Definition: rte_ethdev.h:766
uint8_t wthresh
Definition: rte_ethdev.h:285
uint16_t max_rx_queues
Definition: rte_ethdev.h:1020
int rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size)
void rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
int rte_eth_xstats_get_names(uint16_t port_id, struct rte_eth_xstat_name *xstats_names, unsigned int size)
int rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
int rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
int rte_eth_allmulticast_get(uint16_t port_id)
uint8_t rx_drop_en
Definition: rte_ethdev.h:724
int rte_eth_dev_is_valid_port(uint16_t port_id)
uint16_t nb_min
Definition: rte_ethdev.h:780
int rte_eth_timesync_enable(uint16_t port_id)
uint8_t pthresh
Definition: rte_ethdev.h:283
void rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *link)
uint32_t speed_capa
Definition: rte_ethdev.h:1047
static uint16_t rte_eth_tx_burst(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
Definition: rte_ethdev.h:3146
uint8_t drop_queue
Definition: rte_ethdev.h:872
int rte_eth_dev_rx_queue_start(uint16_t port_id, uint16_t rx_queue_id)
int rte_eth_dev_set_link_down(uint16_t port_id)
int rte_eth_dev_flow_ctrl_set(uint16_t port_id, struct rte_eth_fc_conf *fc_conf)
uint8_t autoneg
Definition: rte_ethdev.h:829
uint32_t min_rx_bufsize
Definition: rte_ethdev.h:1018
int rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
void * rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param)
static uint16_t rte_eth_tx_buffer_flush(uint16_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer)
Definition: rte_ethdev.h:3347
int rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool)
rte_eth_event_type
Definition: rte_ethdev.h:3520