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