xref: /dpdk/lib/node/rte_node_eth_api.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(C) 2020 Marvell International Ltd.
399a2dd95SBruce Richardson  */
499a2dd95SBruce Richardson 
599a2dd95SBruce Richardson #ifndef __INCLUDE_RTE_NODE_ETH_API_H__
699a2dd95SBruce Richardson #define __INCLUDE_RTE_NODE_ETH_API_H__
799a2dd95SBruce Richardson 
899a2dd95SBruce Richardson /**
999a2dd95SBruce Richardson  * @file rte_node_eth_api.h
1099a2dd95SBruce Richardson  *
1199a2dd95SBruce Richardson  * @warning
1299a2dd95SBruce Richardson  * @b EXPERIMENTAL:
1399a2dd95SBruce Richardson  * All functions in this file may be changed or removed without prior notice.
1499a2dd95SBruce Richardson  *
1599a2dd95SBruce Richardson  * This API allows to setup ethdev_rx and ethdev_tx nodes
1699a2dd95SBruce Richardson  * and its queue associations.
1799a2dd95SBruce Richardson  */
1899a2dd95SBruce Richardson 
191094dd94SDavid Marchand #include <rte_compat.h>
2099a2dd95SBruce Richardson #include <rte_common.h>
2177b88bf5SRakesh Kudurumalla #include <rte_graph.h>
2299a2dd95SBruce Richardson #include <rte_mempool.h>
2399a2dd95SBruce Richardson 
24*719834a6SMattias Rönnblom #ifdef __cplusplus
25*719834a6SMattias Rönnblom extern "C" {
26*719834a6SMattias Rönnblom #endif
27*719834a6SMattias Rönnblom 
2899a2dd95SBruce Richardson /**
2999a2dd95SBruce Richardson  * Port config for ethdev_rx and ethdev_tx node.
3099a2dd95SBruce Richardson  */
3199a2dd95SBruce Richardson struct rte_node_ethdev_config {
3299a2dd95SBruce Richardson 	uint16_t port_id;
3399a2dd95SBruce Richardson 	/**< Port identifier */
3499a2dd95SBruce Richardson 	uint16_t num_rx_queues;
3599a2dd95SBruce Richardson 	/**< Number of Rx queues. */
3699a2dd95SBruce Richardson 	uint16_t num_tx_queues;
3799a2dd95SBruce Richardson 	/**< Number of Tx queues. */
3899a2dd95SBruce Richardson 	struct rte_mempool **mp;
3999a2dd95SBruce Richardson 	/**< Array of mempools associated to Rx queue. */
4099a2dd95SBruce Richardson 	uint16_t mp_count;
4199a2dd95SBruce Richardson 	/**< Size of mp array. */
4299a2dd95SBruce Richardson };
4399a2dd95SBruce Richardson 
4499a2dd95SBruce Richardson /**
4599a2dd95SBruce Richardson  * Initializes ethdev nodes.
4699a2dd95SBruce Richardson  *
4799a2dd95SBruce Richardson  * @param cfg
4899a2dd95SBruce Richardson  *   Array of ethdev config that identifies which port's
4999a2dd95SBruce Richardson  *   ethdev_rx and ethdev_tx nodes need to be created
5099a2dd95SBruce Richardson  *   and queue association.
5199a2dd95SBruce Richardson  * @param cnt
5299a2dd95SBruce Richardson  *   Size of cfg array.
5399a2dd95SBruce Richardson  * @param nb_graphs
5499a2dd95SBruce Richardson  *   Number of graphs that will be used.
5599a2dd95SBruce Richardson  *
5699a2dd95SBruce Richardson  * @return
5799a2dd95SBruce Richardson  *   0 on successful initialization, negative otherwise.
5899a2dd95SBruce Richardson  */
5999a2dd95SBruce Richardson int rte_node_eth_config(struct rte_node_ethdev_config *cfg,
6099a2dd95SBruce Richardson 			uint16_t cnt, uint16_t nb_graphs);
6177b88bf5SRakesh Kudurumalla 
6277b88bf5SRakesh Kudurumalla /**
6377b88bf5SRakesh Kudurumalla  * Update ethdev rx next node.
6477b88bf5SRakesh Kudurumalla  *
6577b88bf5SRakesh Kudurumalla  * @param id
6677b88bf5SRakesh Kudurumalla  *   Node id whose edge is to be updated.
6777b88bf5SRakesh Kudurumalla  * @param edge_name
6877b88bf5SRakesh Kudurumalla  *   Name of the next node.
6977b88bf5SRakesh Kudurumalla  *
7077b88bf5SRakesh Kudurumalla  * @return
7177b88bf5SRakesh Kudurumalla  *   - EINVAL: Either of input parameters are invalid
7277b88bf5SRakesh Kudurumalla  *   - ENOMEM: If memory allocation failed
7377b88bf5SRakesh Kudurumalla  *   - 0 on successful initialization.
7477b88bf5SRakesh Kudurumalla  */
7577b88bf5SRakesh Kudurumalla __rte_experimental
7677b88bf5SRakesh Kudurumalla int rte_node_ethdev_rx_next_update(rte_node_t id, const char *edge_name);
7777b88bf5SRakesh Kudurumalla 
7899a2dd95SBruce Richardson #ifdef __cplusplus
7999a2dd95SBruce Richardson }
8099a2dd95SBruce Richardson #endif
8199a2dd95SBruce Richardson 
8299a2dd95SBruce Richardson #endif /* __INCLUDE_RTE_NODE_ETH_API_H__ */
83