]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: enetc: remove xdp_drops statistic from enetc_xdp_drop()
authorWei Fang <wei.fang@nxp.com>
Thu, 10 Oct 2024 09:20:53 +0000 (17:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Oct 2024 13:40:39 +0000 (15:40 +0200)
commit 412950d5746f7aa139e14fe95338694c1f09b595 upstream.

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")
Cc: stable@vger.kernel.org
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20241010092056.298128-2-wei.fang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/freescale/enetc/enetc.c

index 9e063eb17f527d83edd8f37a62e9bb22a133897e..b51d54799669b90d0be06a6dfa31bd21c2359d02 100644 (file)
@@ -1223,7 +1223,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,
@@ -1280,6 +1279,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;