From: Xiao Wang <xiao.w.wang@intel.com>
To: xiaolong.ye@intel.com
Cc: dev@dpdk.org, qi.z.zhang@intel.com,
Xiao Wang <xiao.w.wang@intel.com>,
stable@dpdk.org, Anna Lukin <annal@silicom.co.il>
Subject: [dpdk-stable] [PATCH] net/fm10k: fix mbuf free in vector Rx
Date: Fri, 25 Oct 2019 20:33:22 -0400 [thread overview]
Message-ID: <20191026003322.131809-1-xiao.w.wang@intel.com> (raw)
There's a corner case that all the Rx queue mbufs are allocated but none
of them is used, this patch fixes mbuf free for this case.
Fixes: b6719f8a04bb ("fm10k: release mbuf for vector Rx")
Cc: stable@dpdk.org
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Anna Lukin <annal@silicom.co.il>
---
drivers/net/fm10k/fm10k_rxtx_vec.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 45542bef3..d76dfd16f 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -359,8 +359,15 @@ fm10k_rx_queue_release_mbufs_vec(struct fm10k_rx_queue *rxq)
return;
/* free all mbufs that are valid in the ring */
- for (i = rxq->next_dd; i != rxq->rxrearm_start; i = (i + 1) & mask)
- rte_pktmbuf_free_seg(rxq->sw_ring[i]);
+ if (rxq->rxrearm_nb == 0) {
+ for (i = 0; i < rxq->nb_desc; i++)
+ if (rxq->sw_ring[i] != NULL)
+ rte_pktmbuf_free_seg(rxq->sw_ring[i]);
+ } else {
+ for (i = rxq->next_dd; i != rxq->rxrearm_start;
+ i = (i + 1) & mask)
+ rte_pktmbuf_free_seg(rxq->sw_ring[i]);
+ }
rxq->rxrearm_nb = rxq->nb_desc;
/* set all entries to NULL */
--
2.15.1
next reply other threads:[~2019-10-25 12:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-26 0:33 Xiao Wang [this message]
2019-10-28 5:39 ` Ye Xiaolong
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=20191026003322.131809-1-xiao.w.wang@intel.com \
--to=xiao.w.wang@intel.com \
--cc=annal@silicom.co.il \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=stable@dpdk.org \
--cc=xiaolong.ye@intel.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).