From fc30efe3a22e720ca48e3a4178063d2b1bb7329d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 24 Jul 2018 14:08:50 -0700 Subject: [PATCH] net/netvsc: change Rx descriptor setup and sizing Increase the size of the ring used to hold mbuf's received but not processed. The default is now based off the size of the receive mbuf pool not the number of sections from the host. Signed-off-by: Stephen Hemminger --- drivers/net/netvsc/hn_rxtx.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index 400598a621..597a9dd415 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -728,18 +728,12 @@ hn_dev_rx_queue_setup(struct rte_eth_dev *dev, struct rte_mempool *mp) { struct hn_data *hv = dev->data->dev_private; - uint32_t qmax = hv->rxbuf_section_cnt; char ring_name[RTE_RING_NAMESIZE]; struct hn_rx_queue *rxq; unsigned int count; - size_t size; - int err = -ENOMEM; PMD_INIT_FUNC_TRACE(); - if (nb_desc == 0 || nb_desc > qmax) - nb_desc = qmax; - if (queue_idx == 0) { rxq = hv->primary; } else { @@ -749,14 +743,9 @@ hn_dev_rx_queue_setup(struct rte_eth_dev *dev, } rxq->mb_pool = mp; - - count = rte_align32pow2(nb_desc); - size = sizeof(struct rte_ring) + count * sizeof(void *); - rxq->rx_ring = rte_malloc_socket("RX_RING", size, - RTE_CACHE_LINE_SIZE, - socket_id); - if (!rxq->rx_ring) - goto fail; + count = rte_mempool_avail_count(mp) / dev->data->nb_rx_queues; + if (nb_desc == 0 || nb_desc > count) + nb_desc = count; /* * Staging ring from receive event logic to rx_pkts. @@ -765,9 +754,10 @@ hn_dev_rx_queue_setup(struct rte_eth_dev *dev, */ snprintf(ring_name, sizeof(ring_name), "hn_rx_%u_%u", dev->data->port_id, queue_idx); - err = rte_ring_init(rxq->rx_ring, ring_name, - count, 0); - if (err) + rxq->rx_ring = rte_ring_create(ring_name, + rte_align32pow2(nb_desc), + socket_id, 0); + if (!rxq->rx_ring) goto fail; dev->data->rx_queues[queue_idx] = rxq; -- 2.20.1