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);
105 typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
106 /**< @internal Enable the receipt of all multicast packets by an Ethernet device. */
108 typedef void (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
109 /**< @internal Disable the receipt of all multicast packets by an Ethernet device. */
111 typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
112 int wait_to_complete);
113 /**< @internal Get link speed, duplex mode and state (up/down) of an Ethernet device. */
115 typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
116 struct rte_eth_stats *igb_stats);
117 /**< @internal Get global I/O statistics of an Ethernet device. */
121 * Reset global I/O statistics of an Ethernet device to 0.
124 * ethdev handle of port.
127 * Negative errno value on error, 0 on success.
130 * Success, statistics has been reset.
132 * Resetting statistics is not supported.
134 * Resetting statistics is not valid.
136 * Not enough memory to get the stats.
138 typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
140 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
141 struct rte_eth_xstat *stats, unsigned n);
142 /**< @internal Get extended stats of an Ethernet device. */
144 typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
148 /**< @internal Get extended stats of an Ethernet device. */
152 * Reset extended stats of an Ethernet device.
155 * ethdev handle of port.
158 * Negative errno value on error, 0 on success.
161 * Success, statistics has been reset.
163 * Resetting statistics is not supported.
165 * Resetting statistics is not valid.
167 * Not enough memory to get the stats.
169 typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
171 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
172 struct rte_eth_xstat_name *xstats_names, unsigned size);
173 /**< @internal Get names of extended stats of an Ethernet device. */
175 typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
176 struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
178 /**< @internal Get names of extended stats of an Ethernet device. */
180 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
184 /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
186 typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
187 struct rte_eth_dev_info *dev_info);
188 /**< @internal Get specific information of an Ethernet device. */
190 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
191 /**< @internal Get supported ptypes of an Ethernet device. */
193 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
195 /**< @internal Start rx and tx of a queue of an Ethernet device. */
197 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
199 /**< @internal Stop rx and tx of a queue of an Ethernet device. */
201 typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
202 uint16_t rx_queue_id,
204 unsigned int socket_id,
205 const struct rte_eth_rxconf *rx_conf,
206 struct rte_mempool *mb_pool);
207 /**< @internal Set up a receive queue of an Ethernet device. */
209 typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
210 uint16_t tx_queue_id,
212 unsigned int socket_id,
213 const struct rte_eth_txconf *tx_conf);
214 /**< @internal Setup a transmit queue of an Ethernet device. */
216 typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
217 uint16_t rx_queue_id);
218 /**< @internal Enable interrupt of a receive queue of an Ethernet device. */
220 typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
221 uint16_t rx_queue_id);
222 /**< @internal Disable interrupt of a receive queue of an Ethernet device. */
224 typedef void (*eth_queue_release_t)(void *queue);
225 /**< @internal Release memory resources allocated by given RX/TX queue. */
227 typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
228 uint16_t rx_queue_id);
229 /**< @internal Get number of used descriptors on a receive queue. */
231 typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
232 /**< @internal Check DD bit of specific RX descriptor */
234 typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
235 /**< @internal Check the status of a Rx descriptor */
237 typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
238 /**< @internal Check the status of a Tx descriptor */
240 typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
241 char *fw_version, size_t fw_size);
242 /**< @internal Get firmware information of an Ethernet device. */
244 typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
245 /**< @internal Force mbufs to be from TX ring. */
247 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
248 uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
250 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
251 uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
253 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
254 /**< @internal Set MTU. */
256 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
259 /**< @internal filtering of a VLAN Tag Identifier by an Ethernet device. */
261 typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
262 enum rte_vlan_type type, uint16_t tpid);
263 /**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */
265 typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
266 /**< @internal set VLAN offload function by an Ethernet device. */
268 typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
271 /**< @internal set port based TX VLAN insertion by an Ethernet device. */
273 typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
274 uint16_t rx_queue_id,
276 /**< @internal VLAN stripping enable/disable by an queue of Ethernet device. */
278 typedef uint16_t (*eth_rx_burst_t)(void *rxq,
279 struct rte_mbuf **rx_pkts,
281 /**< @internal Retrieve input packets from a receive queue of an Ethernet device. */
283 typedef uint16_t (*eth_tx_burst_t)(void *txq,
284 struct rte_mbuf **tx_pkts,
286 /**< @internal Send output packets on a transmit queue of an Ethernet device. */
288 typedef uint16_t (*eth_tx_prep_t)(void *txq,
289 struct rte_mbuf **tx_pkts,
291 /**< @internal Prepare output packets on a transmit queue of an Ethernet device. */
293 typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
294 struct rte_eth_fc_conf *fc_conf);
295 /**< @internal Get current flow control parameter on an Ethernet device */
297 typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
298 struct rte_eth_fc_conf *fc_conf);
299 /**< @internal Setup flow control parameter on an Ethernet device */
301 typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
302 struct rte_eth_pfc_conf *pfc_conf);
303 /**< @internal Setup priority flow control parameter on an Ethernet device */
305 typedef int (*reta_update_t)(struct rte_eth_dev *dev,
306 struct rte_eth_rss_reta_entry64 *reta_conf,
308 /**< @internal Update RSS redirection table on an Ethernet device */
310 typedef int (*reta_query_t)(struct rte_eth_dev *dev,
311 struct rte_eth_rss_reta_entry64 *reta_conf,
313 /**< @internal Query RSS redirection table on an Ethernet device */
315 typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
316 struct rte_eth_rss_conf *rss_conf);
317 /**< @internal Update RSS hash configuration of an Ethernet device */
319 typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
320 struct rte_eth_rss_conf *rss_conf);
321 /**< @internal Get current RSS hash configuration of an Ethernet device */
323 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
324 /**< @internal Turn on SW controllable LED on an Ethernet device */
326 typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
327 /**< @internal Turn off SW controllable LED on an Ethernet device */
329 typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
330 /**< @internal Remove MAC address from receive address register */
332 typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
333 struct rte_ether_addr *mac_addr,
336 /**< @internal Set a MAC address into Receive Address Address Register */
338 typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
339 struct rte_ether_addr *mac_addr);
340 /**< @internal Set a MAC address into Receive Address Address Register */
342 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
343 struct rte_ether_addr *mac_addr,
345 /**< @internal Set a Unicast Hash bitmap */
347 typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
349 /**< @internal Set all Unicast Hash bitmap */
351 typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
354 /**< @internal Set queue TX rate */
356 typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,
357 struct rte_eth_mirror_conf *mirror_conf,
360 /**< @internal Add a traffic mirroring rule on an Ethernet device */
362 typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,
364 /**< @internal Remove a traffic mirroring rule on an Ethernet device */
366 typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
367 struct rte_eth_udp_tunnel *tunnel_udp);
368 /**< @internal Add tunneling UDP port */
370 typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
371 struct rte_eth_udp_tunnel *tunnel_udp);
372 /**< @internal Delete tunneling UDP port */
374 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
375 struct rte_ether_addr *mc_addr_set,
376 uint32_t nb_mc_addr);
377 /**< @internal set the list of multicast addresses on an Ethernet device */
379 typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
380 /**< @internal Function used to enable IEEE1588/802.1AS timestamping. */
382 typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
383 /**< @internal Function used to disable IEEE1588/802.1AS timestamping. */
385 typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
386 struct timespec *timestamp,
388 /**< @internal Function used to read an RX IEEE1588/802.1AS timestamp. */
390 typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
391 struct timespec *timestamp);
392 /**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */
394 typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
395 /**< @internal Function used to adjust the device clock */
397 typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
398 struct timespec *timestamp);
399 /**< @internal Function used to get time from the device clock. */
401 typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
402 const struct timespec *timestamp);
403 /**< @internal Function used to get time from the device clock */
405 typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
406 uint64_t *timestamp);
407 /**< @internal Function used to get the current value of the device clock. */
409 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
410 struct rte_dev_reg_info *info);
411 /**< @internal Retrieve registers */
413 typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
414 /**< @internal Retrieve eeprom size */
416 typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
417 struct rte_dev_eeprom_info *info);
418 /**< @internal Retrieve eeprom data */
420 typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
421 struct rte_dev_eeprom_info *info);
422 /**< @internal Program eeprom data */
424 typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
425 struct rte_eth_dev_module_info *modinfo);
426 /**< @internal Retrieve type and size of plugin module eeprom */
428 typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
429 struct rte_dev_eeprom_info *info);
430 /**< @internal Retrieve plugin module eeprom data */
432 typedef int (*eth_l2_tunnel_eth_type_conf_t)
433 (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
434 /**< @internal config l2 tunnel ether type */
436 typedef int (*eth_l2_tunnel_offload_set_t)
437 (struct rte_eth_dev *dev,
438 struct rte_eth_l2_tunnel_conf *l2_tunnel,
441 /**< @internal enable/disable the l2 tunnel offload functions */
444 typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
445 enum rte_filter_type filter_type,
446 enum rte_filter_op filter_op,
448 /**< @internal Take operations to assigned filter type on an Ethernet device */
450 typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
451 /**< @internal Get Traffic Management (TM) operations on an Ethernet device */
453 typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
454 /**< @internal Get Traffic Metering and Policing (MTR) operations */
456 typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
457 struct rte_eth_dcb_info *dcb_info);
458 /**< @internal Get dcb information on an Ethernet device */
460 typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
462 /**< @internal Test if a port supports specific mempool ops */
465 * @internal A structure containing the functions exported by an Ethernet driver.
468 eth_dev_configure_t dev_configure; /**< Configure device. */
469 eth_dev_start_t dev_start; /**< Start device. */
470 eth_dev_stop_t dev_stop; /**< Stop device. */
471 eth_dev_set_link_up_t dev_set_link_up; /**< Device link up. */
472 eth_dev_set_link_down_t dev_set_link_down; /**< Device link down. */
473 eth_dev_close_t dev_close; /**< Close device. */
474 eth_dev_reset_t dev_reset; /**< Reset device. */
475 eth_link_update_t link_update; /**< Get device link state. */
476 eth_is_removed_t is_removed;
477 /**< Check if the device was physically removed. */
479 eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON. */
480 eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF. */
481 eth_allmulticast_enable_t allmulticast_enable;/**< RX multicast ON. */
482 eth_allmulticast_disable_t allmulticast_disable;/**< RX multicast OFF. */
483 eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address. */
484 eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address. */
485 eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address. */
486 eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs. */
487 mtu_set_t mtu_set; /**< Set MTU. */
489 eth_stats_get_t stats_get; /**< Get generic device statistics. */
490 eth_stats_reset_t stats_reset; /**< Reset generic device statistics. */
491 eth_xstats_get_t xstats_get; /**< Get extended device statistics. */
492 eth_xstats_reset_t xstats_reset; /**< Reset extended device statistics. */
493 eth_xstats_get_names_t xstats_get_names;
494 /**< Get names of extended statistics. */
495 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
496 /**< Configure per queue stat counter mapping. */
498 eth_dev_infos_get_t dev_infos_get; /**< Get device info. */
499 eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */
500 eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */
501 eth_fw_version_get_t fw_version_get; /**< Get firmware version. */
502 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
503 /**< Get packet types supported and identified by device. */
505 vlan_filter_set_t vlan_filter_set; /**< Filter VLAN Setup. */
506 vlan_tpid_set_t vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */
507 vlan_strip_queue_set_t vlan_strip_queue_set; /**< VLAN Stripping on queue. */
508 vlan_offload_set_t vlan_offload_set; /**< Set VLAN Offload. */
509 vlan_pvid_set_t vlan_pvid_set; /**< Set port based TX VLAN insertion. */
511 eth_queue_start_t rx_queue_start;/**< Start RX for a queue. */
512 eth_queue_stop_t rx_queue_stop; /**< Stop RX for a queue. */
513 eth_queue_start_t tx_queue_start;/**< Start TX for a queue. */
514 eth_queue_stop_t tx_queue_stop; /**< Stop TX for a queue. */
515 eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue. */
516 eth_queue_release_t rx_queue_release; /**< Release RX queue. */
517 eth_rx_queue_count_t rx_queue_count;
518 /**< Get the number of used RX descriptors. */
519 eth_rx_descriptor_done_t rx_descriptor_done; /**< Check rxd DD bit. */
520 eth_rx_descriptor_status_t rx_descriptor_status;
521 /**< Check the status of a Rx descriptor. */
522 eth_tx_descriptor_status_t tx_descriptor_status;
523 /**< Check the status of a Tx descriptor. */
524 eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue interrupt. */
525 eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx queue interrupt. */
526 eth_tx_queue_setup_t tx_queue_setup;/**< Set up device TX queue. */
527 eth_queue_release_t tx_queue_release; /**< Release TX queue. */
528 eth_tx_done_cleanup_t tx_done_cleanup;/**< Free tx ring mbufs */
530 eth_dev_led_on_t dev_led_on; /**< Turn on LED. */
531 eth_dev_led_off_t dev_led_off; /**< Turn off LED. */
533 flow_ctrl_get_t flow_ctrl_get; /**< Get flow control. */
534 flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control. */
535 priority_flow_ctrl_set_t priority_flow_ctrl_set; /**< Setup priority flow control. */
537 eth_uc_hash_table_set_t uc_hash_table_set; /**< Set Unicast Table Array. */
538 eth_uc_all_hash_table_set_t uc_all_hash_table_set; /**< Set Unicast hash bitmap. */
540 eth_mirror_rule_set_t mirror_rule_set; /**< Add a traffic mirror rule. */
541 eth_mirror_rule_reset_t mirror_rule_reset; /**< reset a traffic mirror rule. */
543 eth_udp_tunnel_port_add_t udp_tunnel_port_add; /** Add UDP tunnel port. */
544 eth_udp_tunnel_port_del_t udp_tunnel_port_del; /** Del UDP tunnel port. */
545 eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
546 /** Config ether type of l2 tunnel. */
547 eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
548 /** Enable/disable l2 tunnel offload functions. */
550 eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue rate limit. */
552 rss_hash_update_t rss_hash_update; /** Configure RSS hash protocols. */
553 rss_hash_conf_get_t rss_hash_conf_get; /** Get current RSS hash configuration. */
554 reta_update_t reta_update; /** Update redirection table. */
555 reta_query_t reta_query; /** Query redirection table. */
557 eth_get_reg_t get_reg; /**< Get registers. */
558 eth_get_eeprom_length_t get_eeprom_length; /**< Get eeprom length. */
559 eth_get_eeprom_t get_eeprom; /**< Get eeprom data. */
560 eth_set_eeprom_t set_eeprom; /**< Set eeprom. */
562 eth_get_module_info_t get_module_info;
563 /** Get plugin module eeprom attribute. */
564 eth_get_module_eeprom_t get_module_eeprom;
565 /** Get plugin module eeprom data. */
567 eth_filter_ctrl_t filter_ctrl; /**< common filter control. */
569 eth_get_dcb_info get_dcb_info; /** Get DCB information. */
571 eth_timesync_enable_t timesync_enable;
572 /** Turn IEEE1588/802.1AS timestamping on. */
573 eth_timesync_disable_t timesync_disable;
574 /** Turn IEEE1588/802.1AS timestamping off. */
575 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
576 /** Read the IEEE1588/802.1AS RX timestamp. */
577 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
578 /** Read the IEEE1588/802.1AS TX timestamp. */
579 eth_timesync_adjust_time timesync_adjust_time; /** Adjust the device clock. */
580 eth_timesync_read_time timesync_read_time; /** Get the device clock time. */
581 eth_timesync_write_time timesync_write_time; /** Set the device clock time. */
583 eth_read_clock read_clock;
585 eth_xstats_get_by_id_t xstats_get_by_id;
586 /**< Get extended device statistic values by ID. */
587 eth_xstats_get_names_by_id_t xstats_get_names_by_id;
588 /**< Get name of extended device statistics by ID. */
590 eth_tm_ops_get_t tm_ops_get;
591 /**< Get Traffic Management (TM) operations. */
593 eth_mtr_ops_get_t mtr_ops_get;
594 /**< Get Traffic Metering and Policing (MTR) operations. */
596 eth_pool_ops_supported_t pool_ops_supported;
597 /**< Test if a port supports specific mempool ops */
602 * Structure used to hold information about the callbacks to be called for a
603 * queue on RX and TX.
605 struct rte_eth_rxtx_callback {
606 struct rte_eth_rxtx_callback *next;
608 rte_rx_callback_fn rx;
609 rte_tx_callback_fn tx;
616 * The generic data structure associated with each ethernet device.
618 * Pointers to burst-oriented packet receive and transmit functions are
619 * located at the beginning of the structure, along with the pointer to
620 * where all the data elements for the particular device are stored in shared
621 * memory. This split allows the function pointer and driver data to be per-
622 * process, while the actual configuration data for the device is shared.
625 eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */
626 eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
627 eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */
629 * Next two fields are per-device data but *data is shared between
630 * primary and secondary processes and *process_private is per-process
631 * private. The second one is managed by PMDs if necessary.
633 struct rte_eth_dev_data *data; /**< Pointer to device data. */
634 void *process_private; /**< Pointer to per-process device data. */
635 const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
636 struct rte_device *device; /**< Backing device */
637 struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
638 /** User application callbacks for NIC interrupts */
639 struct rte_eth_dev_cb_list link_intr_cbs;
641 * User-supplied functions called from rx_burst to post-process
642 * received packets before passing them to the user
644 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
646 * User-supplied functions called from tx_burst to pre-process
647 * received packets before passing them to the driver for transmission.
649 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
650 enum rte_eth_dev_state state; /**< Flag indicating the port state */
651 void *security_ctx; /**< Context for security ops */
652 } __rte_cache_aligned;
654 struct rte_eth_dev_sriov;
655 struct rte_eth_dev_owner;
659 * The data part, with no function pointers, associated with each ethernet device.
661 * This structure is safe to place in shared memory to be common among different
662 * processes in a multi-process configuration.
664 struct rte_eth_dev_data {
665 char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
667 void **rx_queues; /**< Array of pointers to RX queues. */
668 void **tx_queues; /**< Array of pointers to TX queues. */
669 uint16_t nb_rx_queues; /**< Number of RX queues. */
670 uint16_t nb_tx_queues; /**< Number of TX queues. */
672 struct rte_eth_dev_sriov sriov; /**< SRIOV data */
675 /**< PMD-specific private data.
676 * @see rte_eth_dev_release_port()
679 struct rte_eth_link dev_link; /**< Link-level information & status. */
680 struct rte_eth_conf dev_conf; /**< Configuration applied to device. */
681 uint16_t mtu; /**< Maximum Transmission Unit. */
682 uint32_t min_rx_buf_size;
683 /**< Common RX buffer size handled by all queues. */
685 uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */
686 struct rte_ether_addr *mac_addrs;
687 /**< Device Ethernet link address.
688 * @see rte_eth_dev_release_port()
690 uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
691 /**< Bitmap associating MAC addresses to pools. */
692 struct rte_ether_addr *hash_mac_addrs;
693 /**< Device Ethernet MAC addresses of hash filtering.
694 * @see rte_eth_dev_release_port()
696 uint16_t port_id; /**< Device [external] port identifier. */
699 uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
700 scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */
701 all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
702 dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */
703 lro : 1; /**< RX LRO is ON(1) / OFF(0) */
704 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
705 /**< Queues state: STARTED(1) / STOPPED(0). */
706 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
707 /**< Queues state: STARTED(1) / STOPPED(0). */
708 uint32_t dev_flags; /**< Capabilities. */
709 enum rte_kernel_driver kdrv; /**< Kernel driver passthrough. */
710 int numa_node; /**< NUMA node connection. */
711 struct rte_vlan_filter_conf vlan_filter_conf;
712 /**< VLAN filter configuration. */
713 struct rte_eth_dev_owner owner; /**< The port owner. */
714 uint16_t representor_id;
715 /**< Switch-specific identifier.
716 * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
718 } __rte_cache_aligned;
722 * The pool of *rte_eth_dev* structures. The size of the pool
723 * is configured at compile-time in the <rte_ethdev.c> file.
725 extern struct rte_eth_dev rte_eth_devices[];
727 #endif /* _RTE_ETHDEV_CORE_H_ */