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