1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 Gaëtan Rivet 3 */ 4 5 #ifndef _ETH_PRIVATE_H_ 6 #define _ETH_PRIVATE_H_ 7 8 #include <sys/queue.h> 9 10 #include <rte_malloc.h> 11 #include <rte_os_shim.h> 12 13 #include "rte_ethdev.h" 14 15 struct eth_dev_shared { 16 uint64_t next_owner_id; 17 rte_spinlock_t ownership_lock; 18 struct rte_eth_dev_data data[RTE_MAX_ETHPORTS]; 19 }; 20 21 extern struct eth_dev_shared *eth_dev_shared_data; 22 23 /** 24 * The user application callback description. 25 * 26 * It contains callback address to be registered by user application, 27 * the pointer to the parameters for callback, and the event type. 28 */ 29 struct rte_eth_dev_callback { 30 TAILQ_ENTRY(rte_eth_dev_callback) next; /**< Callbacks list */ 31 rte_eth_dev_cb_fn cb_fn; /**< Callback address */ 32 void *cb_arg; /**< Parameter for callback */ 33 void *ret_param; /**< Return parameter */ 34 enum rte_eth_event_type event; /**< Interrupt event type */ 35 uint32_t active; /**< Callback is executing */ 36 }; 37 38 extern rte_spinlock_t eth_dev_cb_lock; 39 40 /* 41 * Convert rte_eth_dev pointer to port ID. 42 * NULL will be translated to RTE_MAX_ETHPORTS. 43 */ 44 uint16_t eth_dev_to_id(const struct rte_eth_dev *dev); 45 46 /* Generic rte_eth_dev comparison function. */ 47 typedef int (*rte_eth_cmp_t)(const struct rte_eth_dev *, const void *); 48 49 /* Generic rte_eth_dev iterator. */ 50 struct rte_eth_dev * 51 eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, 52 const void *data); 53 54 /* Parse devargs value for representor parameter. */ 55 int rte_eth_devargs_parse_representor_ports(char *str, void *data); 56 57 /* reset eth fast-path API to dummy values */ 58 void eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo); 59 60 /* setup eth fast-path API to ethdev values */ 61 void eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo, 62 const struct rte_eth_dev *dev); 63 64 65 void eth_dev_shared_data_prepare(void); 66 67 void eth_dev_rxq_release(struct rte_eth_dev *dev, uint16_t qid); 68 void eth_dev_txq_release(struct rte_eth_dev *dev, uint16_t qid); 69 int eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues); 70 int eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues); 71 72 #endif /* _ETH_PRIVATE_H_ */ 73