summaryrefslogtreecommitdiff
path: root/examples/l2fwd-cat
diff options
context:
space:
mode:
authorRoman Zhukov <roman.zhukov@oktetlabs.ru>2017-05-25 16:57:54 +0100
committerThomas Monjalon <thomas@monjalon.net>2017-07-08 18:47:00 +0200
commit60efb44f73c9a5f3f19cc78ba2d6eaf398ab51dc (patch)
treeb1275fa51805e3666be7c86376722f6bfd7fb877 /examples/l2fwd-cat
parent0f67fc3baeb99e087ac32c6b9116d5fe44e50de6 (diff)
downloaddpdk-60efb44f73c9a5f3f19cc78ba2d6eaf398ab51dc.zip
dpdk-60efb44f73c9a5f3f19cc78ba2d6eaf398ab51dc.tar.gz
dpdk-60efb44f73c9a5f3f19cc78ba2d6eaf398ab51dc.tar.xz
examples: adjust Rx and Tx descriptors to device limits
Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Diffstat (limited to 'examples/l2fwd-cat')
-rw-r--r--examples/l2fwd-cat/l2fwd-cat.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index 8cce33b..c293bd9 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -65,6 +65,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
const uint16_t rx_rings = 1, tx_rings = 1;
int retval;
uint16_t q;
+ uint16_t nb_rxd = RX_RING_SIZE;
+ uint16_t nb_txd = TX_RING_SIZE;
if (port >= rte_eth_dev_count())
return -1;
@@ -74,9 +76,13 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ return retval;
+
/* Allocate and set up 1 RX queue per Ethernet port. */
for (q = 0; q < rx_rings; q++) {
- retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
+ retval = rte_eth_rx_queue_setup(port, q, nb_rxd,
rte_eth_dev_socket_id(port), NULL, mbuf_pool);
if (retval < 0)
return retval;
@@ -84,7 +90,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
/* Allocate and set up 1 TX queue per Ethernet port. */
for (q = 0; q < tx_rings; q++) {
- retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE,
+ retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port), NULL);
if (retval < 0)
return retval;