1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2017 Intel Corporation 3 */ 4 5 #ifndef _RTE_ETHDEV_CORE_H_ 6 #define _RTE_ETHDEV_CORE_H_ 7 8 #include <pthread.h> 9 10 /** 11 * @file 12 * 13 * RTE Ethernet Device internal header. 14 * 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. 17 * 18 * Applications should not use these directly. 19 * 20 */ 21 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); 25 26 struct rte_eth_dev; 27 28 typedef uint16_t (*eth_rx_burst_t)(void *rxq, 29 struct rte_mbuf **rx_pkts, 30 uint16_t nb_pkts); 31 /**< @internal Retrieve input packets from a receive queue of an Ethernet device. */ 32 33 typedef uint16_t (*eth_tx_burst_t)(void *txq, 34 struct rte_mbuf **tx_pkts, 35 uint16_t nb_pkts); 36 /**< @internal Send output packets on a transmit queue of an Ethernet device. */ 37 38 typedef uint16_t (*eth_tx_prep_t)(void *txq, 39 struct rte_mbuf **tx_pkts, 40 uint16_t nb_pkts); 41 /**< @internal Prepare output packets on a transmit queue of an Ethernet device. */ 42 43 44 typedef uint32_t (*eth_rx_queue_count_t)(void *rxq); 45 /**< @internal Get number of used descriptors on a receive queue. */ 46 47 typedef int (*eth_rx_descriptor_status_t)(void *rxq, uint16_t offset); 48 /**< @internal Check the status of a Rx descriptor */ 49 50 typedef int (*eth_tx_descriptor_status_t)(void *txq, uint16_t offset); 51 /**< @internal Check the status of a Tx descriptor */ 52 53 /** 54 * @internal 55 * Structure used to hold opaque pointers to internal ethdev Rx/Tx 56 * queues data. 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. 59 */ 60 struct rte_ethdev_qdata { 61 /** points to array of internal queue data pointers */ 62 void **data; 63 /** points to array of queue callback data pointers */ 64 void **clbk; 65 }; 66 67 /** 68 * @internal 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. 73 */ 74 struct rte_eth_fp_ops { 75 76 /**@{*/ 77 /** 78 * Rx fast-path functions and related data. 79 * 64-bit systems: occupies first 64B line 80 */ 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]; 90 /**@}*/ 91 92 /**@{*/ 93 /** 94 * Tx fast-path functions and related data. 95 * 64-bit systems: occupies second 64B line 96 */ 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]; 106 /**@}*/ 107 108 } __rte_cache_aligned; 109 110 extern struct rte_eth_fp_ops rte_eth_fp_ops[RTE_MAX_ETHPORTS]; 111 112 #endif /* _RTE_ETHDEV_CORE_H_ */ 113