xref: /dpdk/lib/node/rte_node_eth_api.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2020 Marvell International Ltd.
3  */
4 
5 #ifndef __INCLUDE_RTE_NODE_ETH_API_H__
6 #define __INCLUDE_RTE_NODE_ETH_API_H__
7 
8 /**
9  * @file rte_node_eth_api.h
10  *
11  * @warning
12  * @b EXPERIMENTAL:
13  * All functions in this file may be changed or removed without prior notice.
14  *
15  * This API allows to setup ethdev_rx and ethdev_tx nodes
16  * and its queue associations.
17  */
18 
19 #include <rte_compat.h>
20 #include <rte_common.h>
21 #include <rte_graph.h>
22 #include <rte_mempool.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /**
29  * Port config for ethdev_rx and ethdev_tx node.
30  */
31 struct rte_node_ethdev_config {
32 	uint16_t port_id;
33 	/**< Port identifier */
34 	uint16_t num_rx_queues;
35 	/**< Number of Rx queues. */
36 	uint16_t num_tx_queues;
37 	/**< Number of Tx queues. */
38 	struct rte_mempool **mp;
39 	/**< Array of mempools associated to Rx queue. */
40 	uint16_t mp_count;
41 	/**< Size of mp array. */
42 };
43 
44 /**
45  * Initializes ethdev nodes.
46  *
47  * @param cfg
48  *   Array of ethdev config that identifies which port's
49  *   ethdev_rx and ethdev_tx nodes need to be created
50  *   and queue association.
51  * @param cnt
52  *   Size of cfg array.
53  * @param nb_graphs
54  *   Number of graphs that will be used.
55  *
56  * @return
57  *   0 on successful initialization, negative otherwise.
58  */
59 int rte_node_eth_config(struct rte_node_ethdev_config *cfg,
60 			uint16_t cnt, uint16_t nb_graphs);
61 
62 /**
63  * Update ethdev rx next node.
64  *
65  * @param id
66  *   Node id whose edge is to be updated.
67  * @param edge_name
68  *   Name of the next node.
69  *
70  * @return
71  *   - EINVAL: Either of input parameters are invalid
72  *   - ENOMEM: If memory allocation failed
73  *   - 0 on successful initialization.
74  */
75 __rte_experimental
76 int rte_node_ethdev_rx_next_update(rte_node_t id, const char *edge_name);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* __INCLUDE_RTE_NODE_ETH_API_H__ */
83