From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH 1/4] netvsc: change rx descriptor setup and sizing Date: Tue, 24 Jul 2018 14:08:50 -0700 Message-ID: <20180724210853.22767-2-stephen@networkplumber.org> References: <20180724210853.22767-1-stephen@networkplumber.org> Cc: Stephen Hemminger , Stephen Hemminger To: dev@dpdk.org Return-path: Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) by dpdk.org (Postfix) with ESMTP id E9B9398 for ; Tue, 24 Jul 2018 23:09:03 +0200 (CEST) Received: by mail-pl0-f66.google.com with SMTP id w3-v6so2296505plq.2 for ; Tue, 24 Jul 2018 14:09:03 -0700 (PDT) In-Reply-To: <20180724210853.22767-1-stephen@networkplumber.org> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Increase the size of the ring used to hold mbuf's received but not processed. The default is now based off the size of thw 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 6d2f41c4c011..9a2dd9cb1beb 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.18.0