diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 6832f01e24..ada025ffeb 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -346,7 +346,7 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], eth_dev->rx_pkt_burst = eth_ring_rx; eth_dev->tx_pkt_burst = eth_ring_tx; - return 0; + return data->port_id; error: rte_free(data); @@ -384,7 +384,7 @@ eth_dev_ring_create(const char *name, const unsigned numa_node, return -1; } - if (rte_eth_from_rings(name, rxtx, num_rings, rxtx, num_rings, numa_node)) + if (rte_eth_from_rings(name, rxtx, num_rings, rxtx, num_rings, numa_node) < 0) return -1; return 0; @@ -424,8 +424,9 @@ eth_dev_ring_pair_create(const char *name, const unsigned numa_node, } if (rte_eth_from_rings(rx_rng_name, rx, num_rings, tx, num_rings, - numa_node) || rte_eth_from_rings(tx_rng_name, tx, num_rings, rx, - num_rings, numa_node)) + numa_node) < 0 || + rte_eth_from_rings(tx_rng_name, tx, num_rings, rx, + num_rings, numa_node) < 0) return -1; return 0; diff --git a/drivers/net/ring/rte_eth_ring.h b/drivers/net/ring/rte_eth_ring.h index d36489abc7..2262249707 100644 --- a/drivers/net/ring/rte_eth_ring.h +++ b/drivers/net/ring/rte_eth_ring.h @@ -40,6 +40,24 @@ extern "C" { #include +/** + * Create a new ethdev port from a set of rings + * + * @param name + * name to be given to the new ethdev port + * @param rx_queues + * pointer to array of rte_rings to be used as RX queues + * @param nb_rx_queues + * number of elements in the rx_queues array + * @param tx_queues + * pointer to array of rte_rings to be used as TX queues + * @param nb_tx_queues + * number of elements in the tx_queues array + * @param numa_node + * the numa node on which the memory for this port is to be allocated + * @return + * the port number of the newly created the ethdev or -1 on error. + */ int rte_eth_from_rings(const char *name, struct rte_ring * const rx_queues[], const unsigned nb_rx_queues,