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

Loktionov, Aleksandr aleksandr.loktionov at intel.com
Wed Feb 11 08:04:50 UTC 2026



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces at osuosl.org> On Behalf
> Of Lorenzo Bianconi
> Sent: Tuesday, February 10, 2026 6:22 PM
> To: Donald Hunter <donald.hunter at gmail.com>; Jakub Kicinski
> <kuba at kernel.org>; David S. Miller <davem at davemloft.net>; Eric Dumazet
> <edumazet at google.com>; Paolo Abeni <pabeni at redhat.com>; Simon Horman
> <horms at kernel.org>; Alexei Starovoitov <ast at kernel.org>; Daniel
> Borkmann <daniel at iogearbox.net>; Jesper Dangaard Brouer
> <hawk at kernel.org>; John Fastabend <john.fastabend at gmail.com>;
> Stanislav Fomichev <sdf at fomichev.me>; Andrew Lunn
> <andrew+netdev at lunn.ch>; Nguyen, Anthony L
> <anthony.l.nguyen at intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel at intel.com>; Lobakin, Aleksander
> <aleksander.lobakin at intel.com>; Andrii Nakryiko <andrii at kernel.org>;
> Martin KaFai Lau <martin.lau at linux.dev>; Eduard Zingerman
> <eddyz87 at gmail.com>; Song Liu <song at kernel.org>; Yonghong Song
> <yonghong.song at linux.dev>; KP Singh <kpsingh at kernel.org>; Hao Luo
> <haoluo at google.com>; Jiri Olsa <jolsa at kernel.org>; Shuah Khan
> <shuah at kernel.org>; Fijalkowski, Maciej <maciej.fijalkowski at intel.com>
> Cc: Jakub Sitnicki <jakub at cloudflare.com>; netdev at vger.kernel.org;
> bpf at vger.kernel.org; intel-wired-lan at lists.osuosl.org; linux-
> kselftest at vger.kernel.org; Lorenzo Bianconi <lorenzo at kernel.org>
> 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 at 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 <aleksandr.loktionov at intel.com>


More information about the Intel-wired-lan mailing list