Thread (17 messages) 17 messages, 5 authors, 2026-02-13

Re: [Intel-wired-lan] [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver

From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: 2026-02-13 15:22:06
Also in: bpf, intel-wired-lan, linux-kselftest

quoted
-----Original Message-----
From: Intel-wired-lan <redacted> On Behalf
Of Lorenzo Bianconi
Sent: Tuesday, February 10, 2026 6:22 PM
To: Donald Hunter <donald.hunter@gmail.com>; Jakub Kicinski
[off-list ref]; David S. Miller [off-list ref]; Eric Dumazet
[off-list ref]; Paolo Abeni [off-list ref]; Simon Horman
[off-list ref]; Alexei Starovoitov [off-list ref]; Daniel
Borkmann [off-list ref]; Jesper Dangaard Brouer
[off-list ref]; John Fastabend [off-list ref];
Stanislav Fomichev [off-list ref]; Andrew Lunn
[off-list ref]; Nguyen, Anthony L
[off-list ref]; Kitszel, Przemyslaw
[off-list ref]; Lobakin, Aleksander
[off-list ref]; Andrii Nakryiko [off-list ref];
Martin KaFai Lau [off-list ref]; Eduard Zingerman
[off-list ref]; Song Liu [off-list ref]; Yonghong Song
[off-list ref]; KP Singh [off-list ref]; Hao Luo
[off-list ref]; Jiri Olsa [off-list ref]; Shuah Khan
[off-list ref]; Fijalkowski, Maciej [off-list ref]
Cc: Jakub Sitnicki <jakub@cloudflare.com>; netdev@vger.kernel.org;
bpf@vger.kernel.org; intel-wired-lan@lists.osuosl.org; linux-
kselftest@vger.kernel.org; Lorenzo Bianconi [off-list ref]
Subject: [Intel-wired-lan] [PATCH bpf-next 2/5] net: veth: Add
xmo_rx_checksum callback to veth driver

Implement xmo_rx_checksum callback in veth driver to report RX
checksum result to the eBPF program bounded to the veth device.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/veth.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index
14e6f2a2fb7783334d8f6afd54e658cf9a0e6f3d..38b70ad62db7e92cccc6c6c9ed1f
5573d8baf48b 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1693,6 +1693,25 @@ static int veth_xdp_rx_vlan_tag(const struct
xdp_md *ctx, __be16 *vlan_proto,
 	return err;
 }

+static int veth_xdp_rx_checksum(const struct xdp_md *ctx,
+				enum xdp_checksum *ip_summed,
+				u32 *cksum_meta)
+{
+	const struct veth_xdp_buff *_ctx = (void *)ctx;
+	const struct sk_buff *skb = _ctx->skb;
+
+	if (!skb)
+		return -ENODATA;
+
+	/* For locally generated packets ip_summed is set to
+	 * CHECKSUM_PARTIAL.
+	 */
+	*ip_summed = skb->ip_summed;
+	*cksum_meta = 0;
+
+	return 0;
+}
+
 static const struct net_device_ops veth_netdev_ops = {
 	.ndo_init            = veth_dev_init,
 	.ndo_open            = veth_open,
@@ -1718,6 +1737,7 @@ static const struct xdp_metadata_ops
veth_xdp_metadata_ops = {
 	.xmo_rx_timestamp		= veth_xdp_rx_timestamp,
 	.xmo_rx_hash			= veth_xdp_rx_hash,
 	.xmo_rx_vlan_tag		= veth_xdp_rx_vlan_tag,
+	.xmo_rx_checksum		= veth_xdp_rx_checksum,
 };

 #define VETH_FEATURES (NETIF_F_SG | NETIF_F_FRAGLIST |
NETIF_F_HW_CSUM | \

--
2.53.0
Reviewed-by: Aleksandr Loktionov <redacted>
@Aleksandr: veth implementation is quite different in v2 so I will
remove your Reviewed-by tag.
Can you please take a look to the new version when you have some free cycles?
Thanks in advance.

Regards,
Lorenzo

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help