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