[PATCH v3 net 1/7] net: enetc: consistenly track dropped frames in enetc_xdp_xmit()

From: vladimir . oltean

Date: Tue Sep 15 2026 - 18:33:20 EST


2 distinct classes of problems:
(a) failures in enetc_xdp_frame_to_xdp_tx_swbd(), as well as frames
split across too many buffers, should be tracked by some drop
counters, as they will not be transmitted. This is similar to how
enetc_xdp_tx() increments xdp_tx_drops.
(b) enetc_xdp_tx() failures increment xdp_tx_drops by 1, but that is not
necessarily correct. Wei Fang points out that on .ndo_xdp_xmit()
failure, bq_xmit_all() drops all remaining frames from the batch,
not just the current one. So we should in any case increment the
xdp_tx_drops counter by the remainder, not just by 1.

A limitation that remains is that the xdp_tx_drops ethtool statistics
counter tracks XDP_TX and XDP_REDIRECT drops in the same value. We
should distinguish between these at some point, but that is an ABI
change and is out of scope for a bug fix.

Fixes: 9d2b68cc108d ("net: enetc: add support for XDP_REDIRECT")
Signed-off-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>
---
v2->v3: patch is new; replaces:
https://lore.kernel.org/netdev/20260406204122.167237-2-vladimir.oltean@xxxxxxx/
---
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 80f0082f6c63..e7ecdf8ef67c 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -1843,7 +1843,6 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames,
for (i = 0; i < xdp_tx_bd_cnt; i++)
enetc_unmap_tx_buff(tx_ring,
&xdp_redirect_arr[i]);
- tx_ring->stats.xdp_tx_drops++;
break;
}

@@ -1854,6 +1853,7 @@ int enetc_xdp_xmit(struct net_device *ndev, int num_frames,
enetc_update_tx_ring_tail(tx_ring);

tx_ring->stats.xdp_tx += xdp_tx_frm_cnt;
+ tx_ring->stats.xdp_tx_drops += num_frames - xdp_tx_frm_cnt;

enetc_unlock_mdio();

--
2.43.0