From: Jisheng Zhang <jszhang@kernel.org>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH v2] net: stmmac: Disable checksum insertion for XDP frame TX
Date: Mon, 16 Nov 2026 21:48:48 +0800 [thread overview]
Message-ID: <20261116134848.4793-1-jszhang@kernel.org> (raw)
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
next reply other threads:[~2026-11-16 14:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 13:48 Jisheng Zhang [this message]
2026-11-16 14:12 ` [PATCH v2] net: stmmac: Disable checksum insertion for XDP frame TX netdev-bot+sinfo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116134848.4793-1-jszhang@kernel.org \
--to=jszhang@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox