netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/3] net: enetc: fix some issues of XDP
@ 2024-09-19  8:41 Wei Fang
  2024-09-19  8:41 ` [PATCH net 1/3] net: enetc: remove xdp_drops statistic from enetc_xdp_drop() Wei Fang
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Wei Fang @ 2024-09-19  8:41 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, claudiu.manoil, vladimir.oltean,
	ast, daniel, hawk, john.fastabend
  Cc: linux-kernel, netdev, bpf, stable, imx

We found some bugs when testing the XDP function of enetc driver,
and these bugs are easy to reproduce. This is not only causes XDP
to not work, but also the network cannot be restored after exiting
the XDP program. So the patch set is mainly to fix these bugs. For
details, please see the commit message of each patch.

Wei Fang (3):
  net: enetc: remove xdp_drops statistic from enetc_xdp_drop()
  net: enetc: fix the issues of XDP_REDIRECT feature
  net: enetc: reset xdp_tx_in_flight when updating bpf program

 drivers/net/ethernet/freescale/enetc/enetc.c | 46 +++++++++++++++-----
 drivers/net/ethernet/freescale/enetc/enetc.h |  1 +
 2 files changed, 37 insertions(+), 10 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: [PATCH net 3/3] net: enetc: reset xdp_tx_in_flight when updating bpf program
@ 2024-09-19 11:12 Subbaraya Sundeep
  0 siblings, 0 replies; 24+ messages in thread
From: Subbaraya Sundeep @ 2024-09-19 11:12 UTC (permalink / raw)
  To: Wei Fang
  Cc: davem, edumazet, kuba, pabeni, claudiu.manoil, vladimir.oltean,
	ast, daniel, hawk, john.fastabend, linux-kernel, netdev, bpf,
	stable, imx

On 2024-09-19 at 14:11:04, Wei Fang (wei.fang@nxp.com) wrote:
> When running "xdp-bench tx eno0" to test the XDP_TX feature of ENETC
> on LS1028A, it was found that if the command was re-run multiple times,
> Rx could not receive the frames, and the result of xdo-bench showed
> that the rx rate was 0.
> 
> root@ls1028ardb:~# ./xdp-bench tx eno0
> Hairpinning (XDP_TX) packets on eno0 (ifindex 3; driver fsl_enetc)
> Summary                      2046 rx/s                  0 err,drop/s
> Summary                         0 rx/s                  0 err,drop/s
> Summary                         0 rx/s                  0 err,drop/s
> Summary                         0 rx/s                  0 err,drop/s
> 
> By observing the Rx PIR and CIR registers, we found that CIR is always
> equal to 0x7FF and PIR is always 0x7FE, which means that the Rx ring
> is full and can no longer accommodate other Rx frames. Therefore, it
> is obvious that the RX BD ring has not been cleaned up.
> 
> Further analysis of the code revealed that the Rx BD ring will only
> be cleaned if the "cleaned_cnt > xdp_tx_in_flight" condition is met.
> Therefore, some debug logs were added to the driver and the current
> values of cleaned_cnt and xdp_tx_in_flight were printed when the Rx
> BD ring was full. The logs are as follows.
> 
> [  178.762419] [XDP TX] >> cleaned_cnt:1728, xdp_tx_in_flight:2140
> [  178.771387] [XDP TX] >> cleaned_cnt:1941, xdp_tx_in_flight:2110
> [  178.776058] [XDP TX] >> cleaned_cnt:1792, xdp_tx_in_flight:2110
> 
> From the results, we can see that the maximum value of xdp_tx_in_flight
> has reached 2140. However, the size of the Rx BD ring is only 2048. This
> is incredible, so checked the code again and found that the driver did
> not reset xdp_tx_in_flight when installing or uninstalling bpf program,
> resulting in xdp_tx_in_flight still retaining the value after the last
> command was run.
> 
> Fixes: c33bfaf91c4c ("net: enetc: set up XDP program under enetc_reconfigure()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wei Fang <wei.fang@nxp.com>

Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>

Thanks,
Sundeep

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

end of thread, other threads:[~2024-09-29  1:35 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-19  8:41 [PATCH net 0/3] net: enetc: fix some issues of XDP Wei Fang
2024-09-19  8:41 ` [PATCH net 1/3] net: enetc: remove xdp_drops statistic from enetc_xdp_drop() Wei Fang
2024-09-20 12:08   ` Maciej Fijalkowski
2024-09-23  5:02   ` Ratheesh Kannoth
2024-09-23  5:53     ` Wei Fang
2024-09-27 14:25       ` Vladimir Oltean
2024-09-19  8:41 ` [PATCH net 2/3] net: enetc: fix the issues of XDP_REDIRECT feature Wei Fang
2024-09-20 12:50   ` Maciej Fijalkowski
2024-09-27 14:41   ` Vladimir Oltean
2024-09-29  1:35     ` Wei Fang
2024-09-19  8:41 ` [PATCH net 3/3] net: enetc: reset xdp_tx_in_flight when updating bpf program Wei Fang
2024-09-19 13:21   ` Vladimir Oltean
2024-09-20  3:12     ` Wei Fang
2024-09-23  4:56       ` Ratheesh Kannoth
2024-09-23  5:48         ` Wei Fang
2024-09-20 13:04   ` Maciej Fijalkowski
2024-09-20 14:05     ` Wei Fang
2024-09-20 14:25       ` Vladimir Oltean
2024-09-20 14:29         ` Vladimir Oltean
2024-09-23  1:59         ` Wei Fang
2024-09-27 14:33           ` Vladimir Oltean
2024-09-29  1:31             ` Wei Fang
2024-09-27 14:38   ` Vladimir Oltean
  -- strict thread matches above, loose matches on Subject: below --
2024-09-19 11:12 Subbaraya Sundeep

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).