New upstream version 18.02
[deb_dpdk.git] / drivers / net / ring / rte_eth_ring.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifndef _RTE_ETH_RING_H_
6 #define _RTE_ETH_RING_H_
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 #include <rte_ring.h>
13
14 /**
15  * Create a new ethdev port from a set of rings
16  *
17  * @param name
18  *    name to be given to the new ethdev port
19  * @param rx_queues
20  *    pointer to array of rte_rings to be used as RX queues
21  * @param nb_rx_queues
22  *    number of elements in the rx_queues array
23  * @param tx_queues
24  *    pointer to array of rte_rings to be used as TX queues
25  * @param nb_tx_queues
26  *    number of elements in the tx_queues array
27  * @param numa_node
28  *    the numa node on which the memory for this port is to be allocated
29  * @return
30  *    the port number of the newly created the ethdev or -1 on error.
31  */
32 int rte_eth_from_rings(const char *name,
33                 struct rte_ring * const rx_queues[],
34                 const unsigned nb_rx_queues,
35                 struct rte_ring *const tx_queues[],
36                 const unsigned nb_tx_queues,
37                 const unsigned numa_node);
38
39 /**
40  * Create a new ethdev port from a ring
41  *
42  * This function is a shortcut call for rte_eth_from_rings for the
43  * case where one wants to take a single rte_ring and use it as though
44  * it were an ethdev
45  *
46  * @param ring
47  *    the ring to be used as an ethdev
48  * @return
49  *    the port number of the newly created ethdev, or -1 on error
50  */
51 int rte_eth_from_ring(struct rte_ring *r);
52
53 #ifdef __cplusplus
54 }
55 #endif
56
57 #endif