DPDK  make-f/builddir/build/BUILD/dpdk-stable-16.11.2/mk/rte.sdkconfig.mkshowversion
rte_ethdev.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2010-2016 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 #include <rte_dev.h>
176 
177 /* Use this macro to check if LRO API is supported */
178 #define RTE_ETHDEV_HAS_LRO_SUPPORT
179 
180 #include <rte_log.h>
181 #include <rte_interrupts.h>
182 #include <rte_pci.h>
183 #include <rte_dev.h>
184 #include <rte_devargs.h>
185 #include "rte_ether.h"
186 #include "rte_eth_ctrl.h"
187 #include "rte_dev_info.h"
188 
189 struct rte_mbuf;
190 
198  uint64_t ipackets;
199  uint64_t opackets;
200  uint64_t ibytes;
201  uint64_t obytes;
202  uint64_t imissed;
206  uint64_t ierrors;
207  uint64_t oerrors;
208  uint64_t rx_nombuf;
209  uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
211  uint64_t q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
213  uint64_t q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
215  uint64_t q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
217  uint64_t q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];
219 };
220 
224 #define ETH_LINK_SPEED_AUTONEG (0 << 0)
225 #define ETH_LINK_SPEED_FIXED (1 << 0)
226 #define ETH_LINK_SPEED_10M_HD (1 << 1)
227 #define ETH_LINK_SPEED_10M (1 << 2)
228 #define ETH_LINK_SPEED_100M_HD (1 << 3)
229 #define ETH_LINK_SPEED_100M (1 << 4)
230 #define ETH_LINK_SPEED_1G (1 << 5)
231 #define ETH_LINK_SPEED_2_5G (1 << 6)
232 #define ETH_LINK_SPEED_5G (1 << 7)
233 #define ETH_LINK_SPEED_10G (1 << 8)
234 #define ETH_LINK_SPEED_20G (1 << 9)
235 #define ETH_LINK_SPEED_25G (1 << 10)
236 #define ETH_LINK_SPEED_40G (1 << 11)
237 #define ETH_LINK_SPEED_50G (1 << 12)
238 #define ETH_LINK_SPEED_56G (1 << 13)
239 #define ETH_LINK_SPEED_100G (1 << 14)
244 #define ETH_SPEED_NUM_NONE 0
245 #define ETH_SPEED_NUM_10M 10
246 #define ETH_SPEED_NUM_100M 100
247 #define ETH_SPEED_NUM_1G 1000
248 #define ETH_SPEED_NUM_2_5G 2500
249 #define ETH_SPEED_NUM_5G 5000
250 #define ETH_SPEED_NUM_10G 10000
251 #define ETH_SPEED_NUM_20G 20000
252 #define ETH_SPEED_NUM_25G 25000
253 #define ETH_SPEED_NUM_40G 40000
254 #define ETH_SPEED_NUM_50G 50000
255 #define ETH_SPEED_NUM_56G 56000
256 #define ETH_SPEED_NUM_100G 100000
261 __extension__
262 struct rte_eth_link {
263  uint32_t link_speed;
264  uint16_t link_duplex : 1;
265  uint16_t link_autoneg : 1;
266  uint16_t link_status : 1;
267 } __attribute__((aligned(8)));
269 /* Utility constants */
270 #define ETH_LINK_HALF_DUPLEX 0
271 #define ETH_LINK_FULL_DUPLEX 1
272 #define ETH_LINK_DOWN 0
273 #define ETH_LINK_UP 1
274 #define ETH_LINK_FIXED 0
275 #define ETH_LINK_AUTONEG 1
281 struct rte_eth_thresh {
282  uint8_t pthresh;
283  uint8_t hthresh;
284  uint8_t wthresh;
285 };
286 
290 #define ETH_MQ_RX_RSS_FLAG 0x1
291 #define ETH_MQ_RX_DCB_FLAG 0x2
292 #define ETH_MQ_RX_VMDQ_FLAG 0x4
293 
301 
305  ETH_MQ_RX_DCB = ETH_MQ_RX_DCB_FLAG,
307  ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG,
308 
310  ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG,
312  ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_VMDQ_FLAG,
314  ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG | ETH_MQ_RX_DCB_FLAG,
317  ETH_MQ_RX_VMDQ_FLAG,
318 };
319 
323 #define ETH_RSS ETH_MQ_RX_RSS
324 #define VMDQ_DCB ETH_MQ_RX_VMDQ_DCB
325 #define ETH_DCB_RX ETH_MQ_RX_DCB
326 
336 };
337 
341 #define ETH_DCB_NONE ETH_MQ_TX_NONE
342 #define ETH_VMDQ_DCB_TX ETH_MQ_TX_VMDQ_DCB
343 #define ETH_DCB_TX ETH_MQ_TX_DCB
344 
351  uint32_t max_rx_pkt_len;
352  uint16_t split_hdr_size;
353  __extension__
354  uint16_t header_split : 1,
355  hw_ip_checksum : 1,
356  hw_vlan_filter : 1,
357  hw_vlan_strip : 1,
358  hw_vlan_extend : 1,
359  jumbo_frame : 1,
360  hw_strip_crc : 1,
361  enable_scatter : 1,
362  enable_lro : 1;
363 };
364 
370  ETH_VLAN_TYPE_UNKNOWN = 0,
373  ETH_VLAN_TYPE_MAX,
374 };
375 
394  uint8_t *rss_key;
395  uint8_t rss_key_len;
396  uint64_t rss_hf;
397 };
398 
399 /*
400  * The RSS offload types are defined based on flow types which are defined
401  * in rte_eth_ctrl.h. Different NIC hardwares may support different RSS offload
402  * types. The supported flow types or RSS offload types can be queried by
403  * rte_eth_dev_info_get().
404  */
405 #define ETH_RSS_IPV4 (1ULL << RTE_ETH_FLOW_IPV4)
406 #define ETH_RSS_FRAG_IPV4 (1ULL << RTE_ETH_FLOW_FRAG_IPV4)
407 #define ETH_RSS_NONFRAG_IPV4_TCP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_TCP)
408 #define ETH_RSS_NONFRAG_IPV4_UDP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_UDP)
409 #define ETH_RSS_NONFRAG_IPV4_SCTP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_SCTP)
410 #define ETH_RSS_NONFRAG_IPV4_OTHER (1ULL << RTE_ETH_FLOW_NONFRAG_IPV4_OTHER)
411 #define ETH_RSS_IPV6 (1ULL << RTE_ETH_FLOW_IPV6)
412 #define ETH_RSS_FRAG_IPV6 (1ULL << RTE_ETH_FLOW_FRAG_IPV6)
413 #define ETH_RSS_NONFRAG_IPV6_TCP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_TCP)
414 #define ETH_RSS_NONFRAG_IPV6_UDP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_UDP)
415 #define ETH_RSS_NONFRAG_IPV6_SCTP (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_SCTP)
416 #define ETH_RSS_NONFRAG_IPV6_OTHER (1ULL << RTE_ETH_FLOW_NONFRAG_IPV6_OTHER)
417 #define ETH_RSS_L2_PAYLOAD (1ULL << RTE_ETH_FLOW_L2_PAYLOAD)
418 #define ETH_RSS_IPV6_EX (1ULL << RTE_ETH_FLOW_IPV6_EX)
419 #define ETH_RSS_IPV6_TCP_EX (1ULL << RTE_ETH_FLOW_IPV6_TCP_EX)
420 #define ETH_RSS_IPV6_UDP_EX (1ULL << RTE_ETH_FLOW_IPV6_UDP_EX)
421 #define ETH_RSS_PORT (1ULL << RTE_ETH_FLOW_PORT)
422 #define ETH_RSS_VXLAN (1ULL << RTE_ETH_FLOW_VXLAN)
423 #define ETH_RSS_GENEVE (1ULL << RTE_ETH_FLOW_GENEVE)
424 #define ETH_RSS_NVGRE (1ULL << RTE_ETH_FLOW_NVGRE)
425 
426 #define ETH_RSS_IP ( \
427  ETH_RSS_IPV4 | \
428  ETH_RSS_FRAG_IPV4 | \
429  ETH_RSS_NONFRAG_IPV4_OTHER | \
430  ETH_RSS_IPV6 | \
431  ETH_RSS_FRAG_IPV6 | \
432  ETH_RSS_NONFRAG_IPV6_OTHER | \
433  ETH_RSS_IPV6_EX)
434 
435 #define ETH_RSS_UDP ( \
436  ETH_RSS_NONFRAG_IPV4_UDP | \
437  ETH_RSS_NONFRAG_IPV6_UDP | \
438  ETH_RSS_IPV6_UDP_EX)
439 
440 #define ETH_RSS_TCP ( \
441  ETH_RSS_NONFRAG_IPV4_TCP | \
442  ETH_RSS_NONFRAG_IPV6_TCP | \
443  ETH_RSS_IPV6_TCP_EX)
444 
445 #define ETH_RSS_SCTP ( \
446  ETH_RSS_NONFRAG_IPV4_SCTP | \
447  ETH_RSS_NONFRAG_IPV6_SCTP)
448 
449 #define ETH_RSS_TUNNEL ( \
450  ETH_RSS_VXLAN | \
451  ETH_RSS_GENEVE | \
452  ETH_RSS_NVGRE)
453 
454 
456 #define ETH_RSS_PROTO_MASK ( \
457  ETH_RSS_IPV4 | \
458  ETH_RSS_FRAG_IPV4 | \
459  ETH_RSS_NONFRAG_IPV4_TCP | \
460  ETH_RSS_NONFRAG_IPV4_UDP | \
461  ETH_RSS_NONFRAG_IPV4_SCTP | \
462  ETH_RSS_NONFRAG_IPV4_OTHER | \
463  ETH_RSS_IPV6 | \
464  ETH_RSS_FRAG_IPV6 | \
465  ETH_RSS_NONFRAG_IPV6_TCP | \
466  ETH_RSS_NONFRAG_IPV6_UDP | \
467  ETH_RSS_NONFRAG_IPV6_SCTP | \
468  ETH_RSS_NONFRAG_IPV6_OTHER | \
469  ETH_RSS_L2_PAYLOAD | \
470  ETH_RSS_IPV6_EX | \
471  ETH_RSS_IPV6_TCP_EX | \
472  ETH_RSS_IPV6_UDP_EX | \
473  ETH_RSS_PORT | \
474  ETH_RSS_VXLAN | \
475  ETH_RSS_GENEVE | \
476  ETH_RSS_NVGRE)
477 
478 /*
479  * Definitions used for redirection table entry size.
480  * Some RSS RETA sizes may not be supported by some drivers, check the
481  * documentation or the description of relevant functions for more details.
482  */
483 #define ETH_RSS_RETA_SIZE_64 64
484 #define ETH_RSS_RETA_SIZE_128 128
485 #define ETH_RSS_RETA_SIZE_256 256
486 #define ETH_RSS_RETA_SIZE_512 512
487 #define RTE_RETA_GROUP_SIZE 64
488 
489 /* Definitions used for VMDQ and DCB functionality */
490 #define ETH_VMDQ_MAX_VLAN_FILTERS 64
491 #define ETH_DCB_NUM_USER_PRIORITIES 8
492 #define ETH_VMDQ_DCB_NUM_QUEUES 128
493 #define ETH_DCB_NUM_QUEUES 128
495 /* DCB capability defines */
496 #define ETH_DCB_PG_SUPPORT 0x00000001
497 #define ETH_DCB_PFC_SUPPORT 0x00000002
499 /* Definitions used for VLAN Offload functionality */
500 #define ETH_VLAN_STRIP_OFFLOAD 0x0001
501 #define ETH_VLAN_FILTER_OFFLOAD 0x0002
502 #define ETH_VLAN_EXTEND_OFFLOAD 0x0004
504 /* Definitions used for mask VLAN setting */
505 #define ETH_VLAN_STRIP_MASK 0x0001
506 #define ETH_VLAN_FILTER_MASK 0x0002
507 #define ETH_VLAN_EXTEND_MASK 0x0004
508 #define ETH_VLAN_ID_MAX 0x0FFF
510 /* Definitions used for receive MAC address */
511 #define ETH_NUM_RECEIVE_MAC_ADDR 128
513 /* Definitions used for unicast hash */
514 #define ETH_VMDQ_NUM_UC_HASH_ARRAY 128
516 /* Definitions used for VMDQ pool rx mode setting */
517 #define ETH_VMDQ_ACCEPT_UNTAG 0x0001
518 #define ETH_VMDQ_ACCEPT_HASH_MC 0x0002
519 #define ETH_VMDQ_ACCEPT_HASH_UC 0x0004
520 #define ETH_VMDQ_ACCEPT_BROADCAST 0x0008
521 #define ETH_VMDQ_ACCEPT_MULTICAST 0x0010
524 #define ETH_MIRROR_MAX_VLANS 64
525 
526 #define ETH_MIRROR_VIRTUAL_POOL_UP 0x01
527 #define ETH_MIRROR_UPLINK_PORT 0x02
528 #define ETH_MIRROR_DOWNLINK_PORT 0x04
529 #define ETH_MIRROR_VLAN 0x08
530 #define ETH_MIRROR_VIRTUAL_POOL_DOWN 0x10
535 struct rte_eth_vlan_mirror {
536  uint64_t vlan_mask;
538  uint16_t vlan_id[ETH_MIRROR_MAX_VLANS];
539 };
540 
545  uint8_t rule_type;
546  uint8_t dst_pool;
547  uint64_t pool_mask;
550 };
551 
559  uint64_t mask;
561  uint16_t reta[RTE_RETA_GROUP_SIZE];
563 };
564 
570  ETH_4_TCS = 4,
572 };
573 
583 };
584 
585 /* This structure may be extended in future. */
586 struct rte_eth_dcb_rx_conf {
587  enum rte_eth_nb_tcs nb_tcs;
589  uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
590 };
591 
592 struct rte_eth_vmdq_dcb_tx_conf {
593  enum rte_eth_nb_pools nb_queue_pools;
595  uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
596 };
597 
598 struct rte_eth_dcb_tx_conf {
599  enum rte_eth_nb_tcs nb_tcs;
601  uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES];
602 };
603 
604 struct rte_eth_vmdq_tx_conf {
605  enum rte_eth_nb_pools nb_queue_pools;
606 };
607 
622  uint8_t default_pool;
623  uint8_t nb_pool_maps;
624  struct {
625  uint16_t vlan_id;
626  uint64_t pools;
630 };
631 
632 struct rte_eth_vmdq_rx_conf {
633  enum rte_eth_nb_pools nb_queue_pools;
634  uint8_t enable_default_pool;
635  uint8_t default_pool;
636  uint8_t enable_loop_back;
637  uint8_t nb_pool_maps;
638  uint32_t rx_mode;
639  struct {
640  uint16_t vlan_id;
641  uint64_t pools;
642  } pool_map[ETH_VMDQ_MAX_VLAN_FILTERS];
643 };
644 
651  /* For i40e specifically */
652  uint16_t pvid;
653  __extension__
654  uint8_t hw_vlan_reject_tagged : 1,
660 };
661 
667  uint16_t rx_free_thresh;
668  uint8_t rx_drop_en;
670 };
671 
672 #define ETH_TXQ_FLAGS_NOMULTSEGS 0x0001
673 #define ETH_TXQ_FLAGS_NOREFCOUNT 0x0002
674 #define ETH_TXQ_FLAGS_NOMULTMEMP 0x0004
675 #define ETH_TXQ_FLAGS_NOVLANOFFL 0x0100
676 #define ETH_TXQ_FLAGS_NOXSUMSCTP 0x0200
677 #define ETH_TXQ_FLAGS_NOXSUMUDP 0x0400
678 #define ETH_TXQ_FLAGS_NOXSUMTCP 0x0800
679 #define ETH_TXQ_FLAGS_NOOFFLOADS \
680  (ETH_TXQ_FLAGS_NOVLANOFFL | ETH_TXQ_FLAGS_NOXSUMSCTP | \
681  ETH_TXQ_FLAGS_NOXSUMUDP | ETH_TXQ_FLAGS_NOXSUMTCP)
682 #define ETH_TXQ_FLAGS_NOXSUMS \
683  (ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \
684  ETH_TXQ_FLAGS_NOXSUMTCP)
685 
690  uint16_t tx_rs_thresh;
691  uint16_t tx_free_thresh;
694  uint32_t txq_flags;
696 };
697 
702  uint16_t nb_max;
703  uint16_t nb_min;
704  uint16_t nb_align;
705 };
706 
715 };
716 
723  uint32_t high_water;
724  uint32_t low_water;
725  uint16_t pause_time;
726  uint16_t send_xon;
729  uint8_t autoneg;
730 };
731 
739  uint8_t priority;
740 };
741 
750 };
751 
759 };
760 
772  uint8_t drop_queue;
773  struct rte_eth_fdir_masks mask;
776 };
777 
786  uint16_t udp_port;
787  uint8_t prot_type;
788 };
789 
795  uint16_t lsc;
797  uint16_t rxq;
798 };
799 
805 struct rte_eth_conf {
806  uint32_t link_speeds;
815  uint32_t lpbk_mode;
820  struct {
824  struct rte_eth_dcb_rx_conf dcb_rx_conf;
826  struct rte_eth_vmdq_rx_conf vmdq_rx_conf;
828  } rx_adv_conf;
829  union {
830  struct rte_eth_vmdq_dcb_tx_conf vmdq_dcb_tx_conf;
832  struct rte_eth_dcb_tx_conf dcb_tx_conf;
834  struct rte_eth_vmdq_tx_conf vmdq_tx_conf;
836  } tx_adv_conf;
842 };
843 
853 #define DEV_RX_OFFLOAD_VLAN_STRIP 0x00000001
854 #define DEV_RX_OFFLOAD_IPV4_CKSUM 0x00000002
855 #define DEV_RX_OFFLOAD_UDP_CKSUM 0x00000004
856 #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008
857 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010
858 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020
859 #define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040
860 
864 #define DEV_TX_OFFLOAD_VLAN_INSERT 0x00000001
865 #define DEV_TX_OFFLOAD_IPV4_CKSUM 0x00000002
866 #define DEV_TX_OFFLOAD_UDP_CKSUM 0x00000004
867 #define DEV_TX_OFFLOAD_TCP_CKSUM 0x00000008
868 #define DEV_TX_OFFLOAD_SCTP_CKSUM 0x00000010
869 #define DEV_TX_OFFLOAD_TCP_TSO 0x00000020
870 #define DEV_TX_OFFLOAD_UDP_TSO 0x00000040
871 #define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080
872 #define DEV_TX_OFFLOAD_QINQ_INSERT 0x00000100
873 #define DEV_TX_OFFLOAD_VXLAN_TNL_TSO 0x00000200
874 #define DEV_TX_OFFLOAD_GRE_TNL_TSO 0x00000400
875 #define DEV_TX_OFFLOAD_IPIP_TNL_TSO 0x00000800
876 #define DEV_TX_OFFLOAD_GENEVE_TNL_TSO 0x00001000
881 struct rte_eth_dev_info {
883  const char *driver_name;
884  unsigned int if_index;
886  uint32_t min_rx_bufsize;
887  uint32_t max_rx_pktlen;
888  uint16_t max_rx_queues;
889  uint16_t max_tx_queues;
890  uint32_t max_mac_addrs;
891  uint32_t max_hash_mac_addrs;
893  uint16_t max_vfs;
894  uint16_t max_vmdq_pools;
895  uint32_t rx_offload_capa;
896  uint32_t tx_offload_capa;
897  uint16_t reta_size;
899  uint8_t hash_key_size;
902  struct rte_eth_rxconf default_rxconf;
903  struct rte_eth_txconf default_txconf;
904  uint16_t vmdq_queue_base;
905  uint16_t vmdq_queue_num;
906  uint16_t vmdq_pool_base;
907  struct rte_eth_desc_lim rx_desc_lim;
908  struct rte_eth_desc_lim tx_desc_lim;
909  uint32_t speed_capa;
911  uint16_t nb_rx_queues;
912  uint16_t nb_tx_queues;
913 };
914 
920  struct rte_mempool *mp;
922  uint8_t scattered_rx;
923  uint16_t nb_desc;
925 
932  uint16_t nb_desc;
934 
936 #define RTE_ETH_XSTATS_NAME_SIZE 64
937 
946  uint64_t id;
947  uint64_t value;
948 };
949 
957  char name[RTE_ETH_XSTATS_NAME_SIZE];
958 };
959 
960 #define ETH_DCB_NUM_TCS 8
961 #define ETH_MAX_VMDQ_POOL 64
962 
969  struct {
970  uint8_t base;
971  uint8_t nb_queue;
972  } tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
974  struct {
975  uint8_t base;
976  uint8_t nb_queue;
977  } tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS];
978 };
979 
985  uint8_t nb_tcs;
987  uint8_t tc_bws[ETH_DCB_NUM_TCS];
990 };
991 
995 #define RTE_ETH_QUEUE_STATE_STOPPED 0
996 #define RTE_ETH_QUEUE_STATE_STARTED 1
997 
998 struct rte_eth_dev;
999 
1000 struct rte_eth_dev_callback;
1002 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
1003 
1004 /* Macros to check for valid port */
1005 #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
1006  if (!rte_eth_dev_is_valid_port(port_id)) { \
1007  RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
1008  return retval; \
1009  } \
1010 } while (0)
1011 
1012 #define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
1013  if (!rte_eth_dev_is_valid_port(port_id)) { \
1014  RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
1015  return; \
1016  } \
1017 } while (0)
1018 
1024 #define ETH_L2_TUNNEL_ENABLE_MASK 0x00000001
1025 
1026 #define ETH_L2_TUNNEL_INSERTION_MASK 0x00000002
1027 
1028 #define ETH_L2_TUNNEL_STRIPPING_MASK 0x00000004
1029 
1030 #define ETH_L2_TUNNEL_FORWARDING_MASK 0x00000008
1031 
1032 /*
1033  * Definitions of all functions exported by an Ethernet driver through the
1034  * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
1035  * structure associated with an Ethernet device.
1036  */
1037 
1038 typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
1041 typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
1044 typedef void (*eth_dev_stop_t)(struct rte_eth_dev *dev);
1047 typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
1050 typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
1053 typedef void (*eth_dev_close_t)(struct rte_eth_dev *dev);
1056 typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
1059 typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
1062 typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
1065 typedef void (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
1068 typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
1069  int wait_to_complete);
1072 typedef void (*eth_stats_get_t)(struct rte_eth_dev *dev,
1073  struct rte_eth_stats *igb_stats);
1076 typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
1079 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
1080  struct rte_eth_xstat *stats, unsigned n);
1083 typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
1086 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
1087  struct rte_eth_xstat_name *xstats_names, unsigned size);
1090 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
1091  uint16_t queue_id,
1092  uint8_t stat_idx,
1093  uint8_t is_rx);
1096 typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
1097  struct rte_eth_dev_info *dev_info);
1100 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
1103 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
1104  uint16_t queue_id);
1107 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
1108  uint16_t queue_id);
1111 typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
1112  uint16_t rx_queue_id,
1113  uint16_t nb_rx_desc,
1114  unsigned int socket_id,
1115  const struct rte_eth_rxconf *rx_conf,
1116  struct rte_mempool *mb_pool);
1119 typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
1120  uint16_t tx_queue_id,
1121  uint16_t nb_tx_desc,
1122  unsigned int socket_id,
1123  const struct rte_eth_txconf *tx_conf);
1126 typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
1127  uint16_t rx_queue_id);
1130 typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
1131  uint16_t rx_queue_id);
1134 typedef void (*eth_queue_release_t)(void *queue);
1137 typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
1138  uint16_t rx_queue_id);
1141 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
1144 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
1145  uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
1146 
1147 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
1148  uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
1149 
1150 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
1153 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
1154  uint16_t vlan_id,
1155  int on);
1158 typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
1159  enum rte_vlan_type type, uint16_t tpid);
1162 typedef void (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
1165 typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
1166  uint16_t vlan_id,
1167  int on);
1170 typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
1171  uint16_t rx_queue_id,
1172  int on);
1175 typedef uint16_t (*eth_rx_burst_t)(void *rxq,
1176  struct rte_mbuf **rx_pkts,
1177  uint16_t nb_pkts);
1180 typedef uint16_t (*eth_tx_burst_t)(void *txq,
1181  struct rte_mbuf **tx_pkts,
1182  uint16_t nb_pkts);
1185 typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
1186  struct rte_eth_fc_conf *fc_conf);
1189 typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
1190  struct rte_eth_fc_conf *fc_conf);
1193 typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
1194  struct rte_eth_pfc_conf *pfc_conf);
1197 typedef int (*reta_update_t)(struct rte_eth_dev *dev,
1198  struct rte_eth_rss_reta_entry64 *reta_conf,
1199  uint16_t reta_size);
1202 typedef int (*reta_query_t)(struct rte_eth_dev *dev,
1203  struct rte_eth_rss_reta_entry64 *reta_conf,
1204  uint16_t reta_size);
1207 typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
1208  struct rte_eth_rss_conf *rss_conf);
1211 typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
1212  struct rte_eth_rss_conf *rss_conf);
1215 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
1218 typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
1221 typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
1224 typedef void (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
1225  struct ether_addr *mac_addr,
1226  uint32_t index,
1227  uint32_t vmdq);
1230 typedef void (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
1231  struct ether_addr *mac_addr);
1234 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
1235  struct ether_addr *mac_addr,
1236  uint8_t on);
1239 typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
1240  uint8_t on);
1243 typedef int (*eth_set_vf_rx_mode_t)(struct rte_eth_dev *dev,
1244  uint16_t vf,
1245  uint16_t rx_mode,
1246  uint8_t on);
1249 typedef int (*eth_set_vf_rx_t)(struct rte_eth_dev *dev,
1250  uint16_t vf,
1251  uint8_t on);
1254 typedef int (*eth_set_vf_tx_t)(struct rte_eth_dev *dev,
1255  uint16_t vf,
1256  uint8_t on);
1259 typedef int (*eth_set_vf_vlan_filter_t)(struct rte_eth_dev *dev,
1260  uint16_t vlan,
1261  uint64_t vf_mask,
1262  uint8_t vlan_on);
1265 typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
1266  uint16_t queue_idx,
1267  uint16_t tx_rate);
1270 typedef int (*eth_set_vf_rate_limit_t)(struct rte_eth_dev *dev,
1271  uint16_t vf,
1272  uint16_t tx_rate,
1273  uint64_t q_msk);
1276 typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,
1277  struct rte_eth_mirror_conf *mirror_conf,
1278  uint8_t rule_id,
1279  uint8_t on);
1282 typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,
1283  uint8_t rule_id);
1286 typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
1287  struct rte_eth_udp_tunnel *tunnel_udp);
1290 typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
1291  struct rte_eth_udp_tunnel *tunnel_udp);
1294 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
1295  struct ether_addr *mc_addr_set,
1296  uint32_t nb_mc_addr);
1299 typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
1302 typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
1305 typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
1306  struct timespec *timestamp,
1307  uint32_t flags);
1310 typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
1311  struct timespec *timestamp);
1314 typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
1317 typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
1318  struct timespec *timestamp);
1321 typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
1322  const struct timespec *timestamp);
1325 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
1326  struct rte_dev_reg_info *info);
1329 typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
1332 typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
1333  struct rte_dev_eeprom_info *info);
1336 typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
1337  struct rte_dev_eeprom_info *info);
1340 typedef int (*eth_l2_tunnel_eth_type_conf_t)
1341  (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
1344 typedef int (*eth_l2_tunnel_offload_set_t)
1345  (struct rte_eth_dev *dev,
1346  struct rte_eth_l2_tunnel_conf *l2_tunnel,
1347  uint32_t mask,
1348  uint8_t en);
1351 #ifdef RTE_NIC_BYPASS
1352 
1353 enum {
1354  RTE_BYPASS_MODE_NONE,
1355  RTE_BYPASS_MODE_NORMAL,
1356  RTE_BYPASS_MODE_BYPASS,
1357  RTE_BYPASS_MODE_ISOLATE,
1358  RTE_BYPASS_MODE_NUM,
1359 };
1360 
1361 #define RTE_BYPASS_MODE_VALID(x) \
1362  ((x) > RTE_BYPASS_MODE_NONE && (x) < RTE_BYPASS_MODE_NUM)
1363 
1364 enum {
1365  RTE_BYPASS_EVENT_NONE,
1366  RTE_BYPASS_EVENT_START,
1367  RTE_BYPASS_EVENT_OS_ON = RTE_BYPASS_EVENT_START,
1368  RTE_BYPASS_EVENT_POWER_ON,
1369  RTE_BYPASS_EVENT_OS_OFF,
1370  RTE_BYPASS_EVENT_POWER_OFF,
1371  RTE_BYPASS_EVENT_TIMEOUT,
1372  RTE_BYPASS_EVENT_NUM
1373 };
1374 
1375 #define RTE_BYPASS_EVENT_VALID(x) \
1376  ((x) > RTE_BYPASS_EVENT_NONE && (x) < RTE_BYPASS_MODE_NUM)
1377 
1378 enum {
1379  RTE_BYPASS_TMT_OFF, /* timeout disabled. */
1380  RTE_BYPASS_TMT_1_5_SEC, /* timeout for 1.5 seconds */
1381  RTE_BYPASS_TMT_2_SEC, /* timeout for 2 seconds */
1382  RTE_BYPASS_TMT_3_SEC, /* timeout for 3 seconds */
1383  RTE_BYPASS_TMT_4_SEC, /* timeout for 4 seconds */
1384  RTE_BYPASS_TMT_8_SEC, /* timeout for 8 seconds */
1385  RTE_BYPASS_TMT_16_SEC, /* timeout for 16 seconds */
1386  RTE_BYPASS_TMT_32_SEC, /* timeout for 32 seconds */
1387  RTE_BYPASS_TMT_NUM
1388 };
1389 
1390 #define RTE_BYPASS_TMT_VALID(x) \
1391  ((x) == RTE_BYPASS_TMT_OFF || \
1392  ((x) > RTE_BYPASS_TMT_OFF && (x) < RTE_BYPASS_TMT_NUM))
1393 
1394 typedef void (*bypass_init_t)(struct rte_eth_dev *dev);
1395 typedef int32_t (*bypass_state_set_t)(struct rte_eth_dev *dev, uint32_t *new_state);
1396 typedef int32_t (*bypass_state_show_t)(struct rte_eth_dev *dev, uint32_t *state);
1397 typedef int32_t (*bypass_event_set_t)(struct rte_eth_dev *dev, uint32_t state, uint32_t event);
1398 typedef int32_t (*bypass_event_show_t)(struct rte_eth_dev *dev, uint32_t event_shift, uint32_t *event);
1399 typedef int32_t (*bypass_wd_timeout_set_t)(struct rte_eth_dev *dev, uint32_t timeout);
1400 typedef int32_t (*bypass_wd_timeout_show_t)(struct rte_eth_dev *dev, uint32_t *wd_timeout);
1401 typedef int32_t (*bypass_ver_show_t)(struct rte_eth_dev *dev, uint32_t *ver);
1402 typedef int32_t (*bypass_wd_reset_t)(struct rte_eth_dev *dev);
1403 #endif
1404 
1405 typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
1406  enum rte_filter_type filter_type,
1407  enum rte_filter_op filter_op,
1408  void *arg);
1411 typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
1412  struct rte_eth_dcb_info *dcb_info);
1418 struct eth_dev_ops {
1419  eth_dev_configure_t dev_configure;
1420  eth_dev_start_t dev_start;
1421  eth_dev_stop_t dev_stop;
1422  eth_dev_set_link_up_t dev_set_link_up;
1423  eth_dev_set_link_down_t dev_set_link_down;
1424  eth_dev_close_t dev_close;
1425  eth_promiscuous_enable_t promiscuous_enable;
1426  eth_promiscuous_disable_t promiscuous_disable;
1427  eth_allmulticast_enable_t allmulticast_enable;
1428  eth_allmulticast_disable_t allmulticast_disable;
1429  eth_link_update_t link_update;
1430  eth_stats_get_t stats_get;
1431  eth_stats_reset_t stats_reset;
1432  eth_xstats_get_t xstats_get;
1433  eth_xstats_reset_t xstats_reset;
1434  eth_xstats_get_names_t xstats_get_names;
1436  eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1438  eth_dev_infos_get_t dev_infos_get;
1439  eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
1441  mtu_set_t mtu_set;
1442  vlan_filter_set_t vlan_filter_set;
1443  vlan_tpid_set_t vlan_tpid_set;
1444  vlan_strip_queue_set_t vlan_strip_queue_set;
1445  vlan_offload_set_t vlan_offload_set;
1446  vlan_pvid_set_t vlan_pvid_set;
1447  eth_queue_start_t rx_queue_start;
1448  eth_queue_stop_t rx_queue_stop;
1449  eth_queue_start_t tx_queue_start;
1450  eth_queue_stop_t tx_queue_stop;
1451  eth_rx_queue_setup_t rx_queue_setup;
1452  eth_queue_release_t rx_queue_release;
1453  eth_rx_queue_count_t rx_queue_count;
1454  eth_rx_descriptor_done_t rx_descriptor_done;
1456  eth_rx_enable_intr_t rx_queue_intr_enable;
1458  eth_rx_disable_intr_t rx_queue_intr_disable;
1459  eth_tx_queue_setup_t tx_queue_setup;
1460  eth_queue_release_t tx_queue_release;
1461  eth_dev_led_on_t dev_led_on;
1462  eth_dev_led_off_t dev_led_off;
1463  flow_ctrl_get_t flow_ctrl_get;
1464  flow_ctrl_set_t flow_ctrl_set;
1465  priority_flow_ctrl_set_t priority_flow_ctrl_set;
1466  eth_mac_addr_remove_t mac_addr_remove;
1467  eth_mac_addr_add_t mac_addr_add;
1468  eth_mac_addr_set_t mac_addr_set;
1469  eth_uc_hash_table_set_t uc_hash_table_set;
1470  eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1471  eth_mirror_rule_set_t mirror_rule_set;
1472  eth_mirror_rule_reset_t mirror_rule_reset;
1473  eth_set_vf_rx_mode_t set_vf_rx_mode;
1474  eth_set_vf_rx_t set_vf_rx;
1475  eth_set_vf_tx_t set_vf_tx;
1476  eth_set_vf_vlan_filter_t set_vf_vlan_filter;
1478  eth_udp_tunnel_port_add_t udp_tunnel_port_add;
1480  eth_udp_tunnel_port_del_t udp_tunnel_port_del;
1481  eth_set_queue_rate_limit_t set_queue_rate_limit;
1482  eth_set_vf_rate_limit_t set_vf_rate_limit;
1484  reta_update_t reta_update;
1486  reta_query_t reta_query;
1487 
1488  eth_get_reg_t get_reg;
1490  eth_get_eeprom_length_t get_eeprom_length;
1492  eth_get_eeprom_t get_eeprom;
1494  eth_set_eeprom_t set_eeprom;
1496  /* bypass control */
1497 #ifdef RTE_NIC_BYPASS
1498  bypass_init_t bypass_init;
1499  bypass_state_set_t bypass_state_set;
1500  bypass_state_show_t bypass_state_show;
1501  bypass_event_set_t bypass_event_set;
1502  bypass_event_show_t bypass_event_show;
1503  bypass_wd_timeout_set_t bypass_wd_timeout_set;
1504  bypass_wd_timeout_show_t bypass_wd_timeout_show;
1505  bypass_ver_show_t bypass_ver_show;
1506  bypass_wd_reset_t bypass_wd_reset;
1507 #endif
1508 
1510  rss_hash_update_t rss_hash_update;
1512  rss_hash_conf_get_t rss_hash_conf_get;
1513  eth_filter_ctrl_t filter_ctrl;
1515  eth_set_mc_addr_list_t set_mc_addr_list;
1516  eth_rxq_info_get_t rxq_info_get;
1518  eth_txq_info_get_t txq_info_get;
1521  eth_timesync_enable_t timesync_enable;
1523  eth_timesync_disable_t timesync_disable;
1525  eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1527  eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1528 
1530  eth_get_dcb_info get_dcb_info;
1532  eth_timesync_adjust_time timesync_adjust_time;
1534  eth_timesync_read_time timesync_read_time;
1536  eth_timesync_write_time timesync_write_time;
1538  eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
1540  eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
1541 };
1542 
1565 typedef uint16_t (*rte_rx_callback_fn)(uint8_t port, uint16_t queue,
1566  struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts,
1567  void *user_param);
1568 
1589 typedef uint16_t (*rte_tx_callback_fn)(uint8_t port, uint16_t queue,
1590  struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param);
1591 
1597 struct rte_eth_rxtx_callback {
1598  struct rte_eth_rxtx_callback *next;
1599  union{
1600  rte_rx_callback_fn rx;
1601  rte_tx_callback_fn tx;
1602  } fn;
1603  void *param;
1604 };
1605 
1616 struct rte_eth_dev {
1617  eth_rx_burst_t rx_pkt_burst;
1618  eth_tx_burst_t tx_pkt_burst;
1619  struct rte_eth_dev_data *data;
1620  const struct eth_driver *driver;
1621  const struct eth_dev_ops *dev_ops;
1622  struct rte_pci_device *pci_dev;
1624  struct rte_eth_dev_cb_list link_intr_cbs;
1629  struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1634  struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1635  uint8_t attached;
1637 
1638 struct rte_eth_dev_sriov {
1639  uint8_t active;
1640  uint8_t nb_q_per_pool;
1641  uint16_t def_vmdq_idx;
1642  uint16_t def_pool_q_idx;
1643 };
1644 #define RTE_ETH_DEV_SRIOV(dev) ((dev)->data->sriov)
1645 
1646 #define RTE_ETH_NAME_MAX_LEN (32)
1647 
1655 struct rte_eth_dev_data {
1656  char name[RTE_ETH_NAME_MAX_LEN];
1658  void **rx_queues;
1659  void **tx_queues;
1660  uint16_t nb_rx_queues;
1661  uint16_t nb_tx_queues;
1663  struct rte_eth_dev_sriov sriov;
1665  void *dev_private;
1667  struct rte_eth_link dev_link;
1670  struct rte_eth_conf dev_conf;
1671  uint16_t mtu;
1673  uint32_t min_rx_buf_size;
1676  uint64_t rx_mbuf_alloc_failed;
1677  struct ether_addr* mac_addrs;
1678  uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
1680  struct ether_addr* hash_mac_addrs;
1682  uint8_t port_id;
1683  __extension__
1684  uint8_t promiscuous : 1,
1685  scattered_rx : 1,
1686  all_multicast : 1,
1687  dev_started : 1,
1688  lro : 1;
1689  uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1691  uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1693  uint32_t dev_flags;
1694  enum rte_kernel_driver kdrv;
1695  int numa_node;
1696  const char *drv_name;
1697 };
1698 
1700 #define RTE_ETH_DEV_DETACHABLE 0x0001
1701 
1702 #define RTE_ETH_DEV_INTR_LSC 0x0002
1703 
1704 #define RTE_ETH_DEV_BONDED_SLAVE 0x0004
1705 
1711 extern struct rte_eth_dev rte_eth_devices[];
1712 
1726 uint8_t rte_eth_dev_count(void);
1727 
1737 struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
1738 
1749 struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
1750 
1760 int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
1761 
1774 int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
1775 
1788 int rte_eth_dev_detach(uint8_t port_id, char *devname);
1789 
1790 struct eth_driver;
1821 typedef int (*eth_dev_init_t)(struct rte_eth_dev *eth_dev);
1822 
1838 typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev);
1839 
1855 struct eth_driver {
1856  struct rte_pci_driver pci_drv;
1857  eth_dev_init_t eth_dev_init;
1858  eth_dev_uninit_t eth_dev_uninit;
1859  unsigned int dev_private_size;
1860 };
1861 
1873 uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex);
1874 
1904 int rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_queue,
1905  uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf);
1906 
1946 int rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
1947  uint16_t nb_rx_desc, unsigned int socket_id,
1948  const struct rte_eth_rxconf *rx_conf,
1949  struct rte_mempool *mb_pool);
1950 
1994 int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
1995  uint16_t nb_tx_desc, unsigned int socket_id,
1996  const struct rte_eth_txconf *tx_conf);
1997 
2008 int rte_eth_dev_socket_id(uint8_t port_id);
2009 
2019 int rte_eth_dev_is_valid_port(uint8_t port_id);
2020 
2036 int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
2037 
2052 int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
2053 
2069 int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);
2070 
2085 int rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id);
2086 
2087 
2088 
2104 int rte_eth_dev_start(uint8_t port_id);
2105 
2113 void rte_eth_dev_stop(uint8_t port_id);
2114 
2115 
2128 int rte_eth_dev_set_link_up(uint8_t port_id);
2129 
2139 int rte_eth_dev_set_link_down(uint8_t port_id);
2140 
2149 void rte_eth_dev_close(uint8_t port_id);
2150 
2157 void rte_eth_promiscuous_enable(uint8_t port_id);
2158 
2165 void rte_eth_promiscuous_disable(uint8_t port_id);
2166 
2177 int rte_eth_promiscuous_get(uint8_t port_id);
2178 
2185 void rte_eth_allmulticast_enable(uint8_t port_id);
2186 
2193 void rte_eth_allmulticast_disable(uint8_t port_id);
2194 
2205 int rte_eth_allmulticast_get(uint8_t port_id);
2206 
2218 void rte_eth_link_get(uint8_t port_id, struct rte_eth_link *link);
2219 
2231 void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);
2232 
2250 int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);
2251 
2258 void rte_eth_stats_reset(uint8_t port_id);
2259 
2279 int rte_eth_xstats_get_names(uint8_t port_id,
2280  struct rte_eth_xstat_name *xstats_names,
2281  unsigned size);
2282 
2304 int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
2305  unsigned n);
2306 
2313 void rte_eth_xstats_reset(uint8_t port_id);
2314 
2332 int rte_eth_dev_set_tx_queue_stats_mapping(uint8_t port_id,
2333  uint16_t tx_queue_id, uint8_t stat_idx);
2334 
2352 int rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id,
2353  uint16_t rx_queue_id,
2354  uint8_t stat_idx);
2355 
2365 void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr);
2366 
2376 void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);
2377 
2416 int rte_eth_dev_get_supported_ptypes(uint8_t port_id, uint32_t ptype_mask,
2417  uint32_t *ptypes, int num);
2418 
2430 int rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu);
2431 
2446 int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu);
2447 
2466 int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on);
2467 
2487 int rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id,
2488  int on);
2489 
2506 int rte_eth_dev_set_vlan_ether_type(uint8_t port_id,
2507  enum rte_vlan_type vlan_type,
2508  uint16_t tag_type);
2509 
2530 int rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask);
2531 
2544 int rte_eth_dev_get_vlan_offload(uint8_t port_id);
2545 
2560 int rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on);
2561 
2644 static inline uint16_t
2645 rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
2646  struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
2647 {
2648  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2649 
2650 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2651  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2652  RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
2653 
2654  if (queue_id >= dev->data->nb_rx_queues) {
2655  RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
2656  return 0;
2657  }
2658 #endif
2659  int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
2660  rx_pkts, nb_pkts);
2661 
2662 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2663  struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
2664 
2665  if (unlikely(cb != NULL)) {
2666  do {
2667  nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
2668  nb_pkts, cb->param);
2669  cb = cb->next;
2670  } while (cb != NULL);
2671  }
2672 #endif
2673 
2674  return nb_rx;
2675 }
2676 
2689 static inline int
2690 rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
2691 {
2692  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2693  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
2694  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
2695  return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
2696 }
2697 
2713 static inline int
2714 rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
2715 {
2716  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2717  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
2718  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
2719  return (*dev->dev_ops->rx_descriptor_done)( \
2720  dev->data->rx_queues[queue_id], offset);
2721 }
2722 
2782 static inline uint16_t
2783 rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
2784  struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
2785 {
2786  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2787 
2788 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2789  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2790  RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
2791 
2792  if (queue_id >= dev->data->nb_tx_queues) {
2793  RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
2794  return 0;
2795  }
2796 #endif
2797 
2798 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2799  struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id];
2800 
2801  if (unlikely(cb != NULL)) {
2802  do {
2803  nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
2804  cb->param);
2805  cb = cb->next;
2806  } while (cb != NULL);
2807  }
2808 #endif
2809 
2810  return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
2811 }
2812 
2813 typedef void (*buffer_tx_error_fn)(struct rte_mbuf **unsent, uint16_t count,
2814  void *userdata);
2815 
2821  buffer_tx_error_fn error_callback;
2822  void *error_userdata;
2823  uint16_t size;
2824  uint16_t length;
2825  struct rte_mbuf *pkts[];
2827 };
2828 
2835 #define RTE_ETH_TX_BUFFER_SIZE(sz) \
2836  (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *))
2837 
2848 int
2849 rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size);
2850 
2873 static inline uint16_t
2874 rte_eth_tx_buffer_flush(uint8_t port_id, uint16_t queue_id,
2875  struct rte_eth_dev_tx_buffer *buffer)
2876 {
2877  uint16_t sent;
2878  uint16_t to_send = buffer->length;
2879 
2880  if (to_send == 0)
2881  return 0;
2882 
2883  sent = rte_eth_tx_burst(port_id, queue_id, buffer->pkts, to_send);
2884 
2885  buffer->length = 0;
2886 
2887  /* All packets sent, or to be dealt with by callback below */
2888  if (unlikely(sent != to_send))
2889  buffer->error_callback(&buffer->pkts[sent], to_send - sent,
2890  buffer->error_userdata);
2891 
2892  return sent;
2893 }
2894 
2925 static inline uint16_t __attribute__((always_inline))
2926 rte_eth_tx_buffer(uint8_t port_id, uint16_t queue_id,
2927  struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
2928 {
2929  buffer->pkts[buffer->length++] = tx_pkt;
2930  if (buffer->length < buffer->size)
2931  return 0;
2932 
2933  return rte_eth_tx_buffer_flush(port_id, queue_id, buffer);
2934 }
2935 
2960 int
2962  buffer_tx_error_fn callback, void *userdata);
2963 
2986 void
2987 rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent,
2988  void *userdata);
2989 
3013 void
3014 rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent,
3015  void *userdata);
3016 
3029 };
3030 
3031 typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
3032  enum rte_eth_event_type event, void *cb_arg);
3058 int rte_eth_dev_callback_register(uint8_t port_id,
3059  enum rte_eth_event_type event,
3060  rte_eth_dev_cb_fn cb_fn, void *cb_arg);
3061 
3079 int rte_eth_dev_callback_unregister(uint8_t port_id,
3080  enum rte_eth_event_type event,
3081  rte_eth_dev_cb_fn cb_fn, void *cb_arg);
3082 
3100 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
3101  enum rte_eth_event_type event, void *cb_arg);
3102 
3123 int rte_eth_dev_rx_intr_enable(uint8_t port_id, uint16_t queue_id);
3124 
3144 int rte_eth_dev_rx_intr_disable(uint8_t port_id, uint16_t queue_id);
3145 
3163 int rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data);
3164 
3186 int rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
3187  int epfd, int op, void *data);
3188 
3201 int rte_eth_led_on(uint8_t port_id);
3202 
3215 int rte_eth_led_off(uint8_t port_id);
3216 
3229 int rte_eth_dev_flow_ctrl_get(uint8_t port_id,
3230  struct rte_eth_fc_conf *fc_conf);
3231 
3246 int rte_eth_dev_flow_ctrl_set(uint8_t port_id,
3247  struct rte_eth_fc_conf *fc_conf);
3248 
3264 int rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id,
3265  struct rte_eth_pfc_conf *pfc_conf);
3266 
3285 int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
3286  uint32_t pool);
3287 
3301 int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr);
3302 
3316 int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr *mac_addr);
3317 
3318 
3334 int rte_eth_dev_rss_reta_update(uint8_t port,
3335  struct rte_eth_rss_reta_entry64 *reta_conf,
3336  uint16_t reta_size);
3337 
3353 int rte_eth_dev_rss_reta_query(uint8_t port,
3354  struct rte_eth_rss_reta_entry64 *reta_conf,
3355  uint16_t reta_size);
3356 
3375 int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr,
3376  uint8_t on);
3377 
3395 int rte_eth_dev_uc_all_hash_table_set(uint8_t port,uint8_t on);
3396 
3419 int rte_eth_dev_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mode,
3420  uint8_t on);
3421 
3438 int
3439 rte_eth_dev_set_vf_tx(uint8_t port,uint16_t vf, uint8_t on);
3440 
3457 int
3458 rte_eth_dev_set_vf_rx(uint8_t port,uint16_t vf, uint8_t on);
3459 
3479 int
3480 rte_eth_dev_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
3481  uint64_t vf_mask,
3482  uint8_t vlan_on);
3483 
3505 int rte_eth_mirror_rule_set(uint8_t port_id,
3506  struct rte_eth_mirror_conf *mirror_conf,
3507  uint8_t rule_id,
3508  uint8_t on);
3509 
3523 int rte_eth_mirror_rule_reset(uint8_t port_id,
3524  uint8_t rule_id);
3525 
3541 int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
3542  uint16_t tx_rate);
3543 
3561 int rte_eth_set_vf_rate_limit(uint8_t port_id, uint16_t vf,
3562  uint16_t tx_rate, uint64_t q_msk);
3563 
3575 int rte_eth_dev_bypass_init(uint8_t port);
3576 
3592 int rte_eth_dev_bypass_state_show(uint8_t port, uint32_t *state);
3593 
3609 int rte_eth_dev_bypass_state_set(uint8_t port, uint32_t *new_state);
3610 
3633 int rte_eth_dev_bypass_event_show(uint8_t port, uint32_t event, uint32_t *state);
3634 
3657 int rte_eth_dev_bypass_event_store(uint8_t port, uint32_t event, uint32_t state);
3658 
3679 int rte_eth_dev_wd_timeout_store(uint8_t port, uint32_t timeout);
3680 
3693 int rte_eth_dev_bypass_ver_show(uint8_t port, uint32_t *ver);
3694 
3715 int rte_eth_dev_bypass_wd_timeout_show(uint8_t port, uint32_t *wd_timeout);
3716 
3727 int rte_eth_dev_bypass_wd_reset(uint8_t port);
3728 
3742 int rte_eth_dev_rss_hash_update(uint8_t port_id,
3743  struct rte_eth_rss_conf *rss_conf);
3744 
3758 int
3759 rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
3760  struct rte_eth_rss_conf *rss_conf);
3761 
3779 int
3780 rte_eth_dev_udp_tunnel_port_add(uint8_t port_id,
3781  struct rte_eth_udp_tunnel *tunnel_udp);
3782 
3801 int
3802 rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id,
3803  struct rte_eth_udp_tunnel *tunnel_udp);
3804 
3818 int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type);
3819 
3838 int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
3839  enum rte_filter_op filter_op, void *arg);
3840 
3853 int rte_eth_dev_get_dcb_info(uint8_t port_id,
3854  struct rte_eth_dcb_info *dcb_info);
3855 
3880 void *rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
3881  rte_rx_callback_fn fn, void *user_param);
3882 
3883 /*
3884 * Add a callback that must be called first on packet RX on a given port
3885 * and queue.
3886 *
3887 * This API configures a first function to be called for each burst of
3888 * packets received on a given NIC port queue. The return value is a pointer
3889 * that can be used to later remove the callback using
3890 * rte_eth_remove_rx_callback().
3891 *
3892 * Multiple functions are called in the order that they are added.
3893 *
3894 * @param port_id
3895 * The port identifier of the Ethernet device.
3896 * @param queue_id
3897 * The queue on the Ethernet device on which the callback is to be added.
3898 * @param fn
3899 * The callback function
3900 * @param user_param
3901 * A generic pointer parameter which will be passed to each invocation of the
3902 * callback function on this port and queue.
3903 *
3904 * @return
3905 * NULL on error.
3906 * On success, a pointer value which can later be used to remove the callback.
3907 */
3908 void *rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id,
3909  rte_rx_callback_fn fn, void *user_param);
3910 
3935 void *rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
3936  rte_tx_callback_fn fn, void *user_param);
3937 
3968 int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
3969  struct rte_eth_rxtx_callback *user_cb);
3970 
4001 int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
4002  struct rte_eth_rxtx_callback *user_cb);
4003 
4021 int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
4022  struct rte_eth_rxq_info *qinfo);
4023 
4041 int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
4042  struct rte_eth_txq_info *qinfo);
4043 
4060 int rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info);
4061 
4073 int rte_eth_dev_get_eeprom_length(uint8_t port_id);
4074 
4089 int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
4090 
4105 int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
4106 
4124 int rte_eth_dev_set_mc_addr_list(uint8_t port_id,
4125  struct ether_addr *mc_addr_set,
4126  uint32_t nb_mc_addr);
4127 
4139 int rte_eth_timesync_enable(uint8_t port_id);
4140 
4152 int rte_eth_timesync_disable(uint8_t port_id);
4153 
4171 int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
4172  struct timespec *timestamp, uint32_t flags);
4173 
4188 int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
4189  struct timespec *timestamp);
4190 
4207 int rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta);
4208 
4223 int rte_eth_timesync_read_time(uint8_t port_id, struct timespec *time);
4224 
4242 int rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *time);
4243 
4255 void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
4256  struct rte_pci_device *pci_dev);
4257 
4277 const struct rte_memzone *
4278 rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
4279  uint16_t queue_id, size_t size,
4280  unsigned align, int socket_id);
4281 
4296 int
4297 rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
4298  struct rte_eth_l2_tunnel_conf *l2_tunnel);
4299 
4323 int
4324 rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
4325  struct rte_eth_l2_tunnel_conf *l2_tunnel,
4326  uint32_t mask,
4327  uint8_t en);
4328 
4341 int
4342 rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
4343 
4355 int
4356 rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
4357 
4363 int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
4364  struct rte_pci_device *pci_dev);
4365 
4371 int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
4372 
4373 #ifdef __cplusplus
4374 }
4375 #endif
4376 
4377 #endif /* _RTE_ETHDEV_H_ */
int rte_eth_dev_get_vlan_offload(uint8_t port_id)
uint16_t nb_rx_queues
Definition: rte_ethdev.h:911
struct rte_eth_vmdq_dcb_tx_conf vmdq_dcb_tx_conf
Definition: rte_ethdev.h:830
int rte_eth_dev_bypass_state_show(uint8_t port, uint32_t *state)
int rte_eth_dev_set_vlan_ether_type(uint8_t port_id, enum rte_vlan_type vlan_type, uint16_t tag_type)
int rte_eth_dev_udp_tunnel_port_add(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp)
uint32_t txq_flags
Definition: rte_ethdev.h:694
uint8_t tc_bws[ETH_DCB_NUM_TCS]
Definition: rte_ethdev.h:987
#define ETH_VMDQ_MAX_VLAN_FILTERS
Definition: rte_ethdev.h:490
int rte_eth_dev_flow_ctrl_get(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
struct rte_fdir_conf fdir_conf
Definition: rte_ethdev.h:840
uint16_t tx_rs_thresh
Definition: rte_ethdev.h:690
int rte_eth_dev_bypass_event_show(uint8_t port, uint32_t event, uint32_t *state)
int rte_eth_dev_bypass_ver_show(uint8_t port, uint32_t *ver)
int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
uint16_t nb_desc
Definition: rte_ethdev.h:932
int rte_eth_timesync_read_tx_timestamp(uint8_t port_id, struct timespec *timestamp)
void rte_eth_stats_reset(uint8_t port_id)
uint16_t reta[RTE_RETA_GROUP_SIZE]
Definition: rte_ethdev.h:561
int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type)
void rte_eth_allmulticast_disable(uint8_t port_id)
void(* rte_eth_dev_cb_fn)(uint8_t port_id, enum rte_eth_event_type event, void *cb_arg)
Definition: rte_ethdev.h:3031
int rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
int rte_eth_dev_attach(const char *devargs, uint8_t *port_id)
rte_eth_nb_tcs
Definition: rte_ethdev.h:569
struct rte_eth_vmdq_tx_conf vmdq_tx_conf
Definition: rte_ethdev.h:834
uint8_t port
Definition: rte_mbuf.h:395
uint64_t q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:217
int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id, struct rte_eth_rxtx_callback *user_cb)
int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg)
struct rte_eth_thresh rx_thresh
Definition: rte_ethdev.h:666
rte_fdir_pballoc_type
Definition: rte_ethdev.h:746
int rte_eth_dev_bypass_event_store(uint8_t port, uint32_t event, uint32_t state)
int rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_queue, uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf)
uint64_t imissed
Definition: rte_ethdev.h:202
uint32_t low_water
Definition: rte_ethdev.h:724
int rte_eth_dev_callback_unregister(uint8_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg)
int rte_eth_dev_bypass_state_set(uint8_t port, uint32_t *new_state)
uint32_t max_rx_pkt_len
Definition: rte_ethdev.h:351
void
Definition: rte_common.h:413
int rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on)
uint8_t rss_key_len
Definition: rte_ethdev.h:395
int rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc_conf)
uint8_t hthresh
Definition: rte_ethdev.h:283
int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id, struct rte_eth_rxq_info *qinfo)
void rte_eth_dev_stop(uint8_t port_id)
uint16_t reta_size
Definition: rte_ethdev.h:897
void * userdata
Definition: rte_mbuf.h:461
uint32_t lpbk_mode
Definition: rte_ethdev.h:815
int rte_eth_dev_rss_reta_update(uint8_t port, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)
void rte_eth_xstats_reset(uint8_t port_id)
enum rte_fdir_status_mode status
Definition: rte_ethdev.h:770
void rte_eth_promiscuous_disable(uint8_t port_id)
enum rte_eth_tx_mq_mode mq_mode
Definition: rte_ethdev.h:649
int rte_eth_dev_start(uint8_t port_id)
uint32_t link_speeds
Definition: rte_ethdev.h:806
rte_eth_tx_mq_mode
Definition: rte_ethdev.h:331
rte_eth_fc_mode
Definition: rte_ethdev.h:710
uint8_t enable_default_pool
Definition: rte_ethdev.h:621
int rte_eth_dev_rss_hash_conf_get(uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
int rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *time)
int rte_eth_mirror_rule_set(uint8_t port_id, struct rte_eth_mirror_conf *mirror_conf, uint8_t rule_id, uint8_t on)
int rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id)
uint64_t q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:215
int rte_eth_dev_rx_intr_enable(uint8_t port_id, uint16_t queue_id)
int rte_eth_allmulticast_get(uint8_t port_id)
uint64_t opackets
Definition: rte_ethdev.h:199
rte_filter_op
Definition: rte_eth_ctrl.h:108
struct rte_eth_rss_conf rss_conf
Definition: rte_ethdev.h:821
uint8_t hash_key_size
Definition: rte_ethdev.h:899
int rte_eth_timesync_read_time(uint8_t port_id, struct timespec *time)
int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id)
uint16_t split_hdr_size
Definition: rte_ethdev.h:352
static int rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
Definition: rte_ethdev.h:2690
struct rte_mempool * mp
Definition: rte_ethdev.h:920
uint32_t dcb_capability_en
Definition: rte_ethdev.h:839
__extension__ uint16_t hw_strip_crc
Definition: rte_ethdev.h:354
#define ETH_NUM_RECEIVE_MAC_ADDR
Definition: rte_ethdev.h:511
uint64_t q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:213
__extension__ uint16_t enable_scatter
Definition: rte_ethdev.h:354
void * rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id, rte_tx_callback_fn fn, void *user_param)
int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu)
int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on)
int rte_eth_dev_get_dcb_info(uint8_t port_id, struct rte_eth_dcb_info *dcb_info)
__extension__ uint16_t header_split
Definition: rte_ethdev.h:354
uint32_t rx_offload_capa
Definition: rte_ethdev.h:895
int rte_eth_set_vf_rate_limit(uint8_t port_id, uint16_t vf, uint16_t tx_rate, uint64_t q_msk)
int rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
union rte_eth_conf::@48 tx_adv_conf
struct rte_eth_thresh tx_thresh
Definition: rte_ethdev.h:689
int rte_eth_dev_get_supported_ptypes(uint8_t port_id, uint32_t ptype_mask, uint32_t *ptypes, int num)
uint8_t dcb_tc[ETH_DCB_NUM_USER_PRIORITIES]
Definition: rte_ethdev.h:628
int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats, unsigned n)
int rte_eth_promiscuous_get(uint8_t port_id)
uint16_t vmdq_queue_num
Definition: rte_ethdev.h:905
int rte_eth_dev_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mode, uint8_t on)
uint8_t rx_deferred_start
Definition: rte_ethdev.h:669
void rte_eth_promiscuous_enable(uint8_t port_id)
struct rte_mbuf * pkts[]
Definition: rte_ethdev.h:2825
struct rte_eth_rxmode rxmode
Definition: rte_ethdev.h:813
uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS]
Definition: rte_ethdev.h:209
uint32_t high_water
Definition: rte_ethdev.h:723
uint16_t lsc
Definition: rte_ethdev.h:795
enum rte_eth_nb_pools nb_queue_pools
Definition: rte_ethdev.h:620
struct rte_eth_vmdq_dcb_conf::@45 pool_map[ETH_VMDQ_MAX_VLAN_FILTERS]
struct rte_eth_txconf conf
Definition: rte_ethdev.h:931
uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex)
struct rte_intr_conf intr_conf
Definition: rte_ethdev.h:841
int rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu)
#define RTE_ETH_XSTATS_NAME_SIZE
Definition: rte_ethdev.h:936
int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
int rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta)
void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
int rte_eth_timesync_disable(uint8_t port_id)
__extension__ uint16_t hw_vlan_strip
Definition: rte_ethdev.h:354
uint16_t send_xon
Definition: rte_ethdev.h:726
struct rte_pci_device * pci_dev
Definition: rte_ethdev.h:882
int rte_eth_dev_bypass_wd_timeout_show(uint8_t port, uint32_t *wd_timeout)
#define unlikely(x)
uint16_t nb_max
Definition: rte_ethdev.h:702
uint64_t ibytes
Definition: rte_ethdev.h:200
__extension__ uint16_t hw_vlan_filter
Definition: rte_ethdev.h:354
uint64_t oerrors
Definition: rte_ethdev.h:207
void rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent, void *userdata)
struct rte_eth_dcb_rx_conf dcb_rx_conf
Definition: rte_ethdev.h:824
struct rte_eth_dcb_tc_queue_mapping::@50 tc_txq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS]
int rte_eth_timesync_read_rx_timestamp(uint8_t port_id, struct timespec *timestamp, uint32_t flags)
struct rte_eth_vmdq_rx_conf vmdq_rx_conf
Definition: rte_ethdev.h:826
int rte_eth_xstats_get_names(uint8_t port_id, struct rte_eth_xstat_name *xstats_names, unsigned size)
enum rte_eth_rx_mq_mode mq_mode
Definition: rte_ethdev.h:350
void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link)
uint16_t tx_free_thresh
Definition: rte_ethdev.h:691
int rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
uint16_t nb_desc
Definition: rte_ethdev.h:923
void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr, uint32_t pool)
uint16_t max_vmdq_pools
Definition: rte_ethdev.h:894
int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id, struct rte_eth_txq_info *qinfo)
uint8_t scattered_rx
Definition: rte_ethdev.h:922
int rte_eth_dev_set_link_down(uint8_t port_id)
int rte_eth_dev_socket_id(uint8_t port_id)
struct rte_eth_dcb_tx_conf dcb_tx_conf
Definition: rte_ethdev.h:832
uint16_t vmdq_pool_base
Definition: rte_ethdev.h:906
uint32_t tx_offload_capa
Definition: rte_ethdev.h:896
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:211
int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
int rte_eth_dev_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on)
int rte_eth_led_off(uint8_t port_id)
int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id)
int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr)
int rte_eth_dev_is_valid_port(uint8_t port_id)
uint64_t obytes
Definition: rte_ethdev.h:201
int rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id, struct rte_eth_l2_tunnel_conf *l2_tunnel, uint32_t mask, uint8_t en)
int rte_eth_dev_bypass_init(uint8_t port)
int rte_eth_dev_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on)
void rte_eth_link_get(uint8_t port_id, struct rte_eth_link *link)
struct rte_eth_rxconf conf
Definition: rte_ethdev.h:921
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)
int rte_eth_rx_queue_setup(uint8_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)
__extension__ uint16_t enable_lro
Definition: rte_ethdev.h:354
#define ETH_DCB_NUM_USER_PRIORITIES
Definition: rte_ethdev.h:491
uint16_t max_tx_queues
Definition: rte_ethdev.h:889
int rte_eth_dev_uc_all_hash_table_set(uint8_t port, uint8_t on)
uint16_t rx_free_thresh
Definition: rte_ethdev.h:667
struct rte_eth_vlan_mirror vlan
Definition: rte_ethdev.h:549
int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id)
__extension__ uint16_t jumbo_frame
Definition: rte_ethdev.h:354
int rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id, uint16_t rx_queue_id, uint8_t stat_idx)
uint64_t ierrors
Definition: rte_ethdev.h:206
struct rte_eth_conf::@47 rx_adv_conf
int rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp)
static uint16_t rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
Definition: rte_ethdev.h:2783
uint8_t rte_eth_dev_count(void)
__extension__ uint8_t hw_vlan_insert_pvid
Definition: rte_ethdev.h:655
uint8_t priority
Definition: rte_ethdev.h:739
uint64_t flow_type_rss_offloads
Definition: rte_ethdev.h:901
TAILQ_HEAD(rte_driver_list, rte_driver)
static uint16_t rte_eth_tx_buffer(uint8_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
Definition: rte_ethdev.h:2926
int rte_eth_dev_wd_timeout_store(uint8_t port, uint32_t timeout)
int rte_eth_dev_flow_ctrl_set(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
int rte_eth_timesync_enable(uint8_t port_id)
rte_vlan_type
Definition: rte_ethdev.h:369
int rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id, int epfd, int op, void *data)
uint8_t prio_tc[ETH_DCB_NUM_USER_PRIORITIES]
Definition: rte_ethdev.h:986
uint64_t ipackets
Definition: rte_ethdev.h:198
uint16_t max_vfs
Definition: rte_ethdev.h:893
uint16_t pause_time
Definition: rte_ethdev.h:725
struct rte_eth_dcb_tc_queue_mapping tc_queue
Definition: rte_ethdev.h:989
rte_filter_type
Definition: rte_eth_ctrl.h:91
uint64_t rx_nombuf
Definition: rte_ethdev.h:208
int rte_eth_dev_set_link_up(uint8_t port_id)
__extension__ uint8_t hw_vlan_reject_untagged
Definition: rte_ethdev.h:655
struct rte_mempool * pool
Definition: rte_mbuf.h:465
int32_t socket_id
Definition: rte_memzone.h:91
uint16_t(* rte_rx_callback_fn)(uint8_t port, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts, void *user_param)
Definition: rte_ethdev.h:1565
int rte_eth_dev_detach(uint8_t port_id, char *devname)
#define __rte_cache_min_aligned
Definition: rte_memory.h:101
__extension__ uint16_t hw_ip_checksum
Definition: rte_ethdev.h:354
#define ETH_MQ_RX_RSS_FLAG
Definition: rte_ethdev.h:290
struct rte_eth_dcb_tc_queue_mapping::@49 tc_rxq[ETH_MAX_VMDQ_POOL][ETH_DCB_NUM_TCS]
uint16_t vmdq_queue_base
Definition: rte_ethdev.h:904
int rte_eth_dev_set_mc_addr_list(uint8_t port_id, struct ether_addr *mc_addr_set, uint32_t nb_mc_addr)
int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id, struct rte_eth_rxtx_callback *user_cb)
rte_eth_nb_pools
Definition: rte_ethdev.h:578
static uint16_t rte_eth_tx_buffer_flush(uint8_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer)
Definition: rte_ethdev.h:2874
int rte_eth_led_on(uint8_t port_id)
#define ETH_MIRROR_MAX_VLANS
Definition: rte_ethdev.h:524
uint16_t nb_align
Definition: rte_ethdev.h:704
int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx, uint16_t tx_rate)
__extension__ uint16_t hw_vlan_extend
Definition: rte_ethdev.h:354
rte_eth_rx_mq_mode
Definition: rte_ethdev.h:298
int rte_eth_dev_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id, uint64_t vf_mask, uint8_t vlan_on)
const char * driver_name
Definition: rte_ethdev.h:883
uint16_t nb_tx_queues
Definition: rte_ethdev.h:912
#define __rte_cache_aligned
Definition: rte_memory.h:96
struct rte_eth_fdir_flex_conf flex_conf
Definition: rte_ethdev.h:774
static int rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
Definition: rte_ethdev.h:2714
void rte_eth_allmulticast_enable(uint8_t port_id)
uint16_t(* rte_tx_callback_fn)(uint8_t port, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param)
Definition: rte_ethdev.h:1589
void rte_eth_dev_close(uint8_t port_id)
int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf)
int rte_eth_dev_rss_reta_query(uint8_t port, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)
uint32_t max_mac_addrs
Definition: rte_ethdev.h:890
int rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id, int on)
enum rte_fdir_pballoc_type pballoc
Definition: rte_ethdev.h:769
uint32_t max_rx_pktlen
Definition: rte_ethdev.h:887
char name[RTE_MEMZONE_NAMESIZE]
Definition: rte_memzone.h:79
uint64_t rss_hf
Definition: rte_ethdev.h:396
__extension__ uint8_t hw_vlan_reject_tagged
Definition: rte_ethdev.h:655
enum rte_fdir_mode mode
Definition: rte_ethdev.h:768
int rte_eth_dev_uc_hash_table_set(uint8_t port, struct ether_addr *addr, uint8_t on)
unsigned int if_index
Definition: rte_ethdev.h:884
static uint16_t rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id, struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
Definition: rte_ethdev.h:2645
int rte_eth_dev_rx_intr_disable(uint8_t port_id, uint16_t queue_id)
int rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id)
uint8_t mac_ctrl_frame_fwd
Definition: rte_ethdev.h:728
uint16_t rxq
Definition: rte_ethdev.h:797
int rte_eth_dev_get_eeprom_length(uint8_t port_id)
enum rte_eth_fc_mode mode
Definition: rte_ethdev.h:727
rte_fdir_mode
Definition: rte_eth_ctrl.h:685
struct rte_eth_vmdq_dcb_conf vmdq_dcb_conf
Definition: rte_ethdev.h:822
uint8_t * rss_key
Definition: rte_ethdev.h:394
rte_fdir_status_mode
Definition: rte_ethdev.h:755
uint8_t tx_deferred_start
Definition: rte_ethdev.h:695
uint8_t wthresh
Definition: rte_ethdev.h:284
int rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
uint16_t max_rx_queues
Definition: rte_ethdev.h:888
int rte_eth_dev_bypass_wd_reset(uint8_t port)
int rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size)
struct rte_eth_fc_conf fc
Definition: rte_ethdev.h:738
struct rte_eth_txmode txmode
Definition: rte_ethdev.h:814
uint8_t rx_drop_en
Definition: rte_ethdev.h:668
void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr)
int rte_eth_dev_set_tx_queue_stats_mapping(uint8_t port_id, uint16_t tx_queue_id, uint8_t stat_idx)
uint16_t nb_min
Definition: rte_ethdev.h:703
int rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
uint8_t pthresh
Definition: rte_ethdev.h:282
int rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
int rte_eth_dev_callback_register(uint8_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg)
uint32_t speed_capa
Definition: rte_ethdev.h:909
int rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id, struct rte_eth_l2_tunnel_conf *l2_tunnel)
void * rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param)
uint8_t drop_queue
Definition: rte_ethdev.h:772
uint8_t autoneg
Definition: rte_ethdev.h:729
uint32_t min_rx_bufsize
Definition: rte_ethdev.h:886
int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr *mac_addr)
rte_eth_event_type
Definition: rte_ethdev.h:3020