DPDK  /usr/bin/make-f/build/dpdk-16.11/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 
1005 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
1006 #define RTE_PMD_DEBUG_TRACE(...) \
1007  rte_pmd_debug_trace(__func__, __VA_ARGS__)
1008 #else
1009 #define RTE_PMD_DEBUG_TRACE(...)
1010 #endif
1011 
1012 
1013 /* Macros to check for valid port */
1014 #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
1015  if (!rte_eth_dev_is_valid_port(port_id)) { \
1016  RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
1017  return retval; \
1018  } \
1019 } while (0)
1020 
1021 #define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
1022  if (!rte_eth_dev_is_valid_port(port_id)) { \
1023  RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
1024  return; \
1025  } \
1026 } while (0)
1027 
1033 #define ETH_L2_TUNNEL_ENABLE_MASK 0x00000001
1034 
1035 #define ETH_L2_TUNNEL_INSERTION_MASK 0x00000002
1036 
1037 #define ETH_L2_TUNNEL_STRIPPING_MASK 0x00000004
1038 
1039 #define ETH_L2_TUNNEL_FORWARDING_MASK 0x00000008
1040 
1041 /*
1042  * Definitions of all functions exported by an Ethernet driver through the
1043  * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
1044  * structure associated with an Ethernet device.
1045  */
1046 
1047 typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
1050 typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
1053 typedef void (*eth_dev_stop_t)(struct rte_eth_dev *dev);
1056 typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
1059 typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
1062 typedef void (*eth_dev_close_t)(struct rte_eth_dev *dev);
1065 typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
1068 typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
1071 typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
1074 typedef void (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
1077 typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
1078  int wait_to_complete);
1081 typedef void (*eth_stats_get_t)(struct rte_eth_dev *dev,
1082  struct rte_eth_stats *igb_stats);
1085 typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
1088 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
1089  struct rte_eth_xstat *stats, unsigned n);
1092 typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
1095 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
1096  struct rte_eth_xstat_name *xstats_names, unsigned size);
1099 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
1100  uint16_t queue_id,
1101  uint8_t stat_idx,
1102  uint8_t is_rx);
1105 typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
1106  struct rte_eth_dev_info *dev_info);
1109 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
1112 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
1113  uint16_t queue_id);
1116 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
1117  uint16_t queue_id);
1120 typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
1121  uint16_t rx_queue_id,
1122  uint16_t nb_rx_desc,
1123  unsigned int socket_id,
1124  const struct rte_eth_rxconf *rx_conf,
1125  struct rte_mempool *mb_pool);
1128 typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
1129  uint16_t tx_queue_id,
1130  uint16_t nb_tx_desc,
1131  unsigned int socket_id,
1132  const struct rte_eth_txconf *tx_conf);
1135 typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
1136  uint16_t rx_queue_id);
1139 typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
1140  uint16_t rx_queue_id);
1143 typedef void (*eth_queue_release_t)(void *queue);
1146 typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
1147  uint16_t rx_queue_id);
1150 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
1153 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
1154  uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
1155 
1156 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
1157  uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
1158 
1159 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
1162 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
1163  uint16_t vlan_id,
1164  int on);
1167 typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
1168  enum rte_vlan_type type, uint16_t tpid);
1171 typedef void (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
1174 typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
1175  uint16_t vlan_id,
1176  int on);
1179 typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
1180  uint16_t rx_queue_id,
1181  int on);
1184 typedef uint16_t (*eth_rx_burst_t)(void *rxq,
1185  struct rte_mbuf **rx_pkts,
1186  uint16_t nb_pkts);
1189 typedef uint16_t (*eth_tx_burst_t)(void *txq,
1190  struct rte_mbuf **tx_pkts,
1191  uint16_t nb_pkts);
1194 typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
1195  struct rte_eth_fc_conf *fc_conf);
1198 typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
1199  struct rte_eth_fc_conf *fc_conf);
1202 typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
1203  struct rte_eth_pfc_conf *pfc_conf);
1206 typedef int (*reta_update_t)(struct rte_eth_dev *dev,
1207  struct rte_eth_rss_reta_entry64 *reta_conf,
1208  uint16_t reta_size);
1211 typedef int (*reta_query_t)(struct rte_eth_dev *dev,
1212  struct rte_eth_rss_reta_entry64 *reta_conf,
1213  uint16_t reta_size);
1216 typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
1217  struct rte_eth_rss_conf *rss_conf);
1220 typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
1221  struct rte_eth_rss_conf *rss_conf);
1224 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
1227 typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
1230 typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
1233 typedef void (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
1234  struct ether_addr *mac_addr,
1235  uint32_t index,
1236  uint32_t vmdq);
1239 typedef void (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
1240  struct ether_addr *mac_addr);
1243 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
1244  struct ether_addr *mac_addr,
1245  uint8_t on);
1248 typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
1249  uint8_t on);
1252 typedef int (*eth_set_vf_rx_mode_t)(struct rte_eth_dev *dev,
1253  uint16_t vf,
1254  uint16_t rx_mode,
1255  uint8_t on);
1258 typedef int (*eth_set_vf_rx_t)(struct rte_eth_dev *dev,
1259  uint16_t vf,
1260  uint8_t on);
1263 typedef int (*eth_set_vf_tx_t)(struct rte_eth_dev *dev,
1264  uint16_t vf,
1265  uint8_t on);
1268 typedef int (*eth_set_vf_vlan_filter_t)(struct rte_eth_dev *dev,
1269  uint16_t vlan,
1270  uint64_t vf_mask,
1271  uint8_t vlan_on);
1274 typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
1275  uint16_t queue_idx,
1276  uint16_t tx_rate);
1279 typedef int (*eth_set_vf_rate_limit_t)(struct rte_eth_dev *dev,
1280  uint16_t vf,
1281  uint16_t tx_rate,
1282  uint64_t q_msk);
1285 typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,
1286  struct rte_eth_mirror_conf *mirror_conf,
1287  uint8_t rule_id,
1288  uint8_t on);
1291 typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,
1292  uint8_t rule_id);
1295 typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
1296  struct rte_eth_udp_tunnel *tunnel_udp);
1299 typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
1300  struct rte_eth_udp_tunnel *tunnel_udp);
1303 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
1304  struct ether_addr *mc_addr_set,
1305  uint32_t nb_mc_addr);
1308 typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
1311 typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
1314 typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
1315  struct timespec *timestamp,
1316  uint32_t flags);
1319 typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
1320  struct timespec *timestamp);
1323 typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
1326 typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
1327  struct timespec *timestamp);
1330 typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
1331  const struct timespec *timestamp);
1334 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
1335  struct rte_dev_reg_info *info);
1338 typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
1341 typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
1342  struct rte_dev_eeprom_info *info);
1345 typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
1346  struct rte_dev_eeprom_info *info);
1349 typedef int (*eth_l2_tunnel_eth_type_conf_t)
1350  (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
1353 typedef int (*eth_l2_tunnel_offload_set_t)
1354  (struct rte_eth_dev *dev,
1355  struct rte_eth_l2_tunnel_conf *l2_tunnel,
1356  uint32_t mask,
1357  uint8_t en);
1360 #ifdef RTE_NIC_BYPASS
1361 
1362 enum {
1363  RTE_BYPASS_MODE_NONE,
1364  RTE_BYPASS_MODE_NORMAL,
1365  RTE_BYPASS_MODE_BYPASS,
1366  RTE_BYPASS_MODE_ISOLATE,
1367  RTE_BYPASS_MODE_NUM,
1368 };
1369 
1370 #define RTE_BYPASS_MODE_VALID(x) \
1371  ((x) > RTE_BYPASS_MODE_NONE && (x) < RTE_BYPASS_MODE_NUM)
1372 
1373 enum {
1374  RTE_BYPASS_EVENT_NONE,
1375  RTE_BYPASS_EVENT_START,
1376  RTE_BYPASS_EVENT_OS_ON = RTE_BYPASS_EVENT_START,
1377  RTE_BYPASS_EVENT_POWER_ON,
1378  RTE_BYPASS_EVENT_OS_OFF,
1379  RTE_BYPASS_EVENT_POWER_OFF,
1380  RTE_BYPASS_EVENT_TIMEOUT,
1381  RTE_BYPASS_EVENT_NUM
1382 };
1383 
1384 #define RTE_BYPASS_EVENT_VALID(x) \
1385  ((x) > RTE_BYPASS_EVENT_NONE && (x) < RTE_BYPASS_MODE_NUM)
1386 
1387 enum {
1388  RTE_BYPASS_TMT_OFF, /* timeout disabled. */
1389  RTE_BYPASS_TMT_1_5_SEC, /* timeout for 1.5 seconds */
1390  RTE_BYPASS_TMT_2_SEC, /* timeout for 2 seconds */
1391  RTE_BYPASS_TMT_3_SEC, /* timeout for 3 seconds */
1392  RTE_BYPASS_TMT_4_SEC, /* timeout for 4 seconds */
1393  RTE_BYPASS_TMT_8_SEC, /* timeout for 8 seconds */
1394  RTE_BYPASS_TMT_16_SEC, /* timeout for 16 seconds */
1395  RTE_BYPASS_TMT_32_SEC, /* timeout for 32 seconds */
1396  RTE_BYPASS_TMT_NUM
1397 };
1398 
1399 #define RTE_BYPASS_TMT_VALID(x) \
1400  ((x) == RTE_BYPASS_TMT_OFF || \
1401  ((x) > RTE_BYPASS_TMT_OFF && (x) < RTE_BYPASS_TMT_NUM))
1402 
1403 typedef void (*bypass_init_t)(struct rte_eth_dev *dev);
1404 typedef int32_t (*bypass_state_set_t)(struct rte_eth_dev *dev, uint32_t *new_state);
1405 typedef int32_t (*bypass_state_show_t)(struct rte_eth_dev *dev, uint32_t *state);
1406 typedef int32_t (*bypass_event_set_t)(struct rte_eth_dev *dev, uint32_t state, uint32_t event);
1407 typedef int32_t (*bypass_event_show_t)(struct rte_eth_dev *dev, uint32_t event_shift, uint32_t *event);
1408 typedef int32_t (*bypass_wd_timeout_set_t)(struct rte_eth_dev *dev, uint32_t timeout);
1409 typedef int32_t (*bypass_wd_timeout_show_t)(struct rte_eth_dev *dev, uint32_t *wd_timeout);
1410 typedef int32_t (*bypass_ver_show_t)(struct rte_eth_dev *dev, uint32_t *ver);
1411 typedef int32_t (*bypass_wd_reset_t)(struct rte_eth_dev *dev);
1412 #endif
1413 
1414 typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
1415  enum rte_filter_type filter_type,
1416  enum rte_filter_op filter_op,
1417  void *arg);
1420 typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
1421  struct rte_eth_dcb_info *dcb_info);
1427 struct eth_dev_ops {
1428  eth_dev_configure_t dev_configure;
1429  eth_dev_start_t dev_start;
1430  eth_dev_stop_t dev_stop;
1431  eth_dev_set_link_up_t dev_set_link_up;
1432  eth_dev_set_link_down_t dev_set_link_down;
1433  eth_dev_close_t dev_close;
1434  eth_promiscuous_enable_t promiscuous_enable;
1435  eth_promiscuous_disable_t promiscuous_disable;
1436  eth_allmulticast_enable_t allmulticast_enable;
1437  eth_allmulticast_disable_t allmulticast_disable;
1438  eth_link_update_t link_update;
1439  eth_stats_get_t stats_get;
1440  eth_stats_reset_t stats_reset;
1441  eth_xstats_get_t xstats_get;
1442  eth_xstats_reset_t xstats_reset;
1443  eth_xstats_get_names_t xstats_get_names;
1445  eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1447  eth_dev_infos_get_t dev_infos_get;
1448  eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
1450  mtu_set_t mtu_set;
1451  vlan_filter_set_t vlan_filter_set;
1452  vlan_tpid_set_t vlan_tpid_set;
1453  vlan_strip_queue_set_t vlan_strip_queue_set;
1454  vlan_offload_set_t vlan_offload_set;
1455  vlan_pvid_set_t vlan_pvid_set;
1456  eth_queue_start_t rx_queue_start;
1457  eth_queue_stop_t rx_queue_stop;
1458  eth_queue_start_t tx_queue_start;
1459  eth_queue_stop_t tx_queue_stop;
1460  eth_rx_queue_setup_t rx_queue_setup;
1461  eth_queue_release_t rx_queue_release;
1462  eth_rx_queue_count_t rx_queue_count;
1463  eth_rx_descriptor_done_t rx_descriptor_done;
1465  eth_rx_enable_intr_t rx_queue_intr_enable;
1467  eth_rx_disable_intr_t rx_queue_intr_disable;
1468  eth_tx_queue_setup_t tx_queue_setup;
1469  eth_queue_release_t tx_queue_release;
1470  eth_dev_led_on_t dev_led_on;
1471  eth_dev_led_off_t dev_led_off;
1472  flow_ctrl_get_t flow_ctrl_get;
1473  flow_ctrl_set_t flow_ctrl_set;
1474  priority_flow_ctrl_set_t priority_flow_ctrl_set;
1475  eth_mac_addr_remove_t mac_addr_remove;
1476  eth_mac_addr_add_t mac_addr_add;
1477  eth_mac_addr_set_t mac_addr_set;
1478  eth_uc_hash_table_set_t uc_hash_table_set;
1479  eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1480  eth_mirror_rule_set_t mirror_rule_set;
1481  eth_mirror_rule_reset_t mirror_rule_reset;
1482  eth_set_vf_rx_mode_t set_vf_rx_mode;
1483  eth_set_vf_rx_t set_vf_rx;
1484  eth_set_vf_tx_t set_vf_tx;
1485  eth_set_vf_vlan_filter_t set_vf_vlan_filter;
1487  eth_udp_tunnel_port_add_t udp_tunnel_port_add;
1489  eth_udp_tunnel_port_del_t udp_tunnel_port_del;
1490  eth_set_queue_rate_limit_t set_queue_rate_limit;
1491  eth_set_vf_rate_limit_t set_vf_rate_limit;
1493  reta_update_t reta_update;
1495  reta_query_t reta_query;
1496 
1497  eth_get_reg_t get_reg;
1499  eth_get_eeprom_length_t get_eeprom_length;
1501  eth_get_eeprom_t get_eeprom;
1503  eth_set_eeprom_t set_eeprom;
1505  /* bypass control */
1506 #ifdef RTE_NIC_BYPASS
1507  bypass_init_t bypass_init;
1508  bypass_state_set_t bypass_state_set;
1509  bypass_state_show_t bypass_state_show;
1510  bypass_event_set_t bypass_event_set;
1511  bypass_event_show_t bypass_event_show;
1512  bypass_wd_timeout_set_t bypass_wd_timeout_set;
1513  bypass_wd_timeout_show_t bypass_wd_timeout_show;
1514  bypass_ver_show_t bypass_ver_show;
1515  bypass_wd_reset_t bypass_wd_reset;
1516 #endif
1517 
1519  rss_hash_update_t rss_hash_update;
1521  rss_hash_conf_get_t rss_hash_conf_get;
1522  eth_filter_ctrl_t filter_ctrl;
1524  eth_set_mc_addr_list_t set_mc_addr_list;
1525  eth_rxq_info_get_t rxq_info_get;
1527  eth_txq_info_get_t txq_info_get;
1530  eth_timesync_enable_t timesync_enable;
1532  eth_timesync_disable_t timesync_disable;
1534  eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1536  eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1537 
1539  eth_get_dcb_info get_dcb_info;
1541  eth_timesync_adjust_time timesync_adjust_time;
1543  eth_timesync_read_time timesync_read_time;
1545  eth_timesync_write_time timesync_write_time;
1547  eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
1549  eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
1550 };
1551 
1574 typedef uint16_t (*rte_rx_callback_fn)(uint8_t port, uint16_t queue,
1575  struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts,
1576  void *user_param);
1577 
1598 typedef uint16_t (*rte_tx_callback_fn)(uint8_t port, uint16_t queue,
1599  struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param);
1600 
1606 struct rte_eth_rxtx_callback {
1607  struct rte_eth_rxtx_callback *next;
1608  union{
1609  rte_rx_callback_fn rx;
1610  rte_tx_callback_fn tx;
1611  } fn;
1612  void *param;
1613 };
1614 
1625 struct rte_eth_dev {
1626  eth_rx_burst_t rx_pkt_burst;
1627  eth_tx_burst_t tx_pkt_burst;
1628  struct rte_eth_dev_data *data;
1629  const struct eth_driver *driver;
1630  const struct eth_dev_ops *dev_ops;
1631  struct rte_pci_device *pci_dev;
1633  struct rte_eth_dev_cb_list link_intr_cbs;
1638  struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1643  struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
1644  uint8_t attached;
1646 
1647 struct rte_eth_dev_sriov {
1648  uint8_t active;
1649  uint8_t nb_q_per_pool;
1650  uint16_t def_vmdq_idx;
1651  uint16_t def_pool_q_idx;
1652 };
1653 #define RTE_ETH_DEV_SRIOV(dev) ((dev)->data->sriov)
1654 
1655 #define RTE_ETH_NAME_MAX_LEN (32)
1656 
1664 struct rte_eth_dev_data {
1665  char name[RTE_ETH_NAME_MAX_LEN];
1667  void **rx_queues;
1668  void **tx_queues;
1669  uint16_t nb_rx_queues;
1670  uint16_t nb_tx_queues;
1672  struct rte_eth_dev_sriov sriov;
1674  void *dev_private;
1676  struct rte_eth_link dev_link;
1679  struct rte_eth_conf dev_conf;
1680  uint16_t mtu;
1682  uint32_t min_rx_buf_size;
1685  uint64_t rx_mbuf_alloc_failed;
1686  struct ether_addr* mac_addrs;
1687  uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
1689  struct ether_addr* hash_mac_addrs;
1691  uint8_t port_id;
1692  __extension__
1693  uint8_t promiscuous : 1,
1694  scattered_rx : 1,
1695  all_multicast : 1,
1696  dev_started : 1,
1697  lro : 1;
1698  uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1700  uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
1702  uint32_t dev_flags;
1703  enum rte_kernel_driver kdrv;
1704  int numa_node;
1705  const char *drv_name;
1706 };
1707 
1709 #define RTE_ETH_DEV_DETACHABLE 0x0001
1710 
1711 #define RTE_ETH_DEV_INTR_LSC 0x0002
1712 
1713 #define RTE_ETH_DEV_BONDED_SLAVE 0x0004
1714 
1720 extern struct rte_eth_dev rte_eth_devices[];
1721 
1735 uint8_t rte_eth_dev_count(void);
1736 
1746 struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
1747 
1758 struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
1759 
1769 int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
1770 
1783 int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
1784 
1797 int rte_eth_dev_detach(uint8_t port_id, char *devname);
1798 
1799 struct eth_driver;
1830 typedef int (*eth_dev_init_t)(struct rte_eth_dev *eth_dev);
1831 
1847 typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev);
1848 
1864 struct eth_driver {
1865  struct rte_pci_driver pci_drv;
1866  eth_dev_init_t eth_dev_init;
1867  eth_dev_uninit_t eth_dev_uninit;
1868  unsigned int dev_private_size;
1869 };
1870 
1882 uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex);
1883 
1913 int rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_queue,
1914  uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf);
1915 
1955 int rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
1956  uint16_t nb_rx_desc, unsigned int socket_id,
1957  const struct rte_eth_rxconf *rx_conf,
1958  struct rte_mempool *mb_pool);
1959 
2003 int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
2004  uint16_t nb_tx_desc, unsigned int socket_id,
2005  const struct rte_eth_txconf *tx_conf);
2006 
2017 int rte_eth_dev_socket_id(uint8_t port_id);
2018 
2028 int rte_eth_dev_is_valid_port(uint8_t port_id);
2029 
2045 int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
2046 
2061 int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
2062 
2078 int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);
2079 
2094 int rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id);
2095 
2096 
2097 
2113 int rte_eth_dev_start(uint8_t port_id);
2114 
2122 void rte_eth_dev_stop(uint8_t port_id);
2123 
2124 
2137 int rte_eth_dev_set_link_up(uint8_t port_id);
2138 
2148 int rte_eth_dev_set_link_down(uint8_t port_id);
2149 
2158 void rte_eth_dev_close(uint8_t port_id);
2159 
2166 void rte_eth_promiscuous_enable(uint8_t port_id);
2167 
2174 void rte_eth_promiscuous_disable(uint8_t port_id);
2175 
2186 int rte_eth_promiscuous_get(uint8_t port_id);
2187 
2194 void rte_eth_allmulticast_enable(uint8_t port_id);
2195 
2202 void rte_eth_allmulticast_disable(uint8_t port_id);
2203 
2214 int rte_eth_allmulticast_get(uint8_t port_id);
2215 
2227 void rte_eth_link_get(uint8_t port_id, struct rte_eth_link *link);
2228 
2240 void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);
2241 
2259 int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);
2260 
2267 void rte_eth_stats_reset(uint8_t port_id);
2268 
2288 int rte_eth_xstats_get_names(uint8_t port_id,
2289  struct rte_eth_xstat_name *xstats_names,
2290  unsigned size);
2291 
2313 int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
2314  unsigned n);
2315 
2322 void rte_eth_xstats_reset(uint8_t port_id);
2323 
2341 int rte_eth_dev_set_tx_queue_stats_mapping(uint8_t port_id,
2342  uint16_t tx_queue_id, uint8_t stat_idx);
2343 
2361 int rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id,
2362  uint16_t rx_queue_id,
2363  uint8_t stat_idx);
2364 
2374 void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr);
2375 
2385 void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);
2386 
2425 int rte_eth_dev_get_supported_ptypes(uint8_t port_id, uint32_t ptype_mask,
2426  uint32_t *ptypes, int num);
2427 
2439 int rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu);
2440 
2455 int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu);
2456 
2475 int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on);
2476 
2496 int rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id,
2497  int on);
2498 
2515 int rte_eth_dev_set_vlan_ether_type(uint8_t port_id,
2516  enum rte_vlan_type vlan_type,
2517  uint16_t tag_type);
2518 
2539 int rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask);
2540 
2553 int rte_eth_dev_get_vlan_offload(uint8_t port_id);
2554 
2569 int rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on);
2570 
2653 static inline uint16_t
2654 rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
2655  struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
2656 {
2657  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2658 
2659 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2660  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2661  RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
2662 
2663  if (queue_id >= dev->data->nb_rx_queues) {
2664  RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
2665  return 0;
2666  }
2667 #endif
2668  int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
2669  rx_pkts, nb_pkts);
2670 
2671 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2672  struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
2673 
2674  if (unlikely(cb != NULL)) {
2675  do {
2676  nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
2677  nb_pkts, cb->param);
2678  cb = cb->next;
2679  } while (cb != NULL);
2680  }
2681 #endif
2682 
2683  return nb_rx;
2684 }
2685 
2698 static inline int
2699 rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
2700 {
2701  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2702  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
2703  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
2704  return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
2705 }
2706 
2722 static inline int
2723 rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
2724 {
2725  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2726  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
2727  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
2728  return (*dev->dev_ops->rx_descriptor_done)( \
2729  dev->data->rx_queues[queue_id], offset);
2730 }
2731 
2791 static inline uint16_t
2792 rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
2793  struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
2794 {
2795  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2796 
2797 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2798  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2799  RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
2800 
2801  if (queue_id >= dev->data->nb_tx_queues) {
2802  RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
2803  return 0;
2804  }
2805 #endif
2806 
2807 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2808  struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id];
2809 
2810  if (unlikely(cb != NULL)) {
2811  do {
2812  nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
2813  cb->param);
2814  cb = cb->next;
2815  } while (cb != NULL);
2816  }
2817 #endif
2818 
2819  return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
2820 }
2821 
2822 typedef void (*buffer_tx_error_fn)(struct rte_mbuf **unsent, uint16_t count,
2823  void *userdata);
2824 
2830  buffer_tx_error_fn error_callback;
2831  void *error_userdata;
2832  uint16_t size;
2833  uint16_t length;
2834  struct rte_mbuf *pkts[];
2836 };
2837 
2844 #define RTE_ETH_TX_BUFFER_SIZE(sz) \
2845  (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *))
2846 
2857 int
2858 rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size);
2859 
2882 static inline uint16_t
2883 rte_eth_tx_buffer_flush(uint8_t port_id, uint16_t queue_id,
2884  struct rte_eth_dev_tx_buffer *buffer)
2885 {
2886  uint16_t sent;
2887  uint16_t to_send = buffer->length;
2888 
2889  if (to_send == 0)
2890  return 0;
2891 
2892  sent = rte_eth_tx_burst(port_id, queue_id, buffer->pkts, to_send);
2893 
2894  buffer->length = 0;
2895 
2896  /* All packets sent, or to be dealt with by callback below */
2897  if (unlikely(sent != to_send))
2898  buffer->error_callback(&buffer->pkts[sent], to_send - sent,
2899  buffer->error_userdata);
2900 
2901  return sent;
2902 }
2903 
2934 static inline uint16_t __attribute__((always_inline))
2935 rte_eth_tx_buffer(uint8_t port_id, uint16_t queue_id,
2936  struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
2937 {
2938  buffer->pkts[buffer->length++] = tx_pkt;
2939  if (buffer->length < buffer->size)
2940  return 0;
2941 
2942  return rte_eth_tx_buffer_flush(port_id, queue_id, buffer);
2943 }
2944 
2969 int
2971  buffer_tx_error_fn callback, void *userdata);
2972 
2995 void
2996 rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent,
2997  void *userdata);
2998 
3022 void
3023 rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent,
3024  void *userdata);
3025 
3038 };
3039 
3040 typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
3041  enum rte_eth_event_type event, void *cb_arg);
3067 int rte_eth_dev_callback_register(uint8_t port_id,
3068  enum rte_eth_event_type event,
3069  rte_eth_dev_cb_fn cb_fn, void *cb_arg);
3070 
3088 int rte_eth_dev_callback_unregister(uint8_t port_id,
3089  enum rte_eth_event_type event,
3090  rte_eth_dev_cb_fn cb_fn, void *cb_arg);
3091 
3109 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
3110  enum rte_eth_event_type event, void *cb_arg);
3111 
3132 int rte_eth_dev_rx_intr_enable(uint8_t port_id, uint16_t queue_id);
3133 
3153 int rte_eth_dev_rx_intr_disable(uint8_t port_id, uint16_t queue_id);
3154 
3172 int rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data);
3173 
3195 int rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
3196  int epfd, int op, void *data);
3197 
3210 int rte_eth_led_on(uint8_t port_id);
3211 
3224 int rte_eth_led_off(uint8_t port_id);
3225 
3238 int rte_eth_dev_flow_ctrl_get(uint8_t port_id,
3239  struct rte_eth_fc_conf *fc_conf);
3240 
3255 int rte_eth_dev_flow_ctrl_set(uint8_t port_id,
3256  struct rte_eth_fc_conf *fc_conf);
3257 
3273 int rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id,
3274  struct rte_eth_pfc_conf *pfc_conf);
3275 
3294 int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
3295  uint32_t pool);
3296 
3310 int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr);
3311 
3325 int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr *mac_addr);
3326 
3327 
3343 int rte_eth_dev_rss_reta_update(uint8_t port,
3344  struct rte_eth_rss_reta_entry64 *reta_conf,
3345  uint16_t reta_size);
3346 
3362 int rte_eth_dev_rss_reta_query(uint8_t port,
3363  struct rte_eth_rss_reta_entry64 *reta_conf,
3364  uint16_t reta_size);
3365 
3384 int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr,
3385  uint8_t on);
3386 
3404 int rte_eth_dev_uc_all_hash_table_set(uint8_t port,uint8_t on);
3405 
3428 int rte_eth_dev_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mode,
3429  uint8_t on);
3430 
3447 int
3448 rte_eth_dev_set_vf_tx(uint8_t port,uint16_t vf, uint8_t on);
3449 
3466 int
3467 rte_eth_dev_set_vf_rx(uint8_t port,uint16_t vf, uint8_t on);
3468 
3488 int
3489 rte_eth_dev_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
3490  uint64_t vf_mask,
3491  uint8_t vlan_on);
3492 
3514 int rte_eth_mirror_rule_set(uint8_t port_id,
3515  struct rte_eth_mirror_conf *mirror_conf,
3516  uint8_t rule_id,
3517  uint8_t on);
3518 
3532 int rte_eth_mirror_rule_reset(uint8_t port_id,
3533  uint8_t rule_id);
3534 
3550 int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
3551  uint16_t tx_rate);
3552 
3570 int rte_eth_set_vf_rate_limit(uint8_t port_id, uint16_t vf,
3571  uint16_t tx_rate, uint64_t q_msk);
3572 
3584 int rte_eth_dev_bypass_init(uint8_t port);
3585 
3601 int rte_eth_dev_bypass_state_show(uint8_t port, uint32_t *state);
3602 
3618 int rte_eth_dev_bypass_state_set(uint8_t port, uint32_t *new_state);
3619 
3642 int rte_eth_dev_bypass_event_show(uint8_t port, uint32_t event, uint32_t *state);
3643 
3666 int rte_eth_dev_bypass_event_store(uint8_t port, uint32_t event, uint32_t state);
3667 
3688 int rte_eth_dev_wd_timeout_store(uint8_t port, uint32_t timeout);
3689 
3702 int rte_eth_dev_bypass_ver_show(uint8_t port, uint32_t *ver);
3703 
3724 int rte_eth_dev_bypass_wd_timeout_show(uint8_t port, uint32_t *wd_timeout);
3725 
3736 int rte_eth_dev_bypass_wd_reset(uint8_t port);
3737 
3751 int rte_eth_dev_rss_hash_update(uint8_t port_id,
3752  struct rte_eth_rss_conf *rss_conf);
3753 
3767 int
3768 rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
3769  struct rte_eth_rss_conf *rss_conf);
3770 
3788 int
3789 rte_eth_dev_udp_tunnel_port_add(uint8_t port_id,
3790  struct rte_eth_udp_tunnel *tunnel_udp);
3791 
3810 int
3811 rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id,
3812  struct rte_eth_udp_tunnel *tunnel_udp);
3813 
3827 int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type);
3828 
3847 int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
3848  enum rte_filter_op filter_op, void *arg);
3849 
3862 int rte_eth_dev_get_dcb_info(uint8_t port_id,
3863  struct rte_eth_dcb_info *dcb_info);
3864 
3889 void *rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
3890  rte_rx_callback_fn fn, void *user_param);
3891 
3892 /*
3893 * Add a callback that must be called first on packet RX on a given port
3894 * and queue.
3895 *
3896 * This API configures a first function to be called for each burst of
3897 * packets received on a given NIC port queue. The return value is a pointer
3898 * that can be used to later remove the callback using
3899 * rte_eth_remove_rx_callback().
3900 *
3901 * Multiple functions are called in the order that they are added.
3902 *
3903 * @param port_id
3904 * The port identifier of the Ethernet device.
3905 * @param queue_id
3906 * The queue on the Ethernet device on which the callback is to be added.
3907 * @param fn
3908 * The callback function
3909 * @param user_param
3910 * A generic pointer parameter which will be passed to each invocation of the
3911 * callback function on this port and queue.
3912 *
3913 * @return
3914 * NULL on error.
3915 * On success, a pointer value which can later be used to remove the callback.
3916 */
3917 void *rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id,
3918  rte_rx_callback_fn fn, void *user_param);
3919 
3944 void *rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
3945  rte_tx_callback_fn fn, void *user_param);
3946 
3977 int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
3978  struct rte_eth_rxtx_callback *user_cb);
3979 
4010 int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
4011  struct rte_eth_rxtx_callback *user_cb);
4012 
4030 int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
4031  struct rte_eth_rxq_info *qinfo);
4032 
4050 int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
4051  struct rte_eth_txq_info *qinfo);
4052 
4069 int rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info);
4070 
4082 int rte_eth_dev_get_eeprom_length(uint8_t port_id);
4083 
4098 int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
4099 
4114 int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
4115 
4133 int rte_eth_dev_set_mc_addr_list(uint8_t port_id,
4134  struct ether_addr *mc_addr_set,
4135  uint32_t nb_mc_addr);
4136 
4148 int rte_eth_timesync_enable(uint8_t port_id);
4149 
4161 int rte_eth_timesync_disable(uint8_t port_id);
4162 
4180 int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
4181  struct timespec *timestamp, uint32_t flags);
4182 
4197 int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
4198  struct timespec *timestamp);
4199 
4216 int rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta);
4217 
4232 int rte_eth_timesync_read_time(uint8_t port_id, struct timespec *time);
4233 
4251 int rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *time);
4252 
4264 void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
4265  struct rte_pci_device *pci_dev);
4266 
4286 const struct rte_memzone *
4287 rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
4288  uint16_t queue_id, size_t size,
4289  unsigned align, int socket_id);
4290 
4305 int
4306 rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
4307  struct rte_eth_l2_tunnel_conf *l2_tunnel);
4308 
4332 int
4333 rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
4334  struct rte_eth_l2_tunnel_conf *l2_tunnel,
4335  uint32_t mask,
4336  uint8_t en);
4337 
4350 int
4351 rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
4352 
4364 int
4365 rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
4366 
4372 int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
4373  struct rte_pci_device *pci_dev);
4374 
4380 int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
4381 
4382 #ifdef __cplusplus
4383 }
4384 #endif
4385 
4386 #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:3040
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
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
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)
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:2699
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:2834
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
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:2792
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:2935
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:1574
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:2883
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:2723
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:1598
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:2654
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:3029