1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Gaƫtan Rivet
5 #ifndef _ETH_PRIVATE_H_
6 #define _ETH_PRIVATE_H_
10 #include <rte_malloc.h>
11 #include <rte_os_shim.h>
13 #include "rte_ethdev.h"
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];
21 extern struct eth_dev_shared *eth_dev_shared_data;
24 * The user application callback description.
26 * It contains callback address to be registered by user application,
27 * the pointer to the parameters for callback, and the event type.
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 */
38 extern rte_spinlock_t eth_dev_cb_lock;
41 * Convert rte_eth_dev pointer to port ID.
42 * NULL will be translated to RTE_MAX_ETHPORTS.
44 uint16_t eth_dev_to_id(const struct rte_eth_dev *dev);
46 /* Generic rte_eth_dev comparison function. */
47 typedef int (*rte_eth_cmp_t)(const struct rte_eth_dev *, const void *);
49 /* Generic rte_eth_dev iterator. */
51 eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp,
54 /* Parse devargs value for representor parameter. */
55 int rte_eth_devargs_parse_representor_ports(char *str, void *data);
57 /* reset eth fast-path API to dummy values */
58 void eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo);
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);
65 void eth_dev_shared_data_prepare(void);
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);
72 #endif /* _ETH_PRIVATE_H_ */