From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 114FCA0547 for ; Tue, 9 Feb 2021 11:35:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EAED940147; Tue, 9 Feb 2021 11:35:33 +0100 (CET) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mails.dpdk.org (Postfix) with ESMTP id 4F7B940147 for ; Tue, 9 Feb 2021 11:35:33 +0100 (CET) Received: by mail-wr1-f49.google.com with SMTP id q7so20925378wre.13 for ; Tue, 09 Feb 2021 02:35:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s0oR+tPYCcKQGP9W0RGdOq71Bn7d7vPixpxvKYX8r/8=; b=LzOaZCQy2i3hs3n9Nmz5QtUbLQiXb1VfvFchPuJCpX4q7xTSLyVnC+ku052+HSnh1F zZCDkXLxety+jabOXiIuNXVS1SDGbwB2FwaIm5U2pTZ4R/rwAaoRQBgsQPv8iCk5PaI5 RBm7CrZp7dg2yvD6YCAHLgdNZJSL3Bnwz9wLcGYAAxYUmgZKhX37z74iRx8PL4KLyAlC k3Hajjyr1VlzJBTPGaJ6OgPxVvLyx8waCzJa2ipk2VCIcjXRm2dpOXToowVdIya1DPsL x0UkH5cKgqQUMUDSJWC1gdFEaHy6T7i2dfBb5fVZEFa2E5Z613fdQF4yPwviM3/2qEoy 0cQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s0oR+tPYCcKQGP9W0RGdOq71Bn7d7vPixpxvKYX8r/8=; b=pRtyNqMojHyRhfpxNlD4D6/8/D80S7wf3Ctls47c5xRzxp4+AemAvwjxu6zg1R5fJh bNOX+YXf68peOCeRjymEZpzNPhzjEX5fVlyBblwFK7MSqGSgfYiH1XYCpjVIw2OBdd8e uJ62vu0p7CaPiSrhxAaT+t7SvcPpuWIrbEYnZZYGevNL8yldebrQ2GhS7geUkEKpW4Qc Sp4bVQhQBjaZu/WtsIg4uCNWuGCNRxyMSin1inbZBF77QSBPhR5R6f2WSvx594hLIod/ wsEEtqTDTw+VbC+VogxV76/lsd+RUq1N+S13W2Aq/tHU8gsl9T635pURUniUyH/QVdHU +sYw== X-Gm-Message-State: AOAM533RNazwQTDYIR+Rsjb+9rEPIMHB7SsXWWdBu47qKGHsm8qUOh4S 1Sngomu0OVKAXZp2F8BwQvY= X-Google-Smtp-Source: ABdhPJwp4DtHdLAJtG+6Cfmdhr7IbapTk49FLH01HBt0ZYOS4JbKDurONjbI1cg4QcYX8PRbAtgRtw== X-Received: by 2002:a5d:53c3:: with SMTP id a3mr24187388wrw.43.1612866933052; Tue, 09 Feb 2021 02:35:33 -0800 (PST) Received: from localhost ([2a01:4b00:f419:6f00:7a8e:ed70:5c52:ea3]) by smtp.gmail.com with ESMTPSA id h14sm3836161wmq.45.2021.02.09.02.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 02:35:32 -0800 (PST) From: luca.boccassi@gmail.com To: Lance Richardson Cc: Ajit Khaparde , dpdk stable Date: Tue, 9 Feb 2021 10:34:59 +0000 Message-Id: <20210209103529.466775-1-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210205111920.1272063-1-luca.boccassi@gmail.com> References: <20210205111920.1272063-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix Rx completion ring size calculation' has been queued to stable release 20.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/11/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/42f7f70176ac78335f522fcdd7b15e613bfbddd9 Thanks. Luca Boccassi --- >From 42f7f70176ac78335f522fcdd7b15e613bfbddd9 Mon Sep 17 00:00:00 2001 From: Lance Richardson Date: Fri, 29 Jan 2021 13:07:09 -0500 Subject: [PATCH] net/bnxt: fix Rx completion ring size calculation [ upstream commit 8e18a019c1fc942321e5fe4529edfc793a4f0d2a ] The size of the receive completion ring should be recalculated when MTU is increased to a size that requires scattered receive or when LRO is enabled. Move logic for this calculation from the ring configuration path to the device start path. - Made size calculation dependent only on scattered_rx status. - Moved calculation of scattered_rx up in the initialization sequence. - Made LRO offload status part of scattered_rx calculation. When the completion ring size is too small, completion overflows can occur causing the ring to be disabled in hardware. Fixes: 04067844a3e9 ("net/bnxt: reduce CQ queue size without aggregation ring") Signed-off-by: Lance Richardson Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++---- drivers/net/bnxt/bnxt_ring.c | 22 ++++++++++++++++++++++ drivers/net/bnxt/bnxt_rxr.c | 15 +-------------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index a4a31f224f..3aa346d45c 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1147,6 +1147,9 @@ static int bnxt_scattered_rx(struct rte_eth_dev *eth_dev) if (eth_dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) return 1; + if (eth_dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TCP_LRO) + return 1; + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { struct bnxt_rx_queue *rxq = eth_dev->data->rx_queues[i]; @@ -1395,11 +1398,12 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) bnxt_enable_int(bp); - rc = bnxt_start_nic(bp); - if (rc) - goto error; - eth_dev->data->scattered_rx = bnxt_scattered_rx(eth_dev); + + rc = bnxt_start_nic(bp); + if (rc) + goto error; + eth_dev->data->dev_started = 1; bnxt_link_update_op(eth_dev, 1); diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index aeb6cb6150..94cf7d3de2 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -568,6 +568,17 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index) struct bnxt_rx_ring_info *rxr = rxq->rx_ring; int rc; + /* + * Storage for the cp ring is allocated based on worst-case + * usage, the actual size to be used by hw is computed here. + */ + cp_ring->ring_size = rxr->rx_ring_struct->ring_size * 2; + + if (bp->eth_dev->data->scattered_rx) + cp_ring->ring_size *= AGG_RING_SIZE_FACTOR; + + cp_ring->ring_mask = cp_ring->ring_size - 1; + rc = bnxt_alloc_cmpl_ring(bp, queue_index, cpr); if (rc) goto err_out; @@ -679,6 +690,17 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) struct bnxt_ring *cp_ring = cpr->cp_ring_struct; struct bnxt_rx_ring_info *rxr = rxq->rx_ring; + /* + * Storage for the cp ring is allocated based on worst-case + * usage, the actual size to be used by hw is computed here. + */ + cp_ring->ring_size = rxr->rx_ring_struct->ring_size * 2; + + if (bp->eth_dev->data->scattered_rx) + cp_ring->ring_size *= AGG_RING_SIZE_FACTOR; + + cp_ring->ring_mask = cp_ring->ring_size - 1; + if (bnxt_alloc_cmpl_ring(bp, i, cpr)) goto err_out; diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index ddb1021251..b28b7fb561 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -1040,12 +1040,9 @@ void bnxt_free_rx_rings(struct bnxt *bp) int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) { - struct rte_eth_dev *eth_dev = rxq->bp->eth_dev; - struct rte_eth_rxmode *rxmode; struct bnxt_cp_ring_info *cpr; struct bnxt_rx_ring_info *rxr; struct bnxt_ring *ring; - bool use_agg_ring; rxq->rx_buf_size = BNXT_MAX_PKT_LEN + sizeof(struct rte_mbuf); @@ -1088,19 +1085,9 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) return -ENOMEM; cpr->cp_ring_struct = ring; - rxmode = ð_dev->data->dev_conf.rxmode; - use_agg_ring = (rxmode->offloads & DEV_RX_OFFLOAD_SCATTER) || - (rxmode->offloads & DEV_RX_OFFLOAD_TCP_LRO) || - (rxmode->max_rx_pkt_len > - (uint32_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) - - RTE_PKTMBUF_HEADROOM)); - /* Allocate two completion slots per entry in desc ring. */ ring->ring_size = rxr->rx_ring_struct->ring_size * 2; - - /* Allocate additional slots if aggregation ring is in use. */ - if (use_agg_ring) - ring->ring_size *= AGG_RING_SIZE_FACTOR; + ring->ring_size *= AGG_RING_SIZE_FACTOR; ring->ring_size = rte_align32pow2(ring->ring_size); ring->ring_mask = ring->ring_size - 1; -- 2.29.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-09 10:34:57.978611773 +0000 +++ 0001-net-bnxt-fix-Rx-completion-ring-size-calculation.patch 2021-02-09 10:34:57.818582221 +0000 @@ -1 +1 @@ -From 8e18a019c1fc942321e5fe4529edfc793a4f0d2a Mon Sep 17 00:00:00 2001 +From 42f7f70176ac78335f522fcdd7b15e613bfbddd9 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8e18a019c1fc942321e5fe4529edfc793a4f0d2a ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org @@ -31 +32 @@ -index 4b76cd5591..22c880c5c3 100644 +index a4a31f224f..3aa346d45c 100644 @@ -34 +35 @@ -@@ -1143,6 +1143,9 @@ static int bnxt_scattered_rx(struct rte_eth_dev *eth_dev) +@@ -1147,6 +1147,9 @@ static int bnxt_scattered_rx(struct rte_eth_dev *eth_dev) @@ -44 +45 @@ -@@ -1418,11 +1421,12 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) +@@ -1395,11 +1398,12 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) @@ -62 +63 @@ -index 4e513244a6..ba23c1fa03 100644 +index aeb6cb6150..94cf7d3de2 100644 @@ -65 +66 @@ -@@ -583,6 +583,17 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index) +@@ -568,6 +568,17 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index) @@ -83 +84 @@ -@@ -693,6 +704,17 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) +@@ -679,6 +690,17 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) @@ -102 +103 @@ -index 8c2781c968..4674f7cea2 100644 +index ddb1021251..b28b7fb561 100644 @@ -105 +106 @@ -@@ -1116,12 +1116,9 @@ void bnxt_free_rx_rings(struct bnxt *bp) +@@ -1040,12 +1040,9 @@ void bnxt_free_rx_rings(struct bnxt *bp) @@ -118 +119 @@ -@@ -1164,19 +1161,9 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id) +@@ -1088,19 +1085,9 @@ int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id)