1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
5 #ifndef _RTE_ETHDEV_DRIVER_H_
6 #define _RTE_ETHDEV_DRIVER_H_
15 * RTE Ethernet Device PMD API
17 * These APIs for the use from Ethernet drivers, user applications shouldn't
22 #include <rte_ethdev.h>
26 * Structure used to hold information about the callbacks to be called for a
29 struct rte_eth_rxtx_callback {
30 struct rte_eth_rxtx_callback *next;
32 rte_rx_callback_fn rx;
33 rte_tx_callback_fn tx;
40 * The generic data structure associated with each Ethernet device.
42 * Pointers to burst-oriented packet receive and transmit functions are
43 * located at the beginning of the structure, along with the pointer to
44 * where all the data elements for the particular device are stored in shared
45 * memory. This split allows the function pointer and driver data to be per-
46 * process, while the actual configuration data for the device is shared.
49 eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function */
50 eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function */
52 /** Pointer to PMD transmit prepare function */
53 eth_tx_prep_t tx_pkt_prepare;
54 /** Get the number of used Rx descriptors */
55 eth_rx_queue_count_t rx_queue_count;
56 /** Check the status of a Rx descriptor */
57 eth_rx_descriptor_status_t rx_descriptor_status;
58 /** Check the status of a Tx descriptor */
59 eth_tx_descriptor_status_t tx_descriptor_status;
62 * Device data that is shared between primary and secondary processes
64 struct rte_eth_dev_data *data;
65 void *process_private; /**< Pointer to per-process device data */
66 const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
67 struct rte_device *device; /**< Backing device */
68 struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
70 /** User application callbacks for NIC interrupts */
71 struct rte_eth_dev_cb_list link_intr_cbs;
73 * User-supplied functions called from rx_burst to post-process
74 * received packets before passing them to the user
76 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
78 * User-supplied functions called from tx_burst to pre-process
79 * received packets before passing them to the driver for transmission
81 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
83 enum rte_eth_dev_state state; /**< Flag indicating the port state */
84 void *security_ctx; /**< Context for security ops */
85 } __rte_cache_aligned;
87 struct rte_eth_dev_sriov;
88 struct rte_eth_dev_owner;
92 * The data part, with no function pointers, associated with each Ethernet
93 * device. This structure is safe to place in shared memory to be common
94 * among different processes in a multi-process configuration.
96 struct rte_eth_dev_data {
97 char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
99 void **rx_queues; /**< Array of pointers to Rx queues */
100 void **tx_queues; /**< Array of pointers to Tx queues */
101 uint16_t nb_rx_queues; /**< Number of Rx queues */
102 uint16_t nb_tx_queues; /**< Number of Tx queues */
104 struct rte_eth_dev_sriov sriov; /**< SRIOV data */
106 /** PMD-specific private data. @see rte_eth_dev_release_port() */
109 struct rte_eth_link dev_link; /**< Link-level information & status */
110 struct rte_eth_conf dev_conf; /**< Configuration applied to device */
111 uint16_t mtu; /**< Maximum Transmission Unit */
113 /** Common Rx buffer size handled by all queues */
114 uint32_t min_rx_buf_size;
116 uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */
118 /** Device Ethernet link address. @see rte_eth_dev_release_port() */
119 struct rte_ether_addr *mac_addrs;
120 /** Bitmap associating MAC addresses to pools */
121 uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR];
123 * Device Ethernet MAC addresses of hash filtering.
124 * @see rte_eth_dev_release_port()
126 struct rte_ether_addr *hash_mac_addrs;
128 uint16_t port_id; /**< Device [external] port identifier */
131 uint8_t /** Rx promiscuous mode ON(1) / OFF(0) */
133 /** Rx of scattered packets is ON(1) / OFF(0) */
135 /** Rx all multicast mode ON(1) / OFF(0) */
137 /** Device state: STARTED(1) / STOPPED(0) */
139 /** Rx LRO is ON(1) / OFF(0) */
142 * Indicates whether the device is configured:
143 * CONFIGURED(1) / NOT CONFIGURED(0)
147 * Indicates whether the flow engine is configured:
148 * CONFIGURED(1) / NOT CONFIGURED(0)
152 /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
153 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
154 /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
155 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
157 uint32_t dev_flags; /**< Capabilities */
158 int numa_node; /**< NUMA node connection */
160 /** VLAN filter configuration */
161 struct rte_vlan_filter_conf vlan_filter_conf;
163 struct rte_eth_dev_owner owner; /**< The port owner */
166 * Switch-specific identifier.
167 * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
169 uint16_t representor_id;
171 * Port ID of the backing device.
172 * This device will be used to query representor info and calculate
173 * representor IDs. Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
175 uint16_t backer_port_id;
177 pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex */
178 } __rte_cache_aligned;
182 * The pool of *rte_eth_dev* structures. The size of the pool
183 * is configured at compile-time in the <rte_ethdev.c> file.
185 extern struct rte_eth_dev rte_eth_devices[];
187 /** @internal Declaration of the hairpin peer queue information structure. */
188 struct rte_hairpin_peer_info;
191 * Definitions of all functions exported by an Ethernet driver through the
192 * generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
193 * structure associated with an Ethernet device.
196 /** @internal Ethernet device configuration. */
197 typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
199 /** @internal Function used to start a configured Ethernet device. */
200 typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
202 /** @internal Function used to stop a configured Ethernet device. */
203 typedef int (*eth_dev_stop_t)(struct rte_eth_dev *dev);
205 /** @internal Function used to link up a configured Ethernet device. */
206 typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
208 /** @internal Function used to link down a configured Ethernet device. */
209 typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
211 /** @internal Function used to close a configured Ethernet device. */
212 typedef int (*eth_dev_close_t)(struct rte_eth_dev *dev);
214 /** @internal Function used to reset a configured Ethernet device. */
215 typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
217 /** @internal Function used to detect an Ethernet device removal. */
218 typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
222 * Function used to enable the Rx promiscuous mode of an Ethernet device.
225 * ethdev handle of port.
228 * Negative errno value on error, 0 on success.
231 * Success, promiscuous mode is enabled.
233 * Promiscuous mode is not supported.
236 * @retval -E_RTE_SECONDARY
237 * Function was called from a secondary process instance and not supported.
239 * Attempt to enable promiscuous mode failed because of timeout.
241 * Failed to enable promiscuous mode.
243 typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
247 * Function used to disable the Rx promiscuous mode of an Ethernet device.
250 * ethdev handle of port.
253 * Negative errno value on error, 0 on success.
256 * Success, promiscuous mode is disabled.
258 * Promiscuous mode disabling is not supported.
261 * @retval -E_RTE_SECONDARY
262 * Function was called from a secondary process instance and not supported.
264 * Attempt to disable promiscuous mode failed because of timeout.
266 * Failed to disable promiscuous mode.
268 typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
272 * Enable the receipt of all multicast packets by an Ethernet device.
275 * ethdev handle of port.
278 * Negative errno value on error, 0 on success.
281 * Success, all-multicast mode is enabled.
283 * All-multicast mode is not supported.
286 * @retval -E_RTE_SECONDARY
287 * Function was called from a secondary process instance and not supported.
289 * Attempt to enable all-multicast mode failed because of timeout.
291 * Failed to enable all-multicast mode.
293 typedef int (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
297 * Disable the receipt of all multicast packets by an Ethernet device.
300 * ethdev handle of port.
303 * Negative errno value on error, 0 on success.
306 * Success, all-multicast mode is disabled.
308 * All-multicast mode disabling is not supported.
311 * @retval -E_RTE_SECONDARY
312 * Function was called from a secondary process instance and not supported.
314 * Attempt to disable all-multicast mode failed because of timeout.
316 * Failed to disable all-multicast mode.
318 typedef int (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
322 * Get link speed, duplex mode and state (up/down) of an Ethernet device.
324 typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
325 int wait_to_complete);
327 /** @internal Get global I/O statistics of an Ethernet device. */
328 typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
329 struct rte_eth_stats *igb_stats);
333 * Reset global I/O statistics of an Ethernet device to 0.
336 * ethdev handle of port.
339 * Negative errno value on error, 0 on success.
342 * Success, statistics has been reset.
344 * Resetting statistics is not supported.
346 * Resetting statistics is not valid.
348 * Not enough memory to get the stats.
350 typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
352 /** @internal Get extended stats of an Ethernet device. */
353 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
354 struct rte_eth_xstat *stats, unsigned int n);
358 * Get extended stats of an Ethernet device.
361 * ethdev handle of port.
363 * IDs array to retrieve specific statistics. Must not be NULL.
365 * A pointer to a table to be filled with device statistics values.
368 * Element count in @p ids and @p values.
371 * - A number of filled in stats.
372 * - A negative value on error.
374 typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
381 * Reset extended stats of an Ethernet device.
384 * ethdev handle of port.
387 * Negative errno value on error, 0 on success.
390 * Success, statistics has been reset.
392 * Resetting statistics is not supported.
394 * Resetting statistics is not valid.
396 * Not enough memory to get the stats.
398 typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
400 /** @internal Get names of extended stats of an Ethernet device. */
401 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
402 struct rte_eth_xstat_name *xstats_names, unsigned int size);
406 * Get names of extended stats of an Ethernet device.
409 * ethdev handle of port.
411 * IDs array to retrieve specific statistics. Must not be NULL.
412 * @param xstats_names
413 * An rte_eth_xstat_name array of at least @p size elements to be filled.
416 * Element count in @p ids and @p xstats_names.
419 * - A number of filled in stats.
420 * - A negative value on error.
422 typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
423 const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
428 * Set a queue statistics mapping for a Tx/Rx queue of an Ethernet device.
430 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
435 /** @internal Get specific information of an Ethernet device. */
436 typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
437 struct rte_eth_dev_info *dev_info);
439 /** @internal Get supported ptypes of an Ethernet device. */
440 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
444 * Inform Ethernet device about reduced range of packet types to handle.
447 * The Ethernet device identifier.
449 * The ptype family that application is interested in should be bitwise OR of
450 * RTE_PTYPE_*_MASK or 0.
454 typedef int (*eth_dev_ptypes_set_t)(struct rte_eth_dev *dev,
455 uint32_t ptype_mask);
457 /** @internal Start Rx and Tx of a queue of an Ethernet device. */
458 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
461 /** @internal Stop Rx and Tx of a queue of an Ethernet device. */
462 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
465 /** @internal Set up a receive queue of an Ethernet device. */
466 typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
467 uint16_t rx_queue_id,
469 unsigned int socket_id,
470 const struct rte_eth_rxconf *rx_conf,
471 struct rte_mempool *mb_pool);
473 /** @internal Setup a transmit queue of an Ethernet device. */
474 typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
475 uint16_t tx_queue_id,
477 unsigned int socket_id,
478 const struct rte_eth_txconf *tx_conf);
480 /** @internal Enable interrupt of a receive queue of an Ethernet device. */
481 typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
482 uint16_t rx_queue_id);
484 /** @internal Disable interrupt of a receive queue of an Ethernet device. */
485 typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
486 uint16_t rx_queue_id);
488 /** @internal Release memory resources allocated by given Rx/Tx queue. */
489 typedef void (*eth_queue_release_t)(struct rte_eth_dev *dev,
492 /** @internal Get firmware information of an Ethernet device. */
493 typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
494 char *fw_version, size_t fw_size);
496 /** @internal Force mbufs to be from Tx ring. */
497 typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
499 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
500 uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
502 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
503 uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
505 typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev,
506 uint16_t queue_id, struct rte_eth_burst_mode *mode);
508 /** @internal Set MTU. */
509 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
511 /** @internal Filtering of a VLAN Tag Identifier by an Ethernet device. */
512 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
516 /** @internal Set the outer/inner VLAN-TPID by an Ethernet device. */
517 typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
518 enum rte_vlan_type type, uint16_t tpid);
520 /** @internal Set VLAN offload function by an Ethernet device. */
521 typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
523 /** @internal Set port based Tx VLAN insertion by an Ethernet device. */
524 typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
528 /** @internal VLAN stripping enable/disable by an queue of Ethernet device. */
529 typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
530 uint16_t rx_queue_id,
533 /** @internal Get current flow control parameter on an Ethernet device. */
534 typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
535 struct rte_eth_fc_conf *fc_conf);
537 /** @internal Setup flow control parameter on an Ethernet device. */
538 typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
539 struct rte_eth_fc_conf *fc_conf);
541 /** @internal Setup priority flow control parameter on an Ethernet device. */
542 typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
543 struct rte_eth_pfc_conf *pfc_conf);
545 /** @internal Get info for queue based PFC on an Ethernet device. */
546 typedef int (*priority_flow_ctrl_queue_info_get_t)(struct rte_eth_dev *dev,
547 struct rte_eth_pfc_queue_info *pfc_queue_info);
548 /** @internal Configure queue based PFC parameter on an Ethernet device. */
549 typedef int (*priority_flow_ctrl_queue_config_t)(struct rte_eth_dev *dev,
550 struct rte_eth_pfc_queue_conf *pfc_queue_conf);
552 /** @internal Update RSS redirection table on an Ethernet device. */
553 typedef int (*reta_update_t)(struct rte_eth_dev *dev,
554 struct rte_eth_rss_reta_entry64 *reta_conf,
557 /** @internal Query RSS redirection table on an Ethernet device. */
558 typedef int (*reta_query_t)(struct rte_eth_dev *dev,
559 struct rte_eth_rss_reta_entry64 *reta_conf,
562 /** @internal Update RSS hash configuration of an Ethernet device. */
563 typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
564 struct rte_eth_rss_conf *rss_conf);
566 /** @internal Get current RSS hash configuration of an Ethernet device. */
567 typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
568 struct rte_eth_rss_conf *rss_conf);
570 /** @internal Turn on SW controllable LED on an Ethernet device. */
571 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
573 /** @internal Turn off SW controllable LED on an Ethernet device. */
574 typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
576 /** @internal Remove MAC address from receive address register. */
577 typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
579 /** @internal Set a MAC address into Receive Address Register. */
580 typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
581 struct rte_ether_addr *mac_addr,
585 /** @internal Set a MAC address into Receive Address Register. */
586 typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
587 struct rte_ether_addr *mac_addr);
589 /** @internal Set a Unicast Hash bitmap. */
590 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
591 struct rte_ether_addr *mac_addr,
594 /** @internal Set all Unicast Hash bitmap. */
595 typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
598 /** @internal Set queue Tx rate. */
599 typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
603 /** @internal Add tunneling UDP port. */
604 typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
605 struct rte_eth_udp_tunnel *tunnel_udp);
607 /** @internal Delete tunneling UDP port. */
608 typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
609 struct rte_eth_udp_tunnel *tunnel_udp);
611 /** @internal set the list of multicast addresses on an Ethernet device. */
612 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
613 struct rte_ether_addr *mc_addr_set,
614 uint32_t nb_mc_addr);
616 /** @internal Function used to enable IEEE1588/802.1AS timestamping. */
617 typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
619 /** @internal Function used to disable IEEE1588/802.1AS timestamping. */
620 typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
622 /** @internal Function used to read an Rx IEEE1588/802.1AS timestamp. */
623 typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
624 struct timespec *timestamp,
627 /** @internal Function used to read a Tx IEEE1588/802.1AS timestamp. */
628 typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
629 struct timespec *timestamp);
631 /** @internal Function used to adjust the device clock. */
632 typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
634 /** @internal Function used to get time from the device clock. */
635 typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
636 struct timespec *timestamp);
638 /** @internal Function used to get time from the device clock. */
639 typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
640 const struct timespec *timestamp);
642 /** @internal Function used to get the current value of the device clock. */
643 typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
644 uint64_t *timestamp);
646 /** @internal Retrieve registers. */
647 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
648 struct rte_dev_reg_info *info);
650 /** @internal Retrieve EEPROM size. */
651 typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
653 /** @internal Retrieve EEPROM data. */
654 typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
655 struct rte_dev_eeprom_info *info);
657 /** @internal Program EEPROM data. */
658 typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
659 struct rte_dev_eeprom_info *info);
661 /** @internal Retrieve type and size of plugin module EEPROM. */
662 typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
663 struct rte_eth_dev_module_info *modinfo);
665 /** @internal Retrieve plugin module EEPROM data. */
666 typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
667 struct rte_dev_eeprom_info *info);
672 * Get flow operations.
674 * If the flow API is not supported for the specified device,
675 * the driver can return NULL.
677 typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev,
678 const struct rte_flow_ops **ops);
680 /** @internal Get Traffic Management (TM) operations on an Ethernet device. */
681 typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
683 /** @internal Get Traffic Metering and Policing (MTR) operations. */
684 typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
686 /** @internal Get DCB information on an Ethernet device. */
687 typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
688 struct rte_eth_dcb_info *dcb_info);
690 /** @internal Test if a port supports specific mempool ops. */
691 typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
696 * Get the hairpin capabilities.
699 * ethdev handle of port.
701 * returns the hairpin capabilities from the device.
704 * Negative errno value on error, 0 on success.
707 * Success, hairpin is supported.
709 * Hairpin is not supported.
711 typedef int (*eth_hairpin_cap_get_t)(struct rte_eth_dev *dev,
712 struct rte_eth_hairpin_cap *cap);
716 * Setup Rx hairpin queue.
719 * ethdev handle of port.
721 * the selected Rx queue index.
723 * the requested number of descriptors for this queue. 0 - use PMD default.
725 * the Rx hairpin configuration structure.
728 * Negative errno value on error, 0 on success.
731 * Success, hairpin is supported.
733 * Hairpin is not supported.
735 * One of the parameters is invalid.
737 * Unable to allocate resources.
739 typedef int (*eth_rx_hairpin_queue_setup_t)
740 (struct rte_eth_dev *dev, uint16_t rx_queue_id,
742 const struct rte_eth_hairpin_conf *conf);
746 * Setup Tx hairpin queue.
749 * ethdev handle of port.
751 * the selected Tx queue index.
753 * the requested number of descriptors for this queue. 0 - use PMD default.
755 * the Tx hairpin configuration structure.
758 * Negative errno value on error, 0 on success.
761 * Success, hairpin is supported.
763 * Hairpin is not supported.
765 * One of the parameters is invalid.
767 * Unable to allocate resources.
769 typedef int (*eth_tx_hairpin_queue_setup_t)
770 (struct rte_eth_dev *dev, uint16_t tx_queue_id,
772 const struct rte_eth_hairpin_conf *hairpin_conf);
776 * Get Forward Error Correction(FEC) capability.
779 * ethdev handle of port.
780 * @param speed_fec_capa
781 * speed_fec_capa is out only with per-speed capabilities.
783 * a number of elements in an speed_fec_capa array.
786 * Negative errno value on error, positive value on success.
788 * @retval positive value
789 * A non-negative value lower or equal to num: success. The return value
790 * is the number of entries filled in the fec capa array.
791 * A non-negative value higher than num: error, the given fec capa array
792 * is too small. The return value corresponds to the num that should
793 * be given to succeed. The entries in the fec capa array are not valid
794 * and shall not be used by the caller.
796 * Operation is not supported.
800 * *num* or *speed_fec_capa* invalid.
802 typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev,
803 struct rte_eth_fec_capa *speed_fec_capa, unsigned int num);
807 * Get Forward Error Correction(FEC) mode.
810 * ethdev handle of port.
812 * a bitmask of enabled FEC modes. If AUTO bit is set, other
813 * bits specify FEC modes which may be negotiated. If AUTO
814 * bit is clear, specify FEC modes to be used (only one valid
815 * mode per speed may be set).
818 * Negative errno value on error, 0 on success.
821 * Success, get FEC success.
823 * Operation is not supported.
827 typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev,
832 * Set Forward Error Correction(FEC) mode.
835 * ethdev handle of port.
837 * bitmask of allowed FEC modes. It must be only one
838 * if AUTO is disabled. If AUTO is enabled, other
839 * bits specify FEC modes which may be negotiated.
842 * Negative errno value on error, 0 on success.
845 * Success, set FEC success.
847 * Operation is not supported.
849 * Unsupported FEC mode requested.
853 typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, uint32_t fec_capa);
857 * Get all hairpin Tx/Rx peer ports of the current device, if any.
860 * ethdev handle of port.
862 * array to save the ports list.
866 * value to decide the current to peer direction
867 * positive - used as Tx to get all peer Rx ports.
868 * zero - used as Rx to get all peer Tx ports.
871 * Negative errno value on error, 0 or positive on success.
874 * Success, no peer ports.
876 * Actual number of the peer ports.
878 * Get peer ports API is not supported.
880 * One of the parameters is invalid.
882 typedef int (*hairpin_get_peer_ports_t)(struct rte_eth_dev *dev,
883 uint16_t *peer_ports, size_t len,
888 * Bind all hairpin Tx queues of one port to the Rx queues of the peer port.
891 * ethdev handle of port.
896 * Negative errno value on error, 0 on success.
899 * Success, bind successfully.
901 * Bind API is not supported.
903 * One of the parameters is invalid.
905 * Device is not started.
907 typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev,
912 * Unbind all hairpin Tx queues of one port from the Rx queues of the peer port.
915 * ethdev handle of port.
920 * Negative errno value on error, 0 on success.
923 * Success, unbind successfully.
925 * Bind API is not supported.
927 * One of the parameters is invalid.
929 * Device is already stopped.
931 typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev,
934 /** @internal Update and fetch peer queue information. */
935 typedef int (*eth_hairpin_queue_peer_update_t)
936 (struct rte_eth_dev *dev, uint16_t peer_queue,
937 struct rte_hairpin_peer_info *current_info,
938 struct rte_hairpin_peer_info *peer_info, uint32_t direction);
940 /** @internal Bind peer queue to the current queue with fetched information. */
941 typedef int (*eth_hairpin_queue_peer_bind_t)
942 (struct rte_eth_dev *dev, uint16_t cur_queue,
943 struct rte_hairpin_peer_info *peer_info, uint32_t direction);
945 /** @internal Unbind peer queue from the current queue. */
946 typedef int (*eth_hairpin_queue_peer_unbind_t)
947 (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction);
951 * Get address of memory location whose contents will change whenever there is
952 * new data to be received on an Rx queue.
955 * Ethdev queue pointer.
957 * The pointer to power-optimized monitoring condition structure.
959 * Negative errno value on error, 0 on success.
966 typedef int (*eth_get_monitor_addr_t)(void *rxq,
967 struct rte_power_monitor_cond *pmc);
971 * Get representor info to be able to calculate the unique representor ID.
973 * Caller should pass NULL as pointer of info to get number of entries,
974 * allocate info buffer according to returned entry number, then call
975 * again with buffer to get real info.
977 * To calculate the representor ID, caller should iterate each entry,
978 * match controller index, pf index, vf or sf start index and range,
979 * then calculate representor ID from offset to vf/sf start index.
980 * @see rte_eth_representor_id_get.
983 * Ethdev handle of port.
985 * Pointer to memory to save device representor info.
987 * Negative errno value on error, number of info entries otherwise.
990 typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev,
991 struct rte_eth_representor_info *info);
995 * Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD.
998 * Port (ethdev) handle
1000 * @param[inout] features
1001 * Feature selection buffer
1004 * Negative errno value on error, zero otherwise
1006 typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev,
1007 uint64_t *features);
1011 * Get IP reassembly offload capability of a PMD.
1014 * Port (ethdev) handle
1017 * IP reassembly capability supported by the PMD
1020 * Negative errno value on error, zero otherwise
1022 typedef int (*eth_ip_reassembly_capability_get_t)(struct rte_eth_dev *dev,
1023 struct rte_eth_ip_reassembly_params *capa);
1027 * Get IP reassembly offload configuration parameters set in PMD.
1030 * Port (ethdev) handle
1033 * Configuration parameters for IP reassembly.
1036 * Negative errno value on error, zero otherwise
1038 typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev,
1039 struct rte_eth_ip_reassembly_params *conf);
1043 * Set configuration parameters for enabling IP reassembly offload in hardware.
1046 * Port (ethdev) handle
1049 * Configuration parameters for IP reassembly.
1052 * Negative errno value on error, zero otherwise
1054 typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev,
1055 const struct rte_eth_ip_reassembly_params *conf);
1059 * Dump private info from device to a file.
1062 * Port (ethdev) handle.
1064 * A pointer to a file for output.
1067 * Negative value on error, 0 on success.
1074 typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file);
1077 * @internal Set Rx queue available descriptors threshold.
1078 * @see rte_eth_rx_avail_thresh_set()
1080 * Driver should round down number of descriptors on conversion from
1083 typedef int (*eth_rx_queue_avail_thresh_set_t)(struct rte_eth_dev *dev,
1084 uint16_t rx_queue_id,
1085 uint8_t avail_thresh);
1088 * @internal Query Rx queue available descriptors threshold event.
1089 * @see rte_eth_rx_avail_thresh_query()
1092 typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
1093 uint16_t *rx_queue_id,
1094 uint8_t *avail_thresh);
1097 * @internal A structure containing the functions exported by an Ethernet driver.
1099 struct eth_dev_ops {
1100 eth_dev_configure_t dev_configure; /**< Configure device */
1101 eth_dev_start_t dev_start; /**< Start device */
1102 eth_dev_stop_t dev_stop; /**< Stop device */
1103 eth_dev_set_link_up_t dev_set_link_up; /**< Device link up */
1104 eth_dev_set_link_down_t dev_set_link_down; /**< Device link down */
1105 eth_dev_close_t dev_close; /**< Close device */
1106 eth_dev_reset_t dev_reset; /**< Reset device */
1107 eth_link_update_t link_update; /**< Get device link state */
1108 /** Check if the device was physically removed */
1109 eth_is_removed_t is_removed;
1111 eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON */
1112 eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF */
1113 eth_allmulticast_enable_t allmulticast_enable;/**< Rx multicast ON */
1114 eth_allmulticast_disable_t allmulticast_disable;/**< Rx multicast OFF */
1115 eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address */
1116 eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */
1117 eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address */
1118 /** Set list of multicast addresses */
1119 eth_set_mc_addr_list_t set_mc_addr_list;
1120 mtu_set_t mtu_set; /**< Set MTU */
1122 /** Get generic device statistics */
1123 eth_stats_get_t stats_get;
1124 /** Reset generic device statistics */
1125 eth_stats_reset_t stats_reset;
1126 /** Get extended device statistics */
1127 eth_xstats_get_t xstats_get;
1128 /** Reset extended device statistics */
1129 eth_xstats_reset_t xstats_reset;
1130 /** Get names of extended statistics */
1131 eth_xstats_get_names_t xstats_get_names;
1132 /** Configure per queue stat counter mapping */
1133 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1135 eth_dev_infos_get_t dev_infos_get; /**< Get device info */
1136 /** Retrieve Rx queue information */
1137 eth_rxq_info_get_t rxq_info_get;
1138 /** Retrieve Tx queue information */
1139 eth_txq_info_get_t txq_info_get;
1140 eth_burst_mode_get_t rx_burst_mode_get; /**< Get Rx burst mode */
1141 eth_burst_mode_get_t tx_burst_mode_get; /**< Get Tx burst mode */
1142 eth_fw_version_get_t fw_version_get; /**< Get firmware version */
1144 /** Get packet types supported and identified by device */
1145 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
1147 * Inform Ethernet device about reduced range of packet types to
1150 eth_dev_ptypes_set_t dev_ptypes_set;
1152 /** Filter VLAN Setup */
1153 vlan_filter_set_t vlan_filter_set;
1154 /** Outer/Inner VLAN TPID Setup */
1155 vlan_tpid_set_t vlan_tpid_set;
1156 /** VLAN Stripping on queue */
1157 vlan_strip_queue_set_t vlan_strip_queue_set;
1158 /** Set VLAN Offload */
1159 vlan_offload_set_t vlan_offload_set;
1160 /** Set port based Tx VLAN insertion */
1161 vlan_pvid_set_t vlan_pvid_set;
1163 eth_queue_start_t rx_queue_start;/**< Start Rx for a queue */
1164 eth_queue_stop_t rx_queue_stop; /**< Stop Rx for a queue */
1165 eth_queue_start_t tx_queue_start;/**< Start Tx for a queue */
1166 eth_queue_stop_t tx_queue_stop; /**< Stop Tx for a queue */
1167 eth_rx_queue_setup_t rx_queue_setup;/**< Set up device Rx queue */
1168 eth_queue_release_t rx_queue_release; /**< Release Rx queue */
1170 /** Enable Rx queue interrupt */
1171 eth_rx_enable_intr_t rx_queue_intr_enable;
1172 /** Disable Rx queue interrupt */
1173 eth_rx_disable_intr_t rx_queue_intr_disable;
1175 eth_tx_queue_setup_t tx_queue_setup;/**< Set up device Tx queue */
1176 eth_queue_release_t tx_queue_release; /**< Release Tx queue */
1177 eth_tx_done_cleanup_t tx_done_cleanup;/**< Free Tx ring mbufs */
1179 eth_dev_led_on_t dev_led_on; /**< Turn on LED */
1180 eth_dev_led_off_t dev_led_off; /**< Turn off LED */
1182 flow_ctrl_get_t flow_ctrl_get; /**< Get flow control */
1183 flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control */
1184 /** Setup priority flow control */
1185 priority_flow_ctrl_set_t priority_flow_ctrl_set;
1186 /** Priority flow control queue info get */
1187 priority_flow_ctrl_queue_info_get_t priority_flow_ctrl_queue_info_get;
1188 /** Priority flow control queue configure */
1189 priority_flow_ctrl_queue_config_t priority_flow_ctrl_queue_config;
1191 /** Set Unicast Table Array */
1192 eth_uc_hash_table_set_t uc_hash_table_set;
1193 /** Set Unicast hash bitmap */
1194 eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1196 /** Add UDP tunnel port */
1197 eth_udp_tunnel_port_add_t udp_tunnel_port_add;
1198 /** Delete UDP tunnel port */
1199 eth_udp_tunnel_port_del_t udp_tunnel_port_del;
1201 /** Set queue rate limit */
1202 eth_set_queue_rate_limit_t set_queue_rate_limit;
1204 /** Configure RSS hash protocols and hashing key */
1205 rss_hash_update_t rss_hash_update;
1206 /** Get current RSS hash configuration */
1207 rss_hash_conf_get_t rss_hash_conf_get;
1208 /** Update redirection table */
1209 reta_update_t reta_update;
1210 /** Query redirection table */
1211 reta_query_t reta_query;
1213 eth_get_reg_t get_reg; /**< Get registers */
1214 eth_get_eeprom_length_t get_eeprom_length; /**< Get EEPROM length */
1215 eth_get_eeprom_t get_eeprom; /**< Get EEPROM data */
1216 eth_set_eeprom_t set_eeprom; /**< Set EEPROM */
1218 /** Get plugin module EEPROM attribute */
1219 eth_get_module_info_t get_module_info;
1220 /** Get plugin module EEPROM data */
1221 eth_get_module_eeprom_t get_module_eeprom;
1223 eth_flow_ops_get_t flow_ops_get; /**< Get flow operations */
1225 eth_get_dcb_info get_dcb_info; /**< Get DCB information */
1227 /** Turn IEEE1588/802.1AS timestamping on */
1228 eth_timesync_enable_t timesync_enable;
1229 /** Turn IEEE1588/802.1AS timestamping off */
1230 eth_timesync_disable_t timesync_disable;
1231 /** Read the IEEE1588/802.1AS Rx timestamp */
1232 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1233 /** Read the IEEE1588/802.1AS Tx timestamp */
1234 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1235 /** Adjust the device clock */
1236 eth_timesync_adjust_time timesync_adjust_time;
1237 /** Get the device clock time */
1238 eth_timesync_read_time timesync_read_time;
1239 /** Set the device clock time */
1240 eth_timesync_write_time timesync_write_time;
1242 eth_read_clock read_clock;
1244 /** Get extended device statistic values by ID */
1245 eth_xstats_get_by_id_t xstats_get_by_id;
1246 /** Get name of extended device statistics by ID */
1247 eth_xstats_get_names_by_id_t xstats_get_names_by_id;
1249 /** Get Traffic Management (TM) operations */
1250 eth_tm_ops_get_t tm_ops_get;
1252 /** Get Traffic Metering and Policing (MTR) operations */
1253 eth_mtr_ops_get_t mtr_ops_get;
1255 /** Test if a port supports specific mempool ops */
1256 eth_pool_ops_supported_t pool_ops_supported;
1258 /** Returns the hairpin capabilities */
1259 eth_hairpin_cap_get_t hairpin_cap_get;
1260 /** Set up device Rx hairpin queue */
1261 eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup;
1262 /** Set up device Tx hairpin queue */
1263 eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup;
1265 /** Get Forward Error Correction(FEC) capability */
1266 eth_fec_get_capability_t fec_get_capability;
1267 /** Get Forward Error Correction(FEC) mode */
1268 eth_fec_get_t fec_get;
1269 /** Set Forward Error Correction(FEC) mode */
1270 eth_fec_set_t fec_set;
1272 /** Get hairpin peer ports list */
1273 hairpin_get_peer_ports_t hairpin_get_peer_ports;
1274 /** Bind all hairpin Tx queues of device to the peer port Rx queues */
1275 eth_hairpin_bind_t hairpin_bind;
1276 /** Unbind all hairpin Tx queues from the peer port Rx queues */
1277 eth_hairpin_unbind_t hairpin_unbind;
1278 /** Pass the current queue info and get the peer queue info */
1279 eth_hairpin_queue_peer_update_t hairpin_queue_peer_update;
1280 /** Set up the connection between the pair of hairpin queues */
1281 eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind;
1282 /** Disconnect the hairpin queues of a pair from each other */
1283 eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind;
1285 /** Get power monitoring condition for Rx queue */
1286 eth_get_monitor_addr_t get_monitor_addr;
1288 /** Get representor info */
1289 eth_representor_info_get_t representor_info_get;
1292 * Negotiate the NIC's ability to deliver specific
1293 * kinds of metadata to the PMD
1295 eth_rx_metadata_negotiate_t rx_metadata_negotiate;
1297 /** Get IP reassembly capability */
1298 eth_ip_reassembly_capability_get_t ip_reassembly_capability_get;
1299 /** Get IP reassembly configuration */
1300 eth_ip_reassembly_conf_get_t ip_reassembly_conf_get;
1301 /** Set IP reassembly configuration */
1302 eth_ip_reassembly_conf_set_t ip_reassembly_conf_set;
1304 /** Dump private info from device */
1305 eth_dev_priv_dump_t eth_dev_priv_dump;
1307 /** Set Rx queue available descriptors threshold */
1308 eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
1309 /** Query Rx queue available descriptors threshold event */
1310 eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
1315 * Check if the selected Rx queue is hairpin queue.
1318 * Pointer to the selected device.
1320 * The selected queue.
1323 * - (1) if the queue is hairpin queue, 0 otherwise.
1326 int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
1330 * Check if the selected Tx queue is hairpin queue.
1333 * Pointer to the selected device.
1335 * The selected queue.
1338 * - (1) if the queue is hairpin queue, 0 otherwise.
1341 int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
1345 * Returns a ethdev slot specified by the unique identifier name.
1348 * The pointer to the Unique identifier name for each Ethernet device
1350 * - The pointer to the ethdev slot, on success. NULL on error
1353 struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
1357 * Allocates a new ethdev slot for an Ethernet device and returns the pointer
1358 * to that slot for the driver to use.
1360 * @param name Unique identifier name for each Ethernet device
1362 * - Slot in the rte_dev_devices array for a new device;
1365 struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
1369 * Attach to the ethdev already initialized by the primary
1372 * @param name Ethernet device's name.
1374 * - Success: Slot in the rte_dev_devices array for attached
1376 * - Error: Null pointer.
1379 struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name);
1383 * Notify RTE_ETH_EVENT_DESTROY and release the specified ethdev port.
1385 * The following PMD-managed data fields will be freed:
1389 * If one of these fields should not be freed,
1390 * it must be reset to NULL by the PMD, typically in dev_close method.
1393 * Device to be detached.
1395 * - 0 on success, negative on error
1398 int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
1402 * Release device queues and clear its configuration to force the user
1403 * application to reconfigure it. It is for internal use only.
1406 * Pointer to struct rte_eth_dev.
1412 void rte_eth_dev_internal_reset(struct rte_eth_dev *dev);
1415 * @internal Executes all the user application registered callbacks for
1416 * the specific device. It is for DPDK internal user only. User
1417 * application should not call it directly.
1420 * Pointer to struct rte_eth_dev.
1422 * Eth device interrupt event type.
1424 * To pass data back to user application.
1425 * This allows the user application to decide if a particular function
1426 * is permitted or not.
1432 int rte_eth_dev_callback_process(struct rte_eth_dev *dev,
1433 enum rte_eth_event_type event, void *ret_param);
1437 * This is the last step of device probing.
1438 * It must be called after a port is allocated and initialized successfully.
1440 * The notification RTE_ETH_EVENT_NEW is sent to other entities
1441 * (libraries and applications).
1442 * The state is set as RTE_ETH_DEV_ATTACHED.
1448 void rte_eth_dev_probing_finish(struct rte_eth_dev *dev);
1451 * Create memzone for HW rings.
1452 * malloc can't be used as the physical address is needed.
1453 * If the memzone is already created, then this function returns a ptr
1457 * The *eth_dev* pointer is the address of the *rte_eth_dev* structure
1459 * The name of the memory zone
1461 * The index of the queue to add to name
1463 * The sizeof of the memory area
1465 * Alignment for resulting memzone. Must be a power of 2.
1467 * The *socket_id* argument is the socket identifier in case of NUMA.
1470 const struct rte_memzone *
1471 rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
1472 uint16_t queue_id, size_t size,
1473 unsigned align, int socket_id);
1476 * Free previously allocated memzone for HW rings.
1479 * The *eth_dev* pointer is the address of the *rte_eth_dev* structure
1481 * The name of the memory zone
1483 * The index of the queue to add to name
1485 * Negative errno value on error, 0 on success.
1489 rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name,
1494 * Atomically set the link status for the specific device.
1495 * It is for use by DPDK device driver use only.
1496 * User applications should not call it
1499 * Pointer to struct rte_eth_dev.
1501 * New link status value.
1503 * Same convention as eth_link_update operation.
1504 * 0 if link up status has changed
1505 * -1 if link up status was unchanged
1508 rte_eth_linkstatus_set(struct rte_eth_dev *dev,
1509 const struct rte_eth_link *new_link)
1511 uint64_t *dev_link = (uint64_t *)&(dev->data->dev_link);
1514 struct rte_eth_link link;
1517 RTE_BUILD_BUG_ON(sizeof(*new_link) != sizeof(uint64_t));
1519 orig.val64 = __atomic_exchange_n(dev_link, *(const uint64_t *)new_link,
1522 return (orig.link.link_status == new_link->link_status) ? -1 : 0;
1527 * Atomically get the link speed and status.
1530 * Pointer to struct rte_eth_dev.
1532 * link status value.
1535 rte_eth_linkstatus_get(const struct rte_eth_dev *dev,
1536 struct rte_eth_link *link)
1538 uint64_t *src = (uint64_t *)&(dev->data->dev_link);
1539 uint64_t *dst = (uint64_t *)link;
1541 RTE_BUILD_BUG_ON(sizeof(*link) != sizeof(uint64_t));
1543 *dst = __atomic_load_n(src, __ATOMIC_SEQ_CST);
1548 * Dummy DPDK callback for Rx/Tx packet burst.
1551 * Pointer to Rx/Tx queue
1555 * Number of packets in packet array
1559 rte_eth_pkt_burst_dummy(void *queue __rte_unused,
1560 struct rte_mbuf **pkts __rte_unused,
1561 uint16_t nb_pkts __rte_unused);
1564 * Allocate an unique switch domain identifier.
1566 * A pool of switch domain identifiers which can be allocated on request. This
1567 * will enabled devices which support the concept of switch domains to request
1568 * a switch domain ID which is guaranteed to be unique from other devices
1569 * running in the same process.
1572 * switch domain identifier parameter to pass back to application
1575 * Negative errno value on error, 0 on success.
1579 rte_eth_switch_domain_alloc(uint16_t *domain_id);
1582 * Free switch domain.
1584 * Return a switch domain identifier to the pool of free identifiers after it is
1585 * no longer in use by device.
1588 * switch domain identifier to free
1591 * Negative errno value on error, 0 on success.
1595 rte_eth_switch_domain_free(uint16_t domain_id);
1598 * Generic Ethernet device arguments
1600 * One type of representor each structure.
1602 struct rte_eth_devargs {
1603 uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS];
1604 /** controller/s number in case of multi-host */
1605 uint16_t nb_mh_controllers;
1606 /** number of controllers in multi-host controllers field */
1607 uint16_t ports[RTE_MAX_ETHPORTS];
1608 /** port/s number to enable on a multi-port single function */
1610 /** number of ports in ports field */
1611 uint16_t representor_ports[RTE_MAX_ETHPORTS];
1612 /** representor port/s identifier to enable on device */
1613 uint16_t nb_representor_ports;
1614 /** number of ports in representor port field */
1615 enum rte_eth_representor_type type; /* type of representor */
1619 * PMD helper function to get representor ID from location detail.
1621 * Get representor ID from controller, pf and (sf or vf).
1622 * The mapping is retrieved from rte_eth_representor_info_get().
1624 * For backward compatibility, if no representor info, direct
1625 * map legacy VF (no controller and pf).
1628 * Port ID of the backing device.
1632 * Controller ID, -1 if unspecified.
1634 * PF port ID, -1 if unspecified.
1635 * @param representor_port
1636 * VF or SF representor port number, -1 if unspecified.
1638 * Pointer to output representor ID.
1641 * Negative errno value on error, 0 on success.
1645 rte_eth_representor_id_get(uint16_t port_id,
1646 enum rte_eth_representor_type type,
1647 int controller, int pf, int representor_port,
1651 * PMD helper function to parse ethdev arguments
1655 * @param eth_devargs
1656 * parsed ethdev specific arguments.
1659 * Negative errno value on error, 0 on success.
1663 rte_eth_devargs_parse(const char *devargs, struct rte_eth_devargs *eth_devargs);
1666 typedef int (*ethdev_init_t)(struct rte_eth_dev *ethdev, void *init_params);
1667 typedef int (*ethdev_bus_specific_init)(struct rte_eth_dev *ethdev,
1668 void *bus_specific_init_params);
1671 * PMD helper function for the creation of a new ethdev ports.
1674 * rte_device handle.
1677 * @param priv_data_size
1678 * size of private data required for port.
1679 * @param bus_specific_init
1680 * port bus specific initialisation callback function
1681 * @param bus_init_params
1682 * port bus specific initialisation parameters
1683 * @param ethdev_init
1684 * device specific port initialization callback function
1685 * @param init_params
1686 * port initialisation parameters
1689 * Negative errno value on error, 0 on success.
1693 rte_eth_dev_create(struct rte_device *device, const char *name,
1694 size_t priv_data_size,
1695 ethdev_bus_specific_init bus_specific_init, void *bus_init_params,
1696 ethdev_init_t ethdev_init, void *init_params);
1699 typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev);
1702 * PMD helper function for cleaning up the resources of a ethdev port on it's
1706 * ethdev handle of port.
1707 * @param ethdev_uninit
1708 * device specific port un-initialise callback function
1711 * Negative errno value on error, 0 on success.
1715 rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit);
1719 * Pass the current hairpin queue HW and/or SW information to the peer queue
1720 * and fetch back the information of the peer queue.
1723 * Peer port identifier of the Ethernet device.
1725 * Peer queue index of the port.
1727 * Pointer to the current information structure.
1729 * Pointer to the peer information, output.
1731 * Direction to pass the information.
1732 * positive - pass Tx queue information and get peer Rx queue information
1733 * zero - pass Rx queue information and get peer Tx queue information
1736 * Negative errno value on error, 0 on success.
1740 rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
1741 struct rte_hairpin_peer_info *cur_info,
1742 struct rte_hairpin_peer_info *peer_info,
1743 uint32_t direction);
1747 * Configure current hairpin queue with the peer information fetched to create
1748 * the connection (bind) with peer queue in the specified direction.
1749 * This function might need to be called twice to fully create the connections.
1752 * Current port identifier of the Ethernet device.
1754 * Current queue index of the port.
1756 * Pointer to the peer information, input.
1758 * Direction to create the connection.
1759 * positive - bind current Tx queue to peer Rx queue
1760 * zero - bind current Rx queue to peer Tx queue
1763 * Negative errno value on error, 0 on success.
1767 rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
1768 struct rte_hairpin_peer_info *peer_info,
1769 uint32_t direction);
1773 * Get rte_eth_dev from device name. The device name should be specified
1775 * - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0
1776 * - SoC device name, for example fsl-gmac0
1777 * - vdev dpdk name, for example net_[pcap0|null0|tap0]
1780 * PCI address or name of the device
1782 * - rte_eth_dev if successful
1787 rte_eth_dev_get_by_name(const char *name);
1791 * Reset the current queue state and configuration to disconnect (unbind) it
1792 * from the peer queue.
1793 * This function might need to be called twice to disconnect each other.
1796 * Current port identifier of the Ethernet device.
1798 * Current queue index of the port.
1800 * Direction to destroy the connection.
1801 * positive - unbind current Tx queue from peer Rx queue
1802 * zero - unbind current Rx queue from peer Tx queue
1805 * Negative errno value on error, 0 on success.
1809 rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
1810 uint32_t direction);
1814 * Register mbuf dynamic field and flag for IP reassembly incomplete case.
1818 rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag);
1822 * Legacy ethdev API used internally by drivers.
1825 enum rte_filter_type {
1826 RTE_ETH_FILTER_NONE = 0,
1827 RTE_ETH_FILTER_ETHERTYPE,
1828 RTE_ETH_FILTER_FLEXIBLE,
1830 RTE_ETH_FILTER_NTUPLE,
1831 RTE_ETH_FILTER_TUNNEL,
1832 RTE_ETH_FILTER_FDIR,
1833 RTE_ETH_FILTER_HASH,
1834 RTE_ETH_FILTER_L2_TUNNEL,
1838 * Define all structures for Ethertype Filter type.
1841 #define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */
1842 #define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */
1845 * A structure used to define the ethertype filter entry
1846 * to support RTE_ETH_FILTER_ETHERTYPE data representation.
1848 struct rte_eth_ethertype_filter {
1849 struct rte_ether_addr mac_addr; /**< Mac address to match */
1850 uint16_t ether_type; /**< Ether type to match */
1851 uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */
1852 uint16_t queue; /**< Queue assigned to when match */
1856 * A structure used to define the TCP syn filter entry
1857 * to support RTE_ETH_FILTER_SYN data representation.
1859 struct rte_eth_syn_filter {
1860 /** 1 - higher priority than other filters, 0 - lower priority */
1862 uint16_t queue; /**< Queue assigned to when match */
1866 * filter type of tunneling packet
1868 #define RTE_ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
1869 #define RTE_ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */
1870 #define RTE_ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
1871 #define RTE_ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */
1872 #define RTE_ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
1873 #define RTE_ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */
1875 #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN (RTE_ETH_TUNNEL_FILTER_IMAC | \
1876 RTE_ETH_TUNNEL_FILTER_IVLAN)
1877 #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
1878 RTE_ETH_TUNNEL_FILTER_IVLAN | \
1879 RTE_ETH_TUNNEL_FILTER_TENID)
1880 #define RTE_ETH_TUNNEL_FILTER_IMAC_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
1881 RTE_ETH_TUNNEL_FILTER_TENID)
1882 #define RTE_ETH_TUNNEL_FILTER_OMAC_TENID_IMAC (RTE_ETH_TUNNEL_FILTER_OMAC | \
1883 RTE_ETH_TUNNEL_FILTER_TENID | \
1884 RTE_ETH_TUNNEL_FILTER_IMAC)
1887 * Select IPv4 or IPv6 for tunnel filters.
1889 enum rte_tunnel_iptype {
1890 RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4 */
1891 RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6 */
1895 * Tunneling Packet filter configuration.
1897 struct rte_eth_tunnel_filter_conf {
1898 struct rte_ether_addr outer_mac; /**< Outer MAC address to match */
1899 struct rte_ether_addr inner_mac; /**< Inner MAC address to match */
1900 uint16_t inner_vlan; /**< Inner VLAN to match */
1901 enum rte_tunnel_iptype ip_type; /**< IP address type */
1903 * Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP
1904 * is set in filter_type, or inner destination IP address to match
1905 * if ETH_TUNNEL_FILTER_IIP is set in filter_type.
1908 uint32_t ipv4_addr; /**< IPv4 address in big endian */
1909 uint32_t ipv6_addr[4]; /**< IPv6 address in big endian */
1911 /** Flags from ETH_TUNNEL_FILTER_XX - see above */
1912 uint16_t filter_type;
1913 enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type */
1914 uint32_t tenant_id; /**< Tenant ID to match: VNI, GRE key... */
1915 uint16_t queue_id; /**< Queue assigned to if match */
1922 #endif /* _RTE_ETHDEV_DRIVER_H_ */