]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/dpdk/lib/librte_ethdev/rte_ethdev_core.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / dpdk / lib / librte_ethdev / rte_ethdev_core.h
CommitLineData
11fdf7f2
TL
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
3 */
4
5#ifndef _RTE_ETHDEV_CORE_H_
6#define _RTE_ETHDEV_CORE_H_
7
8/**
9 * @file
10 *
11 * RTE Ethernet Device internal header.
12 *
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.
15 *
16 * Applications should not use these directly.
17 *
18 */
19
20struct rte_eth_dev_callback;
21/** @internal Structure to keep track of registered callbacks */
22TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
23
24/*
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.
28 */
29struct rte_eth_dev;
30
31typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
32/**< @internal Ethernet device configuration. */
33
34typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
35/**< @internal Function used to start a configured Ethernet device. */
36
37typedef void (*eth_dev_stop_t)(struct rte_eth_dev *dev);
38/**< @internal Function used to stop a configured Ethernet device. */
39
40typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
41/**< @internal Function used to link up a configured Ethernet device. */
42
43typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
44/**< @internal Function used to link down a configured Ethernet device. */
45
46typedef void (*eth_dev_close_t)(struct rte_eth_dev *dev);
47/**< @internal Function used to close a configured Ethernet device. */
48
49typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
50/** <@internal Function used to reset a configured Ethernet device. */
51
52typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
53/**< @internal Function used to detect an Ethernet device removal. */
54
55typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
56/**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
57
58typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
59/**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
60
61typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
62/**< @internal Enable the receipt of all multicast packets by an Ethernet device. */
63
64typedef void (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
65/**< @internal Disable the receipt of all multicast packets by an Ethernet device. */
66
67typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
68 int wait_to_complete);
69/**< @internal Get link speed, duplex mode and state (up/down) of an Ethernet device. */
70
71typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
72 struct rte_eth_stats *igb_stats);
73/**< @internal Get global I/O statistics of an Ethernet device. */
74
75typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev);
76/**< @internal Reset global I/O statistics of an Ethernet device to 0. */
77
78typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
79 struct rte_eth_xstat *stats, unsigned n);
80/**< @internal Get extended stats of an Ethernet device. */
81
82typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
83 const uint64_t *ids,
84 uint64_t *values,
85 unsigned int n);
86/**< @internal Get extended stats of an Ethernet device. */
87
88typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
89/**< @internal Reset extended stats of an Ethernet device. */
90
91typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
92 struct rte_eth_xstat_name *xstats_names, unsigned size);
93/**< @internal Get names of extended stats of an Ethernet device. */
94
95typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
96 struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
97 unsigned int size);
98/**< @internal Get names of extended stats of an Ethernet device. */
99
100typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
101 uint16_t queue_id,
102 uint8_t stat_idx,
103 uint8_t is_rx);
104/**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */
105
106typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
107 struct rte_eth_dev_info *dev_info);
9f95a23c 108/**< @internal Get specific information of an Ethernet device. */
11fdf7f2
TL
109
110typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
111/**< @internal Get supported ptypes of an Ethernet device. */
112
113typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
114 uint16_t queue_id);
115/**< @internal Start rx and tx of a queue of an Ethernet device. */
116
117typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
118 uint16_t queue_id);
119/**< @internal Stop rx and tx of a queue of an Ethernet device. */
120
121typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
122 uint16_t rx_queue_id,
123 uint16_t nb_rx_desc,
124 unsigned int socket_id,
125 const struct rte_eth_rxconf *rx_conf,
126 struct rte_mempool *mb_pool);
127/**< @internal Set up a receive queue of an Ethernet device. */
128
129typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
130 uint16_t tx_queue_id,
131 uint16_t nb_tx_desc,
132 unsigned int socket_id,
133 const struct rte_eth_txconf *tx_conf);
134/**< @internal Setup a transmit queue of an Ethernet device. */
135
136typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
137 uint16_t rx_queue_id);
138/**< @internal Enable interrupt of a receive queue of an Ethernet device. */
139
140typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
141 uint16_t rx_queue_id);
142/**< @internal Disable interrupt of a receive queue of an Ethernet device. */
143
144typedef void (*eth_queue_release_t)(void *queue);
145/**< @internal Release memory resources allocated by given RX/TX queue. */
146
147typedef uint32_t (*eth_rx_queue_count_t)(struct rte_eth_dev *dev,
148 uint16_t rx_queue_id);
149/**< @internal Get number of used descriptors on a receive queue. */
150
151typedef int (*eth_rx_descriptor_done_t)(void *rxq, uint16_t offset);
152/**< @internal Check DD bit of specific RX descriptor */
153
154typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
155/**< @internal Check the status of a Rx descriptor */
156
157typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
158/**< @internal Check the status of a Tx descriptor */
159
160typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
161 char *fw_version, size_t fw_size);
162/**< @internal Get firmware information of an Ethernet device. */
163
164typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
165/**< @internal Force mbufs to be from TX ring. */
166
167typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
168 uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
169
170typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
171 uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
172
173typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
174/**< @internal Set MTU. */
175
176typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
177 uint16_t vlan_id,
178 int on);
179/**< @internal filtering of a VLAN Tag Identifier by an Ethernet device. */
180
181typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
182 enum rte_vlan_type type, uint16_t tpid);
183/**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */
184
185typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
186/**< @internal set VLAN offload function by an Ethernet device. */
187
188typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
189 uint16_t vlan_id,
190 int on);
191/**< @internal set port based TX VLAN insertion by an Ethernet device. */
192
193typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
194 uint16_t rx_queue_id,
195 int on);
196/**< @internal VLAN stripping enable/disable by an queue of Ethernet device. */
197
198typedef uint16_t (*eth_rx_burst_t)(void *rxq,
199 struct rte_mbuf **rx_pkts,
200 uint16_t nb_pkts);
201/**< @internal Retrieve input packets from a receive queue of an Ethernet device. */
202
203typedef uint16_t (*eth_tx_burst_t)(void *txq,
204 struct rte_mbuf **tx_pkts,
205 uint16_t nb_pkts);
206/**< @internal Send output packets on a transmit queue of an Ethernet device. */
207
208typedef uint16_t (*eth_tx_prep_t)(void *txq,
209 struct rte_mbuf **tx_pkts,
210 uint16_t nb_pkts);
211/**< @internal Prepare output packets on a transmit queue of an Ethernet device. */
212
213typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
214 struct rte_eth_fc_conf *fc_conf);
215/**< @internal Get current flow control parameter on an Ethernet device */
216
217typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
218 struct rte_eth_fc_conf *fc_conf);
219/**< @internal Setup flow control parameter on an Ethernet device */
220
221typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
222 struct rte_eth_pfc_conf *pfc_conf);
223/**< @internal Setup priority flow control parameter on an Ethernet device */
224
225typedef int (*reta_update_t)(struct rte_eth_dev *dev,
226 struct rte_eth_rss_reta_entry64 *reta_conf,
227 uint16_t reta_size);
228/**< @internal Update RSS redirection table on an Ethernet device */
229
230typedef int (*reta_query_t)(struct rte_eth_dev *dev,
231 struct rte_eth_rss_reta_entry64 *reta_conf,
232 uint16_t reta_size);
233/**< @internal Query RSS redirection table on an Ethernet device */
234
235typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
236 struct rte_eth_rss_conf *rss_conf);
237/**< @internal Update RSS hash configuration of an Ethernet device */
238
239typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
240 struct rte_eth_rss_conf *rss_conf);
241/**< @internal Get current RSS hash configuration of an Ethernet device */
242
243typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
244/**< @internal Turn on SW controllable LED on an Ethernet device */
245
246typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
247/**< @internal Turn off SW controllable LED on an Ethernet device */
248
249typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
250/**< @internal Remove MAC address from receive address register */
251
252typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
253 struct ether_addr *mac_addr,
254 uint32_t index,
255 uint32_t vmdq);
256/**< @internal Set a MAC address into Receive Address Address Register */
257
258typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
259 struct ether_addr *mac_addr);
260/**< @internal Set a MAC address into Receive Address Address Register */
261
262typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
263 struct ether_addr *mac_addr,
264 uint8_t on);
265/**< @internal Set a Unicast Hash bitmap */
266
267typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
268 uint8_t on);
269/**< @internal Set all Unicast Hash bitmap */
270
271typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
272 uint16_t queue_idx,
273 uint16_t tx_rate);
274/**< @internal Set queue TX rate */
275
276typedef int (*eth_mirror_rule_set_t)(struct rte_eth_dev *dev,
277 struct rte_eth_mirror_conf *mirror_conf,
278 uint8_t rule_id,
279 uint8_t on);
280/**< @internal Add a traffic mirroring rule on an Ethernet device */
281
282typedef int (*eth_mirror_rule_reset_t)(struct rte_eth_dev *dev,
283 uint8_t rule_id);
284/**< @internal Remove a traffic mirroring rule on an Ethernet device */
285
286typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
287 struct rte_eth_udp_tunnel *tunnel_udp);
288/**< @internal Add tunneling UDP port */
289
290typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
291 struct rte_eth_udp_tunnel *tunnel_udp);
292/**< @internal Delete tunneling UDP port */
293
294typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
295 struct ether_addr *mc_addr_set,
296 uint32_t nb_mc_addr);
297/**< @internal set the list of multicast addresses on an Ethernet device */
298
299typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
300/**< @internal Function used to enable IEEE1588/802.1AS timestamping. */
301
302typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
303/**< @internal Function used to disable IEEE1588/802.1AS timestamping. */
304
305typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
306 struct timespec *timestamp,
307 uint32_t flags);
308/**< @internal Function used to read an RX IEEE1588/802.1AS timestamp. */
309
310typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
311 struct timespec *timestamp);
312/**< @internal Function used to read a TX IEEE1588/802.1AS timestamp. */
313
314typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
315/**< @internal Function used to adjust the device clock */
316
317typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
318 struct timespec *timestamp);
319/**< @internal Function used to get time from the device clock. */
320
321typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
322 const struct timespec *timestamp);
323/**< @internal Function used to get time from the device clock */
324
325typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
326 struct rte_dev_reg_info *info);
327/**< @internal Retrieve registers */
328
329typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
330/**< @internal Retrieve eeprom size */
331
332typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
333 struct rte_dev_eeprom_info *info);
334/**< @internal Retrieve eeprom data */
335
336typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
337 struct rte_dev_eeprom_info *info);
338/**< @internal Program eeprom data */
339
340typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
341 struct rte_eth_dev_module_info *modinfo);
342/**< @internal Retrieve type and size of plugin module eeprom */
343
344typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
345 struct rte_dev_eeprom_info *info);
346/**< @internal Retrieve plugin module eeprom data */
347
348typedef int (*eth_l2_tunnel_eth_type_conf_t)
349 (struct rte_eth_dev *dev, struct rte_eth_l2_tunnel_conf *l2_tunnel);
350/**< @internal config l2 tunnel ether type */
351
352typedef int (*eth_l2_tunnel_offload_set_t)
353 (struct rte_eth_dev *dev,
354 struct rte_eth_l2_tunnel_conf *l2_tunnel,
355 uint32_t mask,
356 uint8_t en);
357/**< @internal enable/disable the l2 tunnel offload functions */
358
359
360typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
361 enum rte_filter_type filter_type,
362 enum rte_filter_op filter_op,
363 void *arg);
364/**< @internal Take operations to assigned filter type on an Ethernet device */
365
366typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
367/**< @internal Get Traffic Management (TM) operations on an Ethernet device */
368
369typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
9f95a23c 370/**< @internal Get Traffic Metering and Policing (MTR) operations */
11fdf7f2
TL
371
372typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
373 struct rte_eth_dcb_info *dcb_info);
374/**< @internal Get dcb information on an Ethernet device */
375
376typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
377 const char *pool);
378/**< @internal Test if a port supports specific mempool ops */
379
380/**
381 * @internal A structure containing the functions exported by an Ethernet driver.
382 */
383struct eth_dev_ops {
384 eth_dev_configure_t dev_configure; /**< Configure device. */
385 eth_dev_start_t dev_start; /**< Start device. */
386 eth_dev_stop_t dev_stop; /**< Stop device. */
387 eth_dev_set_link_up_t dev_set_link_up; /**< Device link up. */
388 eth_dev_set_link_down_t dev_set_link_down; /**< Device link down. */
389 eth_dev_close_t dev_close; /**< Close device. */
390 eth_dev_reset_t dev_reset; /**< Reset device. */
391 eth_link_update_t link_update; /**< Get device link state. */
392 eth_is_removed_t is_removed;
393 /**< Check if the device was physically removed. */
394
395 eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON. */
396 eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF. */
397 eth_allmulticast_enable_t allmulticast_enable;/**< RX multicast ON. */
398 eth_allmulticast_disable_t allmulticast_disable;/**< RX multicast OFF. */
399 eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address. */
400 eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address. */
401 eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address. */
402 eth_set_mc_addr_list_t set_mc_addr_list; /**< set list of mcast addrs. */
403 mtu_set_t mtu_set; /**< Set MTU. */
404
405 eth_stats_get_t stats_get; /**< Get generic device statistics. */
406 eth_stats_reset_t stats_reset; /**< Reset generic device statistics. */
407 eth_xstats_get_t xstats_get; /**< Get extended device statistics. */
408 eth_xstats_reset_t xstats_reset; /**< Reset extended device statistics. */
409 eth_xstats_get_names_t xstats_get_names;
410 /**< Get names of extended statistics. */
411 eth_queue_stats_mapping_set_t queue_stats_mapping_set;
412 /**< Configure per queue stat counter mapping. */
413
414 eth_dev_infos_get_t dev_infos_get; /**< Get device info. */
415 eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */
416 eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */
417 eth_fw_version_get_t fw_version_get; /**< Get firmware version. */
418 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
419 /**< Get packet types supported and identified by device. */
420
421 vlan_filter_set_t vlan_filter_set; /**< Filter VLAN Setup. */
422 vlan_tpid_set_t vlan_tpid_set; /**< Outer/Inner VLAN TPID Setup. */
423 vlan_strip_queue_set_t vlan_strip_queue_set; /**< VLAN Stripping on queue. */
424 vlan_offload_set_t vlan_offload_set; /**< Set VLAN Offload. */
425 vlan_pvid_set_t vlan_pvid_set; /**< Set port based TX VLAN insertion. */
426
427 eth_queue_start_t rx_queue_start;/**< Start RX for a queue. */
428 eth_queue_stop_t rx_queue_stop; /**< Stop RX for a queue. */
429 eth_queue_start_t tx_queue_start;/**< Start TX for a queue. */
430 eth_queue_stop_t tx_queue_stop; /**< Stop TX for a queue. */
431 eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue. */
432 eth_queue_release_t rx_queue_release; /**< Release RX queue. */
433 eth_rx_queue_count_t rx_queue_count;
434 /**< Get the number of used RX descriptors. */
435 eth_rx_descriptor_done_t rx_descriptor_done; /**< Check rxd DD bit. */
436 eth_rx_descriptor_status_t rx_descriptor_status;
437 /**< Check the status of a Rx descriptor. */
438 eth_tx_descriptor_status_t tx_descriptor_status;
439 /**< Check the status of a Tx descriptor. */
440 eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue interrupt. */
441 eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx queue interrupt. */
442 eth_tx_queue_setup_t tx_queue_setup;/**< Set up device TX queue. */
443 eth_queue_release_t tx_queue_release; /**< Release TX queue. */
444 eth_tx_done_cleanup_t tx_done_cleanup;/**< Free tx ring mbufs */
445
446 eth_dev_led_on_t dev_led_on; /**< Turn on LED. */
447 eth_dev_led_off_t dev_led_off; /**< Turn off LED. */
448
449 flow_ctrl_get_t flow_ctrl_get; /**< Get flow control. */
450 flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control. */
451 priority_flow_ctrl_set_t priority_flow_ctrl_set; /**< Setup priority flow control. */
452
453 eth_uc_hash_table_set_t uc_hash_table_set; /**< Set Unicast Table Array. */
454 eth_uc_all_hash_table_set_t uc_all_hash_table_set; /**< Set Unicast hash bitmap. */
455
456 eth_mirror_rule_set_t mirror_rule_set; /**< Add a traffic mirror rule. */
457 eth_mirror_rule_reset_t mirror_rule_reset; /**< reset a traffic mirror rule. */
458
459 eth_udp_tunnel_port_add_t udp_tunnel_port_add; /** Add UDP tunnel port. */
460 eth_udp_tunnel_port_del_t udp_tunnel_port_del; /** Del UDP tunnel port. */
461 eth_l2_tunnel_eth_type_conf_t l2_tunnel_eth_type_conf;
462 /** Config ether type of l2 tunnel. */
463 eth_l2_tunnel_offload_set_t l2_tunnel_offload_set;
464 /** Enable/disable l2 tunnel offload functions. */
465
466 eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue rate limit. */
467
468 rss_hash_update_t rss_hash_update; /** Configure RSS hash protocols. */
469 rss_hash_conf_get_t rss_hash_conf_get; /** Get current RSS hash configuration. */
470 reta_update_t reta_update; /** Update redirection table. */
471 reta_query_t reta_query; /** Query redirection table. */
472
473 eth_get_reg_t get_reg; /**< Get registers. */
474 eth_get_eeprom_length_t get_eeprom_length; /**< Get eeprom length. */
475 eth_get_eeprom_t get_eeprom; /**< Get eeprom data. */
476 eth_set_eeprom_t set_eeprom; /**< Set eeprom. */
477
478 eth_get_module_info_t get_module_info;
479 /** Get plugin module eeprom attribute. */
480 eth_get_module_eeprom_t get_module_eeprom;
481 /** Get plugin module eeprom data. */
482
483 eth_filter_ctrl_t filter_ctrl; /**< common filter control. */
484
485 eth_get_dcb_info get_dcb_info; /** Get DCB information. */
486
487 eth_timesync_enable_t timesync_enable;
488 /** Turn IEEE1588/802.1AS timestamping on. */
489 eth_timesync_disable_t timesync_disable;
490 /** Turn IEEE1588/802.1AS timestamping off. */
491 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
492 /** Read the IEEE1588/802.1AS RX timestamp. */
493 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
494 /** Read the IEEE1588/802.1AS TX timestamp. */
495 eth_timesync_adjust_time timesync_adjust_time; /** Adjust the device clock. */
496 eth_timesync_read_time timesync_read_time; /** Get the device clock time. */
497 eth_timesync_write_time timesync_write_time; /** Set the device clock time. */
498
499 eth_xstats_get_by_id_t xstats_get_by_id;
500 /**< Get extended device statistic values by ID. */
501 eth_xstats_get_names_by_id_t xstats_get_names_by_id;
502 /**< Get name of extended device statistics by ID. */
503
504 eth_tm_ops_get_t tm_ops_get;
505 /**< Get Traffic Management (TM) operations. */
506
507 eth_mtr_ops_get_t mtr_ops_get;
508 /**< Get Traffic Metering and Policing (MTR) operations. */
509
510 eth_pool_ops_supported_t pool_ops_supported;
511 /**< Test if a port supports specific mempool ops */
512};
513
514/**
515 * @internal
516 * Structure used to hold information about the callbacks to be called for a
517 * queue on RX and TX.
518 */
519struct rte_eth_rxtx_callback {
520 struct rte_eth_rxtx_callback *next;
521 union{
522 rte_rx_callback_fn rx;
523 rte_tx_callback_fn tx;
524 } fn;
525 void *param;
526};
527
528/**
529 * @internal
530 * The generic data structure associated with each ethernet device.
531 *
532 * Pointers to burst-oriented packet receive and transmit functions are
533 * located at the beginning of the structure, along with the pointer to
534 * where all the data elements for the particular device are stored in shared
535 * memory. This split allows the function pointer and driver data to be per-
536 * process, while the actual configuration data for the device is shared.
537 */
538struct rte_eth_dev {
539 eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function. */
540 eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */
541 eth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */
9f95a23c
TL
542 /**
543 * Next two fields are per-device data but *data is shared between
544 * primary and secondary processes and *process_private is per-process
545 * private. The second one is managed by PMDs if necessary.
546 */
547 struct rte_eth_dev_data *data; /**< Pointer to device data. */
548 void *process_private; /**< Pointer to per-process device data. */
11fdf7f2
TL
549 const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
550 struct rte_device *device; /**< Backing device */
551 struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
552 /** User application callbacks for NIC interrupts */
553 struct rte_eth_dev_cb_list link_intr_cbs;
554 /**
555 * User-supplied functions called from rx_burst to post-process
556 * received packets before passing them to the user
557 */
558 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
559 /**
560 * User-supplied functions called from tx_burst to pre-process
561 * received packets before passing them to the driver for transmission.
562 */
563 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
564 enum rte_eth_dev_state state; /**< Flag indicating the port state */
565 void *security_ctx; /**< Context for security ops */
566} __rte_cache_aligned;
567
568struct rte_eth_dev_sriov;
569struct rte_eth_dev_owner;
570
571/**
572 * @internal
573 * The data part, with no function pointers, associated with each ethernet device.
574 *
575 * This structure is safe to place in shared memory to be common among different
576 * processes in a multi-process configuration.
577 */
578struct rte_eth_dev_data {
579 char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
580
581 void **rx_queues; /**< Array of pointers to RX queues. */
582 void **tx_queues; /**< Array of pointers to TX queues. */
583 uint16_t nb_rx_queues; /**< Number of RX queues. */
584 uint16_t nb_tx_queues; /**< Number of TX queues. */
585
586 struct rte_eth_dev_sriov sriov; /**< SRIOV data */
587
9f95a23c
TL
588 void *dev_private;
589 /**< PMD-specific private data.
590 * @see rte_eth_dev_release_port()
591 */
11fdf7f2 592
9f95a23c 593 struct rte_eth_link dev_link; /**< Link-level information & status. */
11fdf7f2
TL
594 struct rte_eth_conf dev_conf; /**< Configuration applied to device. */
595 uint16_t mtu; /**< Maximum Transmission Unit. */
11fdf7f2 596 uint32_t min_rx_buf_size;
9f95a23c 597 /**< Common RX buffer size handled by all queues. */
11fdf7f2
TL
598
599 uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */
9f95a23c
TL
600 struct ether_addr *mac_addrs;
601 /**< Device Ethernet link address.
602 * @see rte_eth_dev_release_port()
603 */
11fdf7f2 604 uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR];
9f95a23c
TL
605 /**< Bitmap associating MAC addresses to pools. */
606 struct ether_addr *hash_mac_addrs;
607 /**< Device Ethernet MAC addresses of hash filtering.
608 * @see rte_eth_dev_release_port()
609 */
11fdf7f2 610 uint16_t port_id; /**< Device [external] port identifier. */
9f95a23c 611
11fdf7f2
TL
612 __extension__
613 uint8_t promiscuous : 1, /**< RX promiscuous mode ON(1) / OFF(0). */
614 scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */
615 all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */
616 dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */
617 lro : 1; /**< RX LRO is ON(1) / OFF(0) */
618 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
9f95a23c 619 /**< Queues state: STARTED(1) / STOPPED(0). */
11fdf7f2 620 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
9f95a23c
TL
621 /**< Queues state: STARTED(1) / STOPPED(0). */
622 uint32_t dev_flags; /**< Capabilities. */
623 enum rte_kernel_driver kdrv; /**< Kernel driver passthrough. */
624 int numa_node; /**< NUMA node connection. */
11fdf7f2 625 struct rte_vlan_filter_conf vlan_filter_conf;
9f95a23c 626 /**< VLAN filter configuration. */
11fdf7f2 627 struct rte_eth_dev_owner owner; /**< The port owner. */
9f95a23c
TL
628 uint16_t representor_id;
629 /**< Switch-specific identifier.
630 * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
631 */
11fdf7f2
TL
632} __rte_cache_aligned;
633
634/**
635 * @internal
636 * The pool of *rte_eth_dev* structures. The size of the pool
637 * is configured at compile-time in the <rte_ethdev.c> file.
638 */
639extern struct rte_eth_dev rte_eth_devices[];
640
641#endif /* _RTE_ETHDEV_CORE_H_ */