ethdev: add missing C++ guards
[dpdk.git] / lib / ethdev / ethdev_driver.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4
5 #ifndef _RTE_ETHDEV_DRIVER_H_
6 #define _RTE_ETHDEV_DRIVER_H_
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 /**
13  * @file
14  *
15  * RTE Ethernet Device PMD API
16  *
17  * These APIs for the use from Ethernet drivers, user applications shouldn't
18  * use them.
19  *
20  */
21
22 #include <rte_ethdev.h>
23
24 /**
25  * @internal
26  * Structure used to hold information about the callbacks to be called for a
27  * queue on Rx and Tx.
28  */
29 struct rte_eth_rxtx_callback {
30         struct rte_eth_rxtx_callback *next;
31         union{
32                 rte_rx_callback_fn rx;
33                 rte_tx_callback_fn tx;
34         } fn;
35         void *param;
36 };
37
38 /**
39  * @internal
40  * The generic data structure associated with each Ethernet device.
41  *
42  * Pointers to burst-oriented packet receive and transmit functions are
43  * located at the beginning of the structure, along with the pointer to
44  * where all the data elements for the particular device are stored in shared
45  * memory. This split allows the function pointer and driver data to be per-
46  * process, while the actual configuration data for the device is shared.
47  */
48 struct rte_eth_dev {
49         eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function */
50         eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function */
51
52         /** Pointer to PMD transmit prepare function */
53         eth_tx_prep_t tx_pkt_prepare;
54         /** Get the number of used Rx descriptors */
55         eth_rx_queue_count_t rx_queue_count;
56         /** Check the status of a Rx descriptor */
57         eth_rx_descriptor_status_t rx_descriptor_status;
58         /** Check the status of a Tx descriptor */
59         eth_tx_descriptor_status_t tx_descriptor_status;
60
61         /**
62          * Device data that is shared between primary and secondary processes
63          */
64         struct rte_eth_dev_data *data;
65         void *process_private; /**< Pointer to per-process device data */
66         const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
67         struct rte_device *device; /**< Backing device */
68         struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
69
70         /** User application callbacks for NIC interrupts */
71         struct rte_eth_dev_cb_list link_intr_cbs;
72         /**
73          * User-supplied functions called from rx_burst to post-process
74          * received packets before passing them to the user
75          */
76         struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
77         /**
78          * User-supplied functions called from tx_burst to pre-process
79          * received packets before passing them to the driver for transmission
80          */
81         struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
82
83         enum rte_eth_dev_state state; /**< Flag indicating the port state */
84         void *security_ctx; /**< Context for security ops */
85 } __rte_cache_aligned;
86
87 struct rte_eth_dev_sriov;
88 struct rte_eth_dev_owner;
89
90 /**
91  * @internal
92  * The data part, with no function pointers, associated with each Ethernet
93  * device. This structure is safe to place in shared memory to be common
94  * among different processes in a multi-process configuration.
95  */
96 struct rte_eth_dev_data {
97         char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
98
99         void **rx_queues; /**< Array of pointers to Rx queues */
100         void **tx_queues; /**< Array of pointers to Tx queues */
101         uint16_t nb_rx_queues; /**< Number of Rx queues */
102         uint16_t nb_tx_queues; /**< Number of Tx queues */
103
104         struct rte_eth_dev_sriov sriov;    /**< SRIOV data */
105
106         /** PMD-specific private data. @see rte_eth_dev_release_port() */
107         void *dev_private;
108
109         struct rte_eth_link dev_link;   /**< Link-level information & status */
110         struct rte_eth_conf dev_conf;   /**< Configuration applied to device */
111         uint16_t mtu;                   /**< Maximum Transmission Unit */
112
113         /** Common Rx buffer size handled by all queues */
114         uint32_t min_rx_buf_size;
115
116         uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */
117
118         /** Device Ethernet link address. @see rte_eth_dev_release_port() */
119         struct rte_ether_addr *mac_addrs;
120         /** Bitmap associating MAC addresses to pools */
121         uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR];
122         /**
123          * Device Ethernet MAC addresses of hash filtering.
124          * @see rte_eth_dev_release_port()
125          */
126         struct rte_ether_addr *hash_mac_addrs;
127
128         uint16_t port_id;           /**< Device [external] port identifier */
129
130         __extension__
131         uint8_t /** Rx promiscuous mode ON(1) / OFF(0) */
132                 promiscuous   : 1,
133                 /** Rx of scattered packets is ON(1) / OFF(0) */
134                 scattered_rx : 1,
135                 /** Rx all multicast mode ON(1) / OFF(0) */
136                 all_multicast : 1,
137                 /** Device state: STARTED(1) / STOPPED(0) */
138                 dev_started : 1,
139                 /** Rx LRO is ON(1) / OFF(0) */
140                 lro         : 1,
141                 /**
142                  * Indicates whether the device is configured:
143                  * CONFIGURED(1) / NOT CONFIGURED(0)
144                  */
145                 dev_configured : 1;
146
147         /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
148         uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
149         /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
150         uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
151
152         uint32_t dev_flags;             /**< Capabilities */
153         int numa_node;                  /**< NUMA node connection */
154
155         /** VLAN filter configuration */
156         struct rte_vlan_filter_conf vlan_filter_conf;
157
158         struct rte_eth_dev_owner owner; /**< The port owner */
159
160         /**
161          * Switch-specific identifier.
162          * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
163          */
164         uint16_t representor_id;
165         /**
166          * Port ID of the backing device.
167          * This device will be used to query representor info and calculate
168          * representor IDs. Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
169          */
170         uint16_t backer_port_id;
171
172         pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex */
173 } __rte_cache_aligned;
174
175 /**
176  * @internal
177  * The pool of *rte_eth_dev* structures. The size of the pool
178  * is configured at compile-time in the <rte_ethdev.c> file.
179  */
180 extern struct rte_eth_dev rte_eth_devices[];
181
182 /** @internal Declaration of the hairpin peer queue information structure. */
183 struct rte_hairpin_peer_info;
184
185 /*
186  * Definitions of all functions exported by an Ethernet driver through the
187  * generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
188  * structure associated with an Ethernet device.
189  */
190
191 /** @internal Ethernet device configuration. */
192 typedef int  (*eth_dev_configure_t)(struct rte_eth_dev *dev);
193
194 /** @internal Function used to start a configured Ethernet device. */
195 typedef int  (*eth_dev_start_t)(struct rte_eth_dev *dev);
196
197 /** @internal Function used to stop a configured Ethernet device. */
198 typedef int (*eth_dev_stop_t)(struct rte_eth_dev *dev);
199
200 /** @internal Function used to link up a configured Ethernet device. */
201 typedef int  (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
202
203 /** @internal Function used to link down a configured Ethernet device. */
204 typedef int  (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
205
206 /** @internal Function used to close a configured Ethernet device. */
207 typedef int (*eth_dev_close_t)(struct rte_eth_dev *dev);
208
209 /** @internal Function used to reset a configured Ethernet device. */
210 typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
211
212 /** @internal Function used to detect an Ethernet device removal. */
213 typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
214
215 /**
216  * @internal
217  * Function used to enable the Rx promiscuous mode of an Ethernet device.
218  *
219  * @param dev
220  *   ethdev handle of port.
221  *
222  * @return
223  *   Negative errno value on error, 0 on success.
224  *
225  * @retval 0
226  *   Success, promiscuous mode is enabled.
227  * @retval -ENOTSUP
228  *   Promiscuous mode is not supported.
229  * @retval -ENODEV
230  *   Device is gone.
231  * @retval -E_RTE_SECONDARY
232  *   Function was called from a secondary process instance and not supported.
233  * @retval -ETIMEDOUT
234  *   Attempt to enable promiscuous mode failed because of timeout.
235  * @retval -EAGAIN
236  *   Failed to enable promiscuous mode.
237  */
238 typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
239
240 /**
241  * @internal
242  * Function used to disable the Rx promiscuous mode of an Ethernet device.
243  *
244  * @param dev
245  *   ethdev handle of port.
246  *
247  * @return
248  *   Negative errno value on error, 0 on success.
249  *
250  * @retval 0
251  *   Success, promiscuous mode is disabled.
252  * @retval -ENOTSUP
253  *   Promiscuous mode disabling is not supported.
254  * @retval -ENODEV
255  *   Device is gone.
256  * @retval -E_RTE_SECONDARY
257  *   Function was called from a secondary process instance and not supported.
258  * @retval -ETIMEDOUT
259  *   Attempt to disable promiscuous mode failed because of timeout.
260  * @retval -EAGAIN
261  *   Failed to disable promiscuous mode.
262  */
263 typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
264
265 /**
266  * @internal
267  * Enable the receipt of all multicast packets by an Ethernet device.
268  *
269  * @param dev
270  *   ethdev handle of port.
271  *
272  * @return
273  *   Negative errno value on error, 0 on success.
274  *
275  * @retval 0
276  *   Success, all-multicast mode is enabled.
277  * @retval -ENOTSUP
278  *   All-multicast mode is not supported.
279  * @retval -ENODEV
280  *   Device is gone.
281  * @retval -E_RTE_SECONDARY
282  *   Function was called from a secondary process instance and not supported.
283  * @retval -ETIMEDOUT
284  *   Attempt to enable all-multicast mode failed because of timeout.
285  * @retval -EAGAIN
286  *   Failed to enable all-multicast mode.
287  */
288 typedef int (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
289
290 /**
291  * @internal
292  * Disable the receipt of all multicast packets by an Ethernet device.
293  *
294  * @param dev
295  *   ethdev handle of port.
296  *
297  * @return
298  *   Negative errno value on error, 0 on success.
299  *
300  * @retval 0
301  *   Success, all-multicast mode is disabled.
302  * @retval -ENOTSUP
303  *   All-multicast mode disabling is not supported.
304  * @retval -ENODEV
305  *   Device is gone.
306  * @retval -E_RTE_SECONDARY
307  *   Function was called from a secondary process instance and not supported.
308  * @retval -ETIMEDOUT
309  *   Attempt to disable all-multicast mode failed because of timeout.
310  * @retval -EAGAIN
311  *   Failed to disable all-multicast mode.
312  */
313 typedef int (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
314
315 /**
316  * @internal
317  * Get link speed, duplex mode and state (up/down) of an Ethernet device.
318  */
319 typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
320                                 int wait_to_complete);
321
322 /** @internal Get global I/O statistics of an Ethernet device. */
323 typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
324                                 struct rte_eth_stats *igb_stats);
325
326 /**
327  * @internal
328  * Reset global I/O statistics of an Ethernet device to 0.
329  *
330  * @param dev
331  *   ethdev handle of port.
332  *
333  * @return
334  *   Negative errno value on error, 0 on success.
335  *
336  * @retval 0
337  *   Success, statistics has been reset.
338  * @retval -ENOTSUP
339  *   Resetting statistics is not supported.
340  * @retval -EINVAL
341  *   Resetting statistics is not valid.
342  * @retval -ENOMEM
343  *   Not enough memory to get the stats.
344  */
345 typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
346
347 /** @internal Get extended stats of an Ethernet device. */
348 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
349         struct rte_eth_xstat *stats, unsigned int n);
350
351 /**
352  * @internal
353  * Get extended stats of an Ethernet device.
354  *
355  * @param dev
356  *   ethdev handle of port.
357  * @param ids
358  *   IDs array to retrieve specific statistics. Must not be NULL.
359  * @param values
360  *   A pointer to a table to be filled with device statistics values.
361  *   Must not be NULL.
362  * @param n
363  *   Element count in @p ids and @p values.
364  *
365  * @return
366  *   - A number of filled in stats.
367  *   - A negative value on error.
368  */
369 typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
370                                       const uint64_t *ids,
371                                       uint64_t *values,
372                                       unsigned int n);
373
374 /**
375  * @internal
376  * Reset extended stats of an Ethernet device.
377  *
378  * @param dev
379  *   ethdev handle of port.
380  *
381  * @return
382  *   Negative errno value on error, 0 on success.
383  *
384  * @retval 0
385  *   Success, statistics has been reset.
386  * @retval -ENOTSUP
387  *   Resetting statistics is not supported.
388  * @retval -EINVAL
389  *   Resetting statistics is not valid.
390  * @retval -ENOMEM
391  *   Not enough memory to get the stats.
392  */
393 typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
394
395 /** @internal Get names of extended stats of an Ethernet device. */
396 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
397         struct rte_eth_xstat_name *xstats_names, unsigned int size);
398
399 /**
400  * @internal
401  * Get names of extended stats of an Ethernet device.
402  *
403  * @param dev
404  *   ethdev handle of port.
405  * @param ids
406  *   IDs array to retrieve specific statistics. Must not be NULL.
407  * @param xstats_names
408  *   An rte_eth_xstat_name array of at least @p size elements to be filled.
409  *   Must not be NULL.
410  * @param size
411  *   Element count in @p ids and @p xstats_names.
412  *
413  * @return
414  *   - A number of filled in stats.
415  *   - A negative value on error.
416  */
417 typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
418         const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
419         unsigned int size);
420
421 /**
422  * @internal
423  * Set a queue statistics mapping for a Tx/Rx queue of an Ethernet device.
424  */
425 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
426                                              uint16_t queue_id,
427                                              uint8_t stat_idx,
428                                              uint8_t is_rx);
429
430 /** @internal Get specific information of an Ethernet device. */
431 typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
432                                    struct rte_eth_dev_info *dev_info);
433
434 /** @internal Get supported ptypes of an Ethernet device. */
435 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev);
436
437 /**
438  * @internal
439  * Inform Ethernet device about reduced range of packet types to handle.
440  *
441  * @param dev
442  *   The Ethernet device identifier.
443  * @param ptype_mask
444  *   The ptype family that application is interested in should be bitwise OR of
445  *   RTE_PTYPE_*_MASK or 0.
446  * @return
447  *   - (0) if Success.
448  */
449 typedef int (*eth_dev_ptypes_set_t)(struct rte_eth_dev *dev,
450                                      uint32_t ptype_mask);
451
452 /** @internal Start Rx and Tx of a queue of an Ethernet device. */
453 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
454                                     uint16_t queue_id);
455
456 /** @internal Stop Rx and Tx of a queue of an Ethernet device. */
457 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
458                                     uint16_t queue_id);
459
460 /** @internal Set up a receive queue of an Ethernet device. */
461 typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
462                                     uint16_t rx_queue_id,
463                                     uint16_t nb_rx_desc,
464                                     unsigned int socket_id,
465                                     const struct rte_eth_rxconf *rx_conf,
466                                     struct rte_mempool *mb_pool);
467
468 /** @internal Setup a transmit queue of an Ethernet device. */
469 typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
470                                     uint16_t tx_queue_id,
471                                     uint16_t nb_tx_desc,
472                                     unsigned int socket_id,
473                                     const struct rte_eth_txconf *tx_conf);
474
475 /** @internal Enable interrupt of a receive queue of an Ethernet device. */
476 typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
477                                     uint16_t rx_queue_id);
478
479 /** @internal Disable interrupt of a receive queue of an Ethernet device. */
480 typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
481                                     uint16_t rx_queue_id);
482
483 /** @internal Release memory resources allocated by given Rx/Tx queue. */
484 typedef void (*eth_queue_release_t)(struct rte_eth_dev *dev,
485                                     uint16_t queue_id);
486
487 /** @internal Get firmware information of an Ethernet device. */
488 typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
489                                      char *fw_version, size_t fw_size);
490
491 /** @internal Force mbufs to be from Tx ring. */
492 typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
493
494 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
495         uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
496
497 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
498         uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
499
500 typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev,
501         uint16_t queue_id, struct rte_eth_burst_mode *mode);
502
503 /** @internal Set MTU. */
504 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
505
506 /** @internal Filtering of a VLAN Tag Identifier by an Ethernet device. */
507 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
508                                   uint16_t vlan_id,
509                                   int on);
510
511 /** @internal Set the outer/inner VLAN-TPID by an Ethernet device. */
512 typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
513                                enum rte_vlan_type type, uint16_t tpid);
514
515 /** @internal Set VLAN offload function by an Ethernet device. */
516 typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
517
518 /** @internal Set port based Tx VLAN insertion by an Ethernet device. */
519 typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
520                                uint16_t vlan_id,
521                                int on);
522
523 /** @internal VLAN stripping enable/disable by an queue of Ethernet device. */
524 typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
525                                   uint16_t rx_queue_id,
526                                   int on);
527
528 /** @internal Get current flow control parameter on an Ethernet device. */
529 typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
530                                struct rte_eth_fc_conf *fc_conf);
531
532 /** @internal Setup flow control parameter on an Ethernet device. */
533 typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
534                                struct rte_eth_fc_conf *fc_conf);
535
536 /** @internal Setup priority flow control parameter on an Ethernet device. */
537 typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
538                                 struct rte_eth_pfc_conf *pfc_conf);
539
540 /** @internal Get info for queue based PFC on an Ethernet device. */
541 typedef int (*priority_flow_ctrl_queue_info_get_t)(struct rte_eth_dev *dev,
542                         struct rte_eth_pfc_queue_info *pfc_queue_info);
543 /** @internal Configure queue based PFC parameter on an Ethernet device. */
544 typedef int (*priority_flow_ctrl_queue_config_t)(struct rte_eth_dev *dev,
545                         struct rte_eth_pfc_queue_conf *pfc_queue_conf);
546
547 /** @internal Update RSS redirection table on an Ethernet device. */
548 typedef int (*reta_update_t)(struct rte_eth_dev *dev,
549                              struct rte_eth_rss_reta_entry64 *reta_conf,
550                              uint16_t reta_size);
551
552 /** @internal Query RSS redirection table on an Ethernet device. */
553 typedef int (*reta_query_t)(struct rte_eth_dev *dev,
554                             struct rte_eth_rss_reta_entry64 *reta_conf,
555                             uint16_t reta_size);
556
557 /** @internal Update RSS hash configuration of an Ethernet device. */
558 typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
559                                  struct rte_eth_rss_conf *rss_conf);
560
561 /** @internal Get current RSS hash configuration of an Ethernet device. */
562 typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
563                                    struct rte_eth_rss_conf *rss_conf);
564
565 /** @internal Turn on SW controllable LED on an Ethernet device. */
566 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
567
568 /** @internal Turn off SW controllable LED on an Ethernet device. */
569 typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
570
571 /** @internal Remove MAC address from receive address register. */
572 typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
573
574 /** @internal Set a MAC address into Receive Address Register. */
575 typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
576                                   struct rte_ether_addr *mac_addr,
577                                   uint32_t index,
578                                   uint32_t vmdq);
579
580 /** @internal Set a MAC address into Receive Address Register. */
581 typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
582                                   struct rte_ether_addr *mac_addr);
583
584 /** @internal Set a Unicast Hash bitmap. */
585 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
586                                   struct rte_ether_addr *mac_addr,
587                                   uint8_t on);
588
589 /** @internal Set all Unicast Hash bitmap. */
590 typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
591                                   uint8_t on);
592
593 /** @internal Set queue Tx rate. */
594 typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
595                                 uint16_t queue_idx,
596                                 uint16_t tx_rate);
597
598 /** @internal Add tunneling UDP port. */
599 typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
600                                          struct rte_eth_udp_tunnel *tunnel_udp);
601
602 /** @internal Delete tunneling UDP port. */
603 typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
604                                          struct rte_eth_udp_tunnel *tunnel_udp);
605
606 /** @internal set the list of multicast addresses on an Ethernet device. */
607 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
608                                       struct rte_ether_addr *mc_addr_set,
609                                       uint32_t nb_mc_addr);
610
611 /** @internal Function used to enable IEEE1588/802.1AS timestamping. */
612 typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
613
614 /** @internal Function used to disable IEEE1588/802.1AS timestamping. */
615 typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
616
617 /** @internal Function used to read an Rx IEEE1588/802.1AS timestamp. */
618 typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
619                                                 struct timespec *timestamp,
620                                                 uint32_t flags);
621
622 /** @internal Function used to read a Tx IEEE1588/802.1AS timestamp. */
623 typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
624                                                 struct timespec *timestamp);
625
626 /** @internal Function used to adjust the device clock. */
627 typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
628
629 /** @internal Function used to get time from the device clock. */
630 typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
631                                       struct timespec *timestamp);
632
633 /** @internal Function used to get time from the device clock. */
634 typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
635                                        const struct timespec *timestamp);
636
637 /** @internal Function used to get the current value of the device clock. */
638 typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
639                                       uint64_t *timestamp);
640
641 /** @internal Retrieve registers. */
642 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
643                                 struct rte_dev_reg_info *info);
644
645 /** @internal Retrieve EEPROM size. */
646 typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
647
648 /** @internal Retrieve EEPROM data. */
649 typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
650                                 struct rte_dev_eeprom_info *info);
651
652 /** @internal Program EEPROM data. */
653 typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
654                                 struct rte_dev_eeprom_info *info);
655
656 /** @internal Retrieve type and size of plugin module EEPROM. */
657 typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
658                                      struct rte_eth_dev_module_info *modinfo);
659
660 /** @internal Retrieve plugin module EEPROM data. */
661 typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
662                                        struct rte_dev_eeprom_info *info);
663
664 struct rte_flow_ops;
665 /**
666  * @internal
667  * Get flow operations.
668  *
669  * If the flow API is not supported for the specified device,
670  * the driver can return NULL.
671  */
672 typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev,
673                                   const struct rte_flow_ops **ops);
674
675 /** @internal Get Traffic Management (TM) operations on an Ethernet device. */
676 typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
677
678 /** @internal Get Traffic Metering and Policing (MTR) operations. */
679 typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
680
681 /** @internal Get DCB information on an Ethernet device. */
682 typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
683                                  struct rte_eth_dcb_info *dcb_info);
684
685 /** @internal Test if a port supports specific mempool ops. */
686 typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
687                                                 const char *pool);
688
689 /**
690  * @internal
691  * Get the hairpin capabilities.
692  *
693  * @param dev
694  *   ethdev handle of port.
695  * @param cap
696  *   returns the hairpin capabilities from the device.
697  *
698  * @return
699  *   Negative errno value on error, 0 on success.
700  *
701  * @retval 0
702  *   Success, hairpin is supported.
703  * @retval -ENOTSUP
704  *   Hairpin is not supported.
705  */
706 typedef int (*eth_hairpin_cap_get_t)(struct rte_eth_dev *dev,
707                                      struct rte_eth_hairpin_cap *cap);
708
709 /**
710  * @internal
711  * Setup Rx hairpin queue.
712  *
713  * @param dev
714  *   ethdev handle of port.
715  * @param rx_queue_id
716  *   the selected Rx queue index.
717  * @param nb_rx_desc
718  *   the requested number of descriptors for this queue. 0 - use PMD default.
719  * @param conf
720  *   the Rx hairpin configuration structure.
721  *
722  * @return
723  *   Negative errno value on error, 0 on success.
724  *
725  * @retval 0
726  *   Success, hairpin is supported.
727  * @retval -ENOTSUP
728  *   Hairpin is not supported.
729  * @retval -EINVAL
730  *   One of the parameters is invalid.
731  * @retval -ENOMEM
732  *   Unable to allocate resources.
733  */
734 typedef int (*eth_rx_hairpin_queue_setup_t)
735         (struct rte_eth_dev *dev, uint16_t rx_queue_id,
736          uint16_t nb_rx_desc,
737          const struct rte_eth_hairpin_conf *conf);
738
739 /**
740  * @internal
741  * Setup Tx hairpin queue.
742  *
743  * @param dev
744  *   ethdev handle of port.
745  * @param tx_queue_id
746  *   the selected Tx queue index.
747  * @param nb_tx_desc
748  *   the requested number of descriptors for this queue. 0 - use PMD default.
749  * @param conf
750  *   the Tx hairpin configuration structure.
751  *
752  * @return
753  *   Negative errno value on error, 0 on success.
754  *
755  * @retval 0
756  *   Success, hairpin is supported.
757  * @retval -ENOTSUP
758  *   Hairpin is not supported.
759  * @retval -EINVAL
760  *   One of the parameters is invalid.
761  * @retval -ENOMEM
762  *   Unable to allocate resources.
763  */
764 typedef int (*eth_tx_hairpin_queue_setup_t)
765         (struct rte_eth_dev *dev, uint16_t tx_queue_id,
766          uint16_t nb_tx_desc,
767          const struct rte_eth_hairpin_conf *hairpin_conf);
768
769 /**
770  * @internal
771  * Get Forward Error Correction(FEC) capability.
772  *
773  * @param dev
774  *   ethdev handle of port.
775  * @param speed_fec_capa
776  *   speed_fec_capa is out only with per-speed capabilities.
777  * @param num
778  *   a number of elements in an speed_fec_capa array.
779  *
780  * @return
781  *   Negative errno value on error, positive value on success.
782  *
783  * @retval positive value
784  *   A non-negative value lower or equal to num: success. The return value
785  *   is the number of entries filled in the fec capa array.
786  *   A non-negative value higher than num: error, the given fec capa array
787  *   is too small. The return value corresponds to the num that should
788  *   be given to succeed. The entries in the fec capa array are not valid
789  *   and shall not be used by the caller.
790  * @retval -ENOTSUP
791  *   Operation is not supported.
792  * @retval -EIO
793  *   Device is removed.
794  * @retval -EINVAL
795  *   *num* or *speed_fec_capa* invalid.
796  */
797 typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev,
798                 struct rte_eth_fec_capa *speed_fec_capa, unsigned int num);
799
800 /**
801  * @internal
802  * Get Forward Error Correction(FEC) mode.
803  *
804  * @param dev
805  *   ethdev handle of port.
806  * @param fec_capa
807  *   a bitmask of enabled FEC modes. If AUTO bit is set, other
808  *   bits specify FEC modes which may be negotiated. If AUTO
809  *   bit is clear, specify FEC modes to be used (only one valid
810  *   mode per speed may be set).
811  *
812  * @return
813  *   Negative errno value on error, 0 on success.
814  *
815  * @retval 0
816  *   Success, get FEC success.
817  * @retval -ENOTSUP
818  *   Operation is not supported.
819  * @retval -EIO
820  *   Device is removed.
821  */
822 typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev,
823                              uint32_t *fec_capa);
824
825 /**
826  * @internal
827  * Set Forward Error Correction(FEC) mode.
828  *
829  * @param dev
830  *   ethdev handle of port.
831  * @param fec_capa
832  *   bitmask of allowed FEC modes. It must be only one
833  *   if AUTO is disabled. If AUTO is enabled, other
834  *   bits specify FEC modes which may be negotiated.
835  *
836  * @return
837  *   Negative errno value on error, 0 on success.
838  *
839  * @retval 0
840  *   Success, set FEC success.
841  * @retval -ENOTSUP
842  *   Operation is not supported.
843  * @retval -EINVAL
844  *   Unsupported FEC mode requested.
845  * @retval -EIO
846  *   Device is removed.
847  */
848 typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, uint32_t fec_capa);
849
850 /**
851  * @internal
852  * Get all hairpin Tx/Rx peer ports of the current device, if any.
853  *
854  * @param dev
855  *   ethdev handle of port.
856  * @param peer_ports
857  *   array to save the ports list.
858  * @param len
859  *   array length.
860  * @param direction
861  *   value to decide the current to peer direction
862  *   positive - used as Tx to get all peer Rx ports.
863  *   zero - used as Rx to get all peer Tx ports.
864  *
865  * @return
866  *   Negative errno value on error, 0 or positive on success.
867  *
868  * @retval 0
869  *   Success, no peer ports.
870  * @retval >0
871  *   Actual number of the peer ports.
872  * @retval -ENOTSUP
873  *   Get peer ports API is not supported.
874  * @retval -EINVAL
875  *   One of the parameters is invalid.
876  */
877 typedef int (*hairpin_get_peer_ports_t)(struct rte_eth_dev *dev,
878                                         uint16_t *peer_ports, size_t len,
879                                         uint32_t direction);
880
881 /**
882  * @internal
883  * Bind all hairpin Tx queues of one port to the Rx queues of the peer port.
884  *
885  * @param dev
886  *   ethdev handle of port.
887  * @param rx_port
888  *   the peer Rx port.
889  *
890  * @return
891  *   Negative errno value on error, 0 on success.
892  *
893  * @retval 0
894  *   Success, bind successfully.
895  * @retval -ENOTSUP
896  *   Bind API is not supported.
897  * @retval -EINVAL
898  *   One of the parameters is invalid.
899  * @retval -EBUSY
900  *   Device is not started.
901  */
902 typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev,
903                                 uint16_t rx_port);
904
905 /**
906  * @internal
907  * Unbind all hairpin Tx queues of one port from the Rx queues of the peer port.
908  *
909  * @param dev
910  *   ethdev handle of port.
911  * @param rx_port
912  *   the peer Rx port.
913  *
914  * @return
915  *   Negative errno value on error, 0 on success.
916  *
917  * @retval 0
918  *   Success, unbind successfully.
919  * @retval -ENOTSUP
920  *   Bind API is not supported.
921  * @retval -EINVAL
922  *   One of the parameters is invalid.
923  * @retval -EBUSY
924  *   Device is already stopped.
925  */
926 typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev,
927                                   uint16_t rx_port);
928
929 /** @internal Update and fetch peer queue information. */
930 typedef int (*eth_hairpin_queue_peer_update_t)
931         (struct rte_eth_dev *dev, uint16_t peer_queue,
932          struct rte_hairpin_peer_info *current_info,
933          struct rte_hairpin_peer_info *peer_info, uint32_t direction);
934
935 /** @internal Bind peer queue to the current queue with fetched information. */
936 typedef int (*eth_hairpin_queue_peer_bind_t)
937         (struct rte_eth_dev *dev, uint16_t cur_queue,
938          struct rte_hairpin_peer_info *peer_info, uint32_t direction);
939
940 /** @internal Unbind peer queue from the current queue. */
941 typedef int (*eth_hairpin_queue_peer_unbind_t)
942         (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction);
943
944 /**
945  * @internal
946  * Get address of memory location whose contents will change whenever there is
947  * new data to be received on an Rx queue.
948  *
949  * @param rxq
950  *   Ethdev queue pointer.
951  * @param pmc
952  *   The pointer to power-optimized monitoring condition structure.
953  * @return
954  *   Negative errno value on error, 0 on success.
955  *
956  * @retval 0
957  *   Success
958  * @retval -EINVAL
959  *   Invalid parameters
960  */
961 typedef int (*eth_get_monitor_addr_t)(void *rxq,
962                 struct rte_power_monitor_cond *pmc);
963
964 /**
965  * @internal
966  * Get representor info to be able to calculate the unique representor ID.
967  *
968  * Caller should pass NULL as pointer of info to get number of entries,
969  * allocate info buffer according to returned entry number, then call
970  * again with buffer to get real info.
971  *
972  * To calculate the representor ID, caller should iterate each entry,
973  * match controller index, pf index, vf or sf start index and range,
974  * then calculate representor ID from offset to vf/sf start index.
975  * @see rte_eth_representor_id_get.
976  *
977  * @param dev
978  *   Ethdev handle of port.
979  * @param [out] info
980  *   Pointer to memory to save device representor info.
981  * @return
982  *   Negative errno value on error, number of info entries otherwise.
983  */
984
985 typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev,
986         struct rte_eth_representor_info *info);
987
988 /**
989  * @internal
990  * Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD.
991  *
992  * @param dev
993  *   Port (ethdev) handle
994  *
995  * @param[inout] features
996  *   Feature selection buffer
997  *
998  * @return
999  *   Negative errno value on error, zero otherwise
1000  */
1001 typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev,
1002                                        uint64_t *features);
1003
1004 /**
1005  * @internal
1006  * Get IP reassembly offload capability of a PMD.
1007  *
1008  * @param dev
1009  *   Port (ethdev) handle
1010  *
1011  * @param[out] conf
1012  *   IP reassembly capability supported by the PMD
1013  *
1014  * @return
1015  *   Negative errno value on error, zero otherwise
1016  */
1017 typedef int (*eth_ip_reassembly_capability_get_t)(struct rte_eth_dev *dev,
1018                 struct rte_eth_ip_reassembly_params *capa);
1019
1020 /**
1021  * @internal
1022  * Get IP reassembly offload configuration parameters set in PMD.
1023  *
1024  * @param dev
1025  *   Port (ethdev) handle
1026  *
1027  * @param[out] conf
1028  *   Configuration parameters for IP reassembly.
1029  *
1030  * @return
1031  *   Negative errno value on error, zero otherwise
1032  */
1033 typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev,
1034                 struct rte_eth_ip_reassembly_params *conf);
1035
1036 /**
1037  * @internal
1038  * Set configuration parameters for enabling IP reassembly offload in hardware.
1039  *
1040  * @param dev
1041  *   Port (ethdev) handle
1042  *
1043  * @param[in] conf
1044  *   Configuration parameters for IP reassembly.
1045  *
1046  * @return
1047  *   Negative errno value on error, zero otherwise
1048  */
1049 typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev,
1050                 const struct rte_eth_ip_reassembly_params *conf);
1051
1052 /**
1053  * @internal
1054  * Dump private info from device to a file.
1055  *
1056  * @param dev
1057  *   Port (ethdev) handle.
1058  * @param file
1059  *   A pointer to a file for output.
1060  *
1061  * @return
1062  *   Negative value on error, 0 on success.
1063  *
1064  * @retval 0
1065  *   Success
1066  * @retval -EINVAL
1067  *   Invalid file
1068  */
1069 typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file);
1070
1071 /**
1072  * @internal A structure containing the functions exported by an Ethernet driver.
1073  */
1074 struct eth_dev_ops {
1075         eth_dev_configure_t        dev_configure; /**< Configure device */
1076         eth_dev_start_t            dev_start;     /**< Start device */
1077         eth_dev_stop_t             dev_stop;      /**< Stop device */
1078         eth_dev_set_link_up_t      dev_set_link_up;   /**< Device link up */
1079         eth_dev_set_link_down_t    dev_set_link_down; /**< Device link down */
1080         eth_dev_close_t            dev_close;     /**< Close device */
1081         eth_dev_reset_t            dev_reset;     /**< Reset device */
1082         eth_link_update_t          link_update;   /**< Get device link state */
1083         /** Check if the device was physically removed */
1084         eth_is_removed_t           is_removed;
1085
1086         eth_promiscuous_enable_t   promiscuous_enable; /**< Promiscuous ON */
1087         eth_promiscuous_disable_t  promiscuous_disable;/**< Promiscuous OFF */
1088         eth_allmulticast_enable_t  allmulticast_enable;/**< Rx multicast ON */
1089         eth_allmulticast_disable_t allmulticast_disable;/**< Rx multicast OFF */
1090         eth_mac_addr_remove_t      mac_addr_remove; /**< Remove MAC address */
1091         eth_mac_addr_add_t         mac_addr_add;  /**< Add a MAC address */
1092         eth_mac_addr_set_t         mac_addr_set;  /**< Set a MAC address */
1093         /** Set list of multicast addresses */
1094         eth_set_mc_addr_list_t     set_mc_addr_list;
1095         mtu_set_t                  mtu_set;       /**< Set MTU */
1096
1097         /** Get generic device statistics */
1098         eth_stats_get_t            stats_get;
1099         /** Reset generic device statistics */
1100         eth_stats_reset_t          stats_reset;
1101         /** Get extended device statistics */
1102         eth_xstats_get_t           xstats_get;
1103         /** Reset extended device statistics */
1104         eth_xstats_reset_t         xstats_reset;
1105         /** Get names of extended statistics */
1106         eth_xstats_get_names_t     xstats_get_names;
1107         /** Configure per queue stat counter mapping */
1108         eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1109
1110         eth_dev_infos_get_t        dev_infos_get; /**< Get device info */
1111         /** Retrieve Rx queue information */
1112         eth_rxq_info_get_t         rxq_info_get;
1113         /** Retrieve Tx queue information */
1114         eth_txq_info_get_t         txq_info_get;
1115         eth_burst_mode_get_t       rx_burst_mode_get; /**< Get Rx burst mode */
1116         eth_burst_mode_get_t       tx_burst_mode_get; /**< Get Tx burst mode */
1117         eth_fw_version_get_t       fw_version_get; /**< Get firmware version */
1118
1119         /** Get packet types supported and identified by device */
1120         eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
1121         /**
1122          * Inform Ethernet device about reduced range of packet types to
1123          * handle
1124          */
1125         eth_dev_ptypes_set_t dev_ptypes_set;
1126
1127         /** Filter VLAN Setup */
1128         vlan_filter_set_t          vlan_filter_set;
1129         /** Outer/Inner VLAN TPID Setup */
1130         vlan_tpid_set_t            vlan_tpid_set;
1131         /** VLAN Stripping on queue */
1132         vlan_strip_queue_set_t     vlan_strip_queue_set;
1133         /** Set VLAN Offload */
1134         vlan_offload_set_t         vlan_offload_set;
1135         /** Set port based Tx VLAN insertion */
1136         vlan_pvid_set_t            vlan_pvid_set;
1137
1138         eth_queue_start_t          rx_queue_start;/**< Start Rx for a queue */
1139         eth_queue_stop_t           rx_queue_stop; /**< Stop Rx for a queue */
1140         eth_queue_start_t          tx_queue_start;/**< Start Tx for a queue */
1141         eth_queue_stop_t           tx_queue_stop; /**< Stop Tx for a queue */
1142         eth_rx_queue_setup_t       rx_queue_setup;/**< Set up device Rx queue */
1143         eth_queue_release_t        rx_queue_release; /**< Release Rx queue */
1144
1145         /** Enable Rx queue interrupt */
1146         eth_rx_enable_intr_t       rx_queue_intr_enable;
1147         /** Disable Rx queue interrupt */
1148         eth_rx_disable_intr_t      rx_queue_intr_disable;
1149
1150         eth_tx_queue_setup_t       tx_queue_setup;/**< Set up device Tx queue */
1151         eth_queue_release_t        tx_queue_release; /**< Release Tx queue */
1152         eth_tx_done_cleanup_t      tx_done_cleanup;/**< Free Tx ring mbufs */
1153
1154         eth_dev_led_on_t           dev_led_on;    /**< Turn on LED */
1155         eth_dev_led_off_t          dev_led_off;   /**< Turn off LED */
1156
1157         flow_ctrl_get_t            flow_ctrl_get; /**< Get flow control */
1158         flow_ctrl_set_t            flow_ctrl_set; /**< Setup flow control */
1159         /** Setup priority flow control */
1160         priority_flow_ctrl_set_t   priority_flow_ctrl_set;
1161         /** Priority flow control queue info get */
1162         priority_flow_ctrl_queue_info_get_t priority_flow_ctrl_queue_info_get;
1163         /** Priority flow control queue configure */
1164         priority_flow_ctrl_queue_config_t priority_flow_ctrl_queue_config;
1165
1166         /** Set Unicast Table Array */
1167         eth_uc_hash_table_set_t    uc_hash_table_set;
1168         /** Set Unicast hash bitmap */
1169         eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1170
1171         /** Add UDP tunnel port */
1172         eth_udp_tunnel_port_add_t  udp_tunnel_port_add;
1173         /** Delete UDP tunnel port */
1174         eth_udp_tunnel_port_del_t  udp_tunnel_port_del;
1175
1176         /** Set queue rate limit */
1177         eth_set_queue_rate_limit_t set_queue_rate_limit;
1178
1179         /** Configure RSS hash protocols and hashing key */
1180         rss_hash_update_t          rss_hash_update;
1181         /** Get current RSS hash configuration */
1182         rss_hash_conf_get_t        rss_hash_conf_get;
1183         /** Update redirection table */
1184         reta_update_t              reta_update;
1185         /** Query redirection table */
1186         reta_query_t               reta_query;
1187
1188         eth_get_reg_t              get_reg;           /**< Get registers */
1189         eth_get_eeprom_length_t    get_eeprom_length; /**< Get EEPROM length */
1190         eth_get_eeprom_t           get_eeprom;        /**< Get EEPROM data */
1191         eth_set_eeprom_t           set_eeprom;        /**< Set EEPROM */
1192
1193         /** Get plugin module EEPROM attribute */
1194         eth_get_module_info_t      get_module_info;
1195         /** Get plugin module EEPROM data */
1196         eth_get_module_eeprom_t    get_module_eeprom;
1197
1198         eth_flow_ops_get_t         flow_ops_get; /**< Get flow operations */
1199
1200         eth_get_dcb_info           get_dcb_info; /**< Get DCB information */
1201
1202         /** Turn IEEE1588/802.1AS timestamping on */
1203         eth_timesync_enable_t      timesync_enable;
1204         /** Turn IEEE1588/802.1AS timestamping off */
1205         eth_timesync_disable_t     timesync_disable;
1206         /** Read the IEEE1588/802.1AS Rx timestamp */
1207         eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1208         /** Read the IEEE1588/802.1AS Tx timestamp */
1209         eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1210         /** Adjust the device clock */
1211         eth_timesync_adjust_time   timesync_adjust_time;
1212         /** Get the device clock time */
1213         eth_timesync_read_time     timesync_read_time;
1214         /** Set the device clock time */
1215         eth_timesync_write_time    timesync_write_time;
1216
1217         eth_read_clock             read_clock;
1218
1219         /** Get extended device statistic values by ID */
1220         eth_xstats_get_by_id_t     xstats_get_by_id;
1221         /** Get name of extended device statistics by ID */
1222         eth_xstats_get_names_by_id_t xstats_get_names_by_id;
1223
1224         /** Get Traffic Management (TM) operations */
1225         eth_tm_ops_get_t tm_ops_get;
1226
1227         /** Get Traffic Metering and Policing (MTR) operations */
1228         eth_mtr_ops_get_t mtr_ops_get;
1229
1230         /** Test if a port supports specific mempool ops */
1231         eth_pool_ops_supported_t pool_ops_supported;
1232
1233         /** Returns the hairpin capabilities */
1234         eth_hairpin_cap_get_t hairpin_cap_get;
1235         /** Set up device Rx hairpin queue */
1236         eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup;
1237         /** Set up device Tx hairpin queue */
1238         eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup;
1239
1240         /** Get Forward Error Correction(FEC) capability */
1241         eth_fec_get_capability_t fec_get_capability;
1242         /** Get Forward Error Correction(FEC) mode */
1243         eth_fec_get_t fec_get;
1244         /** Set Forward Error Correction(FEC) mode */
1245         eth_fec_set_t fec_set;
1246
1247         /** Get hairpin peer ports list */
1248         hairpin_get_peer_ports_t hairpin_get_peer_ports;
1249         /** Bind all hairpin Tx queues of device to the peer port Rx queues */
1250         eth_hairpin_bind_t hairpin_bind;
1251         /** Unbind all hairpin Tx queues from the peer port Rx queues */
1252         eth_hairpin_unbind_t hairpin_unbind;
1253         /** Pass the current queue info and get the peer queue info */
1254         eth_hairpin_queue_peer_update_t hairpin_queue_peer_update;
1255         /** Set up the connection between the pair of hairpin queues */
1256         eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind;
1257         /** Disconnect the hairpin queues of a pair from each other */
1258         eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind;
1259
1260         /** Get power monitoring condition for Rx queue */
1261         eth_get_monitor_addr_t get_monitor_addr;
1262
1263         /** Get representor info */
1264         eth_representor_info_get_t representor_info_get;
1265
1266         /**
1267          * Negotiate the NIC's ability to deliver specific
1268          * kinds of metadata to the PMD
1269          */
1270         eth_rx_metadata_negotiate_t rx_metadata_negotiate;
1271
1272         /** Get IP reassembly capability */
1273         eth_ip_reassembly_capability_get_t ip_reassembly_capability_get;
1274         /** Get IP reassembly configuration */
1275         eth_ip_reassembly_conf_get_t ip_reassembly_conf_get;
1276         /** Set IP reassembly configuration */
1277         eth_ip_reassembly_conf_set_t ip_reassembly_conf_set;
1278
1279         /** Dump private info from device */
1280         eth_dev_priv_dump_t eth_dev_priv_dump;
1281 };
1282
1283 /**
1284  * @internal
1285  * Check if the selected Rx queue is hairpin queue.
1286  *
1287  * @param dev
1288  *  Pointer to the selected device.
1289  * @param queue_id
1290  *  The selected queue.
1291  *
1292  * @return
1293  *   - (1) if the queue is hairpin queue, 0 otherwise.
1294  */
1295 __rte_internal
1296 int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
1297
1298 /**
1299  * @internal
1300  * Check if the selected Tx queue is hairpin queue.
1301  *
1302  * @param dev
1303  *  Pointer to the selected device.
1304  * @param queue_id
1305  *  The selected queue.
1306  *
1307  * @return
1308  *   - (1) if the queue is hairpin queue, 0 otherwise.
1309  */
1310 __rte_internal
1311 int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
1312
1313 /**
1314  * @internal
1315  * Returns a ethdev slot specified by the unique identifier name.
1316  *
1317  * @param       name
1318  *  The pointer to the Unique identifier name for each Ethernet device
1319  * @return
1320  *   - The pointer to the ethdev slot, on success. NULL on error
1321  */
1322 __rte_internal
1323 struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
1324
1325 /**
1326  * @internal
1327  * Allocates a new ethdev slot for an Ethernet device and returns the pointer
1328  * to that slot for the driver to use.
1329  *
1330  * @param       name    Unique identifier name for each Ethernet device
1331  * @return
1332  *   - Slot in the rte_dev_devices array for a new device;
1333  */
1334 __rte_internal
1335 struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
1336
1337 /**
1338  * @internal
1339  * Attach to the ethdev already initialized by the primary
1340  * process.
1341  *
1342  * @param       name    Ethernet device's name.
1343  * @return
1344  *   - Success: Slot in the rte_dev_devices array for attached
1345  *        device.
1346  *   - Error: Null pointer.
1347  */
1348 __rte_internal
1349 struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name);
1350
1351 /**
1352  * @internal
1353  * Notify RTE_ETH_EVENT_DESTROY and release the specified ethdev port.
1354  *
1355  * The following PMD-managed data fields will be freed:
1356  *   - dev_private
1357  *   - mac_addrs
1358  *   - hash_mac_addrs
1359  * If one of these fields should not be freed,
1360  * it must be reset to NULL by the PMD, typically in dev_close method.
1361  *
1362  * @param eth_dev
1363  * Device to be detached.
1364  * @return
1365  *   - 0 on success, negative on error
1366  */
1367 __rte_internal
1368 int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
1369
1370 /**
1371  * @internal
1372  * Release device queues and clear its configuration to force the user
1373  * application to reconfigure it. It is for internal use only.
1374  *
1375  * @param dev
1376  *  Pointer to struct rte_eth_dev.
1377  *
1378  * @return
1379  *  void
1380  */
1381 __rte_internal
1382 void rte_eth_dev_internal_reset(struct rte_eth_dev *dev);
1383
1384 /**
1385  * @internal Executes all the user application registered callbacks for
1386  * the specific device. It is for DPDK internal user only. User
1387  * application should not call it directly.
1388  *
1389  * @param dev
1390  *  Pointer to struct rte_eth_dev.
1391  * @param event
1392  *  Eth device interrupt event type.
1393  * @param ret_param
1394  *  To pass data back to user application.
1395  *  This allows the user application to decide if a particular function
1396  *  is permitted or not.
1397  *
1398  * @return
1399  *  int
1400  */
1401 __rte_internal
1402 int rte_eth_dev_callback_process(struct rte_eth_dev *dev,
1403                 enum rte_eth_event_type event, void *ret_param);
1404
1405 /**
1406  * @internal
1407  * This is the last step of device probing.
1408  * It must be called after a port is allocated and initialized successfully.
1409  *
1410  * The notification RTE_ETH_EVENT_NEW is sent to other entities
1411  * (libraries and applications).
1412  * The state is set as RTE_ETH_DEV_ATTACHED.
1413  *
1414  * @param dev
1415  *  New ethdev port.
1416  */
1417 __rte_internal
1418 void rte_eth_dev_probing_finish(struct rte_eth_dev *dev);
1419
1420 /**
1421  * Create memzone for HW rings.
1422  * malloc can't be used as the physical address is needed.
1423  * If the memzone is already created, then this function returns a ptr
1424  * to the old one.
1425  *
1426  * @param eth_dev
1427  *   The *eth_dev* pointer is the address of the *rte_eth_dev* structure
1428  * @param name
1429  *   The name of the memory zone
1430  * @param queue_id
1431  *   The index of the queue to add to name
1432  * @param size
1433  *   The sizeof of the memory area
1434  * @param align
1435  *   Alignment for resulting memzone. Must be a power of 2.
1436  * @param socket_id
1437  *   The *socket_id* argument is the socket identifier in case of NUMA.
1438  */
1439 __rte_internal
1440 const struct rte_memzone *
1441 rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
1442                          uint16_t queue_id, size_t size,
1443                          unsigned align, int socket_id);
1444
1445 /**
1446  * Free previously allocated memzone for HW rings.
1447  *
1448  * @param eth_dev
1449  *   The *eth_dev* pointer is the address of the *rte_eth_dev* structure
1450  * @param name
1451  *   The name of the memory zone
1452  * @param queue_id
1453  *   The index of the queue to add to name
1454  * @return
1455  *   Negative errno value on error, 0 on success.
1456  */
1457 __rte_internal
1458 int
1459 rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name,
1460                  uint16_t queue_id);
1461
1462 /**
1463  * @internal
1464  * Atomically set the link status for the specific device.
1465  * It is for use by DPDK device driver use only.
1466  * User applications should not call it
1467  *
1468  * @param dev
1469  *  Pointer to struct rte_eth_dev.
1470  * @param link
1471  *  New link status value.
1472  * @return
1473  *  Same convention as eth_link_update operation.
1474  *  0   if link up status has changed
1475  *  -1  if link up status was unchanged
1476  */
1477 static inline int
1478 rte_eth_linkstatus_set(struct rte_eth_dev *dev,
1479                        const struct rte_eth_link *new_link)
1480 {
1481         uint64_t *dev_link = (uint64_t *)&(dev->data->dev_link);
1482         union {
1483                 uint64_t val64;
1484                 struct rte_eth_link link;
1485         } orig;
1486
1487         RTE_BUILD_BUG_ON(sizeof(*new_link) != sizeof(uint64_t));
1488
1489         orig.val64 = __atomic_exchange_n(dev_link, *(const uint64_t *)new_link,
1490                                         __ATOMIC_SEQ_CST);
1491
1492         return (orig.link.link_status == new_link->link_status) ? -1 : 0;
1493 }
1494
1495 /**
1496  * @internal
1497  * Atomically get the link speed and status.
1498  *
1499  * @param dev
1500  *  Pointer to struct rte_eth_dev.
1501  * @param link
1502  *  link status value.
1503  */
1504 static inline void
1505 rte_eth_linkstatus_get(const struct rte_eth_dev *dev,
1506                        struct rte_eth_link *link)
1507 {
1508         uint64_t *src = (uint64_t *)&(dev->data->dev_link);
1509         uint64_t *dst = (uint64_t *)link;
1510
1511         RTE_BUILD_BUG_ON(sizeof(*link) != sizeof(uint64_t));
1512
1513         *dst = __atomic_load_n(src, __ATOMIC_SEQ_CST);
1514 }
1515
1516 /**
1517  * @internal
1518  * Dummy DPDK callback for Rx/Tx packet burst.
1519  *
1520  * @param queue
1521  *  Pointer to Rx/Tx queue
1522  * @param pkts
1523  *  Packet array
1524  * @param nb_pkts
1525  *  Number of packets in packet array
1526  */
1527 __rte_internal
1528 uint16_t
1529 rte_eth_pkt_burst_dummy(void *queue __rte_unused,
1530                 struct rte_mbuf **pkts __rte_unused,
1531                 uint16_t nb_pkts __rte_unused);
1532
1533 /**
1534  * Allocate an unique switch domain identifier.
1535  *
1536  * A pool of switch domain identifiers which can be allocated on request. This
1537  * will enabled devices which support the concept of switch domains to request
1538  * a switch domain ID which is guaranteed to be unique from other devices
1539  * running in the same process.
1540  *
1541  * @param domain_id
1542  *  switch domain identifier parameter to pass back to application
1543  *
1544  * @return
1545  *   Negative errno value on error, 0 on success.
1546  */
1547 __rte_internal
1548 int
1549 rte_eth_switch_domain_alloc(uint16_t *domain_id);
1550
1551 /**
1552  * Free switch domain.
1553  *
1554  * Return a switch domain identifier to the pool of free identifiers after it is
1555  * no longer in use by device.
1556  *
1557  * @param domain_id
1558  *  switch domain identifier to free
1559  *
1560  * @return
1561  *   Negative errno value on error, 0 on success.
1562  */
1563 __rte_internal
1564 int
1565 rte_eth_switch_domain_free(uint16_t domain_id);
1566
1567 /**
1568  * Generic Ethernet device arguments
1569  *
1570  * One type of representor each structure.
1571  */
1572 struct rte_eth_devargs {
1573         uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS];
1574         /** controller/s number in case of multi-host */
1575         uint16_t nb_mh_controllers;
1576         /** number of controllers in multi-host controllers field */
1577         uint16_t ports[RTE_MAX_ETHPORTS];
1578         /** port/s number to enable on a multi-port single function */
1579         uint16_t nb_ports;
1580         /** number of ports in ports field */
1581         uint16_t representor_ports[RTE_MAX_ETHPORTS];
1582         /** representor port/s identifier to enable on device */
1583         uint16_t nb_representor_ports;
1584         /** number of ports in representor port field */
1585         enum rte_eth_representor_type type; /* type of representor */
1586 };
1587
1588 /**
1589  * PMD helper function to get representor ID from location detail.
1590  *
1591  * Get representor ID from controller, pf and (sf or vf).
1592  * The mapping is retrieved from rte_eth_representor_info_get().
1593  *
1594  * For backward compatibility, if no representor info, direct
1595  * map legacy VF (no controller and pf).
1596  *
1597  * @param port_id
1598  *  Port ID of the backing device.
1599  * @param type
1600  *  Representor type.
1601  * @param controller
1602  *  Controller ID, -1 if unspecified.
1603  * @param pf
1604  *  PF port ID, -1 if unspecified.
1605  * @param representor_port
1606  *  VF or SF representor port number, -1 if unspecified.
1607  * @param repr_id
1608  *  Pointer to output representor ID.
1609  *
1610  * @return
1611  *  Negative errno value on error, 0 on success.
1612  */
1613 __rte_internal
1614 int
1615 rte_eth_representor_id_get(uint16_t port_id,
1616                            enum rte_eth_representor_type type,
1617                            int controller, int pf, int representor_port,
1618                            uint16_t *repr_id);
1619
1620 /**
1621  * PMD helper function to parse ethdev arguments
1622  *
1623  * @param devargs
1624  *  device arguments
1625  * @param eth_devargs
1626  *  parsed ethdev specific arguments.
1627  *
1628  * @return
1629  *   Negative errno value on error, 0 on success.
1630  */
1631 __rte_internal
1632 int
1633 rte_eth_devargs_parse(const char *devargs, struct rte_eth_devargs *eth_devargs);
1634
1635
1636 typedef int (*ethdev_init_t)(struct rte_eth_dev *ethdev, void *init_params);
1637 typedef int (*ethdev_bus_specific_init)(struct rte_eth_dev *ethdev,
1638         void *bus_specific_init_params);
1639
1640 /**
1641  * PMD helper function for the creation of a new ethdev ports.
1642  *
1643  * @param device
1644  *  rte_device handle.
1645  * @param name
1646  *  port name.
1647  * @param priv_data_size
1648  *  size of private data required for port.
1649  * @param bus_specific_init
1650  *  port bus specific initialisation callback function
1651  * @param bus_init_params
1652  *  port bus specific initialisation parameters
1653  * @param ethdev_init
1654  *  device specific port initialization callback function
1655  * @param init_params
1656  *  port initialisation parameters
1657  *
1658  * @return
1659  *   Negative errno value on error, 0 on success.
1660  */
1661 __rte_internal
1662 int
1663 rte_eth_dev_create(struct rte_device *device, const char *name,
1664         size_t priv_data_size,
1665         ethdev_bus_specific_init bus_specific_init, void *bus_init_params,
1666         ethdev_init_t ethdev_init, void *init_params);
1667
1668
1669 typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev);
1670
1671 /**
1672  * PMD helper function for cleaning up the resources of a ethdev port on it's
1673  * destruction.
1674  *
1675  * @param ethdev
1676  *   ethdev handle of port.
1677  * @param ethdev_uninit
1678  *   device specific port un-initialise callback function
1679  *
1680  * @return
1681  *   Negative errno value on error, 0 on success.
1682  */
1683 __rte_internal
1684 int
1685 rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit);
1686
1687 /**
1688  * @internal
1689  * Pass the current hairpin queue HW and/or SW information to the peer queue
1690  * and fetch back the information of the peer queue.
1691  *
1692  * @param peer_port
1693  *  Peer port identifier of the Ethernet device.
1694  * @param peer_queue
1695  *  Peer queue index of the port.
1696  * @param cur_info
1697  *  Pointer to the current information structure.
1698  * @param peer_info
1699  *  Pointer to the peer information, output.
1700  * @param direction
1701  *  Direction to pass the information.
1702  *  positive - pass Tx queue information and get peer Rx queue information
1703  *  zero - pass Rx queue information and get peer Tx queue information
1704  *
1705  * @return
1706  *  Negative errno value on error, 0 on success.
1707  */
1708 __rte_internal
1709 int
1710 rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
1711                                   struct rte_hairpin_peer_info *cur_info,
1712                                   struct rte_hairpin_peer_info *peer_info,
1713                                   uint32_t direction);
1714
1715 /**
1716  * @internal
1717  * Configure current hairpin queue with the peer information fetched to create
1718  * the connection (bind) with peer queue in the specified direction.
1719  * This function might need to be called twice to fully create the connections.
1720  *
1721  * @param cur_port
1722  *  Current port identifier of the Ethernet device.
1723  * @param cur_queue
1724  *  Current queue index of the port.
1725  * @param peer_info
1726  *  Pointer to the peer information, input.
1727  * @param direction
1728  *  Direction to create the connection.
1729  *  positive - bind current Tx queue to peer Rx queue
1730  *  zero - bind current Rx queue to peer Tx queue
1731  *
1732  * @return
1733  *  Negative errno value on error, 0 on success.
1734  */
1735 __rte_internal
1736 int
1737 rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
1738                                 struct rte_hairpin_peer_info *peer_info,
1739                                 uint32_t direction);
1740
1741 /**
1742  * @internal
1743  * Get rte_eth_dev from device name. The device name should be specified
1744  * as below:
1745  * - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0
1746  * - SoC device name, for example fsl-gmac0
1747  * - vdev dpdk name, for example net_[pcap0|null0|tap0]
1748  *
1749  * @param name
1750  *   PCI address or name of the device
1751  * @return
1752  *   - rte_eth_dev if successful
1753  *   - NULL on failure
1754  */
1755 __rte_internal
1756 struct rte_eth_dev*
1757 rte_eth_dev_get_by_name(const char *name);
1758
1759 /**
1760  * @internal
1761  * Reset the current queue state and configuration to disconnect (unbind) it
1762  * from the peer queue.
1763  * This function might need to be called twice to disconnect each other.
1764  *
1765  * @param cur_port
1766  *  Current port identifier of the Ethernet device.
1767  * @param cur_queue
1768  *  Current queue index of the port.
1769  * @param direction
1770  *  Direction to destroy the connection.
1771  *  positive - unbind current Tx queue from peer Rx queue
1772  *  zero - unbind current Rx queue from peer Tx queue
1773  *
1774  * @return
1775  *  Negative errno value on error, 0 on success.
1776  */
1777 __rte_internal
1778 int
1779 rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
1780                                   uint32_t direction);
1781
1782 /**
1783  * @internal
1784  * Register mbuf dynamic field and flag for IP reassembly incomplete case.
1785  */
1786 __rte_internal
1787 int
1788 rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag);
1789
1790
1791 /*
1792  * Legacy ethdev API used internally by drivers.
1793  */
1794
1795 enum rte_filter_type {
1796         RTE_ETH_FILTER_NONE = 0,
1797         RTE_ETH_FILTER_ETHERTYPE,
1798         RTE_ETH_FILTER_FLEXIBLE,
1799         RTE_ETH_FILTER_SYN,
1800         RTE_ETH_FILTER_NTUPLE,
1801         RTE_ETH_FILTER_TUNNEL,
1802         RTE_ETH_FILTER_FDIR,
1803         RTE_ETH_FILTER_HASH,
1804         RTE_ETH_FILTER_L2_TUNNEL,
1805 };
1806
1807 /**
1808  * Define all structures for Ethertype Filter type.
1809  */
1810
1811 #define RTE_ETHTYPE_FLAGS_MAC    0x0001 /**< If set, compare mac */
1812 #define RTE_ETHTYPE_FLAGS_DROP   0x0002 /**< If set, drop packet when match */
1813
1814 /**
1815  * A structure used to define the ethertype filter entry
1816  * to support RTE_ETH_FILTER_ETHERTYPE data representation.
1817  */
1818 struct rte_eth_ethertype_filter {
1819         struct rte_ether_addr mac_addr;   /**< Mac address to match */
1820         uint16_t ether_type;          /**< Ether type to match */
1821         uint16_t flags;               /**< Flags from RTE_ETHTYPE_FLAGS_* */
1822         uint16_t queue;               /**< Queue assigned to when match */
1823 };
1824
1825 /**
1826  * A structure used to define the TCP syn filter entry
1827  * to support RTE_ETH_FILTER_SYN data representation.
1828  */
1829 struct rte_eth_syn_filter {
1830         /** 1 - higher priority than other filters, 0 - lower priority */
1831         uint8_t hig_pri;
1832         uint16_t queue;      /**< Queue assigned to when match */
1833 };
1834
1835 /**
1836  * filter type of tunneling packet
1837  */
1838 #define RTE_ETH_TUNNEL_FILTER_OMAC  0x01 /**< filter by outer MAC addr */
1839 #define RTE_ETH_TUNNEL_FILTER_OIP   0x02 /**< filter by outer IP Addr */
1840 #define RTE_ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
1841 #define RTE_ETH_TUNNEL_FILTER_IMAC  0x08 /**< filter by inner MAC addr */
1842 #define RTE_ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
1843 #define RTE_ETH_TUNNEL_FILTER_IIP   0x20 /**< filter by inner IP addr */
1844
1845 #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN (RTE_ETH_TUNNEL_FILTER_IMAC | \
1846                                           RTE_ETH_TUNNEL_FILTER_IVLAN)
1847 #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
1848                                                 RTE_ETH_TUNNEL_FILTER_IVLAN | \
1849                                                 RTE_ETH_TUNNEL_FILTER_TENID)
1850 #define RTE_ETH_TUNNEL_FILTER_IMAC_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
1851                                           RTE_ETH_TUNNEL_FILTER_TENID)
1852 #define RTE_ETH_TUNNEL_FILTER_OMAC_TENID_IMAC (RTE_ETH_TUNNEL_FILTER_OMAC | \
1853                                                RTE_ETH_TUNNEL_FILTER_TENID | \
1854                                                RTE_ETH_TUNNEL_FILTER_IMAC)
1855
1856 /**
1857  *  Select IPv4 or IPv6 for tunnel filters.
1858  */
1859 enum rte_tunnel_iptype {
1860         RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4 */
1861         RTE_TUNNEL_IPTYPE_IPV6,     /**< IPv6 */
1862 };
1863
1864 /**
1865  * Tunneling Packet filter configuration.
1866  */
1867 struct rte_eth_tunnel_filter_conf {
1868         struct rte_ether_addr outer_mac;    /**< Outer MAC address to match */
1869         struct rte_ether_addr inner_mac;    /**< Inner MAC address to match */
1870         uint16_t inner_vlan;                /**< Inner VLAN to match */
1871         enum rte_tunnel_iptype ip_type;     /**< IP address type */
1872         /**
1873          * Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP
1874          * is set in filter_type, or inner destination IP address to match
1875          * if ETH_TUNNEL_FILTER_IIP is set in filter_type.
1876          */
1877         union {
1878                 uint32_t ipv4_addr;         /**< IPv4 address in big endian */
1879                 uint32_t ipv6_addr[4];      /**< IPv6 address in big endian */
1880         } ip_addr;
1881         /** Flags from ETH_TUNNEL_FILTER_XX - see above */
1882         uint16_t filter_type;
1883         enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type */
1884         uint32_t tenant_id;     /**< Tenant ID to match: VNI, GRE key... */
1885         uint16_t queue_id;      /**< Queue assigned to if match */
1886 };
1887
1888 #ifdef __cplusplus
1889 }
1890 #endif
1891
1892 #endif /* _RTE_ETHDEV_DRIVER_H_ */