DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
	Chaoyong He <chaoyong.he@corigine.com>
Subject: [PATCH 3/3] net/nfp: fix wrong increment of free list counter for VNIC
Date: Fri, 18 Nov 2022 09:44:08 +0800	[thread overview]
Message-ID: <20221118014408.19565-4-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20221118014408.19565-1-chaoyong.he@corigine.com>

When using flower firmware application, and the ctrl vNIC receiving a
packet that is larger than the mbuf size, the Rx function will break the
receive loop and sent a free list descriptor with random DMA address.

Fix this by moving the increment of the free list descriptor counter
to after the packet size have been checked and acted on.

Fixes: a36634e87e16 ("net/nfp: add flower ctrl VNIC Rx/Tx")

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_ctrl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index 953ab6e98c..3631e764fe 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -74,8 +74,6 @@ nfp_flower_ctrl_vnic_recv(void *rx_queue,
 			break;
 		}
 
-		nb_hold++;
-
 		/*
 		 * Grab the mbuf and refill the descriptor with the
 		 * previously allocated mbuf
@@ -127,6 +125,7 @@ nfp_flower_ctrl_vnic_recv(void *rx_queue,
 		rxds->fld.dd = 0;
 		rxds->fld.dma_addr_hi = (dma_addr >> 32) & 0xff;
 		rxds->fld.dma_addr_lo = dma_addr & 0xffffffff;
+		nb_hold++;
 
 		rxq->rd_p++;
 		if (unlikely(rxq->rd_p == rxq->rx_count)) /* wrapping?*/
-- 
2.29.3


      parent reply	other threads:[~2022-11-18  1:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18  1:44 [PATCH 0/3] fix wrong increment of free list counter Chaoyong He
2022-11-18  1:44 ` [PATCH 1/3] net/nfp: " Chaoyong He
2022-11-18 14:04   ` Ferruh Yigit
2022-11-18  1:44 ` [PATCH 2/3] net/nfp: fix wrong increment of free list counter for PF Chaoyong He
2022-11-18  1:44 ` Chaoyong He [this message]

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=20221118014408.19565-4-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.com \
    /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).