[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251124-skb-meta-safeproof-netdevs-rx-only-v1-7-8978f5054417@cloudflare.com>
Date: Mon, 24 Nov 2025 17:28:43 +0100
From: Jakub Sitnicki <jakub@...udflare.com>
To: bpf@...r.kernel.org
Cc: netdev@...r.kernel.org, kernel-team@...udflare.com,
Martin KaFai Lau <martin.lau@...ux.dev>
Subject: [PATCH RFC bpf-next 07/15] veth: Call skb_metadata_set when
skb->data points at metadata end
Prepare to track skb metadata location independently of MAC header offset.
Following changes will make skb_metadata_set() record where metadata ends
relative to skb->head. Hence the helper must be called when skb->data
points right past the metadata area.
Unlike other drivers, veth calls skb_metadata_set() after eth_type_trans(),
which pulls the Ethernet header and moves skb->data. This violates the
future calling convention.
Adjust the driver to pull the MAC header after calling skb_metadata_set().
Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
---
drivers/net/veth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 87a63c4bee77..61f218d83f80 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -876,11 +876,11 @@ static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq,
else
skb->data_len = 0;
- skb->protocol = eth_type_trans(skb, rq->dev);
-
metalen = xdp->data - xdp->data_meta;
if (metalen)
skb_metadata_set(skb, metalen);
+
+ skb->protocol = eth_type_trans(skb, rq->dev);
out:
return skb;
drop:
--
2.43.0
Powered by blists - more mailing lists