1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
5 #ifndef _RTE_ETHDEV_CORE_H_
6 #define _RTE_ETHDEV_CORE_H_
11 * RTE Ethernet Device internal header.
13 * This header contains internal data types. But they are still part of the
14 * public API because they are used by inline functions in the published API.
16 * Applications should not use these directly.
20 struct rte_eth_dev_callback;
21 /** @internal Structure to keep track of registered callbacks */
22 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
25 * Definitions of all functions exported by an Ethernet driver through the
26 * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
27 * structure associated with an Ethernet device.
31 typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
32 /**< @internal Ethernet device configuration. */
34 typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
35 /**< @internal Function used to start a configured Ethernet device. */
37 typedef void (*eth_dev_stop_t)(struct rte_eth_dev *dev);
38 /**< @internal Function used to stop a configured Ethernet device. */
40 typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
41 /**< @internal Function used to link up a configured Ethernet device. */
43 typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
44 /**< @internal Function used to link down a configured Ethernet device. */
46 typedef void (*eth_dev_close_t)(struct rte_eth_dev *dev);
47 /**< @internal Function used to close a configured Ethernet device. */
49 typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
50 /** <@internal Function used to reset a configured Ethernet device. */
52 typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
53 /**< @internal Function used to detect an Ethernet device removal. */
57 * Function used to enable the Rx promiscuous mode of an Ethernet device.
60 * ethdev handle of port.
63 * Negative errno value on error, 0 on success.
66 * Success, promiscuous mode is enabled.
68 * Promiscuous mode is not supported.
71 * @retval -E_RTE_SECONDARY
72 * Function was called from a secondary process instance and not supported.
74 * Attempt to enable promiscuos mode failed because of timeout.
76 * Failed to enable promiscuous mode.
78 typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
82 * Function used to disable the Rx promiscuous mode of an Ethernet device.
85 * ethdev handle of port.
88 * Negative errno value on error, 0 on success.
91 * Success, promiscuous mode is disabled.
93 * Promiscuous mode disabling is not supported.
96 * @retval -E_RTE_SECONDARY
97 * Function was called from a secondary process instance and not supported.
99 * Attempt to disable promiscuos mode failed because of timeout.
101 * Failed to disable promiscuous mode.
103 typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
107 * Enable the receipt of all multicast packets by an Ethernet device.
110 * ethdev handle of port.
113 * Negative errno value on error, 0 on success.
116 * Success, all-multicast mode is enabled.
118 * All-multicast mode is not supported.
121 * @retval -E_RTE_SECONDARY
122 * Function was called from a secondary process instance and not supported.
124 * Attempt to enable all-multicast mode failed because of timeout.
126 * Failed to enable all-multicast mode.
128 typedef int (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
132 * Disable the receipt of all multicast packets by an Ethernet device.
135 * ethdev handle of port.
138 * Negative errno value on error, 0 on success.
141 * Success, all-multicast mode is disabled.
143 * All-multicast mode disabling is not supported.
146 * @retval -E_RTE_SECONDARY
147 * Function was called from a secondary process instance and not supported.
149 * Attempt to disable all-multicast mode failed because of timeout.
151 * Failed to disable all-multicast mode.
153 typedef int (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
155 typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
156 int wait_to_complete);
157 /**< @internal Get link speed, duplex mode and state (up/down) of an Ethernet device. */
159 typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
160 struct rte_eth_stats *igb_stats);
161 /**< @internal Get global I/O statistics of an Ethernet device. */
165 * Reset global I/O statistics of an Ethernet device to 0.
168 * ethdev handle of port.
171 * Negative errno value on error, 0 on success.
174 * Success, statistics has been reset.
176 * Resetting statistics is not supported.
178 * Resetting statistics is not valid.
180 * Not enough memory to get the stats.
182 typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
184 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
185 struct rte_eth_xstat *stats, unsigned n);
186 /**< @internal Get extended stats of an Ethernet device. */
188 typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
192 /**< @internal Get extended stats of an Ethernet device. */
196 * Reset extended stats of an Ethernet device.
199 * ethdev handle of port.
202 * Negative errno value on error, 0 on success.
205 * Success, statistics has been reset.
207 * Resetting statistics is not supported.
209 * Resetting statistics is not valid.
211 * Not enough memory to get the stats.
213 typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
215 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
216 struct rte_eth_xstat_name *xstats_names, unsigned size);
217 /**< @internal Get names of extended stats of an Ethernet device. */
219 typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
220 struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
222 /**< @internal Get names of extended stats of an Ethernet device. */
224 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
228 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
230 typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
231 struct rte_eth_dev_info *dev_info);
232 /**< @internal Get specific information of an Ethernet device. */
234 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
235 /**< @internal Get supported ptypes of an Ethernet device. */
237 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
239 /**< @internal Start rx and tx of a queue of an Ethernet device. */
241 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
243 /**< @internal Stop rx and tx of a queue of an Ethernet device. */
245 typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
246 uint16_t rx_queue_id,
248 unsigned int socket_id,
249 const struct rte_eth_rxconf *rx_conf,
250 struct rte_mempool *mb_pool);
251 /**< @internal Set up a receive queue of an Ethernet device. */
253 typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
254 uint16_t tx_queue_id,
256 unsigned int socket_id,
257 const struct rte_eth_txconf *tx_conf);
258 /**< @internal Setup a transmit queue of an Ethernet device. */
260 typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
261 uint16_t rx_queue_id);
262 /**< @internal Enable interrupt of a receive queue of an Ethernet device. */
264 typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
265 uint16_t rx_queue_id);
266 /**< @internal Disable interrupt of a receive queue of an Ethernet device. */
268 typedef void (*eth_queue_release_t)(void *queue);
269 /**< @internal Release memory resources allocated by given RX/TX queue. */
271 typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
272 uint16_t rx_queue_id);
273 /**< @internal Get number of used descriptors on a receive queue. */
275 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
276 /**< @internal Check DD bit of specific RX descriptor */
278 typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
279 /**< @internal Check the status of a Rx descriptor */
281 typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
282 /**< @internal Check the status of a Tx descriptor */
284 typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
285 char *fw_version, size_t fw_size);
286 /**< @internal Get firmware information of an Ethernet device. */
288 typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
289 /**< @internal Force mbufs to be from TX ring. */
291 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
292 uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
294 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
295 uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
297 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
298 /**< @internal Set MTU. */
300 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
303 /**< @internal filtering of a VLAN Tag Identifier by an Ethernet device. */
305 typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
306 enum rte_vlan_type type, uint16_t tpid);
307 /**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */
309 typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
310 /**< @internal set VLAN offload function by an Ethernet device. */
312 typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
315 /**< @internal set port based TX VLAN insertion by an Ethernet device. */
317 typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
318 uint16_t rx_queue_id,
320 /**< @internal VLAN stripping enable/disable by an queue of Ethernet device. */
322 typedef uint16_t (*eth_rx_burst_t)(void *rxq,
323 struct rte_mbuf **rx_pkts,
325 /**< @internal Retrieve input packets from a receive queue of an Ethernet device. */
327 typedef uint16_t (*eth_tx_burst_t)(void *txq,
328 struct rte_mbuf **tx_pkts,
330 /**< @internal Send output packets on a transmit queue of an Ethernet device. */
332 typedef uint16_t (*eth_tx_prep_t)(void *txq,
333 struct rte_mbuf **tx_pkts,
335 /**< @internal Prepare output packets on a transmit queue of an Ethernet device. */
337 typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
338 struct rte_eth_fc_conf *fc_conf);
339 /**< @internal Get current flow control parameter on an Ethernet device */
341 typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
342 struct rte_eth_fc_conf *fc_conf);
343 /**< @internal Setup flow control parameter on an Ethernet device */
345 typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
346 struct rte_eth_pfc_conf *pfc_conf);
347 /**< @internal Setup priority flow control parameter on an Ethernet device */
349 typedef int (*reta_update_t)(struct rte_eth_dev *dev,
350 struct rte_eth_rss_reta_entry64 *reta_conf,
352 /**< @internal Update RSS redirection table on an Ethernet device */
354 typedef int (*reta_query_t)(struct rte_eth_dev *dev,
355 struct rte_eth_rss_reta_entry64 *reta_conf,
357 /**< @internal Query RSS redirection table on an Ethernet device */
359 typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
360 struct rte_eth_rss_conf *rss_conf);
361 /**< @internal Update RSS hash configuration of an Ethernet device */
363 typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
364 struct rte_eth_rss_conf *rss_conf);
365 /**< @internal Get current RSS hash configuration of an Ethernet device */
367 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
368 /**< @internal Turn on SW controllable LED on an Ethernet device */
370 typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
371 /**< @internal Turn off SW controllable LED on an Ethernet device */
373 typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
374 /**< @internal Remove MAC address from receive address register */
376 typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
377 struct rte_ether_addr *mac_addr,
380 /**< @internal Set a MAC address into Receive Address Address Register */
382 typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
383 struct rte_ether_addr *mac_addr);
384 /**< @internal Set a MAC address into Receive Address Address Register */
386 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
387 struct rte_ether_addr *mac_addr,
389 /**< @internal Set a Unicast Hash bitmap */
391 typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
393 /**< @internal Set all Unicast Hash bitmap */
395 typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
398 /**< @internal Set queue TX rate */
400 typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,
401 struct rte_eth_mirror_conf *mirror_conf,
404 /**< @internal Add a traffic mirroring rule on an Ethernet device */
406 typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,
408 /**< @internal Remove a traffic mirroring rule on an Ethernet device */
410 typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
411 struct rte_eth_udp_tunnel *tunnel_udp);
412 /**< @internal Add tunneling UDP port */
414 typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
415 struct rte_eth_udp_tunnel *tunnel_udp);
416 /**< @internal Delete tunneling UDP port */
418 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
419 struct rte_ether_addr *mc_addr_set,
420 uint32_t nb_mc_addr);
421 /**< @internal set the list of multicast addresses on an Ethernet device */
423 typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
424 /**< @internal Function used to enable IEEE1588/802.1AS timestamping. */
426 typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
427 /**< @internal Function used to disable IEEE1588/802.1AS timestamping. */
429 typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
430 struct timespec *timestamp,
432 /**< @internal Function used to read an RX IEEE1588/802.1AS timestamp. */
434 typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
435 struct timespec *timestamp);
436 /**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */
438 typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
439 /**< @internal Function used to adjust the device clock */
441 typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
442 struct timespec *timestamp);
443 /**< @internal Function used to get time from the device clock. */
445 typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
446 const struct timespec *timestamp);
447 /**< @internal Function used to get time from the device clock */
449 typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
450 uint64_t *timestamp);
451 /**< @internal Function used to get the current value of the device clock. */
453 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
454 struct rte_dev_reg_info *info);
455 /**< @internal Retrieve registers */
457 typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
458 /**< @internal Retrieve eeprom size */
460 typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
461 struct rte_dev_eeprom_info *info);
462 /**< @internal Retrieve eeprom data */
464 typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
465 struct rte_dev_eeprom_info *info);
466 /**< @internal Program eeprom data */
468 typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
469 struct rte_eth_dev_module_info *modinfo);
470 /**< @internal Retrieve type and size of plugin module eeprom */
472 typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
473 struct rte_dev_eeprom_info *info);
474 /**< @internal Retrieve plugin module eeprom data */
476 typedef int (*eth_l2_tunnel_eth_type_conf_t)
477 (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
478 /**< @internal config l2 tunnel ether type */
480 typedef int (*eth_l2_tunnel_offload_set_t)
481 (struct rte_eth_dev *dev,
482 struct rte_eth_l2_tunnel_conf *l2_tunnel,
485 /**< @internal enable/disable the l2 tunnel offload functions */
488 typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
489 enum rte_filter_type filter_type,
490 enum rte_filter_op filter_op,
492 /**< @internal Take operations to assigned filter type on an Ethernet device */
494 typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
495 /**< @internal Get Traffic Management (TM) operations on an Ethernet device */
497 typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
498 /**< @internal Get Traffic Metering and Policing (MTR) operations */
500 typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
501 struct rte_eth_dcb_info *dcb_info);
502 /**< @internal Get dcb information on an Ethernet device */
504 typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
506 /**< @internal Test if a port supports specific mempool ops */
509 * @internal A structure containing the functions exported by an Ethernet driver.
512 eth_dev_configure_t dev_configure; /**< Configure device. */
513 eth_dev_start_t dev_start; /**< Start device. */
514 eth_dev_stop_t dev_stop; /**< Stop device. */
515 eth_dev_set_link_up_t dev_set_link_up; /**< Device link up. */
516 eth_dev_set_link_down_t dev_set_link_down; /**< Device link down. */
517 eth_dev_close_t dev_close; /**< Close device. */
518 eth_dev_reset_t dev_reset; /**< Reset device. */
519 eth_link_update_t link_update; /**< Get device link state. */
520 eth_is_removed_t is_removed;
521 /**< Check if the device was physically removed. */
523 eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON. */
524 eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF. */
525 eth_allmulticast_enable_t allmulticast_enable;/**< RX multicast ON. */
526 eth_allmulticast_disable_t allmulticast_disable;/**< RX multicast OFF. */
527 eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address. */
528 eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address. */
529 eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address. */
530 eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs. */
531 mtu_set_t mtu_set; /**< Set MTU. */
533 eth_stats_get_t stats_get; /**< Get generic device statistics. */
534 eth_stats_reset_t stats_reset; /**< Reset generic device statistics. */
535 eth_xstats_get_t xstats_get; /**< Get extended device statistics. */
536 eth_xstats_reset_t xstats_reset; /**< Reset extended device statistics. */
537 eth_xstats_get_names_t xstats_get_names;
538 /**< Get names of extended statistics. */
539 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
540 /**< Configure per queue stat counter mapping. */
542 eth_dev_infos_get_t dev_infos_get; /**< Get device info. */
543 eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */
544 eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */
545 eth_fw_version_get_t fw_version_get; /**< Get firmware version. */
546 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
547 /**< Get packet types supported and identified by device. */
549 vlan_filter_set_t vlan_filter_set; /**< Filter VLAN Setup. */
550 vlan_tpid_set_t vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */
551 vlan_strip_queue_set_t vlan_strip_queue_set; /**< VLAN Stripping on queue. */
552 vlan_offload_set_t vlan_offload_set; /**< Set VLAN Offload. */
553 vlan_pvid_set_t vlan_pvid_set; /**< Set port based TX VLAN insertion. */
555 eth_queue_start_t rx_queue_start;/**< Start RX for a queue. */
556 eth_queue_stop_t rx_queue_stop; /**< Stop RX for a queue. */
557 eth_queue_start_t tx_queue_start;/**< Start TX for a queue. */
558 eth_queue_stop_t tx_queue_stop; /**< Stop TX for a queue. */
559 eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue. */
560 eth_queue_release_t rx_queue_release; /**< Release RX queue. */
561 eth_rx_queue_count_t rx_queue_count;
562 /**< Get the number of used RX descriptors. */
563 eth_rx_descriptor_done_t rx_descriptor_done; /**< Check rxd DD bit. */
564 eth_rx_descriptor_status_t rx_descriptor_status;
565 /**< Check the status of a Rx descriptor. */
566 eth_tx_descriptor_status_t tx_descriptor_status;
567 /**< Check the status of a Tx descriptor. */
568 eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue interrupt. */
569 eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx queue interrupt. */
570 eth_tx_queue_setup_t tx_queue_setup;/**< Set up device TX queue. */
571 eth_queue_release_t tx_queue_release; /**< Release TX queue. */
572 eth_tx_done_cleanup_t tx_done_cleanup;/**< Free tx ring mbufs */
574 eth_dev_led_on_t dev_led_on; /**< Turn on LED. */
575 eth_dev_led_off_t dev_led_off; /**< Turn off LED. */
577 flow_ctrl_get_t flow_ctrl_get; /**< Get flow control. */
578 flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control. */
579 priority_flow_ctrl_set_t priority_flow_ctrl_set; /**< Setup priority flow control. */
581 eth_uc_hash_table_set_t uc_hash_table_set; /**< Set Unicast Table Array. */
582 eth_uc_all_hash_table_set_t uc_all_hash_table_set; /**< Set Unicast hash bitmap. */
584 eth_mirror_rule_set_t mirror_rule_set; /**< Add a traffic mirror rule. */
585 eth_mirror_rule_reset_t mirror_rule_reset; /**< reset a traffic mirror rule. */
587 eth_udp_tunnel_port_add_t udp_tunnel_port_add; /** Add UDP tunnel port. */
588 eth_udp_tunnel_port_del_t udp_tunnel_port_del; /** Del UDP tunnel port. */
589 eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
590 /** Config ether type of l2 tunnel. */
591 eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
592 /** Enable/disable l2 tunnel offload functions. */
594 eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue rate limit. */
596 rss_hash_update_t rss_hash_update; /** Configure RSS hash protocols. */
597 rss_hash_conf_get_t rss_hash_conf_get; /** Get current RSS hash configuration. */
598 reta_update_t reta_update; /** Update redirection table. */
599 reta_query_t reta_query; /** Query redirection table. */
601 eth_get_reg_t get_reg; /**< Get registers. */
602 eth_get_eeprom_length_t get_eeprom_length; /**< Get eeprom length. */
603 eth_get_eeprom_t get_eeprom; /**< Get eeprom data. */
604 eth_set_eeprom_t set_eeprom; /**< Set eeprom. */
606 eth_get_module_info_t get_module_info;
607 /** Get plugin module eeprom attribute. */
608 eth_get_module_eeprom_t get_module_eeprom;
609 /** Get plugin module eeprom data. */
611 eth_filter_ctrl_t filter_ctrl; /**< common filter control. */
613 eth_get_dcb_info get_dcb_info; /** Get DCB information. */
615 eth_timesync_enable_t timesync_enable;
616 /** Turn IEEE1588/802.1AS timestamping on. */
617 eth_timesync_disable_t timesync_disable;
618 /** Turn IEEE1588/802.1AS timestamping off. */
619 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
620 /** Read the IEEE1588/802.1AS RX timestamp. */
621 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
622 /** Read the IEEE1588/802.1AS TX timestamp. */
623 eth_timesync_adjust_time timesync_adjust_time; /** Adjust the device clock. */
624 eth_timesync_read_time timesync_read_time; /** Get the device clock time. */
625 eth_timesync_write_time timesync_write_time; /** Set the device clock time. */
627 eth_read_clock read_clock;
629 eth_xstats_get_by_id_t xstats_get_by_id;
630 /**< Get extended device statistic values by ID. */
631 eth_xstats_get_names_by_id_t xstats_get_names_by_id;
632 /**< Get name of extended device statistics by ID. */
634 eth_tm_ops_get_t tm_ops_get;
635 /**< Get Traffic Management (TM) operations. */
637 eth_mtr_ops_get_t mtr_ops_get;
638 /**< Get Traffic Metering and Policing (MTR) operations. */
640 eth_pool_ops_supported_t pool_ops_supported;
641 /**< Test if a port supports specific mempool ops */
646 * Structure used to hold information about the callbacks to be called for a
647 * queue on RX and TX.
649 struct rte_eth_rxtx_callback {
650 struct rte_eth_rxtx_callback *next;
652 rte_rx_callback_fn rx;
653 rte_tx_callback_fn tx;
660 * The generic data structure associated with each ethernet device.
662 * Pointers to burst-oriented packet receive and transmit functions are
663 * located at the beginning of the structure, along with the pointer to
664 * where all the data elements for the particular device are stored in shared
665 * memory. This split allows the function pointer and driver data to be per-
666 * process, while the actual configuration data for the device is shared.
669 eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */
670 eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
671 eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */
673 * Next two fields are per-device data but *data is shared between
674 * primary and secondary processes and *process_private is per-process
675 * private. The second one is managed by PMDs if necessary.
677 struct rte_eth_dev_data *data; /**< Pointer to device data. */
678 void *process_private; /**< Pointer to per-process device data. */
679 const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
680 struct rte_device *device; /**< Backing device */
681 struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
682 /** User application callbacks for NIC interrupts */
683 struct rte_eth_dev_cb_list link_intr_cbs;
685 * User-supplied functions called from rx_burst to post-process
686 * received packets before passing them to the user
688 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
690 * User-supplied functions called from tx_burst to pre-process
691 * received packets before passing them to the driver for transmission.
693 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
694 enum rte_eth_dev_state state; /**< Flag indicating the port state */
695 void *security_ctx; /**< Context for security ops */
696 } __rte_cache_aligned;
698 struct rte_eth_dev_sriov;
699 struct rte_eth_dev_owner;
703 * The data part, with no function pointers, associated with each ethernet device.
705 * This structure is safe to place in shared memory to be common among different
706 * processes in a multi-process configuration.
708 struct rte_eth_dev_data {
709 char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
711 void **rx_queues; /**< Array of pointers to RX queues. */
712 void **tx_queues; /**< Array of pointers to TX queues. */
713 uint16_t nb_rx_queues; /**< Number of RX queues. */
714 uint16_t nb_tx_queues; /**< Number of TX queues. */
716 struct rte_eth_dev_sriov sriov; /**< SRIOV data */
719 /**< PMD-specific private data.
720 * @see rte_eth_dev_release_port()
723 struct rte_eth_link dev_link; /**< Link-level information & status. */
724 struct rte_eth_conf dev_conf; /**< Configuration applied to device. */
725 uint16_t mtu; /**< Maximum Transmission Unit. */
726 uint32_t min_rx_buf_size;
727 /**< Common RX buffer size handled by all queues. */
729 uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */
730 struct rte_ether_addr *mac_addrs;
731 /**< Device Ethernet link address.
732 * @see rte_eth_dev_release_port()
734 uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
735 /**< Bitmap associating MAC addresses to pools. */
736 struct rte_ether_addr *hash_mac_addrs;
737 /**< Device Ethernet MAC addresses of hash filtering.
738 * @see rte_eth_dev_release_port()
740 uint16_t port_id; /**< Device [external] port identifier. */
743 uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
744 scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */
745 all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
746 dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */
747 lro : 1; /**< RX LRO is ON(1) / OFF(0) */
748 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
749 /**< Queues state: STARTED(1) / STOPPED(0). */
750 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
751 /**< Queues state: STARTED(1) / STOPPED(0). */
752 uint32_t dev_flags; /**< Capabilities. */
753 enum rte_kernel_driver kdrv; /**< Kernel driver passthrough. */
754 int numa_node; /**< NUMA node connection. */
755 struct rte_vlan_filter_conf vlan_filter_conf;
756 /**< VLAN filter configuration. */
757 struct rte_eth_dev_owner owner; /**< The port owner. */
758 uint16_t representor_id;
759 /**< Switch-specific identifier.
760 * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
762 } __rte_cache_aligned;
766 * The pool of *rte_eth_dev* structures. The size of the pool
767 * is configured at compile-time in the <rte_ethdev.c> file.
769 extern struct rte_eth_dev rte_eth_devices[];
771 #endif /* _RTE_ETHDEV_CORE_H_ */