2023-06-02 09:56:45

by Wei Fang

[permalink] [raw]
Subject: [PATCH net 0/2] net: enetc: correct the statistics of rx bytes

From: Wei Fang <[email protected]>

The purpose of this patch set is to fix the issue of rx bytes
statistics. The first patch corrects the rx bytes statistics
of normal kernel protocol stack path, and the second patch is
used to correct the rx bytes statistics of XDP.

Wei Fang (2):
net: enetc: correct the statistics of rx bytes
net: enetc: correct rx_bytes statistics of XDP

drivers/net/ethernet/freescale/enetc/enetc.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

--
2.25.1



2023-06-02 10:09:01

by Wei Fang

[permalink] [raw]
Subject: [PATCH net 2/2] net: enetc: correct rx_bytes statistics of XDP

From: Wei Fang <[email protected]>

The rx_bytes statistics of XDP are always zero, because rx_byte_cnt
is not updated after it is initialized to 0. So fix it.

Fixes: d1b15102dd16 ("net: enetc: add support for XDP_DROP and XDP_PASS")
Signed-off-by: Wei Fang <[email protected]>
---
drivers/net/ethernet/freescale/enetc/enetc.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index d6c0f3f46c2a..9e1b2536e9a9 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -1571,6 +1571,14 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
enetc_build_xdp_buff(rx_ring, bd_status, &rxbd, &i,
&cleaned_cnt, &xdp_buff);

+ /* When set, the outer VLAN header is extracted and reported
+ * in the receive buffer descriptor. So rx_byte_cnt should
+ * add the length of the extracted VLAN header.
+ */
+ if (bd_status & ENETC_RXBD_FLAG_VLAN)
+ rx_byte_cnt += VLAN_HLEN;
+ rx_byte_cnt += xdp_get_buff_len(&xdp_buff);
+
xdp_act = bpf_prog_run_xdp(prog, &xdp_buff);

switch (xdp_act) {
--
2.25.1


2023-06-02 10:50:23

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH net 2/2] net: enetc: correct rx_bytes statistics of XDP

On Fri, Jun 02, 2023 at 05:46:59PM +0800, [email protected] wrote:
> From: Wei Fang <[email protected]>
>
> The rx_bytes statistics of XDP are always zero, because rx_byte_cnt
> is not updated after it is initialized to 0. So fix it.
>
> Fixes: d1b15102dd16 ("net: enetc: add support for XDP_DROP and XDP_PASS")
> Signed-off-by: Wei Fang <[email protected]>
> ---

Reviewed-by: Vladimir Oltean <[email protected]>

Thanks!

2023-06-04 17:30:48

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net 0/2] net: enetc: correct the statistics of rx bytes

Hello:

This series was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

On Fri, 2 Jun 2023 17:46:57 +0800 you wrote:
> From: Wei Fang <[email protected]>
>
> The purpose of this patch set is to fix the issue of rx bytes
> statistics. The first patch corrects the rx bytes statistics
> of normal kernel protocol stack path, and the second patch is
> used to correct the rx bytes statistics of XDP.
>
> [...]

Here is the summary with links:
- [net,1/2] net: enetc: correct the statistics of rx bytes
https://git.kernel.org/netdev/net/c/7190d0ff0e17
- [net,2/2] net: enetc: correct rx_bytes statistics of XDP
https://git.kernel.org/netdev/net/c/fdebd850cc06

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html