patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/fm10k: fix mbuf free in vector Rx
@ 2019-10-26  0:33 Xiao Wang
  2019-10-28  5:39 ` Ye Xiaolong
  0 siblings, 1 reply; 2+ messages in thread
From: Xiao Wang @ 2019-10-26  0:33 UTC (permalink / raw)
  To: xiaolong.ye; +Cc: dev, qi.z.zhang, Xiao Wang, stable, Anna Lukin

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [PATCH] net/fm10k: fix mbuf free in vector Rx
  2019-10-26  0:33 [dpdk-stable] [PATCH] net/fm10k: fix mbuf free in vector Rx Xiao Wang
@ 2019-10-28  5:39 ` Ye Xiaolong
  0 siblings, 0 replies; 2+ messages in thread
From: Ye Xiaolong @ 2019-10-28  5:39 UTC (permalink / raw)
  To: Xiao Wang; +Cc: dev, qi.z.zhang, stable, Anna Lukin

On 10/25, Xiao Wang wrote:
>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
>

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel. Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-28  5:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-26  0:33 [dpdk-stable] [PATCH] net/fm10k: fix mbuf free in vector Rx Xiao Wang
2019-10-28  5:39 ` Ye Xiaolong

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git