]> git.droids-corp.org - dpdk.git/commitdiff
net/netvsc: change Rx descriptor setup and sizing
authorStephen Hemminger <sthemmin@microsoft.com>
Tue, 24 Jul 2018 21:08:50 +0000 (14:08 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Sun, 5 Aug 2018 09:02:15 +0000 (11:02 +0200)
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 <sthemmin@microsoft.com>
drivers/net/netvsc/hn_rxtx.c

index 400598a621f18beca52e0f127ad6ff335f482bc1..597a9dd415a900ca4bc9f69b5220b5953aaac8b2 100644 (file)
@@ -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;