diff mbox series

[net,1/3] net: enetc: remove xdp_drops statistic from enetc_xdp_drop()

Message ID 20240919084104.661180-2-wei.fang@nxp.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: enetc: fix some issues of XDP | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 17 this patch: 17
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-20--15-00 (tests: 764)

Commit Message

Wei Fang Sept. 19, 2024, 8:41 a.m. UTC
The xdp_drops statistic indicates the number of XDP frames dropped in
the Rx direction. However, enetc_xdp_drop() is also used in XDP_TX and
XDP_REDIRECT actions. If frame loss occurs in these two actions, the
frames loss count should not be included in xdp_drops, because there
are already xdp_tx_drops and xdp_redirect_failures to count the frame
loss of these two actions, so it's better to remove xdp_drops statistic
from enetc_xdp_drop() and increase xdp_drops in XDP_DROP action.

Fixes: 7ed2bc80074e ("net: enetc: add support for XDP_TX")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maciej Fijalkowski Sept. 20, 2024, 12:08 p.m. UTC | #1
On Thu, Sep 19, 2024 at 04:41:02PM +0800, Wei Fang wrote:
> The xdp_drops statistic indicates the number of XDP frames dropped in
> the Rx direction. However, enetc_xdp_drop() is also used in XDP_TX and
> XDP_REDIRECT actions. If frame loss occurs in these two actions, the
> frames loss count should not be included in xdp_drops, because there
> are already xdp_tx_drops and xdp_redirect_failures to count the frame
> loss of these two actions, so it's better to remove xdp_drops statistic
> from enetc_xdp_drop() and increase xdp_drops in XDP_DROP action.
> 
> Fixes: 7ed2bc80074e ("net: enetc: add support for XDP_TX")
> Signed-off-by: Wei Fang <wei.fang@nxp.com>

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  drivers/net/ethernet/freescale/enetc/enetc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
> index 032d8eadd003..56e59721ec7d 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc.c
> @@ -1521,7 +1521,6 @@ static void enetc_xdp_drop(struct enetc_bdr *rx_ring, int rx_ring_first,
>  				  &rx_ring->rx_swbd[rx_ring_first]);
>  		enetc_bdr_idx_inc(rx_ring, &rx_ring_first);
>  	}
> -	rx_ring->stats.xdp_drops++;
>  }
>  
>  static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
> @@ -1586,6 +1585,7 @@ static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
>  			fallthrough;
>  		case XDP_DROP:
>  			enetc_xdp_drop(rx_ring, orig_i, i);
> +			rx_ring->stats.xdp_drops++;
>  			break;
>  		case XDP_PASS:
>  			rxbd = orig_rxbd;
> -- 
> 2.34.1
> 
>
Ratheesh Kannoth Sept. 23, 2024, 5:02 a.m. UTC | #2
On 2024-09-19 at 14:11:02, Wei Fang (wei.fang@nxp.com) wrote:
> The xdp_drops statistic indicates the number of XDP frames dropped in
> the Rx direction. However, enetc_xdp_drop() is also used in XDP_TX and
> XDP_REDIRECT actions. If frame loss occurs in these two actions, the
> frames loss count should not be included in xdp_drops, because there
> are already xdp_tx_drops and xdp_redirect_failures to count the frame
> loss of these two actions, so it's better to remove xdp_drops statistic
> from enetc_xdp_drop() and increase xdp_drops in XDP_DROP action.
nit: s/xdp_drops/xdp_rx_drops would be appropriate as you have xdp_tx_drops and
xdp_redirect_failures.
Wei Fang Sept. 23, 2024, 5:53 a.m. UTC | #3
> -----Original Message-----
> From: Ratheesh Kannoth <rkannoth@marvell.com>
> Sent: 2024年9月23日 13:03
> To: Wei Fang <wei.fang@nxp.com>
> Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> pabeni@redhat.com; Claudiu Manoil <claudiu.manoil@nxp.com>; Vladimir
> Oltean <vladimir.oltean@nxp.com>; ast@kernel.org; daniel@iogearbox.net;
> hawk@kernel.org; john.fastabend@gmail.com; linux-kernel@vger.kernel.org;
> netdev@vger.kernel.org; bpf@vger.kernel.org; stable@vger.kernel.org;
> imx@lists.linux.dev
> Subject: Re: [PATCH net 1/3] net: enetc: remove xdp_drops statistic from
> enetc_xdp_drop()
> 
> On 2024-09-19 at 14:11:02, Wei Fang (wei.fang@nxp.com) wrote:
> > The xdp_drops statistic indicates the number of XDP frames dropped in
> > the Rx direction. However, enetc_xdp_drop() is also used in XDP_TX and
> > XDP_REDIRECT actions. If frame loss occurs in these two actions, the
> > frames loss count should not be included in xdp_drops, because there
> > are already xdp_tx_drops and xdp_redirect_failures to count the frame
> > loss of these two actions, so it's better to remove xdp_drops statistic
> > from enetc_xdp_drop() and increase xdp_drops in XDP_DROP action.
> nit: s/xdp_drops/xdp_rx_drops would be appropriate as you have
> xdp_tx_drops and
> xdp_redirect_failures.

