[PATCH v5 net 0/4] Fix short frame transmission in enetc

From: vladimir . oltean

Date: Wed Oct 21 2026 - 11:08:14 EST


This is a belated follow-up to Zefir Kurtisi's report:
https://lore.kernel.org/netdev/20260220132930.2521155-1-zefir.kurtisi@xxxxxxxxx/

which is that the ENETC misbehaves when transmitting packets smaller
than 16 octets sans FCS: it sends them but does not update the completed
index in the transmit BD ring. I did find a sentence in the reference
manual explicitly stating these short frames are not supported.

Separately, the series stops relying on the mEMAC to pad short frames
to ETH_ZLEN, because the padding it inserts is not always zero, and we
want to avoid any risk of leaking SoC-internal memory onto the wire.

- Patch 1 makes the software TSO path reserve enough TX BDs for VLAN
extension BDs. Patch 2 adds one more BD per segment to that same
reservation, so it builds on top of this fix.
- Patch 2 pads short frames to ETH_ZLEN in software, including short
software TSO segments, using a shared read-only zero buffer.
- Patch 3 makes sure the head buffer of an skb is at least 16 octets
long, which fixes the reported stall.
- Patch 4 covers the XDP_TX and ndo_xdp_xmit() paths: it pads short
frames to ETH_ZLEN in the same way, and drops frames whose head
buffer is shorter than 16 octets.

Review of previous versions found a number of pre-existing issues in
the code surrounding these changes, and v4 grew to 8 patches to address
them. Review of v4 found even more. To be able to make progress, v5 is
reduced to the patches strictly needed for the stated purpose. The
other fixes will be submitted separately.

v1 at:
https://lore.kernel.org/netdev/20260401172246.1075883-1-vladimir.oltean@xxxxxxx/

v2 at:
https://lore.kernel.org/netdev/20260406204122.167237-1-vladimir.oltean@xxxxxxx/

v3 at:
https://lore.kernel.org/netdev/20260915222735.1016937-5-vladimir.oltean@xxxxxxx/

v4 at:
https://lore.kernel.org/netdev/20261015105536.1692348-7-vladimir.oltean@xxxxxxx/

Change log in individual patches. At a high level:
- dropped the following v4 patches, which are unrelated to short frames
and will be resubmitted separately:
- 1/8: consistently track dropped frames in enetc_xdp_xmit()
- 2/8: serialize access to the same TX ring from NAPI XDP_TX and
ndo_xdp_xmit()
- 3/8: fix bogus TX ring consumer index after reinitialization
- 7/8: fix leak of pending XDP_TX frames when going down
- 8/8: ensure enetc_xdp_xmit() calls enetc_update_tx_ring_tail()
- new patch 1/4: reserve VLAN extension BDs for software TSO
- patch 2/4: account for the pad BD in enetc_tso_count_descs() and in
the per-frame chained BD limit; explain why hardware LSO is not
affected
- patches 3/4 and 4/4 are unchanged

Vladimir Oltean (4):
net: enetc: reserve VLAN extension BDs for software TSO
net: enetc: do not rely on mEMAC hardware frame padding
net: enetc: ensure head buffer has at least 16 octets
net: enetc: pad short XDP frames in software

drivers/net/ethernet/freescale/enetc/enetc.c | 114 +++++++++++++++++--
drivers/net/ethernet/freescale/enetc/enetc.h | 8 ++
2 files changed, 113 insertions(+), 9 deletions(-)

--
2.43.0