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);
28 typedef uint16_t (*eth_rx_burst_t)(void *rxq,
29 struct rte_mbuf **rx_pkts,
31 /**< @internal Retrieve input packets from a receive queue of an Ethernet device. */
33 typedef uint16_t (*eth_tx_burst_t)(void *txq,
34 struct rte_mbuf **tx_pkts,
36 /**< @internal Send output packets on a transmit queue of an Ethernet device. */
38 typedef uint16_t (*eth_tx_prep_t)(void *txq,
39 struct rte_mbuf **tx_pkts,
41 /**< @internal Prepare output packets on a transmit queue of an Ethernet device. */
44 typedef uint32_t (*eth_rx_queue_count_t)(void *rxq);
45 /**< @internal Get number of used descriptors on a receive queue. */
47 typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset);
48 /**< @internal Check the status of a Rx descriptor */
50 typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset);
51 /**< @internal Check the status of a Tx descriptor */
55 * Structure used to hold opaque pointers to internal ethdev Rx/Tx
57 * The main purpose to expose these pointers at all - allow compiler
58 * to fetch this data for fast-path ethdev inline functions in advance.
60 struct rte_ethdev_qdata {
61 /** points to array of internal queue data pointers */
63 /** points to array of queue callback data pointers */
69 * fast-path ethdev functions and related data are hold in a flat array.
70 * One entry per ethdev.
71 * On 64-bit systems contents of this structure occupy exactly two 64B lines.
72 * On 32-bit systems contents of this structure fits into one 64B line.
74 struct rte_eth_fp_ops {
78 * Rx fast-path functions and related data.
79 * 64-bit systems: occupies first 64B line
81 /** PMD receive function. */
82 eth_rx_burst_t rx_pkt_burst;
83 /** Get the number of used RX descriptors. */
84 eth_rx_queue_count_t rx_queue_count;
85 /** Check the status of a Rx descriptor. */
86 eth_rx_descriptor_status_t rx_descriptor_status;
87 /** Rx queues data. */
88 struct rte_ethdev_qdata rxq;
89 uintptr_t reserved1[3];
94 * Tx fast-path functions and related data.
95 * 64-bit systems: occupies second 64B line
97 /** PMD transmit function. */
98 eth_tx_burst_t tx_pkt_burst;
99 /** PMD transmit prepare function. */
100 eth_tx_prep_t tx_pkt_prepare;
101 /** Check the status of a Tx descriptor. */
102 eth_tx_descriptor_status_t tx_descriptor_status;
103 /** Tx queues data. */
104 struct rte_ethdev_qdata txq;
105 uintptr_t reserved2[3];
108 } __rte_cache_aligned;
110 extern struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS];
112 #endif /* _RTE_ETHDEV_CORE_H_ */