Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net: stmmac: Disable checksum insertion for XDP frame TX
@ 2026-11-16 13:48 Jisheng Zhang
  2026-11-16 14:12 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Jisheng Zhang @ 2026-11-16 13:48 UTC (permalink / raw)
  To: Maxime Chevallier, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
	Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
	John Fastabend, Stanislav Fomichev
  Cc: linux-arm-kernel, linux-kernel, bpf

stmmac enables TX checksum insertion for XDP frames whenever the queue
supports it. XDP frames carry no TX checksum offload request, so this
can overwrite a checksum already present in the packet.

dwmac can only do HW checksum for normal particular packets
layouts, such as TCP, UDP etc. The stmmac_has_ip_ethertype() has
well demostrated this limitation. Different with normal tx where the
common stack supplies the skb->ip_summed metadata, XDP path doesn't
have the necessary metadata. So to make the XDP always work properly
when transmiting arbitrary Eth frames, dwmac HW csum needs to be
disabled by default.

Pass false to stmmac_prepare_tx_desc() when transmitting an XDP frame
so that the packet is sent with its checksum fields unchanged.

Fixes: be8b38a722e6 ("net: stmmac: Add support for XDP_TX action")
Fixes: 8b278a5b69a2 ("net: stmmac: Add support for XDP_REDIRECT action")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---

since v1:
 - rebase against latest rcN
 - update the commit msg

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3014f9c7c3e6..0545f086212e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5284,7 +5284,6 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
 {
 	struct skb_shared_info *sinfo = xdp_get_shared_info_from_frame(xdpf);
 	struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
-	bool csum = !priv->plat->tx_queues_cfg[queue].coe_unsupported;
 	unsigned int txq_thr = STMMAC_TX_THRESH(priv);
 	unsigned int first_entry = tx_q->cur_tx;
 	unsigned int entry = tx_q->cur_tx;
@@ -5306,14 +5305,6 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
 		return STMMAC_XDP_CONSUMED;
 	}
 
-	/* Disable TX checksum offload for jumbo frames on cores where
-	 * checksum insertion is broken for oversized frames, matching the
-	 * stmmac_fix_features() workaround used by the skb path.
-	 */
-	if (priv->plat->bugged_jumbo &&
-	    xdp_get_frame_len(xdpf) > ETH_FRAME_LEN)
-		csum = false;
-
 	while (true) {
 		skb_frag_t *frag = i ? &sinfo->frags[i - 1] : NULL;
 		int len = frag ? skb_frag_size(frag) : xdpf->len;
@@ -5353,7 +5344,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
 		stmmac_set_tx_dma_entry(tx_q, entry, buf_type, dma_addr, len,
 					dma_map && frag);
 		stmmac_set_desc_addr(priv, desc, dma_addr);
-		stmmac_prepare_tx_desc(priv, desc, !i, len, csum,
+		stmmac_prepare_tx_desc(priv, desc, !i, len, false,
 				       priv->descriptor_mode, !!i, last_frame,
 				       xdp_get_frame_len(xdpf));
 		tx_q->xdpf[entry] = last_frame ? xdpf : NULL;
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-16 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 13:48 [PATCH v2] net: stmmac: Disable checksum insertion for XDP frame TX Jisheng Zhang
2026-11-16 14:12 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox