DPDK  16.11.11
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 
847 #define DEV_RX_OFFLOAD_VLAN_STRIP 0x00000001
848 #define DEV_RX_OFFLOAD_IPV4_CKSUM 0x00000002
849 #define DEV_RX_OFFLOAD_UDP_CKSUM 0x00000004
850 #define DEV_RX_OFFLOAD_TCP_CKSUM 0x00000008
851 #define DEV_RX_OFFLOAD_TCP_LRO 0x00000010
852 #define DEV_RX_OFFLOAD_QINQ_STRIP 0x00000020
853 #define DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000040
854 
858 #define DEV_TX_OFFLOAD_VLAN_INSERT 0x00000001
859 #define DEV_TX_OFFLOAD_IPV4_CKSUM 0x00000002
860 #define DEV_TX_OFFLOAD_UDP_CKSUM 0x00000004
861 #define DEV_TX_OFFLOAD_TCP_CKSUM 0x00000008
862 #define DEV_TX_OFFLOAD_SCTP_CKSUM 0x00000010
863 #define DEV_TX_OFFLOAD_TCP_TSO 0x00000020
864 #define DEV_TX_OFFLOAD_UDP_TSO 0x00000040
865 #define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080
866 #define DEV_TX_OFFLOAD_QINQ_INSERT 0x00000100
867 #define DEV_TX_OFFLOAD_VXLAN_TNL_TSO 0x00000200
868 #define DEV_TX_OFFLOAD_GRE_TNL_TSO 0x00000400
869 #define DEV_TX_OFFLOAD_IPIP_TNL_TSO 0x00000800
870 #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;
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 
1748 struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
1749 
1759 int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
1760 
1773 int rte_eth_dev_attach(const char *devargs, uint8_t *port_id);
1774 
1787 int rte_eth_dev_detach(uint8_t port_id, char *devname);
1788 
1789 struct eth_driver;
1820 typedef int (*eth_dev_init_t)(struct rte_eth_dev *eth_dev);
1821 
1837 typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev);
1838 
1854 struct eth_driver {
1855  struct rte_pci_driver pci_drv;
1856  eth_dev_init_t eth_dev_init;
1857  eth_dev_uninit_t eth_dev_uninit;
1858  unsigned int dev_private_size;
1859 };
1860 
1872 uint32_t rte_eth_speed_bitflag(uint32_t speed, int duplex);
1873 
1903 int rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_queue,
1904  uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf);
1905 
1945 int rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
1946  uint16_t nb_rx_desc, unsigned int socket_id,
1947  const struct rte_eth_rxconf *rx_conf,
1948  struct rte_mempool *mb_pool);
1949 
1993 int rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
1994  uint16_t nb_tx_desc, unsigned int socket_id,
1995  const struct rte_eth_txconf *tx_conf);
1996 
2007 int rte_eth_dev_socket_id(uint8_t port_id);
2008 
2018 int rte_eth_dev_is_valid_port(uint8_t port_id);
2019 
2035 int rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id);
2036 
2051 int rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id);
2052 
2068 int rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id);
2069 
2084 int rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id);
2085 
2086 
2087 
2103 int rte_eth_dev_start(uint8_t port_id);
2104 
2112 void rte_eth_dev_stop(uint8_t port_id);
2113 
2114 
2127 int rte_eth_dev_set_link_up(uint8_t port_id);
2128 
2138 int rte_eth_dev_set_link_down(uint8_t port_id);
2139 
2148 void rte_eth_dev_close(uint8_t port_id);
2149 
2156 void rte_eth_promiscuous_enable(uint8_t port_id);
2157 
2164 void rte_eth_promiscuous_disable(uint8_t port_id);
2165 
2176 int rte_eth_promiscuous_get(uint8_t port_id);
2177 
2184 void rte_eth_allmulticast_enable(uint8_t port_id);
2185 
2192 void rte_eth_allmulticast_disable(uint8_t port_id);
2193 
2204 int rte_eth_allmulticast_get(uint8_t port_id);
2205 
2217 void rte_eth_link_get(uint8_t port_id, struct rte_eth_link *link);
2218 
2230 void rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *link);
2231 
2249 int rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats);
2250 
2257 void rte_eth_stats_reset(uint8_t port_id);
2258 
2278 int rte_eth_xstats_get_names(uint8_t port_id,
2279  struct rte_eth_xstat_name *xstats_names,
2280  unsigned size);
2281 
2303 int rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstat *xstats,
2304  unsigned n);
2305 
2312 void rte_eth_xstats_reset(uint8_t port_id);
2313 
2331 int rte_eth_dev_set_tx_queue_stats_mapping(uint8_t port_id,
2332  uint16_t tx_queue_id, uint8_t stat_idx);
2333 
2351 int rte_eth_dev_set_rx_queue_stats_mapping(uint8_t port_id,
2352  uint16_t rx_queue_id,
2353  uint8_t stat_idx);
2354 
2364 void rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr);
2365 
2375 void rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info);
2376 
2415 int rte_eth_dev_get_supported_ptypes(uint8_t port_id, uint32_t ptype_mask,
2416  uint32_t *ptypes, int num);
2417 
2429 int rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu);
2430 
2445 int rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu);
2446 
2465 int rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on);
2466 
2486 int rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id,
2487  int on);
2488 
2505 int rte_eth_dev_set_vlan_ether_type(uint8_t port_id,
2506  enum rte_vlan_type vlan_type,
2507  uint16_t tag_type);
2508 
2529 int rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask);
2530 
2543 int rte_eth_dev_get_vlan_offload(uint8_t port_id);
2544 
2559 int rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on);
2560 
2643 static inline uint16_t
2644 rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
2645  struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
2646 {
2647  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2648  uint16_t nb_rx;
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  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  if (unlikely(dev->post_rx_burst_cbs[queue_id] != NULL)) {
2664  struct rte_eth_rxtx_callback *cb =
2665  dev->post_rx_burst_cbs[queue_id];
2666 
2667  do {
2668  nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
2669  nb_pkts, cb->param);
2670  cb = cb->next;
2671  } while (cb != NULL);
2672  }
2673 #endif
2674 
2675  return nb_rx;
2676 }
2677 
2690 static inline int
2691 rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
2692 {
2693  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2694  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
2695  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
2696  return (int)(*dev->dev_ops->rx_queue_count)(dev, queue_id);
2697 }
2698 
2714 static inline int
2715 rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
2716 {
2717  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2718  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
2719  RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
2720  return (*dev->dev_ops->rx_descriptor_done)( \
2721  dev->data->rx_queues[queue_id], offset);
2722 }
2723 
2783 static inline uint16_t
2784 rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
2785  struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
2786 {
2787  struct rte_eth_dev *dev = &rte_eth_devices[port_id];
2788 
2789 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
2790  RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
2791  RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
2792 
2793  if (queue_id >= dev->data->nb_tx_queues) {
2794  RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
2795  return 0;
2796  }
2797 #endif
2798 
2799 #ifdef RTE_ETHDEV_RXTX_CALLBACKS
2800  struct rte_eth_rxtx_callback *cb = dev->pre_tx_burst_cbs[queue_id];
2801 
2802  if (unlikely(cb != NULL)) {
2803  do {
2804  nb_pkts = cb->fn.tx(port_id, queue_id, tx_pkts, nb_pkts,
2805  cb->param);
2806  cb = cb->next;
2807  } while (cb != NULL);
2808  }
2809 #endif
2810 
2811  return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id], tx_pkts, nb_pkts);
2812 }
2813 
2814 typedef void (*buffer_tx_error_fn)(struct rte_mbuf **unsent, uint16_t count,
2815  void *userdata);
2816 
2822  buffer_tx_error_fn error_callback;
2823  void *error_userdata;
2824  uint16_t size;
2825  uint16_t length;
2826  struct rte_mbuf *pkts[];
2828 };
2829 
2836 #define RTE_ETH_TX_BUFFER_SIZE(sz) \
2837  (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *))
2838 
2849 int
2850 rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size);
2851 
2874 static inline uint16_t
2875 rte_eth_tx_buffer_flush(uint8_t port_id, uint16_t queue_id,
2876  struct rte_eth_dev_tx_buffer *buffer)
2877 {
2878  uint16_t sent;
2879  uint16_t to_send = buffer->length;
2880 
2881  if (to_send == 0)
2882  return 0;
2883 
2884  sent = rte_eth_tx_burst(port_id, queue_id, buffer->pkts, to_send);
2885 
2886  buffer->length = 0;
2887 
2888  /* All packets sent, or to be dealt with by callback below */
2889  if (unlikely(sent != to_send))
2890  buffer->error_callback(&buffer->pkts[sent],
2891  (uint16_t)(to_send - sent),
2892  buffer->error_userdata);
2893 
2894  return sent;
2895 }
2896 
2927 static inline uint16_t __attribute__((always_inline))
2928 rte_eth_tx_buffer(uint8_t port_id, uint16_t queue_id,
2929  struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
2930 {
2931  buffer->pkts[buffer->length++] = tx_pkt;
2932  if (buffer->length < buffer->size)
2933  return 0;
2934 
2935  return rte_eth_tx_buffer_flush(port_id, queue_id, buffer);
2936 }
2937 
2962 int
2964  buffer_tx_error_fn callback, void *userdata);
2965 
2988 void
2989 rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent,
2990  void *userdata);
2991 
3015 void
3016 rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent,
3017  void *userdata);
3018 
3031 };
3032 
3033 typedef void (*rte_eth_dev_cb_fn)(uint8_t port_id, \
3034  enum rte_eth_event_type event, void *cb_arg);
3060 int rte_eth_dev_callback_register(uint8_t port_id,
3061  enum rte_eth_event_type event,
3062  rte_eth_dev_cb_fn cb_fn, void *cb_arg);
3063 
3081 int rte_eth_dev_callback_unregister(uint8_t port_id,
3082  enum rte_eth_event_type event,
3083  rte_eth_dev_cb_fn cb_fn, void *cb_arg);
3084 
3102 void _rte_eth_dev_callback_process(struct rte_eth_dev *dev,
3103  enum rte_eth_event_type event, void *cb_arg);
3104 
3125 int rte_eth_dev_rx_intr_enable(uint8_t port_id, uint16_t queue_id);
3126 
3146 int rte_eth_dev_rx_intr_disable(uint8_t port_id, uint16_t queue_id);
3147 
3165 int rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data);
3166 
3188 int rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
3189  int epfd, int op, void *data);
3190 
3203 int rte_eth_led_on(uint8_t port_id);
3204 
3217 int rte_eth_led_off(uint8_t port_id);
3218 
3231 int rte_eth_dev_flow_ctrl_get(uint8_t port_id,
3232  struct rte_eth_fc_conf *fc_conf);
3233 
3248 int rte_eth_dev_flow_ctrl_set(uint8_t port_id,
3249  struct rte_eth_fc_conf *fc_conf);
3250 
3266 int rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id,
3267  struct rte_eth_pfc_conf *pfc_conf);
3268 
3287 int rte_eth_dev_mac_addr_add(uint8_t port, struct ether_addr *mac_addr,
3288  uint32_t pool);
3289 
3303 int rte_eth_dev_mac_addr_remove(uint8_t port, struct ether_addr *mac_addr);
3304 
3318 int rte_eth_dev_default_mac_addr_set(uint8_t port, struct ether_addr *mac_addr);
3319 
3320 
3336 int rte_eth_dev_rss_reta_update(uint8_t port,
3337  struct rte_eth_rss_reta_entry64 *reta_conf,
3338  uint16_t reta_size);
3339 
3355 int rte_eth_dev_rss_reta_query(uint8_t port,
3356  struct rte_eth_rss_reta_entry64 *reta_conf,
3357  uint16_t reta_size);
3358 
3377 int rte_eth_dev_uc_hash_table_set(uint8_t port,struct ether_addr *addr,
3378  uint8_t on);
3379 
3397 int rte_eth_dev_uc_all_hash_table_set(uint8_t port,uint8_t on);
3398 
3421 int rte_eth_dev_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mode,
3422  uint8_t on);
3423 
3440 int
3441 rte_eth_dev_set_vf_tx(uint8_t port,uint16_t vf, uint8_t on);
3442 
3459 int
3460 rte_eth_dev_set_vf_rx(uint8_t port,uint16_t vf, uint8_t on);
3461 
3481 int
3482 rte_eth_dev_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
3483  uint64_t vf_mask,
3484  uint8_t vlan_on);
3485 
3507 int rte_eth_mirror_rule_set(uint8_t port_id,
3508  struct rte_eth_mirror_conf *mirror_conf,
3509  uint8_t rule_id,
3510  uint8_t on);
3511 
3525 int rte_eth_mirror_rule_reset(uint8_t port_id,
3526  uint8_t rule_id);
3527 
3543 int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
3544  uint16_t tx_rate);
3545 
3563 int rte_eth_set_vf_rate_limit(uint8_t port_id, uint16_t vf,
3564  uint16_t tx_rate, uint64_t q_msk);
3565 
3577 int rte_eth_dev_bypass_init(uint8_t port);
3578 
3594 int rte_eth_dev_bypass_state_show(uint8_t port, uint32_t *state);
3595 
3611 int rte_eth_dev_bypass_state_set(uint8_t port, uint32_t *new_state);
3612 
3635 int rte_eth_dev_bypass_event_show(uint8_t port, uint32_t event, uint32_t *state);
3636 
3659 int rte_eth_dev_bypass_event_store(uint8_t port, uint32_t event, uint32_t state);
3660 
3681 int rte_eth_dev_wd_timeout_store(uint8_t port, uint32_t timeout);
3682 
3695 int rte_eth_dev_bypass_ver_show(uint8_t port, uint32_t *ver);
3696 
3717 int rte_eth_dev_bypass_wd_timeout_show(uint8_t port, uint32_t *wd_timeout);
3718 
3729 int rte_eth_dev_bypass_wd_reset(uint8_t port);
3730 
3744 int rte_eth_dev_rss_hash_update(uint8_t port_id,
3745  struct rte_eth_rss_conf *rss_conf);
3746 
3760 int
3761 rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
3762  struct rte_eth_rss_conf *rss_conf);
3763 
3781 int
3782 rte_eth_dev_udp_tunnel_port_add(uint8_t port_id,
3783  struct rte_eth_udp_tunnel *tunnel_udp);
3784 
3803 int
3804 rte_eth_dev_udp_tunnel_port_delete(uint8_t port_id,
3805  struct rte_eth_udp_tunnel *tunnel_udp);
3806 
3820 int rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type);
3821 
3840 int rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
3841  enum rte_filter_op filter_op, void *arg);
3842 
3855 int rte_eth_dev_get_dcb_info(uint8_t port_id,
3856  struct rte_eth_dcb_info *dcb_info);
3857 
3882 void *rte_eth_add_rx_callback(uint8_t port_id, uint16_t queue_id,
3883  rte_rx_callback_fn fn, void *user_param);
3884 
3885 /*
3886 * Add a callback that must be called first on packet RX on a given port
3887 * and queue.
3888 *
3889 * This API configures a first function to be called for each burst of
3890 * packets received on a given NIC port queue. The return value is a pointer
3891 * that can be used to later remove the callback using
3892 * rte_eth_remove_rx_callback().
3893 *
3894 * Multiple functions are called in the order that they are added.
3895 *
3896 * @param port_id
3897 * The port identifier of the Ethernet device.
3898 * @param queue_id
3899 * The queue on the Ethernet device on which the callback is to be added.
3900 * @param fn
3901 * The callback function
3902 * @param user_param
3903 * A generic pointer parameter which will be passed to each invocation of the
3904 * callback function on this port and queue.
3905 *
3906 * @return
3907 * NULL on error.
3908 * On success, a pointer value which can later be used to remove the callback.
3909 */
3910 void *rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id,
3911  rte_rx_callback_fn fn, void *user_param);
3912 
3937 void *rte_eth_add_tx_callback(uint8_t port_id, uint16_t queue_id,
3938  rte_tx_callback_fn fn, void *user_param);
3939 
3970 int rte_eth_remove_rx_callback(uint8_t port_id, uint16_t queue_id,
3971  struct rte_eth_rxtx_callback *user_cb);
3972 
4003 int rte_eth_remove_tx_callback(uint8_t port_id, uint16_t queue_id,
4004  struct rte_eth_rxtx_callback *user_cb);
4005 
4023 int rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
4024  struct rte_eth_rxq_info *qinfo);
4025 
4043 int rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
4044  struct rte_eth_txq_info *qinfo);
4045 
4062 int rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info);
4063 
4075 int rte_eth_dev_get_eeprom_length(uint8_t port_id);
4076 
4091 int rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
4092 
4107 int rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info);
4108 
4126 int rte_eth_dev_set_mc_addr_list(uint8_t port_id,
4127  struct ether_addr *mc_addr_set,
4128  uint32_t nb_mc_addr);
4129 
4141 int rte_eth_timesync_enable(uint8_t port_id);
4142 
4154 int rte_eth_timesync_disable(uint8_t port_id);
4155 
4173 int rte_eth_timesync_read_rx_timestamp(uint8_t port_id,
4174  struct timespec *timestamp, uint32_t flags);
4175 
4190 int rte_eth_timesync_read_tx_timestamp(uint8_t port_id,
4191  struct timespec *timestamp);
4192 
4209 int rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta);
4210 
4225 int rte_eth_timesync_read_time(uint8_t port_id, struct timespec *time);
4226 
4244 int rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *time);
4245 
4257 void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
4258  struct rte_pci_device *pci_dev);
4259 
4279 const struct rte_memzone *
4280 rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
4281  uint16_t queue_id, size_t size,
4282  unsigned align, int socket_id);
4283 
4298 int
4299 rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id,
4300  struct rte_eth_l2_tunnel_conf *l2_tunnel);
4301 
4325 int
4326 rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
4327  struct rte_eth_l2_tunnel_conf *l2_tunnel,
4328  uint32_t mask,
4329  uint8_t en);
4330 
4343 int
4344 rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
4345 
4357 int
4358 rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
4359 
4365 int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
4366  struct rte_pci_device *pci_dev);
4367 
4373 int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
4374 
4375 #ifdef __cplusplus
4376 }
4377 #endif
4378 
4379 #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(* 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
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)
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:385
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:451
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:2691
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
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_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:2826
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:2784
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:2928
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:455
int32_t socket_id
Definition: rte_memzone.h:91
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:2875
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
void(* rte_eth_dev_cb_fn)(uint8_t port_id, enum rte_eth_event_type event, void *cb_arg)
Definition: rte_ethdev.h:3033
static int rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
Definition: rte_ethdev.h:2715
void rte_eth_allmulticast_enable(uint8_t port_id)
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:2644
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:3022