* [PATCH 0/2] fix problem in Rx
@ 2023-12-11 5:45 Chaoyong He
2023-12-11 5:45 ` [PATCH 1/2] net/nfp: fix receive function memory leak Chaoyong He
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chaoyong He @ 2023-12-11 5:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He
Fix two problems in the receive function.
Long Wu (2):
net/nfp: fix receive function memory leak
net/nfp: fix invalid Rx descriptor data
drivers/net/nfp/flower/nfp_flower.c | 4 +++-
drivers/net/nfp/nfp_rxtx.c | 18 +++++++++---------
2 files changed, 12 insertions(+), 10 deletions(-)
--
2.39.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] net/nfp: fix receive function memory leak
2023-12-11 5:45 [PATCH 0/2] fix problem in Rx Chaoyong He
@ 2023-12-11 5:45 ` Chaoyong He
2023-12-11 5:45 ` [PATCH 2/2] net/nfp: fix invalid Rx descriptor data Chaoyong He
2023-12-13 10:40 ` [PATCH 0/2] fix problem in Rx Ferruh Yigit
2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2023-12-11 5:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Long Wu, chaoyong.he, stable, Peng Zhang
From: Long Wu <long.wu@corigine.com>
If the Rx ring is full and do not care its return value, this will
cause memory leak.
Fixes: 766d51c9ce29 ("net/nfp: merge receive function")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/flower/nfp_flower.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index f950ae233b..94b50611f0 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -133,7 +133,9 @@ nfp_flower_pf_dispatch_pkts(struct nfp_net_hw *hw,
return false;
}
- rte_ring_enqueue(repr->ring, (void *)mbuf);
+ if (rte_ring_enqueue(repr->ring, (void *)mbuf) != 0)
+ return false;
+
return true;
}
--
2.39.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] net/nfp: fix invalid Rx descriptor data
2023-12-11 5:45 [PATCH 0/2] fix problem in Rx Chaoyong He
2023-12-11 5:45 ` [PATCH 1/2] net/nfp: fix receive function memory leak Chaoyong He
@ 2023-12-11 5:45 ` Chaoyong He
2023-12-13 10:40 ` [PATCH 0/2] fix problem in Rx Ferruh Yigit
2 siblings, 0 replies; 4+ messages in thread
From: Chaoyong He @ 2023-12-11 5:45 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Long Wu, chaoyong.he, stable, Peng Zhang
From: Long Wu <long.wu@corigine.com>
If the Rx loop is broken and PMD does not update the descriptor, packets
will can not be received successfully.
Fixes: 766d51c9ce29 ("net/nfp: merge receive function")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_rxtx.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 5094bbf145..3840e2372c 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -765,15 +765,6 @@ nfp_net_recv_pkts(void *rx_queue,
/* Checking the checksum flag */
nfp_net_rx_cksum(rxq, rxds, mb);
- if (meta.port_id == 0) {
- rx_pkts[avail++] = mb;
- } else if (nfp_flower_pf_dispatch_pkts(hw, mb, meta.port_id)) {
- avail_multiplexed++;
- } else {
- rte_pktmbuf_free(mb);
- break;
- }
-
/* Now resetting and updating the descriptor */
rxds->vals[0] = 0;
rxds->vals[1] = 0;
@@ -786,6 +777,15 @@ nfp_net_recv_pkts(void *rx_queue,
rxq->rd_p++;
if (unlikely(rxq->rd_p == rxq->rx_count)) /* Wrapping */
rxq->rd_p = 0;
+
+ if (meta.port_id == 0) {
+ rx_pkts[avail++] = mb;
+ } else if (nfp_flower_pf_dispatch_pkts(hw, mb, meta.port_id)) {
+ avail_multiplexed++;
+ } else {
+ rte_pktmbuf_free(mb);
+ break;
+ }
}
if (nb_hold == 0)
--
2.39.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] fix problem in Rx
2023-12-11 5:45 [PATCH 0/2] fix problem in Rx Chaoyong He
2023-12-11 5:45 ` [PATCH 1/2] net/nfp: fix receive function memory leak Chaoyong He
2023-12-11 5:45 ` [PATCH 2/2] net/nfp: fix invalid Rx descriptor data Chaoyong He
@ 2023-12-13 10:40 ` Ferruh Yigit
2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2023-12-13 10:40 UTC (permalink / raw)
To: Chaoyong He, dev; +Cc: oss-drivers
On 12/11/2023 5:45 AM, Chaoyong He wrote:
> Fix two problems in the receive function.
>
> Long Wu (2):
> net/nfp: fix receive function memory leak
> net/nfp: fix invalid Rx descriptor data
>
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-13 10:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11 5:45 [PATCH 0/2] fix problem in Rx Chaoyong He
2023-12-11 5:45 ` [PATCH 1/2] net/nfp: fix receive function memory leak Chaoyong He
2023-12-11 5:45 ` [PATCH 2/2] net/nfp: fix invalid Rx descriptor data Chaoyong He
2023-12-13 10:40 ` [PATCH 0/2] fix problem in Rx Ferruh Yigit
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).