Thread View: linux.kernel.netdev
5 messages
5 total messages
Started by Lorenzo Bianconi
Mon, 02 Nov 2026 11:46
[PATCH net] net: stmmac: set XDP metadata length on the page_pool RX path
Author: Lorenzo Bianconi
Date: Mon, 02 Nov 2026 11:46
Date: Mon, 02 Nov 2026 11:46
64 lines
17364 bytes
17364 bytes
stmmac_rx() initializes the XDP buffer with the metadata area valid, so
an XDP program can reserve metadata with bpf_xdp_adjust_meta() and write
it in [xdp->data_meta, xdp->data), for example to export the RX hardware
timestamp obtained from the metadata kfunc. When such a frame is passed
to the stack, the skb is built in place around the same page with
napi_build_skb(), but skb_metadata_set() is never called.
napi_build_skb() clears skb_shared_info up to dataref, which includes
meta_len, so skb_metadata_len() stays zero. The stack and TC BPF then see
an empty metadata range even though the bytes are present in the skb
headroom. The AF_XDP zero-copy path already records the length in
stmmac_construct_skb_zc().
Record the metadata length after reserving the headroom and adding the
frame data. No copy is needed because the skb is built over the buffer the
XDP program wrote to. With the length recorded, the software VLAN
stripping path can move the metadata together with the MAC header, as it
already does for zero-copy frames.
Fixes: e3f9c3e34840 ("net: stmmac: add Rx HWTS metadata to XDP receive pkt")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b038472b9817..f97f6dc08789 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6012,7 +6012,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
}
if (!skb) {
- unsigned int head_pad_len;
+ unsigned int metasize;
/* XDP program may expand or reduce tail */
buf1_len = ctx.xdp.data_end - ctx.xdp.data;
@@ -6029,10 +6029,14 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
}
/* XDP program may adjust header */
- head_pad_len = ctx.xdp.data - ctx.xdp.data_hard_start;
- skb_reserve(skb, head_pad_len);
+ skb_reserve(skb,
+ ctx.xdp.data - ctx.xdp.data_hard_start);
skb_put(skb, buf1_len);
skb_mark_for_recycle(skb);
+
+ metasize = ctx.xdp.data - ctx.xdp.data_meta;
+ if (metasize)
+ skb_metadata_set(skb, metasize);
buf->page = NULL;
} else if (buf1_len) {
dma_sync_single_for_cpu(priv->device, buf->addr,
---
base-commit: 21f57ec673a1917547c808cfa81890485fffa03b
change-id: 20261102-stmmac_meatada_pp_path-0c1b9299e2fb
Best regards,
--
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Re: [PATCH net] net: stmmac: set XDP metadata length on the page_pool RX path
Author: netdev-bot+sinfo
Date: Mon, 02 Nov 2026 11:49
Date: Mon, 02 Nov 2026 11:49
26 lines
9327 bytes
9327 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages. - What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then. The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH net] net: stmmac: set XDP metadata length on the page_pool RX path
Author: Lorenzo Bianconi
Date: Mon, 02 Nov 2026 13:20
Date: Mon, 02 Nov 2026 13:20
56 lines
17237 bytes
17237 bytes
--hEQCQpva2igBtHcT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Hi! >=20 > This is an automated message. This series looks like a fix, but its > commit messages seem to be missing some information: >=20 > - How the issue was discovered, e.g. hit in production, hit during > development, syzbot report, manual code inspection, LLM or static > analysis tool scan. The issue has been reported by sashiko >=20 > - Whether the issue was actually triggered, or is only theoretical > (e.g. found by code inspection). If it was triggered please include > the symptoms, like the stack trace or error messages. This is a real issue found by sashiko >=20 > - What hardware the change was tested on. For driver fixes please > mention the device (and if relevant firmware version) used for > testing, or say that the change was not tested on real hardware. I tested the patch on Qualcomm rb3-gen2 board Regards, Lorenzo >=20 > Please do not repost the series just to address the above. Instead, > reply to this email with the missing information, so that reviewers > can take it into account. If the series needs another revision for > other reasons, please include the information in the commit messages > then. >=20 > The evaluation is done by an LLM so it may be wrong, if you think > that is the case please reply and explain. --hEQCQpva2igBtHcT Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCauiOKwAKCRA6cBh0uS2t rHRdAQD/v8Dhm8FIwTs3wowVw2wCikCGentLt6uK5GTW5atbhQEAz8EIXwAcWJPJ sqI3crlBL10HzgL1B2U0IkCcfwTQngA= =Z4aK -----END PGP SIGNATURE----- --hEQCQpva2igBtHcT--
Re: [PATCH net] net: stmmac: set XDP metadata length on the page_pool RX path
Author: Nicolai Buchwitz
Date: Tue, 03 Nov 2026 13:47
Date: Tue, 03 Nov 2026 13:47
39 lines
10248 bytes
10248 bytes
Hi Lorenzo
On 2.11.2026 12:46, Lorenzo Bianconi wrote:
> stmmac_rx() initializes the XDP buffer with the metadata area valid, so
> an XDP program can reserve metadata with bpf_xdp_adjust_meta() and
> write
> it in [xdp->data_meta, xdp->data), for example to export the RX
> hardware
> timestamp obtained from the metadata kfunc. When such a frame is passed
> to the stack, the skb is built in place around the same page with
> napi_build_skb(), but skb_metadata_set() is never called.
>
> napi_build_skb() clears skb_shared_info up to dataref, which includes
> meta_len, so skb_metadata_len() stays zero. The stack and TC BPF then
> see
> an empty metadata range even though the bytes are present in the skb
> headroom. The AF_XDP zero-copy path already records the length in
> stmmac_construct_skb_zc().
>
> Record the metadata length after reserving the headroom and adding the
> frame data. No copy is needed because the skb is built over the buffer
> the
> XDP program wrote to. With the length recorded, the software VLAN
> stripping path can move the metadata together with the MAC header, as
> it
> already does for zero-copy frames.
>
> Fixes: e3f9c3e34840 ("net: stmmac: add Rx HWTS metadata to XDP receive
> pkt")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> ---
> [...]
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Thanks,
Nicolai
Re: [PATCH net] net: stmmac: set XDP metadata length on the page_pool RX path
Author: patchwork-bot+netdevbpf
Date: Thu, 05 Nov 2026 11:20
Date: Thu, 05 Nov 2026 11:20
24 lines
8989 bytes
8989 bytes
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 02 Nov 2026 12:46:04 +0100 you wrote:
> stmmac_rx() initializes the XDP buffer with the metadata area valid, so
> an XDP program can reserve metadata with bpf_xdp_adjust_meta() and write
> it in [xdp->data_meta, xdp->data), for example to export the RX hardware
> timestamp obtained from the metadata kfunc. When such a frame is passed
> to the stack, the skb is built in place around the same page with
> napi_build_skb(), but skb_metadata_set() is never called.
>
> [...]
Here is the summary with links:
- [net] net: stmmac: set XDP metadata length on the page_pool RX path
https://git.kernel.org/netdev/net/c/6d9b7c85af57
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads