1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
5 #ifndef _RTE_ETHDEV_CORE_H_
6 #define _RTE_ETHDEV_CORE_H_
13 * RTE Ethernet Device internal header.
15 * This header contains internal data types. But they are still part of the
16 * public API because they are used by inline functions in the published API.
18 * Applications should not use these directly.
22 struct rte_eth_dev_callback;
23 /** @internal Structure to keep track of registered callbacks */
24 RTE_TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
29 * @internal Retrieve input packets from a receive queue of an Ethernet device.
31 typedef uint16_t (*eth_rx_burst_t)(void *rxq,
32 struct rte_mbuf **rx_pkts,
36 * @internal Send output packets on a transmit queue of an Ethernet device.
38 typedef uint16_t (*eth_tx_burst_t)(void *txq,
39 struct rte_mbuf **tx_pkts,
43 * @internal Prepare output packets on a transmit queue of an Ethernet device.
45 typedef uint16_t (*eth_tx_prep_t)(void *txq,
46 struct rte_mbuf **tx_pkts,
50 /** @internal Get number of used descriptors on a receive queue. */
51 typedef uint32_t (*eth_rx_queue_count_t)(void *rxq);
53 /** @internal Check the status of a Rx descriptor */
54 typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
56 /** @internal Check the status of a Tx descriptor */
57 typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
61 * Structure used to hold opaque pointers to internal ethdev Rx/Tx
63 * The main purpose to expose these pointers at all - allow compiler
64 * to fetch this data for fast-path ethdev inline functions in advance.
66 struct rte_ethdev_qdata {
67 /** points to array of internal queue data pointers */
69 /** points to array of queue callback data pointers */
75 * fast-path ethdev functions and related data are hold in a flat array.
76 * One entry per ethdev.
77 * On 64-bit systems contents of this structure occupy exactly two 64B lines.
78 * On 32-bit systems contents of this structure fits into one 64B line.
80 struct rte_eth_fp_ops {
84 * Rx fast-path functions and related data.
85 * 64-bit systems: occupies first 64B line
87 /** PMD receive function. */
88 eth_rx_burst_t rx_pkt_burst;
89 /** Get the number of used Rx descriptors. */
90 eth_rx_queue_count_t rx_queue_count;
91 /** Check the status of a Rx descriptor. */
92 eth_rx_descriptor_status_t rx_descriptor_status;
93 /** Rx queues data. */
94 struct rte_ethdev_qdata rxq;
95 uintptr_t reserved1[3];
100 * Tx fast-path functions and related data.
101 * 64-bit systems: occupies second 64B line
103 /** PMD transmit function. */
104 eth_tx_burst_t tx_pkt_burst;
105 /** PMD transmit prepare function. */
106 eth_tx_prep_t tx_pkt_prepare;
107 /** Check the status of a Tx descriptor. */
108 eth_tx_descriptor_status_t tx_descriptor_status;
109 /** Tx queues data. */
110 struct rte_ethdev_qdata txq;
111 uintptr_t reserved2[3];
114 } __rte_cache_aligned;
116 extern struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS];
118 #endif /* _RTE_ETHDEV_CORE_H_ */