Sorry, I don't quite understand what you mean.
Vladimir Oltean Sept. 27, 2024, 2:25 p.m. UTC | #4
On Mon, Sep 23, 2024 at 08:53:07AM +0300, Wei Fang wrote:
> > -----Original Message-----
> > From: Ratheesh Kannoth <rkannoth@marvell.com>
> > Sent: 2024年9月23日 13:03
> > To: Wei Fang <wei.fang@nxp.com>
> > Cc: davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> > pabeni@redhat.com; Claudiu Manoil <claudiu.manoil@nxp.com>; Vladimir
> > Oltean <vladimir.oltean@nxp.com>; ast@kernel.org; daniel@iogearbox.net;
> > hawk@kernel.org; john.fastabend@gmail.com; linux-kernel@vger.kernel.org;
> > netdev@vger.kernel.org; bpf@vger.kernel.org; stable@vger.kernel.org;
> > imx@lists.linux.dev
> > Subject: Re: [PATCH net 1/3] net: enetc: remove xdp_drops statistic from
> > enetc_xdp_drop()
> > 
> > On 2024-09-19 at 14:11:02, Wei Fang (wei.fang@nxp.com) wrote:
> > > The xdp_drops statistic indicates the number of XDP frames dropped in
> > > the Rx direction. However, enetc_xdp_drop() is also used in XDP_TX and
> > > XDP_REDIRECT actions. If frame loss occurs in these two actions, the
> > > frames loss count should not be included in xdp_drops, because there
> > > are already xdp_tx_drops and xdp_redirect_failures to count the frame
> > > loss of these two actions, so it's better to remove xdp_drops statistic
> > > from enetc_xdp_drop() and increase xdp_drops in XDP_DROP action.
> > nit: s/xdp_drops/xdp_rx_drops would be appropriate as you have
> > xdp_tx_drops and
> > xdp_redirect_failures.
> 
> Sorry, I don't quite understand what you mean.

I don't understand what he means either. I guess he didn't realize you
aren't proposing any new name, just working with existing concepts in
the driver. Anyway, an ack about this from Ratheesh would be great, to
not leave us hanging.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index 032d8eadd003..56e59721ec7d 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -1521,7 +1521,6 @@  static void enetc_xdp_drop(struct enetc_bdr *rx_ring, int rx_ring_first,
 				  &rx_ring->rx_swbd[rx_ring_first]);
 		enetc_bdr_idx_inc(rx_ring, &rx_ring_first);
 	}
-	rx_ring->stats.xdp_drops++;
 }
 
 static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
@@ -1586,6 +1585,7 @@  static int enetc_clean_rx_ring_xdp(struct enetc_bdr *rx_ring,
 			fallthrough;
 		case XDP_DROP:
 			enetc_xdp_drop(rx_ring, orig_i, i);
+			rx_ring->stats.xdp_drops++;
 			break;
 		case XDP_PASS:
 			rxbd = orig_rxbd;