DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
	Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>,
	stable@dpdk.org, Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [dpdk-dev] [PATCH v2 7/7] net/bnxt: fix buffer allocation reattempt logic
Date: Thu,  6 Feb 2020 10:44:32 -0800	[thread overview]
Message-ID: <20200206184432.34360-8-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20200206184432.34360-1-ajit.khaparde@broadcom.com>

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

In case of a buffer allocation failure, we reattempt buffer allocation
before the rx handler exits. We were not attempting this when producer
index is greater than the number of buffers to allocate. Fixed it with
correct checks.

Fixes: d9dd0b29ed31 ("net/bnxt: fix Rx handling and buffer allocation logic")
Cc: stable@dpdk.org

Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxr.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index 1f47db97b..bef9720f5 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -678,10 +678,11 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 
 	/* Attempt to alloc Rx buf in case of a previous allocation failure. */
 	if (rc == -ENOMEM) {
-		int i;
+		int i = RING_NEXT(rxr->rx_ring_struct, prod);
+		int cnt = nb_rx_pkts;
 
-		for (i = prod; i <= nb_rx_pkts;
-			i = RING_NEXT(rxr->rx_ring_struct, i)) {
+		for (; cnt;
+			i = RING_NEXT(rxr->rx_ring_struct, i), cnt--) {
 			struct bnxt_sw_rx_bd *rx_buf = &rxr->rx_buf_ring[i];
 
 			/* Buffer already allocated for this index. */
-- 
2.21.1 (Apple Git-122.3)


  parent reply	other threads:[~2020-02-06 18:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 16:33 [dpdk-dev] [PATCH 0/7] bnxt patchset with bug fixes Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 1/7] net/bnxt: avoid an unnecessary delay in port stop Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 2/7] net/bnxt: fix default timeout for ver_get command Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 3/7] net/bnxt: log firmware debug notifications Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 4/7] net/bnxt: register for debug notification async event from fw Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 5/7] net/bnxt: fix to call port stop when error recovery fails Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 6/7] net/bnxt: move locally used functions to static Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 7/7] net/bnxt: fix buffer allocation reattempt logic Kalesh A P
2020-02-06 18:44 ` [dpdk-dev] [PATCH v2 0/7] bnxt patchset with bug fixes Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 1/7] net/bnxt: fix unnecessary delay in port stop Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 2/7] net/bnxt: fix default timeout for command to get FW version Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 3/7] net/bnxt: log firmware debug notifications Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 4/7] net/bnxt: register for debug notification event from FW Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 5/7] net/bnxt: fix to call port stop when error recovery fails Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 6/7] net/bnxt: move locally used functions to static Ajit Khaparde
2020-02-06 18:44   ` Ajit Khaparde [this message]
2020-02-06 18:50   ` [dpdk-dev] [PATCH v2 0/7] bnxt patchset with bug fixes Ajit Khaparde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200206184432.34360-8-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=santosh.rastapur@broadcom.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).