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 Add tunneling UDP port. */
766 : : typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev,
767 : : struct rte_eth_udp_tunnel *tunnel_udp);
768 : :
769 : : /** @internal Delete tunneling UDP port. */
770 : : typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev,
771 : : struct rte_eth_udp_tunnel *tunnel_udp);
772 : :
773 : : /** @internal set the list of multicast addresses on an Ethernet device. */
774 : : typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev,
775 : : struct rte_ether_addr *mc_addr_set,
776 : : uint32_t nb_mc_addr);
777 : :
778 : : /** @internal Function used to enable IEEE1588/802.1AS timestamping. */
779 : : typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev);
780 : :
781 : : /** @internal Function used to disable IEEE1588/802.1AS timestamping. */
782 : : typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev);
783 : :
784 : : /** @internal Function used to read an Rx IEEE1588/802.1AS timestamp. */
785 : : typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev,
786 : : struct timespec *timestamp,
787 : : uint32_t flags);
788 : :
789 : : /** @internal Function used to read a Tx IEEE1588/802.1AS timestamp. */
790 : : typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev,
791 : : struct timespec *timestamp);
792 : :
793 : : /** @internal Function used to adjust the device clock. */
794 : : typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t);
795 : :
796 : : /** @internal Function used to adjust the clock frequency. */
797 : : typedef int (*eth_timesync_adjust_freq)(struct rte_eth_dev *dev, int64_t);
798 : :
799 : : /** @internal Function used to get time from the device clock. */
800 : : typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev,
801 : : struct timespec *timestamp);
802 : :
803 : : /** @internal Function used to get time from the device clock. */
804 : : typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev,
805 : : const struct timespec *timestamp);
806 : :
807 : : /** @internal Function used to get the current value of the device clock. */
808 : : typedef int (*eth_read_clock)(struct rte_eth_dev *dev,
809 : : uint64_t *timestamp);
810 : :
811 : : /** @internal Retrieve registers. */
812 : : typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev,
813 : : struct rte_dev_reg_info *info);
814 : :
815 : : /** @internal Retrieve EEPROM size. */
816 : : typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev);
817 : :
818 : : /** @internal Retrieve EEPROM data. */
819 : : typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev,
820 : : struct rte_dev_eeprom_info *info);
821 : :
822 : : /** @internal Program EEPROM data. */
823 : : typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev,
824 : : struct rte_dev_eeprom_info *info);
825 : :
826 : : /** @internal Retrieve type and size of plugin module EEPROM. */
827 : : typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev,
828 : : struct rte_eth_dev_module_info *modinfo);
829 : :
830 : : /** @internal Retrieve plugin module EEPROM data. */
831 : : typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
832 : : struct rte_dev_eeprom_info *info);
833 : :
834 : : struct rte_flow_ops;
835 : : /**
836 : : * @internal
837 : : * Get flow operations.
838 : : *
839 : : * If the flow API is not supported for the specified device,
840 : : * the driver can return NULL.
841 : : */
842 : : typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev,
843 : : const struct rte_flow_ops **ops);
844 : :
845 : : /** @internal Get Traffic Management (TM) operations on an Ethernet device. */
846 : : typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
847 : :
848 : : /** @internal Get Traffic Metering and Policing (MTR) operations. */
849 : : typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops);
850 : :
851 : : /** @internal Get DCB information on an Ethernet device. */
852 : : typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev,
853 : : struct rte_eth_dcb_info *dcb_info);
854 : :
855 : : /** @internal Test if a port supports specific mempool ops. */
856 : : typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev,
857 : : const char *pool);
858 : :
859 : : /**
860 : : * @internal
861 : : * Get the hairpin capabilities.
862 : : *
863 : : * @param dev
864 : : * ethdev handle of port.
865 : : * @param cap
866 : : * returns the hairpin capabilities from the device.
867 : : *
868 : : * @return
869 : : * Negative errno value on error, 0 on success.
870 : : *
871 : : * @retval 0
872 : : * Success, hairpin is supported.
873 : : * @retval -ENOTSUP
874 : : * Hairpin is not supported.
875 : : */
876 : : typedef int (*eth_hairpin_cap_get_t)(struct rte_eth_dev *dev,
877 : : struct rte_eth_hairpin_cap *cap);
878 : :
879 : : /**
880 : : * @internal
881 : : * Setup Rx hairpin queue.
882 : : *
883 : : * @param dev
884 : : * ethdev handle of port.
885 : : * @param rx_queue_id
886 : : * the selected Rx queue index.
887 : : * @param nb_rx_desc
888 : : * the requested number of descriptors for this queue. 0 - use PMD default.
889 : : * @param conf
890 : : * the Rx hairpin configuration structure.
891 : : *
892 : : * @return
893 : : * Negative errno value on error, 0 on success.
894 : : *
895 : : * @retval 0
896 : : * Success, hairpin is supported.
897 : : * @retval -ENOTSUP
898 : : * Hairpin is not supported.
899 : : * @retval -EINVAL
900 : : * One of the parameters is invalid.
901 : : * @retval -ENOMEM
902 : : * Unable to allocate resources.
903 : : */
904 : : typedef int (*eth_rx_hairpin_queue_setup_t)
905 : : (struct rte_eth_dev *dev, uint16_t rx_queue_id,
906 : : uint16_t nb_rx_desc,
907 : : const struct rte_eth_hairpin_conf *conf);
908 : :
909 : : /**
910 : : * @internal
911 : : * Setup Tx hairpin queue.
912 : : *
913 : : * @param dev
914 : : * ethdev handle of port.
915 : : * @param tx_queue_id
916 : : * the selected Tx queue index.
917 : : * @param nb_tx_desc
918 : : * the requested number of descriptors for this queue. 0 - use PMD default.
919 : : * @param conf
920 : : * the Tx hairpin configuration structure.
921 : : *
922 : : * @return
923 : : * Negative errno value on error, 0 on success.
924 : : *
925 : : * @retval 0
926 : : * Success, hairpin is supported.
927 : : * @retval -ENOTSUP
928 : : * Hairpin is not supported.
929 : : * @retval -EINVAL
930 : : * One of the parameters is invalid.
931 : : * @retval -ENOMEM
932 : : * Unable to allocate resources.
933 : : */
934 : : typedef int (*eth_tx_hairpin_queue_setup_t)
935 : : (struct rte_eth_dev *dev, uint16_t tx_queue_id,
936 : : uint16_t nb_tx_desc,
937 : : const struct rte_eth_hairpin_conf *hairpin_conf);
938 : :
939 : : /**
940 : : * @internal
941 : : * Get Forward Error Correction(FEC) capability.
942 : : *
943 : : * @param dev
944 : : * ethdev handle of port.
945 : : * @param speed_fec_capa
946 : : * speed_fec_capa is out only with per-speed capabilities.
947 : : * @param num
948 : : * a number of elements in an speed_fec_capa array.
949 : : *
950 : : * @return
951 : : * Negative errno value on error, positive value on success.
952 : : *
953 : : * @retval positive value
954 : : * A non-negative value lower or equal to num: success. The return value
955 : : * is the number of entries filled in the fec capa array.
956 : : * A non-negative value higher than num: error, the given fec capa array
957 : : * is too small. The return value corresponds to the num that should
958 : : * be given to succeed. The entries in the fec capa array are not valid
959 : : * and shall not be used by the caller.
960 : : * @retval -ENOTSUP
961 : : * Operation is not supported.
962 : : * @retval -EIO
963 : : * Device is removed.
964 : : * @retval -EINVAL
965 : : * *num* or *speed_fec_capa* invalid.
966 : : */
967 : : typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev,
968 : : struct rte_eth_fec_capa *speed_fec_capa, unsigned int num);
969 : :
970 : : /**
971 : : * @internal
972 : : * Get Forward Error Correction(FEC) mode.
973 : : *
974 : : * @param dev
975 : : * ethdev handle of port.
976 : : * @param fec_capa
977 : : * a bitmask of enabled FEC modes. If AUTO bit is set, other
978 : : * bits specify FEC modes which may be negotiated. If AUTO
979 : : * bit is clear, specify FEC modes to be used (only one valid
980 : : * mode per speed may be set).
981 : : *
982 : : * @return
983 : : * Negative errno value on error, 0 on success.
984 : : *
985 : : * @retval 0
986 : : * Success, get FEC success.
987 : : * @retval -ENOTSUP
988 : : * Operation is not supported.
989 : : * @retval -EIO
990 : : * Device is removed.
991 : : */
992 : : typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev,
993 : : uint32_t *fec_capa);
994 : :
995 : : /**
996 : : * @internal
997 : : * Set Forward Error Correction(FEC) mode.
998 : : *
999 : : * @param dev
1000 : : * ethdev handle of port.
1001 : : * @param fec_capa
1002 : : * bitmask of allowed FEC modes. It must be only one
1003 : : * if AUTO is disabled. If AUTO is enabled, other
1004 : : * bits specify FEC modes which may be negotiated.
1005 : : *
1006 : : * @return
1007 : : * Negative errno value on error, 0 on success.
1008 : : *
1009 : : * @retval 0
1010 : : * Success, set FEC success.
1011 : : * @retval -ENOTSUP
1012 : : * Operation is not supported.
1013 : : * @retval -EINVAL
1014 : : * Unsupported FEC mode requested.
1015 : : * @retval -EIO
1016 : : * Device is removed.
1017 : : */
1018 : : typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, uint32_t fec_capa);
1019 : :
1020 : : /**
1021 : : * @internal
1022 : : * Get all hairpin Tx/Rx peer ports of the current device, if any.
1023 : : *
1024 : : * @param dev
1025 : : * ethdev handle of port.
1026 : : * @param peer_ports
1027 : : * array to save the ports list.
1028 : : * @param len
1029 : : * array length.
1030 : : * @param direction
1031 : : * value to decide the current to peer direction
1032 : : * positive - used as Tx to get all peer Rx ports.
1033 : : * zero - used as Rx to get all peer Tx ports.
1034 : : *
1035 : : * @return
1036 : : * Negative errno value on error, 0 or positive on success.
1037 : : *
1038 : : * @retval 0
1039 : : * Success, no peer ports.
1040 : : * @retval >0
1041 : : * Actual number of the peer ports.
1042 : : * @retval -ENOTSUP
1043 : : * Get peer ports API is not supported.
1044 : : * @retval -EINVAL
1045 : : * One of the parameters is invalid.
1046 : : */
1047 : : typedef int (*hairpin_get_peer_ports_t)(struct rte_eth_dev *dev,
1048 : : uint16_t *peer_ports, size_t len,
1049 : : uint32_t direction);
1050 : :
1051 : : /**
1052 : : * @internal
1053 : : * Bind all hairpin Tx queues of one port to the Rx queues of the peer port.
1054 : : *
1055 : : * @param dev
1056 : : * ethdev handle of port.
1057 : : * @param rx_port
1058 : : * the peer Rx port.
1059 : : *
1060 : : * @return
1061 : : * Negative errno value on error, 0 on success.
1062 : : *
1063 : : * @retval 0
1064 : : * Success, bind successfully.
1065 : : * @retval -ENOTSUP
1066 : : * Bind API is not supported.
1067 : : * @retval -EINVAL
1068 : : * One of the parameters is invalid.
1069 : : * @retval -EBUSY
1070 : : * Device is not started.
1071 : : */
1072 : : typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev,
1073 : : uint16_t rx_port);
1074 : :
1075 : : /**
1076 : : * @internal
1077 : : * Unbind all hairpin Tx queues of one port from the Rx queues of the peer port.
1078 : : *
1079 : : * @param dev
1080 : : * ethdev handle of port.
1081 : : * @param rx_port
1082 : : * the peer Rx port.
1083 : : *
1084 : : * @return
1085 : : * Negative errno value on error, 0 on success.
1086 : : *
1087 : : * @retval 0
1088 : : * Success, unbind successfully.
1089 : : * @retval -ENOTSUP
1090 : : * Bind API is not supported.
1091 : : * @retval -EINVAL
1092 : : * One of the parameters is invalid.
1093 : : * @retval -EBUSY
1094 : : * Device is already stopped.
1095 : : */
1096 : : typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev,
1097 : : uint16_t rx_port);
1098 : :
1099 : : /** @internal Update and fetch peer queue information. */
1100 : : typedef int (*eth_hairpin_queue_peer_update_t)
1101 : : (struct rte_eth_dev *dev, uint16_t peer_queue,
1102 : : struct rte_hairpin_peer_info *current_info,
1103 : : struct rte_hairpin_peer_info *peer_info, uint32_t direction);
1104 : :
1105 : : /** @internal Bind peer queue to the current queue with fetched information. */
1106 : : typedef int (*eth_hairpin_queue_peer_bind_t)
1107 : : (struct rte_eth_dev *dev, uint16_t cur_queue,
1108 : : struct rte_hairpin_peer_info *peer_info, uint32_t direction);
1109 : :
1110 : : /** @internal Unbind peer queue from the current queue. */
1111 : : typedef int (*eth_hairpin_queue_peer_unbind_t)
1112 : : (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction);
1113 : :
1114 : : /**
1115 : : * @internal
1116 : : * Get address of memory location whose contents will change whenever there is
1117 : : * new data to be received on an Rx queue.
1118 : : *
1119 : : * @param rxq
1120 : : * Ethdev queue pointer.
1121 : : * @param pmc
1122 : : * The pointer to power-optimized monitoring condition structure.
1123 : : * @return
1124 : : * Negative errno value on error, 0 on success.
1125 : : *
1126 : : * @retval 0
1127 : : * Success
1128 : : * @retval -EINVAL
1129 : : * Invalid parameters
1130 : : */
1131 : : typedef int (*eth_get_monitor_addr_t)(void *rxq,
1132 : : struct rte_power_monitor_cond *pmc);
1133 : :
1134 : : /**
1135 : : * @internal
1136 : : * Get representor info to be able to calculate the unique representor ID.
1137 : : *
1138 : : * Caller should pass NULL as pointer of info to get number of entries,
1139 : : * allocate info buffer according to returned entry number, then call
1140 : : * again with buffer to get real info.
1141 : : *
1142 : : * To calculate the representor ID, caller should iterate each entry,
1143 : : * match controller index, pf index, vf or sf start index and range,
1144 : : * then calculate representor ID from offset to vf/sf start index.
1145 : : * @see rte_eth_representor_id_get.
1146 : : *
1147 : : * @param dev
1148 : : * Ethdev handle of port.
1149 : : * @param [out] info
1150 : : * Pointer to memory to save device representor info.
1151 : : * @return
1152 : : * Negative errno value on error, number of info entries otherwise.
1153 : : */
1154 : :
1155 : : typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev,
1156 : : struct rte_eth_representor_info *info);
1157 : :
1158 : : /**
1159 : : * @internal
1160 : : * Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD.
1161 : : *
1162 : : * @param dev
1163 : : * Port (ethdev) handle
1164 : : *
1165 : : * @param[inout] features
1166 : : * Feature selection buffer
1167 : : *
1168 : : * @return
1169 : : * Negative errno value on error, zero otherwise
1170 : : */
1171 : : typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev,
1172 : : uint64_t *features);
1173 : :
1174 : : /**
1175 : : * @internal
1176 : : * Get IP reassembly offload capability of a PMD.
1177 : : *
1178 : : * @param dev
1179 : : * Port (ethdev) handle
1180 : : *
1181 : : * @param[out] conf
1182 : : * IP reassembly capability supported by the PMD
1183 : : *
1184 : : * @return
1185 : : * Negative errno value on error, zero otherwise
1186 : : */
1187 : : typedef int (*eth_ip_reassembly_capability_get_t)(struct rte_eth_dev *dev,
1188 : : struct rte_eth_ip_reassembly_params *capa);
1189 : :
1190 : : /**
1191 : : * @internal
1192 : : * Get IP reassembly offload configuration parameters set in PMD.
1193 : : *
1194 : : * @param dev
1195 : : * Port (ethdev) handle
1196 : : *
1197 : : * @param[out] conf
1198 : : * Configuration parameters for IP reassembly.
1199 : : *
1200 : : * @return
1201 : : * Negative errno value on error, zero otherwise
1202 : : */
1203 : : typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev,
1204 : : struct rte_eth_ip_reassembly_params *conf);
1205 : :
1206 : : /**
1207 : : * @internal
1208 : : * Set configuration parameters for enabling IP reassembly offload in hardware.
1209 : : *
1210 : : * @param dev
1211 : : * Port (ethdev) handle
1212 : : *
1213 : : * @param[in] conf
1214 : : * Configuration parameters for IP reassembly.
1215 : : *
1216 : : * @return
1217 : : * Negative errno value on error, zero otherwise
1218 : : */
1219 : : typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev,
1220 : : const struct rte_eth_ip_reassembly_params *conf);
1221 : :
1222 : : /**
1223 : : * @internal
1224 : : * Get supported header protocols of a PMD to split.
1225 : : *
1226 : : * @param dev
1227 : : * Ethdev handle of port.
1228 : : *
1229 : : * @return
1230 : : * An array pointer to store supported protocol headers.
1231 : : */
1232 : : typedef const uint32_t *(*eth_buffer_split_supported_hdr_ptypes_get_t)(struct rte_eth_dev *dev,
1233 : : size_t *no_of_elements);
1234 : :
1235 : : /**
1236 : : * @internal
1237 : : * Dump private info from device to a file.
1238 : : *
1239 : : * @param dev
1240 : : * Port (ethdev) handle.
1241 : : * @param file
1242 : : * A pointer to a file for output.
1243 : : *
1244 : : * @return
1245 : : * Negative value on error, 0 on success.
1246 : : *
1247 : : * @retval 0
1248 : : * Success
1249 : : * @retval -EINVAL
1250 : : * Invalid file
1251 : : */
1252 : : typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file);
1253 : :
1254 : : /**
1255 : : * @internal Set Rx queue available descriptors threshold.
1256 : : * @see rte_eth_rx_avail_thresh_set()
1257 : : *
1258 : : * Driver should round down number of descriptors on conversion from
1259 : : * percentage.
1260 : : */
1261 : : typedef int (*eth_rx_queue_avail_thresh_set_t)(struct rte_eth_dev *dev,
1262 : : uint16_t rx_queue_id,
1263 : : uint8_t avail_thresh);
1264 : :
1265 : : /**
1266 : : * @internal Query Rx queue available descriptors threshold event.
1267 : : * @see rte_eth_rx_avail_thresh_query()
1268 : : */
1269 : :
1270 : : typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev,
1271 : : uint16_t *rx_queue_id,
1272 : : uint8_t *avail_thresh);
1273 : :
1274 : : /** @internal Get congestion management information. */
1275 : : typedef int (*eth_cman_info_get_t)(struct rte_eth_dev *dev,
1276 : : struct rte_eth_cman_info *info);
1277 : :
1278 : : /** @internal Init congestion management structure with default values. */
1279 : : typedef int (*eth_cman_config_init_t)(struct rte_eth_dev *dev,
1280 : : struct rte_eth_cman_config *config);
1281 : :
1282 : : /** @internal Configure congestion management on a port. */
1283 : : typedef int (*eth_cman_config_set_t)(struct rte_eth_dev *dev,
1284 : : const struct rte_eth_cman_config *config);
1285 : :
1286 : : /** @internal Retrieve congestion management configuration of a port. */
1287 : : typedef int (*eth_cman_config_get_t)(struct rte_eth_dev *dev,
1288 : : struct rte_eth_cman_config *config);
1289 : :
1290 : : /**
1291 : : * @internal
1292 : : * Dump Rx descriptor info to a file.
1293 : : *
1294 : : * It is used for debugging, not a dataplane API.
1295 : : *
1296 : : * @param dev
1297 : : * Port (ethdev) handle.
1298 : : * @param queue_id
1299 : : * A Rx queue identifier on this port.
1300 : : * @param offset
1301 : : * The offset of the descriptor starting from tail. (0 is the next
1302 : : * packet to be received by the driver).
1303 : : * @param num
1304 : : * The number of the descriptors to dump.
1305 : : * @param file
1306 : : * A pointer to a file for output.
1307 : : * @return
1308 : : * Negative errno value on error, zero on success.
1309 : : */
1310 : : typedef int (*eth_rx_descriptor_dump_t)(const struct rte_eth_dev *dev,
1311 : : uint16_t queue_id, uint16_t offset,
1312 : : uint16_t num, FILE *file);
1313 : :
1314 : : /**
1315 : : * @internal
1316 : : * Dump Tx descriptor info to a file.
1317 : : *
1318 : : * This API is used for debugging, not a dataplane API.
1319 : : *
1320 : : * @param dev
1321 : : * Port (ethdev) handle.
1322 : : * @param queue_id
1323 : : * A Tx queue identifier on this port.
1324 : : * @param offset
1325 : : * The offset of the descriptor starting from tail. (0 is the place where
1326 : : * the next packet will be send).
1327 : : * @param num
1328 : : * The number of the descriptors to dump.
1329 : : * @param file
1330 : : * A pointer to a file for output.
1331 : : * @return
1332 : : * Negative errno value on error, zero on success.
1333 : : */
1334 : : typedef int (*eth_tx_descriptor_dump_t)(const struct rte_eth_dev *dev,
1335 : : uint16_t queue_id, uint16_t offset,
1336 : : uint16_t num, FILE *file);
1337 : :
1338 : : /**
1339 : : * @internal
1340 : : * Get the number of aggregated ports.
1341 : : *
1342 : : * @param dev
1343 : : * Port (ethdev) handle.
1344 : : *
1345 : : * @return
1346 : : * Negative errno value on error, 0 or positive on success.
1347 : : *
1348 : : * @retval >=0
1349 : : * The number of aggregated port if success.
1350 : : */
1351 : : typedef int (*eth_count_aggr_ports_t)(struct rte_eth_dev *dev);
1352 : :
1353 : : /**
1354 : : * @internal
1355 : : * Map a Tx queue with an aggregated port of the DPDK port.
1356 : : *
1357 : : * @param dev
1358 : : * Port (ethdev) handle.
1359 : : * @param tx_queue_id
1360 : : * The index of the transmit queue used in rte_eth_tx_burst().
1361 : : * @param affinity
1362 : : * The number of the aggregated port.
1363 : : *
1364 : : * @return
1365 : : * Negative on error, 0 on success.
1366 : : */
1367 : : typedef int (*eth_map_aggr_tx_affinity_t)(struct rte_eth_dev *dev, uint16_t tx_queue_id,
1368 : : uint8_t affinity);
1369 : :
1370 : : /**
1371 : : * @internal
1372 : : * Defines types of operations which can be executed by the application.
1373 : : */
1374 : : enum rte_eth_dev_operation {
1375 : : RTE_ETH_START,
1376 : : };
1377 : :
1378 : : /**@{@name Restore flags
1379 : : * Flags returned by get_restore_flags() callback.
1380 : : * They indicate to ethdev layer which configuration is required to be restored.
1381 : : */
1382 : : /** If set, ethdev layer will forcefully restore default and any other added MAC addresses. */
1383 : : #define RTE_ETH_RESTORE_MAC_ADDR RTE_BIT64(0)
1384 : : /** If set, ethdev layer will forcefully restore current promiscuous mode setting. */
1385 : : #define RTE_ETH_RESTORE_PROMISC RTE_BIT64(1)
1386 : : /** If set, ethdev layer will forcefully restore current all multicast mode setting. */
1387 : : #define RTE_ETH_RESTORE_ALLMULTI RTE_BIT64(2)
1388 : : /**@}*/
1389 : :
1390 : : /** All configuration which can be restored by ethdev layer. */
1391 : : #define RTE_ETH_RESTORE_ALL (RTE_ETH_RESTORE_MAC_ADDR | \
1392 : : RTE_ETH_RESTORE_PROMISC | \
1393 : : RTE_ETH_RESTORE_ALLMULTI)
1394 : :
1395 : : /**
1396 : : * @internal
1397 : : * Fetch from the driver what kind of configuration must be restored by ethdev layer,
1398 : : * after certain operations are performed by the application (such as rte_eth_dev_start()).
1399 : : *
1400 : : * @param dev
1401 : : * Port (ethdev) handle.
1402 : : * @param op
1403 : : * Type of operation executed by the application.
1404 : : *
1405 : : * @return
1406 : : * ORed restore flags indicating which configuration should be restored by ethdev.
1407 : : * 0 if no restore is required by the driver.
1408 : : */
1409 : : typedef uint64_t (*eth_get_restore_flags_t)(struct rte_eth_dev *dev,
1410 : : enum rte_eth_dev_operation op);
1411 : :
1412 : : /**
1413 : : * @internal A structure containing the functions exported by an Ethernet driver.
1414 : : */
1415 : : struct eth_dev_ops {
1416 : : eth_dev_configure_t dev_configure; /**< Configure device */
1417 : : eth_dev_start_t dev_start; /**< Start device */
1418 : : eth_dev_stop_t dev_stop; /**< Stop device */
1419 : : eth_dev_set_link_up_t dev_set_link_up; /**< Device link up */
1420 : : eth_dev_set_link_down_t dev_set_link_down; /**< Device link down */
1421 : : eth_dev_close_t dev_close; /**< Close device */
1422 : : eth_dev_reset_t dev_reset; /**< Reset device */
1423 : : eth_link_update_t link_update; /**< Get device link state */
1424 : : eth_speed_lanes_get_t speed_lanes_get; /**< Get link speed active lanes */
1425 : : eth_speed_lanes_set_t speed_lanes_set; /**< Set link speeds supported lanes */
1426 : : /** Get link speed lanes capability */
1427 : : eth_speed_lanes_get_capability_t speed_lanes_get_capa;
1428 : : /** Check if the device was physically removed */
1429 : : eth_is_removed_t is_removed;
1430 : :
1431 : : eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON */
1432 : : eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF */
1433 : : eth_allmulticast_enable_t allmulticast_enable;/**< Rx multicast ON */
1434 : : eth_allmulticast_disable_t allmulticast_disable;/**< Rx multicast OFF */
1435 : : eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address */
1436 : : eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */
1437 : : eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address */
1438 : : /** Set list of multicast addresses */
1439 : : eth_set_mc_addr_list_t set_mc_addr_list;
1440 : : mtu_set_t mtu_set; /**< Set MTU */
1441 : :
1442 : : /** Get generic device statistics */
1443 : : eth_stats_get_t stats_get;
1444 : : /** Reset generic device statistics */
1445 : : eth_stats_reset_t stats_reset;
1446 : : /** Get extended device statistics */
1447 : : eth_xstats_get_t xstats_get;
1448 : : /** Reset extended device statistics */
1449 : : eth_xstats_reset_t xstats_reset;
1450 : : /** Get names of extended statistics */
1451 : : eth_xstats_get_names_t xstats_get_names;
1452 : : /** Configure per queue stat counter mapping */
1453 : : eth_queue_stats_mapping_set_t queue_stats_mapping_set;
1454 : :
1455 : : eth_dev_infos_get_t dev_infos_get; /**< Get device info */
1456 : : /** Retrieve Rx queue information */
1457 : : eth_rxq_info_get_t rxq_info_get;
1458 : : /** Retrieve Tx queue information */
1459 : : eth_txq_info_get_t txq_info_get;
1460 : : /** Retrieve mbufs recycle Rx queue information */
1461 : : eth_recycle_rxq_info_get_t recycle_rxq_info_get;
1462 : : eth_burst_mode_get_t rx_burst_mode_get; /**< Get Rx burst mode */
1463 : : eth_burst_mode_get_t tx_burst_mode_get; /**< Get Tx burst mode */
1464 : : eth_fw_version_get_t fw_version_get; /**< Get firmware version */
1465 : :
1466 : : /** Get packet types supported and identified by device */
1467 : : eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;
1468 : : /**
1469 : : * Inform Ethernet device about reduced range of packet types to
1470 : : * handle
1471 : : */
1472 : : eth_dev_ptypes_set_t dev_ptypes_set;
1473 : :
1474 : : /** Filter VLAN Setup */
1475 : : vlan_filter_set_t vlan_filter_set;
1476 : : /** Outer/Inner VLAN TPID Setup */
1477 : : vlan_tpid_set_t vlan_tpid_set;
1478 : : /** VLAN Stripping on queue */
1479 : : vlan_strip_queue_set_t vlan_strip_queue_set;
1480 : : /** Set VLAN Offload */
1481 : : vlan_offload_set_t vlan_offload_set;
1482 : : /** Set port based Tx VLAN insertion */
1483 : : vlan_pvid_set_t vlan_pvid_set;
1484 : :
1485 : : eth_queue_start_t rx_queue_start;/**< Start Rx for a queue */
1486 : : eth_queue_stop_t rx_queue_stop; /**< Stop Rx for a queue */
1487 : : eth_queue_start_t tx_queue_start;/**< Start Tx for a queue */
1488 : : eth_queue_stop_t tx_queue_stop; /**< Stop Tx for a queue */
1489 : : eth_rx_queue_setup_t rx_queue_setup;/**< Set up device Rx queue */
1490 : : eth_queue_release_t rx_queue_release; /**< Release Rx queue */
1491 : :
1492 : : /** Enable Rx queue interrupt */
1493 : : eth_rx_enable_intr_t rx_queue_intr_enable;
1494 : : /** Disable Rx queue interrupt */
1495 : : eth_rx_disable_intr_t rx_queue_intr_disable;
1496 : :
1497 : : eth_tx_queue_setup_t tx_queue_setup;/**< Set up device Tx queue */
1498 : : eth_queue_release_t tx_queue_release; /**< Release Tx queue */
1499 : : eth_tx_done_cleanup_t tx_done_cleanup;/**< Free Tx ring mbufs */
1500 : :
1501 : : eth_dev_led_on_t dev_led_on; /**< Turn on LED */
1502 : : eth_dev_led_off_t dev_led_off; /**< Turn off LED */
1503 : :
1504 : : flow_ctrl_get_t flow_ctrl_get; /**< Get flow control */
1505 : : flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control */
1506 : : /** Setup priority flow control */
1507 : : priority_flow_ctrl_set_t priority_flow_ctrl_set;
1508 : : /** Priority flow control queue info get */
1509 : : priority_flow_ctrl_queue_info_get_t priority_flow_ctrl_queue_info_get;
1510 : : /** Priority flow control queue configure */
1511 : : priority_flow_ctrl_queue_config_t priority_flow_ctrl_queue_config;
1512 : :
1513 : : /** Set Unicast Table Array */
1514 : : eth_uc_hash_table_set_t uc_hash_table_set;
1515 : : /** Set Unicast hash bitmap */
1516 : : eth_uc_all_hash_table_set_t uc_all_hash_table_set;
1517 : :
1518 : : /** Add UDP tunnel port */
1519 : : eth_udp_tunnel_port_add_t udp_tunnel_port_add;
1520 : : /** Delete UDP tunnel port */
1521 : : eth_udp_tunnel_port_del_t udp_tunnel_port_del;
1522 : :
1523 : : /** Set queue rate limit */
1524 : : eth_set_queue_rate_limit_t set_queue_rate_limit;
1525 : :
1526 : : /** Configure RSS hash protocols and hashing key */
1527 : : rss_hash_update_t rss_hash_update;
1528 : : /** Get current RSS hash configuration */
1529 : : rss_hash_conf_get_t rss_hash_conf_get;
1530 : : /** Update redirection table */
1531 : : reta_update_t reta_update;
1532 : : /** Query redirection table */
1533 : : reta_query_t reta_query;
1534 : :
1535 : : eth_get_reg_t get_reg; /**< Get registers */
1536 : : eth_get_eeprom_length_t get_eeprom_length; /**< Get EEPROM length */
1537 : : eth_get_eeprom_t get_eeprom; /**< Get EEPROM data */
1538 : : eth_set_eeprom_t set_eeprom; /**< Set EEPROM */
1539 : :
1540 : : /** Get plugin module EEPROM attribute */
1541 : : eth_get_module_info_t get_module_info;
1542 : : /** Get plugin module EEPROM data */
1543 : : eth_get_module_eeprom_t get_module_eeprom;
1544 : :
1545 : : eth_flow_ops_get_t flow_ops_get; /**< Get flow operations */
1546 : :
1547 : : eth_get_dcb_info get_dcb_info; /**< Get DCB information */
1548 : :
1549 : : /** Turn IEEE1588/802.1AS timestamping on */
1550 : : eth_timesync_enable_t timesync_enable;
1551 : : /** Turn IEEE1588/802.1AS timestamping off */
1552 : : eth_timesync_disable_t timesync_disable;
1553 : : /** Read the IEEE1588/802.1AS Rx timestamp */
1554 : : eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp;
1555 : : /** Read the IEEE1588/802.1AS Tx timestamp */
1556 : : eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp;
1557 : : /** Adjust the device clock */
1558 : : eth_timesync_adjust_time timesync_adjust_time;
1559 : : /** Adjust the clock frequency */
1560 : : eth_timesync_adjust_freq timesync_adjust_freq;
1561 : : /** Get the device clock time */
1562 : : eth_timesync_read_time timesync_read_time;
1563 : : /** Set the device clock time */
1564 : : eth_timesync_write_time timesync_write_time;
1565 : :
1566 : : eth_read_clock read_clock;
1567 : :
1568 : : /** Get extended device statistic values by ID */
1569 : : eth_xstats_get_by_id_t xstats_get_by_id;
1570 : : /** Get name of extended device statistics by ID */
1571 : : eth_xstats_get_names_by_id_t xstats_get_names_by_id;
1572 : :
1573 : : eth_xstats_enable_counter_t xstats_enable;
1574 : : eth_xstats_disable_counter_t xstats_disable;
1575 : : eth_xstats_query_state_t xstats_query_state;
1576 : :
1577 : : /** Get Traffic Management (TM) operations */
1578 : : eth_tm_ops_get_t tm_ops_get;
1579 : :
1580 : : /** Get Traffic Metering and Policing (MTR) operations */
1581 : : eth_mtr_ops_get_t mtr_ops_get;
1582 : :
1583 : : /** Test if a port supports specific mempool ops */
1584 : : eth_pool_ops_supported_t pool_ops_supported;
1585 : :
1586 : : /** Returns the hairpin capabilities */
1587 : : eth_hairpin_cap_get_t hairpin_cap_get;
1588 : : /** Set up device Rx hairpin queue */
1589 : : eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup;
1590 : : /** Set up device Tx hairpin queue */
1591 : : eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup;
1592 : :
1593 : : /** Get Forward Error Correction(FEC) capability */
1594 : : eth_fec_get_capability_t fec_get_capability;
1595 : : /** Get Forward Error Correction(FEC) mode */
1596 : : eth_fec_get_t fec_get;
1597 : : /** Set Forward Error Correction(FEC) mode */
1598 : : eth_fec_set_t fec_set;
1599 : :
1600 : : /** Get hairpin peer ports list */
1601 : : hairpin_get_peer_ports_t hairpin_get_peer_ports;
1602 : : /** Bind all hairpin Tx queues of device to the peer port Rx queues */
1603 : : eth_hairpin_bind_t hairpin_bind;
1604 : : /** Unbind all hairpin Tx queues from the peer port Rx queues */
1605 : : eth_hairpin_unbind_t hairpin_unbind;
1606 : : /** Pass the current queue info and get the peer queue info */
1607 : : eth_hairpin_queue_peer_update_t hairpin_queue_peer_update;
1608 : : /** Set up the connection between the pair of hairpin queues */
1609 : : eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind;
1610 : : /** Disconnect the hairpin queues of a pair from each other */
1611 : : eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind;
1612 : :
1613 : : /** Get power monitoring condition for Rx queue */
1614 : : eth_get_monitor_addr_t get_monitor_addr;
1615 : :
1616 : : /** Get representor info */
1617 : : eth_representor_info_get_t representor_info_get;
1618 : :
1619 : : /**
1620 : : * Negotiate the NIC's ability to deliver specific
1621 : : * kinds of metadata to the PMD
1622 : : */
1623 : : eth_rx_metadata_negotiate_t rx_metadata_negotiate;
1624 : :
1625 : : /** Get IP reassembly capability */
1626 : : eth_ip_reassembly_capability_get_t ip_reassembly_capability_get;
1627 : : /** Get IP reassembly configuration */
1628 : : eth_ip_reassembly_conf_get_t ip_reassembly_conf_get;
1629 : : /** Set IP reassembly configuration */
1630 : : eth_ip_reassembly_conf_set_t ip_reassembly_conf_set;
1631 : :
1632 : : /** Get supported header ptypes to split */
1633 : : eth_buffer_split_supported_hdr_ptypes_get_t buffer_split_supported_hdr_ptypes_get;
1634 : :
1635 : : /** Dump private info from device */
1636 : : eth_dev_priv_dump_t eth_dev_priv_dump;
1637 : :
1638 : : /** Set Rx queue available descriptors threshold */
1639 : : eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set;
1640 : : /** Query Rx queue available descriptors threshold event */
1641 : : eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query;
1642 : :
1643 : : /** Dump Rx descriptor info */
1644 : : eth_rx_descriptor_dump_t eth_rx_descriptor_dump;
1645 : : /** Dump Tx descriptor info */
1646 : : eth_tx_descriptor_dump_t eth_tx_descriptor_dump;
1647 : :
1648 : : /** Get congestion management information */
1649 : : eth_cman_info_get_t cman_info_get;
1650 : : /** Initialize congestion management structure with default values */
1651 : : eth_cman_config_init_t cman_config_init;
1652 : : /** Configure congestion management */
1653 : : eth_cman_config_set_t cman_config_set;
1654 : : /** Retrieve congestion management configuration */
1655 : : eth_cman_config_get_t cman_config_get;
1656 : :
1657 : : /** Get the number of aggregated ports */
1658 : : eth_count_aggr_ports_t count_aggr_ports;
1659 : : /** Map a Tx queue with an aggregated port of the DPDK port */
1660 : : eth_map_aggr_tx_affinity_t map_aggr_tx_affinity;
1661 : :
1662 : : /** Get configuration which ethdev should restore */
1663 : : eth_get_restore_flags_t get_restore_flags;
1664 : : };
1665 : :
1666 : : /**
1667 : : * @internal
1668 : : * Check if the selected Rx queue is hairpin queue.
1669 : : *
1670 : : * @param dev
1671 : : * Pointer to the selected device.
1672 : : * @param queue_id
1673 : : * The selected queue.
1674 : : *
1675 : : * @return
1676 : : * - (1) if the queue is hairpin queue, 0 otherwise.
1677 : : */
1678 : : __rte_internal
1679 : : int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
1680 : :
1681 : : /**
1682 : : * @internal
1683 : : * Check if the selected Tx queue is hairpin queue.
1684 : : *
1685 : : * @param dev
1686 : : * Pointer to the selected device.
1687 : : * @param queue_id
1688 : : * The selected queue.
1689 : : *
1690 : : * @return
1691 : : * - (1) if the queue is hairpin queue, 0 otherwise.
1692 : : */
1693 : : __rte_internal
1694 : : int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
1695 : :
1696 : : /**
1697 : : * @internal
1698 : : * Returns a ethdev slot specified by the unique identifier name.
1699 : : *
1700 : : * @param name
1701 : : * The pointer to the Unique identifier name for each Ethernet device
1702 : : * @return
1703 : : * - The pointer to the ethdev slot, on success. NULL on error
1704 : : */
1705 : : __rte_internal
1706 : : struct rte_eth_dev *rte_eth_dev_allocated(const char *name);
1707 : :
1708 : : /**
1709 : : * @internal
1710 : : * Allocates a new ethdev slot for an Ethernet device and returns the pointer
1711 : : * to that slot for the driver to use.
1712 : : *
1713 : : * @param name Unique identifier name for each Ethernet device
1714 : : * @return
1715 : : * - Slot in the rte_dev_devices array for a new device;
1716 : : */
1717 : : __rte_internal
1718 : : struct rte_eth_dev *rte_eth_dev_allocate(const char *name);
1719 : :
1720 : : /**
1721 : : * @internal
1722 : : * Attach to the ethdev already initialized by the primary
1723 : : * process.
1724 : : *
1725 : : * @param name Ethernet device's name.
1726 : : * @return
1727 : : * - Success: Slot in the rte_dev_devices array for attached
1728 : : * device.
1729 : : * - Error: Null pointer.
1730 : : */
1731 : : __rte_internal
1732 : : struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name);
1733 : :
1734 : : /**
1735 : : * @internal
1736 : : * Notify RTE_ETH_EVENT_DESTROY and release the specified ethdev port.
1737 : : *
1738 : : * The following PMD-managed data fields will be freed:
1739 : : * - dev_private
1740 : : * - mac_addrs
1741 : : * - hash_mac_addrs
1742 : : * If one of these fields should not be freed,
1743 : : * it must be reset to NULL by the PMD, typically in dev_close method.
1744 : : *
1745 : : * @param eth_dev
1746 : : * Device to be detached.
1747 : : * @return
1748 : : * - 0 on success, negative on error
1749 : : */
1750 : : __rte_internal
1751 : : int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev);
1752 : :
1753 : : /**
1754 : : * @internal
1755 : : * Release device queues and clear its configuration to force the user
1756 : : * application to reconfigure it. It is for internal use only.
1757 : : *
1758 : : * @param dev
1759 : : * Pointer to struct rte_eth_dev.
1760 : : *
1761 : : * @return
1762 : : * void
1763 : : */
1764 : : __rte_internal
1765 : : void rte_eth_dev_internal_reset(struct rte_eth_dev *dev);
1766 : :
1767 : : /**
1768 : : * @internal Executes all the user application registered callbacks for
1769 : : * the specific device. It is for DPDK internal user only. User
1770 : : * application should not call it directly.
1771 : : *
1772 : : * @param dev
1773 : : * Pointer to struct rte_eth_dev.
1774 : : * @param event
1775 : : * Eth device interrupt event type.
1776 : : * @param ret_param
1777 : : * To pass data back to user application.
1778 : : * This allows the user application to decide if a particular function
1779 : : * is permitted or not.
1780 : : *
1781 : : * @return
1782 : : * int
1783 : : */
1784 : : __rte_internal
1785 : : int rte_eth_dev_callback_process(struct rte_eth_dev *dev,
1786 : : enum rte_eth_event_type event, void *ret_param);
1787 : :
1788 : : /**
1789 : : * @internal
1790 : : * This is the last step of device probing.
1791 : : * It must be called after a port is allocated and initialized successfully.
1792 : : *
1793 : : * The notification RTE_ETH_EVENT_NEW is sent to other entities
1794 : : * (libraries and applications).
1795 : : * The state is set as RTE_ETH_DEV_ATTACHED.
1796 : : *
1797 : : * @param dev
1798 : : * New ethdev port.
1799 : : */
1800 : : __rte_internal
1801 : : void rte_eth_dev_probing_finish(struct rte_eth_dev *dev);
1802 : :
1803 : : /**
1804 : : * Create memzone for HW rings.
1805 : : * malloc can't be used as the physical address is needed.
1806 : : * If the memzone is already created, then this function returns a ptr
1807 : : * to the old one.
1808 : : *
1809 : : * @param eth_dev
1810 : : * The *eth_dev* pointer is the address of the *rte_eth_dev* structure
1811 : : * @param name
1812 : : * The name of the memory zone
1813 : : * @param queue_id
1814 : : * The index of the queue to add to name
1815 : : * @param size
1816 : : * The sizeof of the memory area
1817 : : * @param align
1818 : : * Alignment for resulting memzone. Must be a power of 2.
1819 : : * @param socket_id
1820 : : * The *socket_id* argument is the socket identifier in case of NUMA.
1821 : : */
1822 : : __rte_internal
1823 : : const struct rte_memzone *
1824 : : rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
1825 : : uint16_t queue_id, size_t size,
1826 : : unsigned align, int socket_id);
1827 : :
1828 : : /**
1829 : : * Free previously allocated memzone for HW rings.
1830 : : *
1831 : : * @param eth_dev
1832 : : * The *eth_dev* pointer is the address of the *rte_eth_dev* structure
1833 : : * @param name
1834 : : * The name of the memory zone
1835 : : * @param queue_id
1836 : : * The index of the queue to add to name
1837 : : * @return
1838 : : * Negative errno value on error, 0 on success.
1839 : : */
1840 : : __rte_internal
1841 : : int
1842 : : rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name,
1843 : : uint16_t queue_id);
1844 : :
1845 : : /**
1846 : : * @internal
1847 : : * Atomically set the link status for the specific device.
1848 : : * It is for use by DPDK device driver use only.
1849 : : * User applications should not call it
1850 : : *
1851 : : * @param dev
1852 : : * Pointer to struct rte_eth_dev.
1853 : : * @param link
1854 : : * New link status value.
1855 : : * @return
1856 : : * Same convention as eth_link_update operation.
1857 : : * 0 if link up status has changed
1858 : : * -1 if link up status was unchanged
1859 : : */
1860 : : static inline int
1861 : 0 : rte_eth_linkstatus_set(struct rte_eth_dev *dev,
1862 : : const struct rte_eth_link *new_link)
1863 : : {
1864 : : struct rte_eth_link old_link;
1865 : :
1866 : 0 : old_link.val64 = rte_atomic_exchange_explicit(&dev->data->dev_link.val64,
1867 : : new_link->val64,
1868 : : rte_memory_order_seq_cst);
1869 : :
1870 [ # # # # : 0 : return (old_link.link_status == new_link->link_status) ? -1 : 0;
# # # # #
# # # ]
1871 : : }
1872 : :
1873 : : /**
1874 : : * @internal
1875 : : * Atomically get the link speed and status.
1876 : : *
1877 : : * @param dev
1878 : : * Pointer to struct rte_eth_dev.
1879 : : * @param link
1880 : : * link status value.
1881 : : */
1882 : : static inline void
1883 : 0 : rte_eth_linkstatus_get(const struct rte_eth_dev *dev,
1884 : : struct rte_eth_link *link)
1885 : : {
1886 : : struct rte_eth_link curr_link;
1887 : :
1888 : 0 : curr_link.val64 = rte_atomic_load_explicit(&dev->data->dev_link.val64,
1889 : : rte_memory_order_seq_cst);
1890 : 0 : rte_atomic_store_explicit(&link->val64, curr_link.val64, rte_memory_order_seq_cst);
1891 : 0 : }
1892 : :
1893 : : /**
1894 : : * @internal
1895 : : * Dummy DPDK callback for Rx/Tx packet burst.
1896 : : *
1897 : : * @param queue
1898 : : * Pointer to Rx/Tx queue
1899 : : * @param pkts
1900 : : * Packet array
1901 : : * @param nb_pkts
1902 : : * Number of packets in packet array
1903 : : */
1904 : : __rte_internal
1905 : : uint16_t
1906 : : rte_eth_pkt_burst_dummy(void *queue __rte_unused,
1907 : : struct rte_mbuf **pkts __rte_unused,
1908 : : uint16_t nb_pkts __rte_unused);
1909 : :
1910 : : /**
1911 : : * @internal
1912 : : * Dummy DPDK callback for Tx packet prepare.
1913 : : *
1914 : : * @param queue
1915 : : * Pointer to Tx queue
1916 : : * @param pkts
1917 : : * Packet array
1918 : : * @param nb_pkts
1919 : : * Number of packets in packet array
1920 : : */
1921 : : __rte_internal
1922 : : uint16_t
1923 : : rte_eth_tx_pkt_prepare_dummy(void *queue __rte_unused,
1924 : : struct rte_mbuf **pkts __rte_unused,
1925 : : uint16_t nb_pkts __rte_unused);
1926 : :
1927 : : /**
1928 : : * @internal
1929 : : * Dummy DPDK callback for queue count.
1930 : : *
1931 : : * @param queue
1932 : : * Pointer to Rx/Tx queue
1933 : : */
1934 : : __rte_internal
1935 : : int
1936 : : rte_eth_queue_count_dummy(void *queue __rte_unused);
1937 : :
1938 : : /**
1939 : : * @internal
1940 : : * Dummy DPDK callback for descriptor status.
1941 : : *
1942 : : * @param queue
1943 : : * Pointer to Rx/Tx queue
1944 : : * @param offset
1945 : : * The offset of the descriptor starting from tail (0 is the next
1946 : : * packet to be received by the driver).
1947 : : */
1948 : : __rte_internal
1949 : : int
1950 : : rte_eth_descriptor_status_dummy(void *queue __rte_unused,
1951 : : uint16_t offset __rte_unused);
1952 : :
1953 : : /**
1954 : : * @internal
1955 : : * Dummy DPDK callback for recycle Tx mbufs reuse.
1956 : : *
1957 : : * @param queue
1958 : : * Pointer to Tx queue
1959 : : * @param recycle_rxq_info
1960 : : * Pointer to recycle Rx queue info
1961 : : */
1962 : : __rte_internal
1963 : : uint16_t
1964 : : rte_eth_recycle_tx_mbufs_reuse_dummy(void *queue __rte_unused,
1965 : : struct rte_eth_recycle_rxq_info *recycle_rxq_info __rte_unused);
1966 : :
1967 : : /**
1968 : : * @internal
1969 : : * Dummy DPDK callback Rx descriptor refill.
1970 : : *
1971 : : * @param queue
1972 : : * Pointer Rx queue
1973 : : * @param offset
1974 : : * number of descriptors to refill
1975 : : */
1976 : : __rte_internal
1977 : : void
1978 : : rte_eth_recycle_rx_descriptors_refill_dummy(void *queue __rte_unused,
1979 : : uint16_t nb __rte_unused);
1980 : :
1981 : : /**
1982 : : * Allocate an unique switch domain identifier.
1983 : : *
1984 : : * A pool of switch domain identifiers which can be allocated on request. This
1985 : : * will enabled devices which support the concept of switch domains to request
1986 : : * a switch domain ID which is guaranteed to be unique from other devices
1987 : : * running in the same process.
1988 : : *
1989 : : * @param domain_id
1990 : : * switch domain identifier parameter to pass back to application
1991 : : *
1992 : : * @return
1993 : : * Negative errno value on error, 0 on success.
1994 : : */
1995 : : __rte_internal
1996 : : int
1997 : : rte_eth_switch_domain_alloc(uint16_t *domain_id);
1998 : :
1999 : : /**
2000 : : * Free switch domain.
2001 : : *
2002 : : * Return a switch domain identifier to the pool of free identifiers after it is
2003 : : * no longer in use by device.
2004 : : *
2005 : : * @param domain_id
2006 : : * switch domain identifier to free
2007 : : *
2008 : : * @return
2009 : : * Negative errno value on error, 0 on success.
2010 : : */
2011 : : __rte_internal
2012 : : int
2013 : : rte_eth_switch_domain_free(uint16_t domain_id);
2014 : :
2015 : : /**
2016 : : * Generic Ethernet device arguments
2017 : : *
2018 : : * One type of representor each structure.
2019 : : */
2020 : : struct rte_eth_devargs {
2021 : : uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS];
2022 : : /** controller/s number in case of multi-host */
2023 : : uint16_t nb_mh_controllers;
2024 : : /** number of controllers in multi-host controllers field */
2025 : : uint16_t ports[RTE_MAX_ETHPORTS];
2026 : : /** port/s number to enable on a multi-port single function */
2027 : : uint16_t nb_ports;
2028 : : /** number of ports in ports field */
2029 : : uint16_t representor_ports[RTE_MAX_ETHPORTS];
2030 : : /** representor port/s identifier to enable on device */
2031 : : uint16_t nb_representor_ports;
2032 : : /** number of ports in representor port field */
2033 : : enum rte_eth_representor_type type; /* type of representor */
2034 : : };
2035 : :
2036 : : /**
2037 : : * PMD helper function to get representor ID from location detail.
2038 : : *
2039 : : * Get representor ID from controller, pf and (sf or vf).
2040 : : * The mapping is retrieved from rte_eth_representor_info_get().
2041 : : *
2042 : : * For backward compatibility, if no representor info, direct
2043 : : * map legacy VF (no controller and pf).
2044 : : *
2045 : : * @param port_id
2046 : : * Port ID of the backing device.
2047 : : * @param type
2048 : : * Representor type.
2049 : : * @param controller
2050 : : * Controller ID, -1 if unspecified.
2051 : : * @param pf
2052 : : * PF port ID, -1 if unspecified.
2053 : : * @param representor_port
2054 : : * VF or SF representor port number, -1 if unspecified.
2055 : : * @param repr_id
2056 : : * Pointer to output representor ID.
2057 : : *
2058 : : * @return
2059 : : * Negative errno value on error, 0 on success.
2060 : : */
2061 : : __rte_internal
2062 : : int
2063 : : rte_eth_representor_id_get(uint16_t port_id,
2064 : : enum rte_eth_representor_type type,
2065 : : int controller, int pf, int representor_port,
2066 : : uint16_t *repr_id);
2067 : :
2068 : : /**
2069 : : * @internal
2070 : : * Check if the ethdev is a representor port.
2071 : : *
2072 : : * @param dev
2073 : : * Pointer to struct rte_eth_dev.
2074 : : *
2075 : : * @return
2076 : : * false the ethdev is not a representor port.
2077 : : * true the ethdev is a representor port.
2078 : : */
2079 : : static inline bool
2080 : : rte_eth_dev_is_repr(const struct rte_eth_dev *dev)
2081 : : {
2082 [ # # # # : 0 : return ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0);
# # # # #
# # # # #
# # # # #
# # # ]
2083 : : }
2084 : :
2085 : : /**
2086 : : * PMD helper function to parse ethdev arguments
2087 : : *
2088 : : * @param devargs
2089 : : * device arguments
2090 : : * @param eth_devargs
2091 : : * contiguous memory populated with parsed ethdev specific arguments.
2092 : : * @param nb_da
2093 : : * size of eth_devargs array passed
2094 : : *
2095 : : * @return
2096 : : * Negative errno value on error, no of devargs parsed on success.
2097 : : */
2098 : : __rte_internal
2099 : : int
2100 : : rte_eth_devargs_parse(const char *devargs, struct rte_eth_devargs *eth_devargs,
2101 : : unsigned int nb_da);
2102 : :
2103 : :
2104 : : typedef int (*ethdev_init_t)(struct rte_eth_dev *ethdev, void *init_params);
2105 : : typedef int (*ethdev_bus_specific_init)(struct rte_eth_dev *ethdev,
2106 : : void *bus_specific_init_params);
2107 : :
2108 : : /**
2109 : : * PMD helper function for the creation of a new ethdev ports.
2110 : : *
2111 : : * @param device
2112 : : * rte_device handle.
2113 : : * @param name
2114 : : * port name.
2115 : : * @param priv_data_size
2116 : : * size of private data required for port.
2117 : : * @param bus_specific_init
2118 : : * port bus specific initialisation callback function
2119 : : * @param bus_init_params
2120 : : * port bus specific initialisation parameters
2121 : : * @param ethdev_init
2122 : : * device specific port initialization callback function
2123 : : * @param init_params
2124 : : * port initialisation parameters
2125 : : *
2126 : : * @return
2127 : : * Negative errno value on error, 0 on success.
2128 : : */
2129 : : __rte_internal
2130 : : int
2131 : : rte_eth_dev_create(struct rte_device *device, const char *name,
2132 : : size_t priv_data_size,
2133 : : ethdev_bus_specific_init bus_specific_init, void *bus_init_params,
2134 : : ethdev_init_t ethdev_init, void *init_params);
2135 : :
2136 : :
2137 : : typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev);
2138 : :
2139 : : /**
2140 : : * PMD helper function for cleaning up the resources of a ethdev port on it's
2141 : : * destruction.
2142 : : *
2143 : : * @param ethdev
2144 : : * ethdev handle of port.
2145 : : * @param ethdev_uninit
2146 : : * device specific port un-initialise callback function
2147 : : *
2148 : : * @return
2149 : : * Negative errno value on error, 0 on success.
2150 : : */
2151 : : __rte_internal
2152 : : int
2153 : : rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit);
2154 : :
2155 : : /**
2156 : : * @internal
2157 : : * Pass the current hairpin queue HW and/or SW information to the peer queue
2158 : : * and fetch back the information of the peer queue.
2159 : : *
2160 : : * @param peer_port
2161 : : * Peer port identifier of the Ethernet device.
2162 : : * @param peer_queue
2163 : : * Peer queue index of the port.
2164 : : * @param cur_info
2165 : : * Pointer to the current information structure.
2166 : : * @param peer_info
2167 : : * Pointer to the peer information, output.
2168 : : * @param direction
2169 : : * Direction to pass the information.
2170 : : * positive - pass Tx queue information and get peer Rx queue information
2171 : : * zero - pass Rx queue information and get peer Tx queue information
2172 : : *
2173 : : * @return
2174 : : * Negative errno value on error, 0 on success.
2175 : : */
2176 : : __rte_internal
2177 : : int
2178 : : rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue,
2179 : : struct rte_hairpin_peer_info *cur_info,
2180 : : struct rte_hairpin_peer_info *peer_info,
2181 : : uint32_t direction);
2182 : :
2183 : : /**
2184 : : * @internal
2185 : : * Configure current hairpin queue with the peer information fetched to create
2186 : : * the connection (bind) with peer queue in the specified direction.
2187 : : * This function might need to be called twice to fully create the connections.
2188 : : *
2189 : : * @param cur_port
2190 : : * Current port identifier of the Ethernet device.
2191 : : * @param cur_queue
2192 : : * Current queue index of the port.
2193 : : * @param peer_info
2194 : : * Pointer to the peer information, input.
2195 : : * @param direction
2196 : : * Direction to create the connection.
2197 : : * positive - bind current Tx queue to peer Rx queue
2198 : : * zero - bind current Rx queue to peer Tx queue
2199 : : *
2200 : : * @return
2201 : : * Negative errno value on error, 0 on success.
2202 : : */
2203 : : __rte_internal
2204 : : int
2205 : : rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
2206 : : struct rte_hairpin_peer_info *peer_info,
2207 : : uint32_t direction);
2208 : :
2209 : : /**
2210 : : * @internal
2211 : : * Get rte_eth_dev from device name. The device name should be specified
2212 : : * as below:
2213 : : * - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0
2214 : : * - SoC device name, for example fsl-gmac0
2215 : : * - vdev dpdk name, for example net_[pcap0|null0|tap0]
2216 : : *
2217 : : * @param name
2218 : : * PCI address or name of the device
2219 : : * @return
2220 : : * - rte_eth_dev if successful
2221 : : * - NULL on failure
2222 : : */
2223 : : __rte_internal
2224 : : struct rte_eth_dev*
2225 : : rte_eth_dev_get_by_name(const char *name);
2226 : :
2227 : : /**
2228 : : * @internal
2229 : : * Reset the current queue state and configuration to disconnect (unbind) it
2230 : : * from the peer queue.
2231 : : * This function might need to be called twice to disconnect each other.
2232 : : *
2233 : : * @param cur_port
2234 : : * Current port identifier of the Ethernet device.
2235 : : * @param cur_queue
2236 : : * Current queue index of the port.
2237 : : * @param direction
2238 : : * Direction to destroy the connection.
2239 : : * positive - unbind current Tx queue from peer Rx queue
2240 : : * zero - unbind current Rx queue from peer Tx queue
2241 : : *
2242 : : * @return
2243 : : * Negative errno value on error, 0 on success.
2244 : : */
2245 : : __rte_internal
2246 : : int
2247 : : rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
2248 : : uint32_t direction);
2249 : :
2250 : : /**
2251 : : * @internal
2252 : : * Register mbuf dynamic field and flag for IP reassembly incomplete case.
2253 : : */
2254 : : __rte_internal
2255 : : int
2256 : : rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag);
2257 : :
2258 : :
2259 : : /*
2260 : : * Legacy ethdev API used internally by drivers.
2261 : : */
2262 : :
2263 : : enum rte_filter_type {
2264 : : RTE_ETH_FILTER_NONE = 0,
2265 : : RTE_ETH_FILTER_ETHERTYPE,
2266 : : RTE_ETH_FILTER_FLEXIBLE,
2267 : : RTE_ETH_FILTER_SYN,
2268 : : RTE_ETH_FILTER_NTUPLE,
2269 : : RTE_ETH_FILTER_TUNNEL,
2270 : : RTE_ETH_FILTER_FDIR,
2271 : : RTE_ETH_FILTER_HASH,
2272 : : RTE_ETH_FILTER_L2_TUNNEL,
2273 : : };
2274 : :
2275 : : /**
2276 : : * Define all structures for Ethertype Filter type.
2277 : : */
2278 : :
2279 : : #define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */
2280 : : #define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */
2281 : :
2282 : : /**
2283 : : * A structure used to define the ethertype filter entry
2284 : : * to support RTE_ETH_FILTER_ETHERTYPE data representation.
2285 : : */
2286 : : struct rte_eth_ethertype_filter {
2287 : : struct rte_ether_addr mac_addr; /**< Mac address to match */
2288 : : uint16_t ether_type; /**< Ether type to match */
2289 : : uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */
2290 : : uint16_t queue; /**< Queue assigned to when match */
2291 : : };
2292 : :
2293 : : /**
2294 : : * A structure used to define the TCP syn filter entry
2295 : : * to support RTE_ETH_FILTER_SYN data representation.
2296 : : */
2297 : : struct rte_eth_syn_filter {
2298 : : /** 1 - higher priority than other filters, 0 - lower priority */
2299 : : uint8_t hig_pri;
2300 : : uint16_t queue; /**< Queue assigned to when match */
2301 : : };
2302 : :
2303 : : /**
2304 : : * filter type of tunneling packet
2305 : : */
2306 : : #define RTE_ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */
2307 : : #define RTE_ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */
2308 : : #define RTE_ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */
2309 : : #define RTE_ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */
2310 : : #define RTE_ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */
2311 : : #define RTE_ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */
2312 : :
2313 : : #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN (RTE_ETH_TUNNEL_FILTER_IMAC | \
2314 : : RTE_ETH_TUNNEL_FILTER_IVLAN)
2315 : : #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
2316 : : RTE_ETH_TUNNEL_FILTER_IVLAN | \
2317 : : RTE_ETH_TUNNEL_FILTER_TENID)
2318 : : #define RTE_ETH_TUNNEL_FILTER_IMAC_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \
2319 : : RTE_ETH_TUNNEL_FILTER_TENID)
2320 : : #define RTE_ETH_TUNNEL_FILTER_OMAC_TENID_IMAC (RTE_ETH_TUNNEL_FILTER_OMAC | \
2321 : : RTE_ETH_TUNNEL_FILTER_TENID | \
2322 : : RTE_ETH_TUNNEL_FILTER_IMAC)
2323 : :
2324 : : /**
2325 : : * Select IPv4 or IPv6 for tunnel filters.
2326 : : */
2327 : : enum rte_tunnel_iptype {
2328 : : RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4 */
2329 : : RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6 */
2330 : : };
2331 : :
2332 : : /**
2333 : : * Tunneling Packet filter configuration.
2334 : : */
2335 : : struct rte_eth_tunnel_filter_conf {
2336 : : struct rte_ether_addr outer_mac; /**< Outer MAC address to match */
2337 : : struct rte_ether_addr inner_mac; /**< Inner MAC address to match */
2338 : : uint16_t inner_vlan; /**< Inner VLAN to match */
2339 : : enum rte_tunnel_iptype ip_type; /**< IP address type */
2340 : : /**
2341 : : * Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP
2342 : : * is set in filter_type, or inner destination IP address to match
2343 : : * if ETH_TUNNEL_FILTER_IIP is set in filter_type.
2344 : : */
2345 : : union {
2346 : : uint32_t ipv4_addr; /**< IPv4 address in big endian */
2347 : : uint32_t ipv6_addr[4]; /**< IPv6 address in big endian */
2348 : : } ip_addr;
2349 : : /** Flags from ETH_TUNNEL_FILTER_XX - see above */
2350 : : uint16_t filter_type;
2351 : : enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type */
2352 : : uint32_t tenant_id; /**< Tenant ID to match: VNI, GRE key... */
2353 : : uint16_t queue_id; /**< Queue assigned to if match */
2354 : : };
2355 : :
2356 : : /**
2357 : : * Memory space that can be configured to store Flow Director filters
2358 : : * in the board memory.
2359 : : */
2360 : : enum rte_eth_fdir_pballoc_type {
2361 : : RTE_ETH_FDIR_PBALLOC_64K = 0, /**< 64k. */
2362 : : RTE_ETH_FDIR_PBALLOC_128K, /**< 128k. */
2363 : : RTE_ETH_FDIR_PBALLOC_256K, /**< 256k. */
2364 : : };
2365 : :
2366 : : /**
2367 : : * Select report mode of FDIR hash information in Rx descriptors.
2368 : : */
2369 : : enum rte_fdir_status_mode {
2370 : : RTE_FDIR_NO_REPORT_STATUS = 0, /**< Never report FDIR hash. */
2371 : : RTE_FDIR_REPORT_STATUS, /**< Only report FDIR hash for matching pkts. */
2372 : : RTE_FDIR_REPORT_STATUS_ALWAYS, /**< Always report FDIR hash. */
2373 : : };
2374 : :
2375 : : /**
2376 : : * A structure used to configure the Flow Director (FDIR) feature
2377 : : * of an Ethernet port.
2378 : : *
2379 : : * If mode is RTE_FDIR_MODE_NONE, the pballoc value is ignored.
2380 : : */
2381 : : struct rte_eth_fdir_conf {
2382 : : enum rte_fdir_mode mode; /**< Flow Director mode. */
2383 : : enum rte_eth_fdir_pballoc_type pballoc; /**< Space for FDIR filters. */
2384 : : enum rte_fdir_status_mode status; /**< How to report FDIR hash. */
2385 : : /** Rx queue of packets matching a "drop" filter in perfect mode. */
2386 : : uint8_t drop_queue;
2387 : : struct rte_eth_fdir_masks mask;
2388 : : /** Flex payload configuration. */
2389 : : struct rte_eth_fdir_flex_conf flex_conf;
2390 : : };
2391 : :
2392 : : /**
2393 : : * @internal
2394 : : * Fetch from the driver what kind of configuration must be restored by ethdev layer,
2395 : : * using get_restore_flags() callback.
2396 : : *
2397 : : * If callback is not defined, it is assumed that all supported configuration must be restored.
2398 : : *
2399 : : * @param dev
2400 : : * Port (ethdev) handle.
2401 : : * @param op
2402 : : * Type of operation executed by the application.
2403 : : *
2404 : : * @return
2405 : : * ORed restore flags indicating which configuration should be restored by ethdev.
2406 : : * 0 if no restore is required by the driver.
2407 : : */
2408 : : __rte_internal
2409 : : uint64_t
2410 : : rte_eth_get_restore_flags(struct rte_eth_dev *dev,
2411 : : enum rte_eth_dev_operation op);
2412 : :
2413 : : #ifdef __cplusplus
2414 : : }
2415 : : #endif
2416 : :
2417 : : #endif /* _RTE_ETHDEV_DRIVER_H_ */
|