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