Branch data Line data Source code
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 : : #include <pthread.h>
18 : :
19 : : #include <dev_driver.h>
20 : : #include <rte_compat.h>
21 : : #include <rte_ethdev.h>
22 : :
23 : : #ifdef __cplusplus
24 : : extern "C" {
25 : : #endif
26 : :
27 : : #define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */
28 : :
29 : : /**
30 : : * @internal
31 : : * Structure used to pass queue stats back to ethdev
32 : : * for drivers which rely on ethdev to add the queue stats automatically to xstats.
33 : : */
34 : : struct eth_queue_stats {
35 : : /* Queue stats are limited to max 256 queues. */
36 : : /** Total number of queue Rx packets. */
37 : : uint64_t q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
38 : : /** Total number of queue Tx packets. */
39 : : uint64_t q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS];
40 : : /** Total number of successfully received queue bytes. */
41 : : uint64_t q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
42 : : /** Total number of successfully transmitted queue bytes. */
43 : : uint64_t q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS];
44 : : /** Total number of queue packets received that are dropped. */
45 : : uint64_t q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS];
46 : : };
47 : :
48 : : /**
49 : : * @internal
50 : : * Structure used to hold information about the callbacks to be called for a
51 : : * queue on Rx and Tx.
52 : : */
53 : : struct rte_eth_rxtx_callback {
54 : : RTE_ATOMIC(struct rte_eth_rxtx_callback *) next;
55 : : union{
56 : : rte_rx_callback_fn rx;
57 : : rte_tx_callback_fn tx;
58 : : } fn;
59 : : void *param;
60 : : };
61 : :
62 : : /**
63 : : * @internal
64 : : * The generic data structure associated with each Ethernet device.
65 : : *
66 : : * Pointers to burst-oriented packet receive and transmit functions are
67 : : * located at the beginning of the structure, along with the pointer to
68 : : * where all the data elements for the particular device are stored in shared
69 : : * memory. This split allows the function pointer and driver data to be per-
70 : : * process, while the actual configuration data for the device is shared.
71 : : */
72 : : struct __rte_cache_aligned rte_eth_dev {
73 : : eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function */
74 : : eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function */
75 : :
76 : : /** Pointer to PMD transmit prepare function */
77 : : eth_tx_prep_t tx_pkt_prepare;
78 : : /** Get the number of used Rx descriptors */
79 : : eth_rx_queue_count_t rx_queue_count;
80 : : /** Check the status of a Rx descriptor */
81 : : eth_rx_descriptor_status_t rx_descriptor_status;
82 : : /** Get the number of used Tx descriptors */
83 : : eth_tx_queue_count_t tx_queue_count;
84 : : /** Check the status of a Tx descriptor */
85 : : eth_tx_descriptor_status_t tx_descriptor_status;
86 : : /** Pointer to PMD transmit mbufs reuse function */
87 : : eth_recycle_tx_mbufs_reuse_t recycle_tx_mbufs_reuse;
88 : : /** Pointer to PMD receive descriptors refill function */
89 : : eth_recycle_rx_descriptors_refill_t recycle_rx_descriptors_refill;
90 : :
91 : : /**
92 : : * Device data that is shared between primary and secondary processes
93 : : */
94 : : struct rte_eth_dev_data *data;
95 : : void *process_private; /**< Pointer to per-process device data */
96 : : const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
97 : : /** Fast path flow API functions exported by PMD */
98 : : const struct rte_flow_fp_ops *flow_fp_ops;
99 : : struct rte_device *device; /**< Backing device */
100 : : struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
101 : :
102 : : /** User application callbacks for NIC interrupts */
103 : : struct rte_eth_dev_cb_list link_intr_cbs;
104 : : /**
105 : : * User-supplied functions called from rx_burst to post-process
106 : : * received packets before passing them to the user
107 : : */
108 : : RTE_ATOMIC(struct rte_eth_rxtx_callback *) post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
109 : : /**
110 : : * User-supplied functions called from tx_burst to pre-process
111 : : * received packets before passing them to the driver for transmission
112 : : */
113 : : RTE_ATOMIC(struct rte_eth_rxtx_callback *) pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT];
114 : :
115 : : enum rte_eth_dev_state state; /**< Flag indicating the port state */
116 : : void *security_ctx; /**< Context for security ops */
117 : : };
118 : :
119 : : struct rte_eth_dev_sriov;
120 : : struct rte_eth_dev_owner;
121 : :
122 : : /**
123 : : * @internal
124 : : * The data part, with no function pointers, associated with each Ethernet
125 : : * device. This structure is safe to place in shared memory to be common
126 : : * among different processes in a multi-process configuration.
127 : : */
128 : : struct __rte_cache_aligned rte_eth_dev_data {
129 : : char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */
130 : :
131 : : void **rx_queues; /**< Array of pointers to Rx queues */
132 : : void **tx_queues; /**< Array of pointers to Tx queues */
133 : : uint16_t nb_rx_queues; /**< Number of Rx queues */
134 : : uint16_t nb_tx_queues; /**< Number of Tx queues */
135 : :
136 : : struct rte_eth_dev_sriov sriov; /**< SRIOV data */
137 : :
138 : : /** PMD-specific private data. @see rte_eth_dev_release_port() */
139 : : void *dev_private;
140 : :
141 : : struct rte_eth_link dev_link; /**< Link-level information & status */
142 : : struct rte_eth_conf dev_conf; /**< Configuration applied to device */
143 : : uint16_t mtu; /**< Maximum Transmission Unit */
144 : :
145 : : /** Common Rx buffer size handled by all queues */
146 : : uint32_t min_rx_buf_size;
147 : :
148 : : uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */
149 : :
150 : : /**
151 : : * Device Ethernet link addresses.
152 : : * All entries are unique.
153 : : * The first entry (index zero) is the default address.
154 : : */
155 : : struct rte_ether_addr *mac_addrs;
156 : : /** Bitmap associating MAC addresses to pools */
157 : : uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR];
158 : : /**
159 : : * Device Ethernet MAC addresses of hash filtering.
160 : : * @see rte_eth_dev_release_port()
161 : : */
162 : : struct rte_ether_addr *hash_mac_addrs;
163 : :
164 : : uint16_t port_id; /**< Device [external] port identifier */
165 : :
166 : : __extension__
167 : : uint8_t /** Rx promiscuous mode ON(1) / OFF(0) */
168 : : promiscuous : 1,
169 : : /** Rx of scattered packets is ON(1) / OFF(0) */
170 : : scattered_rx : 1,
171 : : /** Rx all multicast mode ON(1) / OFF(0) */
172 : : all_multicast : 1,
173 : : /** Device state: STARTED(1) / STOPPED(0) */
174 : : dev_started : 1,
175 : : /** Rx LRO is ON(1) / OFF(0) */
176 : : lro : 1,
177 : : /**
178 : : * Indicates whether the device is configured:
179 : : * CONFIGURED(1) / NOT CONFIGURED(0)
180 : : */
181 : : dev_configured : 1,
182 : : /**
183 : : * Indicates whether the flow engine is configured:
184 : : * CONFIGURED(1) / NOT CONFIGURED(0)
185 : : */
186 : : flow_configured : 1;
187 : :
188 : : /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
189 : : uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT];
190 : : /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */
191 : : uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
192 : :
193 : : uint32_t dev_flags; /**< Capabilities */
194 : : int numa_node; /**< NUMA node connection */
195 : :
196 : : /** VLAN filter configuration */
197 : : struct rte_vlan_filter_conf vlan_filter_conf;
198 : :
199 : : struct rte_eth_dev_owner owner; /**< The port owner */
200 : :
201 : : /**
202 : : * Switch-specific identifier.
203 : : * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
204 : : */
205 : : uint16_t representor_id;
206 : : /**
207 : : * Port ID of the backing device.
208 : : * This device will be used to query representor info and calculate
209 : : * representor IDs. Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags.
210 : : */
211 : : uint16_t backer_port_id;
212 : :
213 : : pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex */
214 : : };
215 : :
216 : : /**
217 : : * @internal
218 : : * The pool of *rte_eth_dev* structures. The size of the pool
219 : : * is configured at compile-time in the <rte_ethdev.c> file.
220 : : */
221 : : extern struct rte_eth_dev rte_eth_devices[];
222 : :
223 : : /** @internal Declaration of the hairpin peer queue information structure. */
224 : : struct rte_hairpin_peer_info;
225 : :
226 : : /*
227 : : * Definitions of all functions exported by an Ethernet driver through the
228 : : * generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
229 : : * structure associated with an Ethernet device.
230 : : */
231 : :
232 : : /** @internal Ethernet device configuration. */
233 : : typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev);
234 : :
235 : : /** @internal Function used to start a configured Ethernet device. */
236 : : typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev);
237 : :
238 : : /** @internal Function used to stop a configured Ethernet device. */
239 : : typedef int (*eth_dev_stop_t)(struct rte_eth_dev *dev);
240 : :
241 : : /** @internal Function used to link up a configured Ethernet device. */
242 : : typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev);
243 : :
244 : : /** @internal Function used to link down a configured Ethernet device. */
245 : : typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev);
246 : :
247 : : /** @internal Function used to close a configured Ethernet device. */
248 : : typedef int (*eth_dev_close_t)(struct rte_eth_dev *dev);
249 : :
250 : : /** @internal Function used to reset a configured Ethernet device. */
251 : : typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
252 : :
253 : : /** @internal Function used to detect an Ethernet device removal. */
254 : : typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
255 : :
256 : : /**
257 : : * @internal
258 : : * Function used to enable the Rx promiscuous mode of an Ethernet device.
259 : : *
260 : : * @param dev
261 : : * ethdev handle of port.
262 : : *
263 : : * @return
264 : : * Negative errno value on error, 0 on success.
265 : : *
266 : : * @retval 0
267 : : * Success, promiscuous mode is enabled.
268 : : * @retval -ENOTSUP
269 : : * Promiscuous mode is not supported.
270 : : * @retval -ENODEV
271 : : * Device is gone.
272 : : * @retval -E_RTE_SECONDARY
273 : : * Function was called from a secondary process instance and not supported.
274 : : * @retval -ETIMEDOUT
275 : : * Attempt to enable promiscuous mode failed because of timeout.
276 : : * @retval -EAGAIN
277 : : * Failed to enable promiscuous mode.
278 : : */
279 : : typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
280 : :
281 : : /**
282 : : * @internal
283 : : * Function used to disable the Rx promiscuous mode of an Ethernet device.
284 : : *
285 : : * @param dev
286 : : * ethdev handle of port.
287 : : *
288 : : * @return
289 : : * Negative errno value on error, 0 on success.
290 : : *
291 : : * @retval 0
292 : : * Success, promiscuous mode is disabled.
293 : : * @retval -ENOTSUP
294 : : * Promiscuous mode disabling is not supported.
295 : : * @retval -ENODEV
296 : : * Device is gone.
297 : : * @retval -E_RTE_SECONDARY
298 : : * Function was called from a secondary process instance and not supported.
299 : : * @retval -ETIMEDOUT
300 : : * Attempt to disable promiscuous mode failed because of timeout.
301 : : * @retval -EAGAIN
302 : : * Failed to disable promiscuous mode.
303 : : */
304 : : typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
305 : :
306 : : /**
307 : : * @internal
308 : : * Enable the receipt of all multicast packets by an Ethernet device.
309 : : *
310 : : * @param dev
311 : : * ethdev handle of port.
312 : : *
313 : : * @return
314 : : * Negative errno value on error, 0 on success.
315 : : *
316 : : * @retval 0
317 : : * Success, all-multicast mode is enabled.
318 : : * @retval -ENOTSUP
319 : : * All-multicast mode is not supported.
320 : : * @retval -ENODEV
321 : : * Device is gone.
322 : : * @retval -E_RTE_SECONDARY
323 : : * Function was called from a secondary process instance and not supported.
324 : : * @retval -ETIMEDOUT
325 : : * Attempt to enable all-multicast mode failed because of timeout.
326 : : * @retval -EAGAIN
327 : : * Failed to enable all-multicast mode.
328 : : */
329 : : typedef int (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
330 : :
331 : : /**
332 : : * @internal
333 : : * Disable the receipt of all multicast packets by an Ethernet device.
334 : : *
335 : : * @param dev
336 : : * ethdev handle of port.
337 : : *
338 : : * @return
339 : : * Negative errno value on error, 0 on success.
340 : : *
341 : : * @retval 0
342 : : * Success, all-multicast mode is disabled.
343 : : * @retval -ENOTSUP
344 : : * All-multicast mode disabling is not supported.
345 : : * @retval -ENODEV
346 : : * Device is gone.
347 : : * @retval -E_RTE_SECONDARY
348 : : * Function was called from a secondary process instance and not supported.
349 : : * @retval -ETIMEDOUT
350 : : * Attempt to disable all-multicast mode failed because of timeout.
351 : : * @retval -EAGAIN
352 : : * Failed to disable all-multicast mode.
353 : : */
354 : : typedef int (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev);
355 : :
356 : : /**
357 : : * @internal
358 : : * Get link speed, duplex mode and state (up/down) of an Ethernet device.
359 : : */
360 : : typedef int (*eth_link_update_t)(struct rte_eth_dev *dev,
361 : : int wait_to_complete);
362 : :
363 : : /**
364 : : * @internal
365 : : * Get number of current active lanes
366 : : *
367 : : * @param dev
368 : : * ethdev handle of port.
369 : : * @param speed_lanes
370 : : * Number of active lanes that the link has trained up. This information
371 : : * is displayed for Autonegotiated or Fixed speed trained link.
372 : : * @return
373 : : * Negative errno value on error, 0 on success.
374 : : *
375 : : * @retval 0
376 : : * Success, get speed_lanes data success.
377 : : * @retval -ENOTSUP
378 : : * Operation is not supported.
379 : : * @retval -EIO
380 : : * Device is removed.
381 : : */
382 : : typedef int (*eth_speed_lanes_get_t)(struct rte_eth_dev *dev, uint32_t *speed_lanes);
383 : :
384 : : /**
385 : : * @internal
386 : : * Set speed lanes supported by the NIC. This configuration is applicable only when
387 : : * fix speed is already configured and or will be configured. This api requires the
388 : : * port be stopped, since driver has to re-configure PHY with fixed speed and lanes.
389 : : * If no lanes are configured prior or after "port config X speed Y duplex Z", the
390 : : * driver will choose the default lane for that speed to bring up the link.
391 : : *
392 : : * @param dev
393 : : * ethdev handle of port.
394 : : * @param speed_lanes
395 : : * Non-negative number of lanes
396 : : *
397 : : * @return
398 : : * Negative errno value on error, 0 on success.
399 : : *
400 : : * @retval 0
401 : : * Success, set lanes success.
402 : : * @retval -ENOTSUP
403 : : * Operation is not supported.
404 : : * @retval -EINVAL
405 : : * Unsupported number of lanes for fixed speed requested.
406 : : * @retval -EIO
407 : : * Device is removed.
408 : : */
409 : : typedef int (*eth_speed_lanes_set_t)(struct rte_eth_dev *dev, uint32_t speed_lanes);
410 : :
411 : : /**
412 : : * @internal
413 : : * Get supported link speed lanes capability. The driver returns number of lanes
414 : : * supported per speed in the form of lanes capability bitmap per speed.
415 : : *
416 : : * @param speed_lanes_capa
417 : : * A pointer to num of rte_eth_speed_lanes_capa struct array which carries the
418 : : * bit map of lanes supported per speed. The number of supported speeds is the
419 : : * size of this speed_lanes_capa table. In link up condition, only active supported
420 : : * speeds lanes bitmap information will be displayed. In link down condition, all
421 : : * the supported speeds and its supported lanes bitmap would be fetched and displayed.
422 : : *
423 : : * This api is overloaded to fetch the size of the speed_lanes_capa array if
424 : : * testpmd calls the driver with speed_lanes_capa = NULL and num = 0
425 : : *
426 : : * @param num
427 : : * Number of elements in a speed_speed_lanes_capa array. This num is equal to the
428 : : * number of supported speeds by the controller. This value will vary in link up
429 : : * and link down condition. num is updated by the driver if speed_lanes_capa is NULL.
430 : : *
431 : : * @return
432 : : * Negative errno value on error, positive value on success.
433 : : *
434 : : * @retval positive value
435 : : * A non-negative value lower or equal to num: success. The return value
436 : : * is the number of entries filled in the speed lanes array.
437 : : * A non-negative value higher than num: error, the given speed lanes capa array
438 : : * is too small. The return value corresponds to the num that should
439 : : * be given to succeed. The entries in the speed lanes capa array are not valid
440 : : * and shall not be used by the caller.
441 : : * @retval -ENOTSUP
442 : : * Operation is not supported.
443 : : * @retval -EINVAL
444 : : * *num* or *speed_lanes_capa* invalid.
445 : : */
446 : : typedef int (*eth_speed_lanes_get_capability_t)(struct rte_eth_dev *dev,
447 : : struct rte_eth_speed_lanes_capa *speed_lanes_capa,
448 : : unsigned int num);
449 : :
450 : : /**
451 : : * @internal
452 : : * Get global I/O statistics of an Ethernet device.
453 : : *
454 : : * @param dev
455 : : * Device being queried.
456 : : * @param stats
457 : : * The stats structure to be completed by the driver and returned to the user.
458 : : * @param qstats
459 : : * Any queue statistics to be returned.
460 : : * @note: This parameter can be NULL
461 : : */
462 : : typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
463 : : struct rte_eth_stats *stats,
464 : : struct eth_queue_stats *qstats);
465 : :
466 : : /**
467 : : * @internal
468 : : * Reset global I/O statistics of an Ethernet device to 0.
469 : : *
470 : : * @param dev
471 : : * ethdev handle of port.
472 : : *
473 : : * @return
474 : : * Negative errno value on error, 0 on success.
475 : : *
476 : : * @retval 0
477 : : * Success, statistics has been reset.
478 : : * @retval -ENOTSUP
479 : : * Resetting statistics is not supported.
480 : : * @retval -EINVAL
481 : : * Resetting statistics is not valid.
482 : : * @retval -ENOMEM
483 : : * Not enough memory to get the stats.
484 : : */
485 : : typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
486 : :
487 : : /** @internal Get extended stats of an Ethernet device. */
488 : : typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
489 : : struct rte_eth_xstat *stats, unsigned int n);
490 : :
491 : : /**
492 : : * @internal
493 : : * Get extended stats of an Ethernet device.
494 : : *
495 : : * @param dev
496 : : * ethdev handle of port.
497 : : * @param ids
498 : : * IDs array to retrieve specific statistics. Must not be NULL.
499 : : * @param values
500 : : * A pointer to a table to be filled with device statistics values.
501 : : * Must not be NULL.
502 : : * @param n
503 : : * Element count in @p ids and @p values.
504 : : *
505 : : * @return
506 : : * - A number of filled in stats.
507 : : * - A negative value on error.
508 : : */
509 : : typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
510 : : const uint64_t *ids,
511 : : uint64_t *values,
512 : : unsigned int n);
513 : :
514 : : /**
515 : : * @internal
516 : : * Reset extended stats of an Ethernet device.
517 : : *
518 : : * @param dev
519 : : * ethdev handle of port.
520 : : *
521 : : * @return
522 : : * Negative errno value on error, 0 on success.
523 : : *
524 : : * @retval 0
525 : : * Success, statistics has been reset.
526 : : * @retval -ENOTSUP
527 : : * Resetting statistics is not supported.
528 : : * @retval -EINVAL
529 : : * Resetting statistics is not valid.
530 : : * @retval -ENOMEM
531 : : * Not enough memory to get the stats.
532 : : */
533 : : typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
534 : :
535 : : /** @internal Get names of extended stats of an Ethernet device. */
536 : : typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
537 : : struct rte_eth_xstat_name *xstats_names, unsigned int size);
538 : :
539 : : /**
540 : : * @internal
541 : : * Get names of extended stats of an Ethernet device.
542 : : *
543 : : * @param dev
544 : : * ethdev handle of port.
545 : : * @param ids
546 : : * IDs array to retrieve specific statistics. Must not be NULL.
547 : : * @param xstats_names
548 : : * An rte_eth_xstat_name array of at least @p size elements to be filled.
549 : : * Must not be NULL.
550 : : * @param size
551 : : * Element count in @p ids and @p xstats_names.
552 : : *
553 : : * @return
554 : : * - A number of filled in stats.
555 : : * - A negative value on error.
556 : : */
557 : : typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev,
558 : : const uint64_t *ids, struct rte_eth_xstat_name *xstats_names,
559 : : unsigned int size);
560 : :
561 : : /** @internal Enable an xstat of an Ethernet device. */
562 : : typedef int (*eth_xstats_enable_counter_t)(struct rte_eth_dev *dev, uint64_t id);
563 : :
564 : : /** @internal Disable an xstat of an Ethernet device. */
565 : : typedef int (*eth_xstats_disable_counter_t)(struct rte_eth_dev *dev, uint64_t id);
566 : :
567 : : /** @internal Query the state of an xstat the can be enabled and disabled in runtime. */
568 : : typedef int (*eth_xstats_query_state_t)(struct rte_eth_dev *dev, uint64_t id);
569 : :
570 : : /**
571 : : * @internal
572 : : * Set a queue statistics mapping for a Tx/Rx queue of an Ethernet device.
573 : : */
574 : : typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev,
575 : : uint16_t queue_id,
576 : : uint8_t stat_idx,
577 : : uint8_t is_rx);
578 : :
579 : : /** @internal Get specific information of an Ethernet device. */
580 : : typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev,
581 : : struct rte_eth_dev_info *dev_info);
582 : :
583 : : /**
584 : : * @internal
585 : : * Function used to get supported ptypes of an Ethernet device.
586 : : *
587 : : * @param dev
588 : : * ethdev handle of port.
589 : : *
590 : : * @param no_of_elements
591 : : * number of ptypes elements. Must be initialized to 0.
592 : : *
593 : : * @retval
594 : : * Success, array of ptypes elements and valid no_of_elements > 0.
595 : : * Failures, NULL.
596 : : */
597 : : typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev,
598 : : size_t *no_of_elements);
599 : :
600 : : /**
601 : : * @internal
602 : : * Inform Ethernet device about reduced range of packet types to handle.
603 : : *
604 : : * @param dev
605 : : * The Ethernet device identifier.
606 : : * @param ptype_mask
607 : : * The ptype family that application is interested in should be bitwise OR of
608 : : * RTE_PTYPE_*_MASK or 0.
609 : : * @return
610 : : * - (0) if Success.
611 : : */
612 : : typedef int (*eth_dev_ptypes_set_t)(struct rte_eth_dev *dev,
613 : : uint32_t ptype_mask);
614 : :
615 : : /** @internal Start Rx and Tx of a queue of an Ethernet device. */
616 : : typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev,
617 : : uint16_t queue_id);
618 : :
619 : : /** @internal Stop Rx and Tx of a queue of an Ethernet device. */
620 : : typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev,
621 : : uint16_t queue_id);
622 : :
623 : : /** @internal Set up a receive queue of an Ethernet device. */
624 : : typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev,
625 : : uint16_t rx_queue_id,
626 : : uint16_t nb_rx_desc,
627 : : unsigned int socket_id,
628 : : const struct rte_eth_rxconf *rx_conf,
629 : : struct rte_mempool *mb_pool);
630 : :
631 : : /** @internal Setup a transmit queue of an Ethernet device. */
632 : : typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev,
633 : : uint16_t tx_queue_id,
634 : : uint16_t nb_tx_desc,
635 : : unsigned int socket_id,
636 : : const struct rte_eth_txconf *tx_conf);
637 : :
638 : : /** @internal Enable interrupt of a receive queue of an Ethernet device. */
639 : : typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,
640 : : uint16_t rx_queue_id);
641 : :
642 : : /** @internal Disable interrupt of a receive queue of an Ethernet device. */
643 : : typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,
644 : : uint16_t rx_queue_id);
645 : :
646 : : /** @internal Release memory resources allocated by given Rx/Tx queue. */
647 : : typedef void (*eth_queue_release_t)(struct rte_eth_dev *dev,
648 : : uint16_t queue_id);
649 : :
650 : : /** @internal Get firmware information of an Ethernet device. */
651 : : typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev,
652 : : char *fw_version, size_t fw_size);
653 : :
654 : : /** @internal Force mbufs to be from Tx ring. */
655 : : typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt);
656 : :
657 : : typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev,
658 : : uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo);
659 : :
660 : : typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev,
661 : : uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo);
662 : :
663 : : typedef void (*eth_recycle_rxq_info_get_t)(struct rte_eth_dev *dev,
664 : : uint16_t rx_queue_id,
665 : : struct rte_eth_recycle_rxq_info *recycle_rxq_info);
666 : :
667 : : typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev,
668 : : uint16_t queue_id, struct rte_eth_burst_mode *mode);
669 : :
670 : : /** @internal Set MTU. */
671 : : typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu);
672 : :
673 : : /** @internal Filtering of a VLAN Tag Identifier by an Ethernet device. */
674 : : typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev,
675 : : uint16_t vlan_id,
676 : : int on);
677 : :
678 : : /** @internal Set the outer/inner VLAN-TPID by an Ethernet device. */
679 : : typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev,
680 : : enum rte_vlan_type type, uint16_t tpid);
681 : :
682 : : /** @internal Set VLAN offload function by an Ethernet device. */
683 : : typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask);
684 : :
685 : : /** @internal Set port based Tx VLAN insertion by an Ethernet device. */
686 : : typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev,
687 : : uint16_t vlan_id,
688 : : int on);
689 : :
690 : : /** @internal VLAN stripping enable/disable by an queue of Ethernet device. */
691 : : typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev,
692 : : uint16_t rx_queue_id,
693 : : int on);
694 : :
695 : : /** @internal Get current flow control parameter on an Ethernet device. */
696 : : typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev,
697 : : struct rte_eth_fc_conf *fc_conf);
698 : :
699 : : /** @internal Setup flow control parameter on an Ethernet device. */
700 : : typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev,
701 : : struct rte_eth_fc_conf *fc_conf);
702 : :
703 : : /** @internal Setup priority flow control parameter on an Ethernet device. */
704 : : typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev,
705 : : struct rte_eth_pfc_conf *pfc_conf);
706 : :
707 : : /** @internal Get info for queue based PFC on an Ethernet device. */
708 : : typedef int (*priority_flow_ctrl_queue_info_get_t)(struct rte_eth_dev *dev,
709 : : struct rte_eth_pfc_queue_info *pfc_queue_info);
710 : : /** @internal Configure queue based PFC parameter on an Ethernet device. */
711 : : typedef int (*priority_flow_ctrl_queue_config_t)(struct rte_eth_dev *dev,
712 : : struct rte_eth_pfc_queue_conf *pfc_queue_conf);
713 : :
714 : : /** @internal Update RSS redirection table on an Ethernet device. */
715 : : typedef int (*reta_update_t)(struct rte_eth_dev *dev,
716 : : struct rte_eth_rss_reta_entry64 *reta_conf,
717 : : uint16_t reta_size);
718 : :
719 : : /** @internal Query RSS redirection table on an Ethernet device. */
720 : : typedef int (*reta_query_t)(struct rte_eth_dev *dev,
721 : : struct rte_eth_rss_reta_entry64 *reta_conf,
722 : : uint16_t reta_size);
723 : :
724 : : /** @internal Update RSS hash configuration of an Ethernet device. */
725 : : typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev,
726 : : struct rte_eth_rss_conf *rss_conf);
727 : :
728 : : /** @internal Get current RSS hash configuration of an Ethernet device. */
729 : : typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev,
730 : : struct rte_eth_rss_conf *rss_conf);
731 : :
732 : : /** @internal Turn on SW controllable LED on an Ethernet device. */
733 : : typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev);
734 : :
735 : : /** @internal Turn off SW controllable LED on an Ethernet device. */
736 : : typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev);
737 : :
738 : : /** @internal Remove MAC address from receive address register. */
739 : : typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index);
740 : :
741 : : /** @internal Set a MAC address into Receive Address Register. */
742 : : typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev,
743 : : struct rte_ether_addr *mac_addr,
744 : : uint32_t index,
745 : : uint32_t vmdq);
746 : :
747 : : /** @internal Set a MAC address into Receive Address Register. */
748 : : typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev,
749 : : struct rte_ether_addr *mac_addr);
750 : :
751 : : /** @internal Set a Unicast Hash bitmap. */
752 : : typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev,
753 : : struct rte_ether_addr *mac_addr,
754 : : uint8_t on);
755 : :
756 : : /** @internal Set all Unicast Hash bitmap. */
757 : : typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev,
758 : : uint8_t on);
759 : :
760 : : /** @internal Set queue Tx rate. */
761 : : typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev,
762 : : uint16_t queue_idx,
763 : : uint32_t tx_rate);
764 : :
765 : : /** @internal Get queue Tx rate. */
766 : : typedef int (*eth_get_queue_rate_limit_t)(struct rte_eth_dev *dev,
767 : : uint16_t queue_idx,
768 : : uint32_t *tx_rate);
769 : :
770 : : /** @internal Add tunneling UDP port. */
771 : : typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
772 : : struct rte_eth_udp_tunnel *tunnel_udp);
773 : :
774 : : /** @internal Delete tunneling UDP port. */
775 : : typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
776 : : struct rte_eth_udp_tunnel *tunnel_udp);
777 : :
778 : : /** @internal set the list of multicast addresses on an Ethernet device. */
779 : : typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
780 : : struct rte_ether_addr *mc_addr_set,
781 : : uint32_t nb_mc_addr);
782 : :
783 : : /** @internal Function used to enable IEEE1588/802.1AS timestamping. */
784 : : typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
785 : :
786 : : /** @internal Function used to disable IEEE1588/802.1AS timestamping. */
787 : : typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
788 : :
789 : : /** @internal Function used to read an Rx IEEE1588/802.1AS timestamp. */
790 : : typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
791 : : struct timespec *timestamp,
792 : : uint32_t flags);
793 : :
794 : : /** @internal Function used to read a Tx IEEE1588/802.1AS timestamp. */
795 : : typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
796 : : struct timespec *timestamp);
797 : :
798 : : /** @internal Function used to adjust the device clock. */
799 : : typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
800 : :
801 : : /** @internal Function used to adjust the clock frequency. */
802 : : typedef int (*eth_timesync_adjust_freq)(struct rte_eth_dev *dev, int64_t);
803 : :
804 : : /** @internal Function used to get time from the device clock. */
805 : : typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
806 : : struct timespec *timestamp);
807 : :
808 : : /** @internal Function used to get time from the device clock. */
809 : : typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
810 : : const struct timespec *timestamp);
811 : :
812 : : /** @internal Function used to get the current value of the device clock. */
813 : : typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
814 : : uint64_t *timestamp);
815 : :
816 : : /** @internal Retrieve registers. */
817 : : typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
818 : : struct rte_dev_reg_info *info);
819 : :
820 : : /** @internal Retrieve EEPROM size. */
821 : : typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
822 : :
823 : : /** @internal Retrieve EEPROM data. */
824 : : typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
825 : : struct rte_dev_eeprom_info *info);
826 : :
827 : : /** @internal Program EEPROM data. */
828 : : typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
829 : : struct rte_dev_eeprom_info *info);
830 : :
831 : : /** @internal Retrieve type and size of plugin module EEPROM. */
832 : : typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
833 : : struct rte_eth_dev_module_info *modinfo);
834 : :
835 : : /** @internal Retrieve plugin module EEPROM data. */
836 : : typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
837 : : struct rte_dev_eeprom_info *info);
838 : :
839 : : struct rte_flow_ops;
840 : : /**
841 : : * @internal
842 : : * Get flow operations.
843 : : *
844 : : * If the flow API is not supported for the specified device,
845 : : * the driver can return NULL.
846 : : */
847 : : typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev,
848 : : const struct rte_flow_ops **ops);
849 : :
850 : : /** @internal Get Traffic Management (TM) operations on an Ethernet device. */
851 : : typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
852 : :
853 : : /** @internal Get Traffic Metering and Policing (MTR) operations. */
854 : : typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
855 : :
856 : : /** @internal Get DCB information on an Ethernet device. */
857 : : typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
858 : : struct rte_eth_dcb_info *dcb_info);
859 : :
860 : : /** @internal Test if a port supports specific mempool ops. */
861 : : typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
862 : : const char *pool);
863 : :
864 : : /**
865 : : * @internal
866 : : * Get the hairpin capabilities.
867 : : *
868 : : * @param dev
869 : : * ethdev handle of port.
870 : : * @param cap
871 : : * returns the hairpin capabilities from the device.
872 : : *
873 : : * @return
874 : : * Negative errno value on error, 0 on success.
875 : : *
876 : : * @retval 0
877 : : * Success, hairpin is supported.
878 : : * @retval -ENOTSUP
879 : : * Hairpin is not supported.
880 : : */
881 : : typedef int (*eth_hairpin_cap_get_t)(struct rte_eth_dev *dev,
882 : : struct rte_eth_hairpin_cap *cap);
883 : :
884 : : /**
885 : : * @internal
886 : : * Setup Rx hairpin queue.
887 : : *
888 : : * @param dev
889 : : * ethdev handle of port.
890 : : * @param rx_queue_id
891 : : * the selected Rx queue index.
892 : : * @param nb_rx_desc
893 : : * the requested number of descriptors for this queue. 0 - use PMD default.
894 : : * @param conf
895 : : * the Rx hairpin configuration structure.
896 : : *
897 : : * @return
898 : : * Negative errno value on error, 0 on success.
899 : : *
900 : : * @retval 0
901 : : * Success, hairpin is supported.
902 : : * @retval -ENOTSUP
903 : : * Hairpin is not supported.
904 : : * @retval -EINVAL
905 : : * One of the parameters is invalid.
906 : : * @retval -ENOMEM
907 : : * Unable to allocate resources.
908 : : */
909 : : typedef int (*eth_rx_hairpin_queue_setup_t)
910 : : (struct rte_eth_dev *dev, uint16_t rx_queue_id,
911 : : uint16_t nb_rx_desc,
912 : : const struct rte_eth_hairpin_conf *conf);
913 : :
914 : : /**
915 : : * @internal
916 : : * Setup Tx hairpin queue.
917 : : *
918 : : * @param dev
919 : : * ethdev handle of port.
920 : : * @param tx_queue_id
921 : : * the selected Tx queue index.
922 : : * @param nb_tx_desc
923 : : * the requested number of descriptors for this queue. 0 - use PMD default.
924 : : * @param conf
925 : : * the Tx hairpin configuration structure.
926 : : *
927 : : * @return
928 : : * Negative errno value on error, 0 on success.
929 : : *
930 : : * @retval 0
931 : : * Success, hairpin is supported.
932 : : * @retval -ENOTSUP
933 : : * Hairpin is not supported.
934 : : * @retval -EINVAL
935 : : * One of the parameters is invalid.
936 : : * @retval -ENOMEM
937 : : * Unable to allocate resources.
938 : : */
939 : : typedef int (*eth_tx_hairpin_queue_setup_t)
940 : : (struct rte_eth_dev *dev, uint16_t tx_queue_id,
941 : : uint16_t nb_tx_desc,
942 : : const struct rte_eth_hairpin_conf *hairpin_conf);
943 : :
944 : : /**
945 : : * @internal
946 : : * Get Forward Error Correction(FEC) capability.
947 : : *
948 : : * @param dev
949 : : * ethdev handle of port.
950 : : * @param speed_fec_capa
951 : : * speed_fec_capa is out only with per-speed capabilities.
952 : : * @param num
953 : : * a number of elements in an speed_fec_capa array.
954 : : *
955 : : * @return
956 : : * Negative errno value on error, positive value on success.
957 : : *
958 : : * @retval positive value
959 : : * A non-negative value lower or equal to num: success. The return value
960 : : * is the number of entries filled in the fec capa array.
961 : : * A non-negative value higher than num: error, the given fec capa array
962 : : * is too small. The return value corresponds to the num that should
963 : : * be given to succeed. The entries in the fec capa array are not valid
964 : : * and shall not be used by the caller.
965 : : * @retval -ENOTSUP
966 : : * Operation is not supported.
967 : : * @retval -EIO
968 : : * Device is removed.
969 : : * @retval -EINVAL
970 : : * *num* or *speed_fec_capa* invalid.
971 : : */
972 : : typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev,
973 : : struct rte_eth_fec_capa *speed_fec_capa, unsigned int num);
974 : :
975 : : /**
976 : : * @internal
977 : : * Get Forward Error Correction(FEC) mode.
978 : : *
979 : : * @param dev
980 : : * ethdev handle of port.
981 : : * @param fec_capa
982 : : * a bitmask of enabled FEC modes. If AUTO bit is set, other
983 : : * bits specify FEC modes which may be negotiated. If AUTO
984 : : * bit is clear, specify FEC modes to be used (only one valid
985 : : * mode per speed may be set).
986 : : *
987 : : * @return
988 : : * Negative errno value on error, 0 on success.
989 : : *
990 : : * @retval 0
991 : : * Success, get FEC success.
992 : : * @retval -ENOTSUP
993 : : * Operation is not supported.
994 : : * @retval -EIO
995 : : * Device is removed.
996 : : */
997 : : typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev,
998 : : uint32_t *fec_capa);
999 : :
1000 : : /**
1001 : : * @internal
1002 : : * Set Forward Error Correction(FEC) mode.
1003 : : *
1004 : : * @param dev
1005 : : * ethdev handle of port.
1006 : : * @param fec_capa
1007 : : * bitmask of allowed FEC modes. It must be only one
1008 : : * if AUTO is disabled. If AUTO is enabled, other
1009 : : * bits specify FEC modes which may be negotiated.
1010 : : *
1011 : : * @return
1012 : : * Negative errno value on error, 0 on success.
1013 : : *
1014 : : * @retval 0
1015 : : * Success, set FEC success.
1016 : : * @retval -ENOTSUP
1017 : : * Operation is not supported.
1018 : : * @retval -EINVAL
1019 : : * Unsupported FEC mode requested.
1020 : : * @retval -EIO
1021 : : * Device is removed.
1022 : : */
1023 : : typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, uint32_t fec_capa);
1024 : :
1025 : : /**
1026 : : * @internal
1027 : : * Get all hairpin Tx/Rx peer ports of the current device, if any.
1028 : : *
1029 : : * @param dev
1030 : : * ethdev handle of port.
1031 : : * @param peer_ports
1032 : : * array to save the ports list.
1033 : : * @param len
1034 : : * array length.
1035 : : * @param direction
1036 : : * value to decide the current to peer direction
1037 : : * positive - used as Tx to get all peer Rx ports.
1038 : : * zero - used as Rx to get all peer Tx ports.
1039 : : *
1040 : : * @return
1041 : : * Negative errno value on error, 0 or positive on success.
1042 : : *
1043 : : * @retval 0
1044 : : * Success, no peer ports.
1045 : : * @retval >0
1046 : : * Actual number of the peer ports.
1047 : : * @retval -ENOTSUP
1048 : : * Get peer ports API is not supported.
1049 : : * @retval -EINVAL
1050 : : * One of the parameters is invalid.
1051 : : */
1052 : : typedef int (*hairpin_get_peer_ports_t)(struct rte_eth_dev *dev,
1053 : : uint16_t *peer_ports, size_t len,
1054 : : uint32_t direction);
1055 : :
1056 : : /**
1057 : : * @internal
1058 : : * Bind all hairpin Tx queues of one port to the Rx queues of the peer port.
1059 : : *
1060 : : * @param dev
1061 : : * ethdev handle of port.
1062 : : * @param rx_port
1063 : : * the peer Rx port.
1064 : : *
1065 : : * @return
1066 : : * Negative errno value on error, 0 on success.
1067 : : *
1068 : : * @retval 0
1069 : : * Success, bind successfully.
1070 : : * @retval -ENOTSUP
1071 : : * Bind API is not supported.
1072 : : * @retval -EINVAL
1073 : : * One of the parameters is invalid.
1074 : : * @retval -EBUSY
1075 : : * Device is not started.
1076 : : */
1077 : : typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev,
1078 : : uint16_t rx_port);
1079 : :
1080 : : /**
1081 : : * @internal
1082 : : * Unbind all hairpin Tx queues of one port from the Rx queues of the peer port.
1083 : : *
1084 : : * @param dev
1085 : : * ethdev handle of port.
1086 : : * @param rx_port
1087 : : * the peer Rx port.
1088 : : *
1089 : : * @return
1090 : : * Negative errno value on error, 0 on success.
1091 : : *
1092 : : * @retval 0
1093 : : * Success, unbind successfully.
1094 : : * @retval -ENOTSUP
1095 : : * Bind API is not supported.
1096 : : * @retval -EINVAL
1097 : : * One of the parameters is invalid.
1098 : : * @retval -EBUSY
1099 : : * Device is already stopped.
1100 : : */
1101 : : typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev,
1102 : : uint16_t rx_port);
1103 : :
1104 : : /** @internal Update and fetch peer queue information. */
1105 : : typedef int (*eth_hairpin_queue_peer_update_t)
1106 : : (struct rte_eth_dev *dev, uint16_t peer_queue,
1107 : : struct rte_hairpin_peer_info *current_info,
1108 : : struct rte_hairpin_peer_info *peer_info, uint32_t direction);
1109 : :
1110 : : /** @internal Bind peer queue to the current queue with fetched information. */
1111 : : typedef int (*eth_hairpin_queue_peer_bind_t)
1112 : : (struct rte_eth_dev *dev, uint16_t cur_queue,
1113 : : struct rte_hairpin_peer_info *peer_info, uint32_t direction);
1114 : :
1115 : : /** @internal Unbind peer queue from the current queue. */
1116 : : typedef int (*eth_hairpin_queue_peer_unbind_t)
1117 : : (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction);
1118 : :
1119 : : /**
1120 : : * @internal
1121 : : * Get address of memory location whose contents will change whenever there is
1122 : : * new data to be received on an Rx queue.
1123 : : *
1124 : : * @param rxq
1125 : : * Ethdev queue pointer.
1126 : : * @param pmc
1127 : : * The pointer to power-optimized monitoring condition structure.
1128 : : * @return
1129 : : * Negative errno value on error, 0 on success.
1130 : : *
1131 : : * @retval 0
1132 : : * Success
1133 : : * @retval -EINVAL
1134 : : * Invalid parameters
1135 : : */
1136 : : typedef int (*eth_get_monitor_addr_t)(void *rxq,
1137 : : struct rte_power_monitor_cond *pmc);
1138 : :
1139 : : /**
1140 : : * @internal
1141 : : * Get representor info to be able to calculate the unique representor ID.
1142 : : *
1143 : : * Caller should pass NULL as pointer of info to get number of entries,
1144 : : * allocate info buffer according to returned entry number, then call
1145 : : * again with buffer to get real info.
1146 : : *
1147 : : * To calculate the representor ID, caller should iterate each entry,
1148 : : * match controller index, pf index, vf or sf start index and range,
1149 : : * then calculate representor ID from offset to vf/sf start index.
1150 : : * @see rte_eth_representor_id_get.
1151 : : *
1152 : : * @param dev
1153 : : * Ethdev handle of port.
1154 : : * @param [out] info
1155 : : * Pointer to memory to save device representor info.
1156 : : * @return
1157 : : * Negative errno value on error, number of info entries otherwise.
1158 : : */
1159 : :
1160 : : typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev,
1161 : : struct rte_eth_representor_info *info);
1162 : :
1163 : : /**
1164 : : * @internal
1165 : : * Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD.
1166 : : *
1167 : : * @param dev
1168 : : * Port (ethdev) handle
1169 : : *
1170 : : * @param[inout] features
1171 : : * Feature selection buffer
1172 : : *
1173 : : * @return
1174 : : * Negative errno value on error, zero otherwise
1175 : : */
1176 : : typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev,
1177 : : uint64_t *features);
1178 : :
1179 : : /**
1180 : : * @internal
1181 : : * Get IP reassembly offload capability of a PMD.
1182 : : *
1183 : : * @param dev
1184 : : * Port (ethdev) handle
1185 : : *
1186 : : * @param[out] conf
1187 : : * IP reassembly capability supported by the PMD
1188 : : *
1189 : : * @return
1190 : : * Negative errno value on error, zero otherwise
1191 : : */
1192 : : typedef int (*eth_ip_reassembly_capability_get_t)(struct rte_eth_dev *dev,
1193 : : struct rte_eth_ip_reassembly_params *capa);
1194 : :
1195 : : /**
1196 : : * @internal
1197 : : * Get IP reassembly offload configuration parameters set in PMD.
1198 : : *
1199 : : * @param dev
1200 : : * Port (ethdev) handle
1201 : : *
1202 : : * @param[out] conf
1203 : : * Configuration parameters for IP reassembly.
1204 : : *
1205 : : * @return
1206 : : * Negative errno value on error, zero otherwise
1207 : : */
1208 : : typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev,
1209 : : struct rte_eth_ip_reassembly_params *conf);
1210 : :
1211 : : /**
1212 : : * @internal
1213 : : * Set configuration parameters for enabling IP reassembly offload in hardware.
1214 : : *
1215 : : * @param dev
1216 : : * Port (ethdev) handle
1217 : : *
1218 : : * @param[in] conf
1219 : : * Configuration parameters for IP reassembly.
1220 : : *
1221 : : * @return
1222 : : * Negative errno value on error, zero otherwise
1223 : : */
1224 : : typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev,
1225 : : const struct rte_eth_ip_reassembly_params *conf);
1226 : :
1227 : : /**
1228 : : * @internal
1229 : : * Get supported header protocols of a PMD to split.
1230 : : *
1231 : : * @param dev
1232 : : * Ethdev handle of port.
1233 : : *
1234 : : * @return
1235 : : * An array pointer to store supported protocol headers.
1236 : : */
1237 : : typedef const uint32_t *(*eth_buffer_split_supported_hdr_ptypes_get_t)(struct rte_eth_dev *dev,
1238 : : size_t *no_of_elements);
1239 : :
1240 : : /**
1241 : : * @internal
1242 : : * Dump private info from device to a file.
1243 : : *
1244 : : * @param dev
1245 : : * Port (ethdev) handle.
1246 : : * @param file
1247 : : * A pointer to a file for output.
1248 : : *
1249 : : * @return
1250 : : * Negative value on error, 0 on success.
1251 : : *
1252 : : * @retval 0
1253 : : * Success
1254 : : * @retval -EINVAL
1255 : : * Invalid file
1256 : : */
1257 : : typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file);
1258 : :
1259 : : /**
1260 : : * @internal Set Rx queue available descriptors threshold.
1261 : : * @see rte_eth_rx_avail_thresh_set()
1262 : : *
1263 : : * Driver should round down number of descriptors on conversion from
1264 : : * percentage.
1265 : : */
1266 : : typedef int (*eth_rx_queue_avail_thresh_set_t)(struct rte_eth_dev *dev,
1267 : : uint16_t rx_queue_id,
1268 : : uint8_t avail_thresh);
1269 : :
1270 : : /**
1271 : : * @internal Query Rx queue available descriptors threshold event.
1272 : : * @see rte_eth_rx_avail_thresh_query()
1273 : : */
1274 : :
1275 : : typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
1276 : : uint16_t *rx_queue_id,
1277 : : uint8_t *avail_thresh);
1278 : :
1279 : : /** @internal Get congestion management information. */
1280 : : typedef int (*eth_cman_info_get_t)(struct rte_eth_dev *dev,
1281 : : struct rte_eth_cman_info *info);
1282 : :
1283 : : /** @internal Init congestion management structure with default values. */
1284 : : typedef int (*eth_cman_config_init_t)(struct rte_eth_dev *dev,
1285 : : struct rte_eth_cman_config *config);
1286 : :
1287 : : /** @internal Configure congestion management on a port. */
1288 : : typedef int (*eth_cman_config_set_t)(struct rte_eth_dev *dev,
1289 : : const struct rte_eth_cman_config *config);
1290 : :
1291 : : /** @internal Retrieve congestion management configuration of a port. */
1292 : : typedef int (*eth_cman_config_get_t)(struct rte_eth_dev *dev,
1293 : : struct rte_eth_cman_config *config);
1294 : :
1295 : : /**
1296 : : * @internal
1297 : : * Dump Rx descriptor info to a file.
1298 : : *
1299 : : * It is used for debugging, not a dataplane API.
1300 : : *
1301 : : * @param dev
1302 : : * Port (ethdev) handle.
1303 : : * @param queue_id
1304 : : * A Rx queue identifier on this port.
1305 : : * @param offset
1306 : : * The offset of the descriptor starting from tail. (0 is the next
1307 : : * packet to be received by the driver).
1308 : : * @param num
1309 : : * The number of the descriptors to dump.
1310 : : * @param file
1311 : : * A pointer to a file for output.
1312 : : * @return
1313 : : * Negative errno value on error, zero on success.
1314 : : */
1315 : : typedef int (*eth_rx_descriptor_dump_t)(const struct rte_eth_dev *dev,
1316 : : uint16_t queue_id, uint16_t offset,
1317 : : uint16_t num, FILE *file);
1318 : :
1319 : : /**
1320 : : * @internal
1321 : : * Dump Tx descriptor info to a file.
1322 : : *
1323 : : * This API is used for debugging, not a dataplane API.
1324 : : *
1325 : : * @param dev
1326 : : * Port (ethdev) handle.
1327 : : * @param queue_id
1328 : : * A Tx queue identifier on this port.
1329 : : * @param offset
1330 : : * The offset of the descriptor starting from tail. (0 is the place where
1331 : : * the next packet will be send).
1332 : : * @param num
1333 : : * The number of the descriptors to dump.
1334 : : * @param file
1335 : : * A pointer to a file for output.
1336 : : * @return
1337 : : * Negative errno value on error, zero on success.
1338 : : */
1339 : : typedef int (*eth_tx_descriptor_dump_t)(const struct rte_eth_dev *dev,
1340 : : uint16_t queue_id, uint16_t offset,
1341 : : uint16_t num, FILE *file);
1342 : :
1343 : : /**
1344 : : * @internal
1345 : : * Get the number of aggregated ports.
1346 : : *
1347 : : * @param dev
1348 : : * Port (ethdev) handle.
1349 : : *
1350 : : * @return
1351 : : * Negative errno value on error, 0 or positive on success.
1352 : : *
1353 : : * @retval >=0
1354 : : * The number of aggregated port if success.
1355 : : */
1356 : : typedef int (*eth_count_aggr_ports_t)(struct rte_eth_dev *dev);
1357 : :
1358 : : /**
1359 : : * @internal
1360 : : * Map a Tx queue with an aggregated port of the DPDK port.
1361 : : *
1362 : : * @param dev
1363 : : * Port (ethdev) handle.
1364 : : * @param tx_queue_id
1365 : : * The index of the transmit queue used in rte_eth_tx_burst().
1366 : : * @param affinity
1367 : : * The number of the aggregated port.
1368 : : *
1369 : : * @return
1370 : : * Negative on error, 0 on success.
1371 : : */
1372 : : typedef int (*eth_map_aggr_tx_affinity_t)(struct rte_eth_dev *dev, uint16_t tx_queue_id,
1373 : : uint8_t affinity);
1374 : :
1375 : : /**
1376 : : * @internal
1377 : : * Defines types of operations which can be executed by the application.
1378 : : */
1379 : : enum rte_eth_dev_operation {
1380 : : RTE_ETH_START,
1381 : : };
1382 : :
1383 : : /**@{@name Restore flags
1384 : : * Flags returned by get_restore_flags() callback.
1385 : : * They indicate to ethdev layer which configuration is required to be restored.
1386 : : */
1387 : : /** If set, ethdev layer will forcefully restore default and any other added MAC addresses. */
1388 : : #define RTE_ETH_RESTORE_MAC_ADDR RTE_BIT64(0)
1389 : : /** If set, ethdev layer will forcefully restore current promiscuous mode setting. */
1390 : : #define RTE_ETH_RESTORE_PROMISC RTE_BIT64(1)
1391 : : /** If set, ethdev layer will forcefully restore current all multicast mode setting. */
1392 : : #define RTE_ETH_RESTORE_ALLMULTI RTE_BIT64(2)
1393 : : /**@}*/
1394 : :
1395 : : /** All configuration which can be restored by ethdev layer. */
1396 : : #define RTE_ETH_RESTORE_ALL (RTE_ETH_RESTORE_MAC_ADDR | \
1397 : : RTE_ETH_RESTORE_PROMISC | \
1398 : : RTE_ETH_RESTORE_ALLMULTI)
1399 : :
1400 : : /**
1401 : : * @internal
1402 : : * Fetch from the driver what kind of configuration must be restored by ethdev layer,
1403 : : * after certain operations are performed by the application (such as rte_eth_dev_start()).
1404 : : *
1405 : : * @param dev
1406 : : * Port (ethdev) handle.
1407 : : * @param op
1408 : : * Type of operation executed by the application.
1409 : : *
1410 : : * @return
1411 : : * ORed restore flags indicating which configuration should be restored by ethdev.
1412 : : * 0 if no restore is required by the driver.
1413 : : */
1414 : : typedef uint64_t (*eth_get_restore_flags_t)(struct rte_eth_dev *dev,
1415 : : enum rte_eth_dev_operation op);
1416 : :
1417 : : /**
1418 : : * @internal A structure containing the functions exported by an Ethernet driver.
1419 : : */
1420 : : struct eth_dev_ops {
1421 : : eth_dev_configure_t dev_configure; /**< Configure device */
1422 : : eth_dev_start_t dev_start; /**< Start device */
1423 : : eth_dev_stop_t dev_stop; /**< Stop device */
1424 : : eth_dev_set_link_up_t dev_set_link_up; /**< Device link up */
1425 : : eth_dev_set_link_down_t dev_set_link_down; /**< Device link down */
1426 : : eth_dev_close_t dev_close; /**< Close device */
1427 : : eth_dev_reset_t dev_reset; /**< Reset device */
1428 : : eth_link_update_t link_update; /**< Get device link state */
1429 : : eth_speed_lanes_get_t speed_lanes_get; /**< Get link speed active lanes */
1430 : : eth_speed_lanes_set_t speed_lanes_set; /**< Set link speeds supported lanes */
1431 : : /** Get link speed lanes capability */
1432 : : eth_speed_lanes_get_capability_t speed_lanes_get_capa;
1433 : : /** Check if the device was physically removed */
1434 : : eth_is_removed_t is_removed;
1435 : :
1436 : : eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON */
1437 : : eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF */
1438 : : eth_allmulticast_enable_t allmulticast_enable;/**< Rx multicast ON */
1439 : : eth_allmulticast_disable_t allmulticast_disable;/**< Rx multicast OFF */
1440 : : eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address */
1441 : : eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */
1442 : : eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address */
1443 : : /** Set list of multicast addresses */
1444 : : eth_set_mc_addr_list_t set_mc_addr_list;
1445 : : mtu_set_t mtu_set; /**< Set MTU */
1446 : :
1447 : : /** Get generic device statistics */
1448 : : eth_stats_get_t stats_get;
1449 : : /** Reset generic device statistics */
1450 : : eth_stats_reset_t stats_reset;
1451 : : /** Get extended device statistics */
1452 : : eth_xstats_get_t xstats_get;
1453 : : /** Reset extended device statistics */
1454 : : eth_xstats_reset_t xstats_reset;
1455 : : /** Get names of extended statistics */
1456 : : eth_xstats_get_names_t xstats_get_names;
1457 : : /** Configure per queue stat counter mapping */
1458 : : eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1459 : :
1460 : : eth_dev_infos_get_t dev_infos_get; /**< Get device info */
1461 : : /** Retrieve Rx queue information */
1462 : : eth_rxq_info_get_t rxq_info_get;
1463 : : /** Retrieve Tx queue information */
1464 : : eth_txq_info_get_t txq_info_get;
1465 : : /** Retrieve mbufs recycle Rx queue information */
1466 : : eth_recycle_rxq_info_get_t recycle_rxq_info_get;
1467 : : eth_burst_mode_get_t rx_burst_mode_get; /**< Get Rx burst mode */
1468 : : eth_burst_mode_get_t tx_burst_mode_get; /**< Get Tx burst mode */
1469 : : eth_fw_version_get_t fw_version_get; /**< Get firmware version */
1470 : :
1471 : : /** Get packet types supported and identified by device */
1472 : : eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
1473 : : /**
1474 : : * Inform Ethernet device about reduced range of packet types to
1475 : : * handle
1476 : : */
1477 : : eth_dev_ptypes_set_t dev_ptypes_set;
1478 : :
1479 : : /** Filter VLAN Setup */
1480 : : vlan_filter_set_t vlan_filter_set;
1481 : : /** Outer/Inner VLAN TPID Setup */
1482 : : vlan_tpid_set_t vlan_tpid_set;
1483 : : /** VLAN Stripping on queue */
1484 : : vlan_strip_queue_set_t vlan_strip_queue_set;
1485 : : /** Set VLAN Offload */
1486 : : vlan_offload_set_t vlan_offload_set;
1487 : : /** Set port based Tx VLAN insertion */
1488 : : vlan_pvid_set_t vlan_pvid_set;
1489 : :
1490 : : eth_queue_start_t rx_queue_start;/**< Start Rx for a queue */
1491 : : eth_queue_stop_t rx_queue_stop; /**< Stop Rx for a queue */
1492 : : eth_queue_start_t tx_queue_start;/**< Start Tx for a queue */
1493 : : eth_queue_stop_t tx_queue_stop; /**< Stop Tx for a queue */
1494 : : eth_rx_queue_setup_t rx_queue_setup;/**< Set up device Rx queue */
1495 : : eth_queue_release_t rx_queue_release; /**< Release Rx queue */
1496 : :
1497 : : /** Enable Rx queue interrupt */
1498 : : eth_rx_enable_intr_t rx_queue_intr_enable;
1499 : : /** Disable Rx queue interrupt */
1500 : : eth_rx_disable_intr_t rx_queue_intr_disable;
1501 : :
1502 : : eth_tx_queue_setup_t tx_queue_setup;/**< Set up device Tx queue */
1503 : : eth_queue_release_t tx_queue_release; /**< Release Tx queue */
1504 : : eth_tx_done_cleanup_t tx_done_cleanup;/**< Free Tx ring mbufs */
1505 : :
1506 : : eth_dev_led_on_t dev_led_on; /**< Turn on LED */
1507 : : eth_dev_led_off_t dev_led_off; /**< Turn off LED */
1508 : :
1509 : : flow_ctrl_get_t flow_ctrl_get; /**< Get flow control */
1510 : : flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control */
1511 : : /** Setup priority flow control */
1512 : : priority_flow_ctrl_set_t priority_flow_ctrl_set;
1513 : : /** Priority flow control queue info get */
1514 : : priority_flow_ctrl_queue_info_get_t priority_flow_ctrl_queue_info_get;
1515 : : /** Priority flow control queue configure */
1516 : : priority_flow_ctrl_queue_config_t priority_flow_ctrl_queue_config;
1517 : :
1518 : : /** Set Unicast Table Array */
1519 : : eth_uc_hash_table_set_t uc_hash_table_set;
1520 : : /** Set Unicast hash bitmap */
1521 : : eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1522 : :
1523 : : /** Add UDP tunnel port */
1524 : : eth_udp_tunnel_port_add_t udp_tunnel_port_add;
1525 : : /** Delete UDP tunnel port */
1526 : : eth_udp_tunnel_port_del_t udp_tunnel_port_del;
1527 : :
1528 : : /** Set queue rate limit */
1529 : : eth_set_queue_rate_limit_t set_queue_rate_limit;
1530 : : /** Get queue rate limit */
1531 : : eth_get_queue_rate_limit_t get_queue_rate_limit;
1532 : :
1533 : : /** Configure RSS hash protocols and hashing key */
1534 : : rss_hash_update_t rss_hash_update;
1535 : : /** Get current RSS hash configuration */
1536 : : rss_hash_conf_get_t rss_hash_conf_get;
1537 : : /** Update redirection table */
1538 : : reta_update_t reta_update;
1539 : : /** Query redirection table */
1540 : : reta_query_t reta_query;
1541 : :
1542 : : eth_get_reg_t get_reg; /**< Get registers */
1543 : : eth_get_eeprom_length_t get_eeprom_length; /**< Get EEPROM length */
1544 : : eth_get_eeprom_t get_eeprom; /**< Get EEPROM data */
1545 : : eth_set_eeprom_t set_eeprom; /**< Set EEPROM */
1546 : :
1547 : : /** Get plugin module EEPROM attribute */
1548 : : eth_get_module_info_t get_module_info;
1549 : : /** Get plugin module EEPROM data */
1550 : : eth_get_module_eeprom_t get_module_eeprom;
1551 : :
1552 : : eth_flow_ops_get_t flow_ops_get; /**< Get flow operations */
1553 : :
1554 : : eth_get_dcb_info get_dcb_info; /**< Get DCB information */
1555 : :
1556 : : /** Turn IEEE1588/802.1AS timestamping on */
1557 : : eth_timesync_enable_t timesync_enable;
1558 : : /** Turn IEEE1588/802.1AS timestamping off */
1559 : : eth_timesync_disable_t timesync_disable;
1560 : : /** Read the IEEE1588/802.1AS Rx timestamp */
1561 : : eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1562 : : /** Read the IEEE1588/802.1AS Tx timestamp */
1563 : : eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1564 : : /** Adjust the device clock */
1565 : : eth_timesync_adjust_time timesync_adjust_time;
1566 : : /** Adjust the clock frequency */
1567 : : eth_timesync_adjust_freq timesync_adjust_freq;
1568 : : /** Get the device clock time */
1569 : : eth_timesync_read_time timesync_read_time;
1570 : : /** Set the device clock time */
1571 : : eth_timesync_write_time timesync_write_time;
1572 : :
1573 : : eth_read_clock read_clock;
1574 : :
1575 : : /** Get extended device statistic values by ID */
1576 : : eth_xstats_get_by_id_t xstats_get_by_id;
1577 : : /** Get name of extended device statistics by ID */
1578 : : eth_xstats_get_names_by_id_t xstats_get_names_by_id;
1579 : :
1580 : : eth_xstats_enable_counter_t xstats_enable;
1581 : : eth_xstats_disable_counter_t xstats_disable;
1582 : : eth_xstats_query_state_t xstats_query_state;
1583 : :
1584 : : /** Get Traffic Management (TM) operations */
1585 : : eth_tm_ops_get_t tm_ops_get;
1586 : :
1587 : : /** Get Traffic Metering and Policing (MTR) operations */
1588 : : eth_mtr_ops_get_t mtr_ops_get;
1589 : :
1590 : : /** Test if a port supports specific mempool ops */
1591 : : eth_pool_ops_supported_t pool_ops_supported;
1592 : :
1593 : : /** Returns the hairpin capabilities */
1594 : : eth_hairpin_cap_get_t hairpin_cap_get;
1595 : : /** Set up device Rx hairpin queue */
1596 : : eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup;
1597 : : /** Set up device Tx hairpin queue */
1598 : : eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup;
1599 : :
1600 : : /** Get Forward Error Correction(FEC) capability */
1601 : : eth_fec_get_capability_t fec_get_capability;
1602 : : /** Get Forward Error Correction(FEC) mode */
1603 : : eth_fec_get_t fec_get;
1604 : : /** Set Forward Error Correction(FEC) mode */
1605 : : eth_fec_set_t fec_set;
1606 : :
1607 : : /** Get hairpin peer ports list */
1608 : : hairpin_get_peer_ports_t hairpin_get_peer_ports;
1609 : : /** Bind all hairpin Tx queues of device to the peer port Rx queues */
1610 : : eth_hairpin_bind_t hairpin_bind;
1611 : : /** Unbind all hairpin Tx queues from the peer port Rx queues */
1612 : : eth_hairpin_unbind_t hairpin_unbind;
1613 : : /** Pass the current queue info and get the peer queue info */
1614 : : eth_hairpin_queue_peer_update_t hairpin_queue_peer_update;
1615 : : /** Set up the connection between the pair of hairpin queues */
1616 : : eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind;
1617 : : /** Disconnect the hairpin queues of a pair from each other */
1618 : : eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind;
1619 : :
1620 : : /** Get power monitoring condition for Rx queue */
1621 : : eth_get_monitor_addr_t get_monitor_addr;
1622 : :
1623 : : /** Get representor info */
1624 : : eth_representor_info_get_t representor_info_get;
1625 : :
1626 : : /**
1627 : : * Negotiate the NIC's ability to deliver specific
1628 : : * kinds of metadata to the PMD
1629 : : */
1630 : : eth_rx_metadata_negotiate_t rx_metadata_negotiate;
1631 : :
1632 : : /** Get IP reassembly capability */
1633 : : eth_ip_reassembly_capability_get_t ip_reassembly_capability_get;
1634 : : /** Get IP reassembly configuration */
1635 : : eth_ip_reassembly_conf_get_t ip_reassembly_conf_get;
1636 : : /** Set IP reassembly configuration */
1637 : : eth_ip_reassembly_conf_set_t ip_reassembly_conf_set;
1638 : :
1639 : : /** Get supported header ptypes to split */
1640 : : eth_buffer_split_supported_hdr_ptypes_get_t buffer_split_supported_hdr_ptypes_get;
1641 : :
1642 : : /** Dump private info from device */
1643 : : eth_dev_priv_dump_t eth_dev_priv_dump;
1644 : :
1645 : : /** Set Rx queue available descriptors threshold */
1646 : : eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
1647 : : /** Query Rx queue available descriptors threshold event */
1648 : : eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
1649 : :
1650 : : /** Dump Rx descriptor info */
1651 : : eth_rx_descriptor_dump_t eth_rx_descriptor_dump;
1652 : : /** Dump Tx descriptor info */
1653 : : eth_tx_descriptor_dump_t eth_tx_descriptor_dump;
1654 : :
1655 : : /** Get congestion management information */
1656 : : eth_cman_info_get_t cman_info_get;
1657 : : /** Initialize congestion management structure with default values */
1658 : : eth_cman_config_init_t cman_config_init;
1659 : : /** Configure congestion management */
1660 : : eth_cman_config_set_t cman_config_set;
1661 : : /** Retrieve congestion management configuration */
1662 : : eth_cman_config_get_t cman_config_get;
1663 : :
1664 : : /** Get the number of aggregated ports */
1665 : : eth_count_aggr_ports_t count_aggr_ports;
1666 : : /** Map a Tx queue with an aggregated port of the DPDK port */
1667 : : eth_map_aggr_tx_affinity_t map_aggr_tx_affinity;
1668 : :
1669 : : /** Get configuration which ethdev should restore */
1670 : : eth_get_restore_flags_t get_restore_flags;
1671 : : };
1672 : :
1673 : : /**
1674 : : * @internal
1675 : : * Check if the selected Rx queue is hairpin queue.
1676 : : *
1677 : : * @param dev
1678 : : * Pointer to the selected device.
1679 : : * @param queue_id
1680 : : * The selected queue.
1681 : : *
1682 : : * @return
1683 : : * - (1) if the queue is hairpin queue, 0 otherwise.
1684 : : */
1685 : : __rte_internal
1686 : : int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
1687 : :
1688 : : /**
1689 : : * @internal
1690 : : * Check if the selected Tx queue is hairpin queue.
1691 : : *
1692 : : * @param dev
1693 : : * Pointer to the selected device.
1694 : : * @param queue_id
1695 : : * The selected queue.
1696 : : *
1697 : : * @return
1698 : : * - (1) if the queue is hairpin queue, 0 otherwise.
1699 : : */
1700 : : __rte_internal
1701 : : int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
1702 : :
1703 : : /**
1704 : : * @internal
1705 : : * Returns a ethdev slot specified by the unique identifier name.
1706 : : *
1707 : : * @param name
1708 : : * The pointer to the Unique identifier name for each Ethernet device
1709 : : * @return
1710 : : * - The pointer to the ethdev slot, on success. NULL on error
1711 : : */
1712 : : __rte_internal
1713 : : struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
1714 : :
1715 : : /**
1716 : : * @internal
1717 : : * Allocates a new ethdev slot for an Ethernet device and returns the pointer
1718 : : * to that slot for the driver to use.
1719 : : *
1720 : : * @param name Unique identifier name for each Ethernet device
1721 : : * @return
1722 : : * - Slot in the rte_dev_devices array for a new device;
1723 : : */
1724 : : __rte_internal
1725 : : struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
1726 : :
1727 : : /**
1728 : : * @internal
1729 : : * Attach to the ethdev already initialized by the primary
1730 : : * process.
1731 : : *
1732 : : * @param name Ethernet device's name.
1733 : : * @return
1734 : : * - Success: Slot in the rte_dev_devices array for attached
1735 : : * device.
1736 : : * - Error: Null pointer.
1737 : : */
1738 : : __rte_internal
1739 : : struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name);
1740 : :
1741 : : /**
1742 : : * @internal
1743 : : * Notify RTE_ETH_EVENT_DESTROY and release the specified ethdev port.
1744 : : *
1745 : : * The following PMD-managed data fields will be freed:
1746 : : * - dev_private
1747 : : * - mac_addrs
1748 : : * - hash_mac_addrs
1749 : : * If one of these fields should not be freed,
1750 : : * it must be reset to NULL by the PMD, typically in dev_close method.
1751 : : *
1752 : : * @param eth_dev
1753 : : * Device to be detached.
1754 : : * @return
1755 : : * - 0 on success, negative on error
1756 : : */
1757 : : __rte_internal
1758 : : int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
1759 : :
1760 : : /**
1761 : : * @internal
1762 : : * Release device queues and clear its configuration to force the user
1763 : : * application to reconfigure it. It is for internal use only.
1764 : : *
1765 : : * @param dev
1766 : : * Pointer to struct rte_eth_dev.
1767 : : *
1768 : : * @return
1769 : : * void
1770 : : */
1771 : : __rte_internal
1772 : : void rte_eth_dev_internal_reset(struct rte_eth_dev *dev);
1773 : :
1774 : : /**
1775 : : * @internal Executes all the user application registered callbacks for
1776 : : * the specific device. It is for DPDK internal user only. User
1777 : : * application should not call it directly.
1778 : : *
1779 : : * @param dev
1780 : : * Pointer to struct rte_eth_dev.
1781 : : * @param event
1782 : : * Eth device interrupt event type.
1783 : : * @param ret_param
1784 : : * To pass data back to user application.
1785 : : * This allows the user application to decide if a particular function
1786 : : * is permitted or not.
1787 : : *
1788 : : * @return
1789 : : * int
1790 : : */
1791 : : __rte_internal
1792 : : int rte_eth_dev_callback_process(struct rte_eth_dev *dev,
1793 : : enum rte_eth_event_type event, void *ret_param);
1794 : :
1795 : : /**
1796 : : * @internal
1797 : : * This is the last step of device probing.
1798 : : * It must be called after a port is allocated and initialized successfully.
1799 : : *
1800 : : * The notification RTE_ETH_EVENT_NEW is sent to other entities
1801 : : * (libraries and applications).
1802 : : * The state is set as RTE_ETH_DEV_ATTACHED.
1803 : : *
1804 : : * @param dev
1805 : : * New ethdev port.
1806 : : */
1807 : : __rte_internal
1808 : : void rte_eth_dev_probing_finish(struct rte_eth_dev *dev);
1809 : :
1810 : : /**
1811 : : * Create memzone for HW rings.
1812 : : * malloc can't be used as the physical address is needed.
1813 : : * If the memzone is already created, then this function returns a ptr
1814 : : * to the old one.
1815 : : *
1816 : : * @param eth_dev
1817 : : * The *eth_dev* pointer is the address of the *rte_eth_dev* structure
1818 : : * @param name
1819 : : * The name of the memory zone
1820 : : * @param queue_id
1821 : : * The index of the queue to add to name
1822 : : * @param size
1823 : : * The sizeof of the memory area
1824 : : * @param align
1825 : : * Alignment for resulting memzone. Must be a power of 2.
1826 : : * @param socket_id
1827 : : * The *socket_id* argument is the socket identifier in case of NUMA.
1828 : : */
1829 : : __rte_internal
1830 : : const struct rte_memzone *
1831 : : rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
1832 : : uint16_t queue_id, size_t size,
1833 : : unsigned align, int socket_id);
1834 : :
1835 : : /**
1836 : : * Free previously allocated memzone for HW rings.
1837 : : *
1838 : : * @param eth_dev
1839 : : * The *eth_dev* pointer is the address of the *rte_eth_dev* structure
1840 : : * @param name
1841 : : * The name of the memory zone
1842 : : * @param queue_id
1843 : : * The index of the queue to add to name
1844 : : * @return
1845 : : * Negative errno value on error, 0 on success.
1846 : : */
1847 : : __rte_internal
1848 : : int
1849 : : rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name,
1850 : : uint16_t queue_id);
1851 : :
1852 : : /**
1853 : : * @internal
1854 : : * Atomically set the link status for the specific device.
1855 : : * It is for use by DPDK device driver use only.
1856 : : * User applications should not call it
1857 : : *
1858 : : * @param dev
1859 : : * Pointer to struct rte_eth_dev.
1860 : : * @param link
1861 : : * New link status value.
1862 : : * @return
1863 : : * Same convention as eth_link_update operation.
1864 : : * 0 if link up status has changed
1865 : : * -1 if link up status was unchanged
1866 : : */
1867 : : static inline int
1868 : 0 : rte_eth_linkstatus_set(struct rte_eth_dev *dev,
1869 : : const struct rte_eth_link *new_link)
1870 : : {
1871 : : struct rte_eth_link old_link;
1872 : :
1873 : 31 : old_link.val64 = rte_atomic_exchange_explicit(&dev->data->dev_link.val64,
1874 : : new_link->val64,
1875 : : rte_memory_order_seq_cst);
1876 : :
1877 [ + + # # : 31 : return (old_link.link_status == new_link->link_status) ? -1 : 0;
# # # # #
# # # ]
1878 : : }
1879 : :
1880 : : /**
1881 : : * @internal
1882 : : * Atomically get the link speed and status.
1883 : : *
1884 : : * @param dev
1885 : : * Pointer to struct rte_eth_dev.
1886 : : * @param link
1887 : : * link status value.
1888 : : */
1889 : : static inline void
1890 : 3 : rte_eth_linkstatus_get(const struct rte_eth_dev *dev,
1891 : : struct rte_eth_link *link)
1892 : : {
1893 : : struct rte_eth_link curr_link;
1894 : :
1895 : 3 : curr_link.val64 = rte_atomic_load_explicit(&dev->data->dev_link.val64,
1896 : : rte_memory_order_seq_cst);
1897 : 3 : rte_atomic_store_explicit(&link->val64, curr_link.val64, rte_memory_order_seq_cst);
1898 : 3 : }
1899 : :
1900 : : /**
1901 : : * @internal
1902 : : * Dummy DPDK callback for Rx/Tx packet burst.
1903 : : *
1904 : : * @param queue
1905 : : * Pointer to Rx/Tx queue
1906 : : * @param pkts
1907 : : * Packet array
1908 : : * @param nb_pkts
1909 : : * Number of packets in packet array
1910 : : */
1911 : : __rte_internal
1912 : : uint16_t
1913 : : rte_eth_pkt_burst_dummy(void *queue __rte_unused,
1914 : : struct rte_mbuf **pkts __rte_unused,
1915 : : uint16_t nb_pkts __rte_unused);
1916 : :
1917 : : /**
1918 : : * @internal
1919 : : * Dummy DPDK callback for Tx packet prepare.
1920 : : *
1921 : : * @param queue
1922 : : * Pointer to Tx queue
1923 : : * @param pkts
1924 : : * Packet array
1925 : : * @param nb_pkts
1926 : : * Number of packets in packet array
1927 : : */
1928 : : __rte_internal
1929 : : uint16_t
1930 : : rte_eth_tx_pkt_prepare_dummy(void *queue __rte_unused,
1931 : : struct rte_mbuf **pkts __rte_unused,
1932 : : uint16_t nb_pkts __rte_unused);
1933 : :
1934 : : /**
1935 : : * @internal
1936 : : * Dummy DPDK callback for queue count.
1937 : : *
1938 : : * @param queue
1939 : : * Pointer to Rx/Tx queue
1940 : : */
1941 : : __rte_internal
1942 : : int
1943 : : rte_eth_queue_count_dummy(void *queue __rte_unused);
1944 : :
1945 : : /**
1946 : : * @internal
1947 : : * Dummy DPDK callback for descriptor status.
1948 : : *
1949 : : * @param queue
1950 : : * Pointer to Rx/Tx queue
1951 : : * @param offset
1952 : : * The offset of the descriptor starting from tail (0 is the next
1953 : : * packet to be received by the driver).
1954 : : */
1955 : : __rte_internal
1956 : : int
1957 : : rte_eth_descriptor_status_dummy(void *queue __rte_unused,
1958 : : uint16_t offset __rte_unused);
1959 : :
1960 : : /**
1961 : : * @internal
1962 : : * Dummy DPDK callback for recycle Tx mbufs reuse.
1963 : : *
1964 : : * @param queue
1965 : : * Pointer to Tx queue
1966 : : * @param recycle_rxq_info
1967 : : * Pointer to recycle Rx queue info
1968 : : */
1969 : : __rte_internal
1970 : : uint16_t
1971 : : rte_eth_recycle_tx_mbufs_reuse_dummy(void *queue __rte_unused,
1972 : : struct rte_eth_recycle_rxq_info *recycle_rxq_info __rte_unused);
1973 : :
1974 : : /**
1975 : : * @internal
1976 : : * Dummy DPDK callback Rx descriptor refill.
1977 : : *
1978 : : * @param queue
1979 : : * Pointer Rx queue
1980 : : * @param offset
1981 : : * number of descriptors to refill
1982 : : */
1983 : : __rte_internal
1984 : : void
1985 : : rte_eth_recycle_rx_descriptors_refill_dummy(void *queue __rte_unused,
1986 : : uint16_t nb __rte_unused);
1987 : :
1988 : : /**
1989 : : * Allocate an unique switch domain identifier.
1990 : : *
1991 : : * A pool of switch domain identifiers which can be allocated on request. This
1992 : : * will enabled devices which support the concept of switch domains to request
1993 : : * a switch domain ID which is guaranteed to be unique from other devices
1994 : : * running in the same process.
1995 : : *
1996 : : * @param domain_id
1997 : : * switch domain identifier parameter to pass back to application
1998 : : *
1999 : : * @return
2000 : : * Negative errno value on error, 0 on success.
2001 : : */
2002 : : __rte_internal
2003 : : int
2004 : : rte_eth_switch_domain_alloc(uint16_t *domain_id);
2005 : :
2006 : : /**
2007 : : * Free switch domain.
2008 : : *
2009 : : * Return a switch domain identifier to the pool of free identifiers after it is
2010 : : * no longer in use by device.
2011 : : *
2012 : : * @param domain_id
2013 : : * switch domain identifier to free
2014 : : *
2015 : : * @return
2016 : : * Negative errno value on error, 0 on success.
2017 : : */
2018 : : __rte_internal
2019 : : int
2020 : : rte_eth_switch_domain_free(uint16_t domain_id);
2021 : :
2022 : : /* Flags for rte_eth_devargs::flags. */
2023 : : /* When enclosed in parentheses, the PF representor is not required. */
2024 : : #define RTE_ETH_DEVARG_REPRESENTOR_IGNORE_PF RTE_BIT32(0)
2025 : :
2026 : : /**
2027 : : * Generic Ethernet device arguments
2028 : : *
2029 : : * One type of representor each structure.
2030 : : */
2031 : : struct rte_eth_devargs {
2032 : : uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS];
2033 : : /** controller/s number in case of multi-host */
2034 : : uint16_t nb_mh_controllers;
2035 : : /** number of controllers in multi-host controllers field */
2036 : : uint16_t ports[RTE_MAX_ETHPORTS];
2037 : : /** port/s number to enable on a multi-port single function */
2038 : : uint16_t nb_ports;
2039 : : /** number of ports in ports field */
2040 : : uint32_t flags; /* see RTE_ETH_DEVARG_* */
2041 : : uint16_t representor_ports[RTE_MAX_ETHPORTS];
2042 : : /** representor port/s identifier to enable on device */
2043 : : uint16_t nb_representor_ports;
2044 : : /** number of ports in representor port field */
2045 : : enum rte_eth_representor_type type; /* type of representor */
2046 : : };
2047 : :
2048 : : /**
2049 : : * PMD helper function to get representor ID from location detail.
2050 : : *
2051 : : * Get representor ID from controller, pf and (sf or vf).
2052 : : * The mapping is retrieved from rte_eth_representor_info_get().
2053 : : *
2054 : : * For backward compatibility, if no representor info, direct
2055 : : * map legacy VF (no controller and pf).
2056 : : *
2057 : : * @param port_id
2058 : : * Port ID of the backing device.
2059 : : * @param type
2060 : : * Representor type.
2061 : : * @param controller
2062 : : * Controller ID, -1 if unspecified.
2063 : : * @param pf
2064 : : * PF port ID, -1 if unspecified.
2065 : : * @param representor_port
2066 : : * VF or SF representor port number, -1 if unspecified.
2067 : : * @param repr_id
2068 : : * Pointer to output representor ID.
2069 : : *
2070 : : * @return
2071 : : * Negative errno value on error, 0 on success.
2072 : : */
2073 : : __rte_internal
2074 : : int
2075 : : rte_eth_representor_id_get(uint16_t port_id,
2076 : : enum rte_eth_representor_type type,
2077 : : int controller, int pf, int representor_port,
2078 : : uint16_t *repr_id);
2079 : :
2080 : : /**
2081 : : * @internal
2082 : : * Check if the ethdev is a representor port.
2083 : : *
2084 : : * @param dev
2085 : : * Pointer to struct rte_eth_dev.
2086 : : *
2087 : : * @return
2088 : : * false the ethdev is not a representor port.
2089 : : * true the ethdev is a representor port.
2090 : : */
2091 : : static inline bool
2092 : : rte_eth_dev_is_repr(const struct rte_eth_dev *dev)
2093 : : {
2094 [ # # # # : 0 : return ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0);
# # # # #
# # # # #
# # # # #
# # # ]
2095 : : }
2096 : :
2097 : : /**
2098 : : * PMD helper function to parse ethdev arguments
2099 : : *
2100 : : * @param devargs
2101 : : * device arguments
2102 : : * @param eth_devargs
2103 : : * contiguous memory populated with parsed ethdev specific arguments.
2104 : : * @param nb_da
2105 : : * size of eth_devargs array passed
2106 : : *
2107 : : * @return
2108 : : * Negative errno value on error, no of devargs parsed on success.
2109 : : */
2110 : : __rte_internal
2111 : : int
2112 : : rte_eth_devargs_parse(const char *devargs, struct rte_eth_devargs *eth_devargs,
2113 : : unsigned int nb_da);
2114 : :
2115 : :
2116 : : typedef int (*ethdev_init_t)(struct rte_eth_dev *ethdev, void *init_params);
2117 : : typedef int (*ethdev_bus_specific_init)(struct rte_eth_dev *ethdev,
2118 : : void *bus_specific_init_params);
2119 : :
2120 : : /**
2121 : : * PMD helper function for the creation of a new ethdev ports.
2122 : : *
2123 : : * @param device
2124 : : * rte_device handle.
2125 : : * @param name
2126 : : * port name.
2127 : : * @param priv_data_size
2128 : : * size of private data required for port.
2129 : : * @param bus_specific_init
2130 : : * port bus specific initialisation callback function
2131 : : * @param bus_init_params
2132 : : * port bus specific initialisation parameters
2133 : : * @param ethdev_init
2134 : : * device specific port initialization callback function
2135 : : * @param init_params
2136 : : * port initialisation parameters
2137 : : *
2138 : : * @return
2139 : : * Negative errno value on error, 0 on success.
2140 : : */
2141 : : __rte_internal
2142 : : int
2143 : : rte_eth_dev_create(struct rte_device *device, const char *name,
2144 : : size_t priv_data_size,
2145 : : ethdev_bus_specific_init bus_specific_init, void *bus_init_params,
2146 : : ethdev_init_t ethdev_init, void *init_params);
2147 : :
2148 : :
2149 : : typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev);
2150 : :
2151 : : /**
2152 : : * PMD helper function for cleaning up the resources of a ethdev port on it's
2153 : : * destruction.
2154 : : *
2155 : : * @param ethdev
2156 : : * ethdev handle of port.
2157 : : * @param ethdev_uninit
2158 : : * device specific port un-initialise callback function
2159 : : *
2160 : : * @return
2161 : : * Negative errno value on error, 0 on success.
2162 : : */
2163 : : __rte_internal
2164 : : int
2165 : : rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit);
2166 : :
2167 : : /**
2168 : : * @internal
2169 : : * Pass the current hairpin queue HW and/or SW information to the peer queue
2170 : : * and fetch back the information of the peer queue.
2171 : : *
2172 : : * @param peer_port
2173 : : * Peer port identifier of the Ethernet device.
2174 : : * @param peer_queue
2175 : : * Peer queue index of the port.
2176 : : * @param cur_info
2177 : : * Pointer to the current information structure.
2178 : : * @param peer_info
2179 : : * Pointer to the peer information, output.
2180 : : * @param direction
2181 : : * Direction to pass the information.
2182 : : * positive - pass Tx queue information and get peer Rx queue information
2183 : : * zero - pass Rx queue information and get peer Tx queue information
2184 : : *
2185 : : * @return
2186 : : * Negative errno value on error, 0 on success.
2187 : : */
2188 : : __rte_internal
2189 : : int
2190 : : rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
2191 : : struct rte_hairpin_peer_info *cur_info,
2192 : : struct rte_hairpin_peer_info *peer_info,
2193 : : uint32_t direction);
2194 : :
2195 : : /**
2196 : : * @internal
2197 : : * Configure current hairpin queue with the peer information fetched to create
2198 : : * the connection (bind) with peer queue in the specified direction.
2199 : : * This function might need to be called twice to fully create the connections.
2200 : : *
2201 : : * @param cur_port
2202 : : * Current port identifier of the Ethernet device.
2203 : : * @param cur_queue
2204 : : * Current queue index of the port.
2205 : : * @param peer_info
2206 : : * Pointer to the peer information, input.
2207 : : * @param direction
2208 : : * Direction to create the connection.
2209 : : * positive - bind current Tx queue to peer Rx queue
2210 : : * zero - bind current Rx queue to peer Tx queue
2211 : : *
2212 : : * @return
2213 : : * Negative errno value on error, 0 on success.
2214 : : */
2215 : : __rte_internal
2216 : : int
2217 : : rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
2218 : : struct rte_hairpin_peer_info *peer_info,
2219 : : uint32_t direction);
2220 : :
2221 : : /**
2222 : : * @internal
2223 : : * Get rte_eth_dev from device name. The device name should be specified
2224 : : * as below:
2225 : : * - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0
2226 : : * - SoC device name, for example fsl-gmac0
2227 : : * - vdev dpdk name, for example net_[pcap0|null0|tap0]
2228 : : *
2229 : : * @param name
2230 : : * PCI address or name of the device
2231 : : * @return
2232 : : * - rte_eth_dev if successful
2233 : : * - NULL on failure
2234 : : */
2235 : : __rte_internal
2236 : : struct rte_eth_dev*
2237 : : rte_eth_dev_get_by_name(const char *name);
2238 : :
2239 : : /**
2240 : : * @internal
2241 : : * Reset the current queue state and configuration to disconnect (unbind) it
2242 : : * from the peer queue.
2243 : : * This function might need to be called twice to disconnect each other.
2244 : : *
2245 : : * @param cur_port
2246 : : * Current port identifier of the Ethernet device.
2247 : : * @param cur_queue
2248 : : * Current queue index of the port.
2249 : : * @param direction
2250 : : * Direction to destroy the connection.
2251 : : * positive - unbind current Tx queue from peer Rx queue
2252 : : * zero - unbind current Rx queue from peer Tx queue
2253 : : *
2254 : : * @return
2255 : : * Negative errno value on error, 0 on success.
2256 : : */
2257 : : __rte_internal
2258 : : int
2259 : : rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
2260 : : uint32_t direction);
2261 : :
2262 : : /**
2263 : : * @internal
2264 : : * Register mbuf dynamic field and flag for IP reassembly incomplete case.
2265 : : */
2266 : : __rte_internal
2267 : : int
2268 : : rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag);
2269 : :
2270 : :
2271 : : /*
2272 : : * Legacy ethdev API used internally by drivers.
2273 : : */
2274 : :
2275 : : enum rte_filter_type {
2276 : : RTE_ETH_FILTER_NONE = 0,
2277 : : RTE_ETH_FILTER_ETHERTYPE,
2278 : : RTE_ETH_FILTER_FLEXIBLE,
2279 : : RTE_ETH_FILTER_SYN,
2280 : : RTE_ETH_FILTER_NTUPLE,
2281 : : RTE_ETH_FILTER_TUNNEL,
2282 : : RTE_ETH_FILTER_FDIR,
2283 : : RTE_ETH_FILTER_HASH,
2284 : : RTE_ETH_FILTER_L2_TUNNEL,
2285 : : };
2286 : :
2287 : : /**
2288 : : * Define all structures for Ethertype Filter type.
2289 : : */
2290 : :
2291 : : #define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */
2292 : : #define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */
2293 : :
2294 : : /**
2295 : : * A structure used to define the ethertype filter entry
2296 : : * to support RTE_ETH_FILTER_ETHERTYPE data representation.
2297 : : */
2298 : : struct rte_eth_ethertype_filter {
2299 : : struct rte_ether_addr mac_addr; /**< Mac address to match */
2300 : : uint16_t ether_type; /**< Ether type to match */
2301 : : uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */
2302 : : uint16_t queue; /**< Queue assigned to when match */
2303 : : };
2304 : :
2305 : : /**
2306 : : * A structure used to define the TCP syn filter entry
2307 : : * to support RTE_ETH_FILTER_SYN data representation.
2308 : : */
2309 : : struct rte_eth_syn_filter {
2310 : : /** 1 - higher priority than other filters, 0 - lower priority */
2311 : : uint8_t hig_pri;
2312 : : uint16_t queue; /**< Queue assigned to when match */
2313 : : };
2314 : :
2315 : : /**
2316 : : * filter type of tunneling packet
2317 : : */
2318 : : #define RTE_ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
2319 : : #define RTE_ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */
2320 : : #define RTE_ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
2321 : : #define RTE_ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */
2322 : : #define RTE_ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
2323 : : #define RTE_ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */
2324 : :
2325 : : #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN (RTE_ETH_TUNNEL_FILTER_IMAC | \
2326 : : RTE_ETH_TUNNEL_FILTER_IVLAN)
2327 : : #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
2328 : : RTE_ETH_TUNNEL_FILTER_IVLAN | \
2329 : : RTE_ETH_TUNNEL_FILTER_TENID)
2330 : : #define RTE_ETH_TUNNEL_FILTER_IMAC_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
2331 : : RTE_ETH_TUNNEL_FILTER_TENID)
2332 : : #define RTE_ETH_TUNNEL_FILTER_OMAC_TENID_IMAC (RTE_ETH_TUNNEL_FILTER_OMAC | \
2333 : : RTE_ETH_TUNNEL_FILTER_TENID | \
2334 : : RTE_ETH_TUNNEL_FILTER_IMAC)
2335 : :
2336 : : /**
2337 : : * Select IPv4 or IPv6 for tunnel filters.
2338 : : */
2339 : : enum rte_tunnel_iptype {
2340 : : RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4 */
2341 : : RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6 */
2342 : : };
2343 : :
2344 : : /**
2345 : : * Tunneling Packet filter configuration.
2346 : : */
2347 : : struct rte_eth_tunnel_filter_conf {
2348 : : struct rte_ether_addr outer_mac; /**< Outer MAC address to match */
2349 : : struct rte_ether_addr inner_mac; /**< Inner MAC address to match */
2350 : : uint16_t inner_vlan; /**< Inner VLAN to match */
2351 : : enum rte_tunnel_iptype ip_type; /**< IP address type */
2352 : : /**
2353 : : * Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP
2354 : : * is set in filter_type, or inner destination IP address to match
2355 : : * if ETH_TUNNEL_FILTER_IIP is set in filter_type.
2356 : : */
2357 : : union {
2358 : : uint32_t ipv4_addr; /**< IPv4 address in big endian */
2359 : : uint32_t ipv6_addr[4]; /**< IPv6 address in big endian */
2360 : : } ip_addr;
2361 : : /** Flags from ETH_TUNNEL_FILTER_XX - see above */
2362 : : uint16_t filter_type;
2363 : : enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type */
2364 : : uint32_t tenant_id; /**< Tenant ID to match: VNI, GRE key... */
2365 : : uint16_t queue_id; /**< Queue assigned to if match */
2366 : : };
2367 : :
2368 : : /**
2369 : : * Memory space that can be configured to store Flow Director filters
2370 : : * in the board memory.
2371 : : */
2372 : : enum rte_eth_fdir_pballoc_type {
2373 : : RTE_ETH_FDIR_PBALLOC_64K = 0, /**< 64k. */
2374 : : RTE_ETH_FDIR_PBALLOC_128K, /**< 128k. */
2375 : : RTE_ETH_FDIR_PBALLOC_256K, /**< 256k. */
2376 : : };
2377 : :
2378 : : /**
2379 : : * Select report mode of FDIR hash information in Rx descriptors.
2380 : : */
2381 : : enum rte_fdir_status_mode {
2382 : : RTE_FDIR_NO_REPORT_STATUS = 0, /**< Never report FDIR hash. */
2383 : : RTE_FDIR_REPORT_STATUS, /**< Only report FDIR hash for matching pkts. */
2384 : : RTE_FDIR_REPORT_STATUS_ALWAYS, /**< Always report FDIR hash. */
2385 : : };
2386 : :
2387 : : /**
2388 : : * A structure used to configure the Flow Director (FDIR) feature
2389 : : * of an Ethernet port.
2390 : : *
2391 : : * If mode is RTE_FDIR_MODE_NONE, the pballoc value is ignored.
2392 : : */
2393 : : struct rte_eth_fdir_conf {
2394 : : enum rte_fdir_mode mode; /**< Flow Director mode. */
2395 : : enum rte_eth_fdir_pballoc_type pballoc; /**< Space for FDIR filters. */
2396 : : enum rte_fdir_status_mode status; /**< How to report FDIR hash. */
2397 : : /** Rx queue of packets matching a "drop" filter in perfect mode. */
2398 : : uint8_t drop_queue;
2399 : : struct rte_eth_fdir_masks mask;
2400 : : /** Flex payload configuration. */
2401 : : struct rte_eth_fdir_flex_conf flex_conf;
2402 : : };
2403 : :
2404 : : /**
2405 : : * @internal
2406 : : * Fetch from the driver what kind of configuration must be restored by ethdev layer,
2407 : : * using get_restore_flags() callback.
2408 : : *
2409 : : * If callback is not defined, it is assumed that all supported configuration must be restored.
2410 : : *
2411 : : * @param dev
2412 : : * Port (ethdev) handle.
2413 : : * @param op
2414 : : * Type of operation executed by the application.
2415 : : *
2416 : : * @return
2417 : : * ORed restore flags indicating which configuration should be restored by ethdev.
2418 : : * 0 if no restore is required by the driver.
2419 : : */
2420 : : __rte_internal
2421 : : uint64_t
2422 : : rte_eth_get_restore_flags(struct rte_eth_dev *dev,
2423 : : enum rte_eth_dev_operation op);
2424 : :
2425 : : #ifdef __cplusplus
2426 : : }
2427 : : #endif
2428 : :
2429 : : #endif /* _RTE_ETHDEV_DRIVER_H_ */
|