> -----Original Message-----
> From: Vladimir Vdovin <[email protected]>
> Sent: Wednesday, July 8, 2026 10:34 PM
> To: Lorenzo Bianconi <[email protected]>; Donald Hunter
> <[email protected]>; Jakub Kicinski <[email protected]>; David S .
> Miller <[email protected]>; Eric Dumazet <[email protected]>;
> Paolo Abeni <[email protected]>; Simon Horman <[email protected]>;
> Alexei Starovoitov <[email protected]>; Daniel Borkmann
> <[email protected]>; Jesper Dangaard Brouer <[email protected]>; John
> Fastabend <[email protected]>; Stanislav Fomichev
> <[email protected]>; Andrew Lunn <[email protected]>; Nguyen,
> Anthony L <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; Lobakin, Aleksander
> <[email protected]>; Andrii Nakryiko <[email protected]>;
> Martin KaFai Lau <[email protected]>; Eduard Zingerman
> <[email protected]>; Song Liu <[email protected]>; Yonghong Song
> <[email protected]>; KP Singh <[email protected]>; Hao Luo
> <[email protected]>; Jiri Olsa <[email protected]>; Shuah Khan
> <[email protected]>; Fijalkowski, Maciej <[email protected]>
> Cc: Jakub Sitnicki <[email protected]>; Loktionov, Aleksandr
> <[email protected]>; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; Vladimir Vdovin <[email protected]>
> Subject: [PATCH bpf-next v4 2/6] net: veth: Add xmo_rx_checksum
> callback to veth driver
> 
> From: Lorenzo Bianconi <[email protected]>
> 
> 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 <[email protected]>
> Signed-off-by: Vladimir Vdovin <[email protected]>
> ---
>  drivers/net/veth.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c index
> 1c5142149175..498d894d043d 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -1700,6 +1700,37 @@ 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, u8 *cksum_level)
> +{
> +     const struct veth_xdp_buff *_ctx = (void *)ctx;
> +     const struct sk_buff *skb = _ctx->skb;
> +
> +     if (!skb)
> +             return -ENODATA;
> +
> +     switch (skb->ip_summed) {
> +     case CHECKSUM_COMPLETE:
> +             *ip_summed = XDP_CHECKSUM_COMPLETE;
> +             *cksum = skb->csum;
> +             *cksum_level = 0;
> +             break;
> +     case CHECKSUM_UNNECESSARY:
> +             *ip_summed = XDP_CHECKSUM_UNNECESSARY;
> +             *cksum_level = skb->csum_level;
> +             *cksum = 0;
> +             break;
> +     default:
> +             *ip_summed = XDP_CHECKSUM_NONE;
> +             *cksum_level = 0;
> +             *cksum = 0;
> +             break;
> +     }
> +
> +     return 0;
> +}
> +
>  static const struct net_device_ops veth_netdev_ops = {
>       .ndo_init            = veth_dev_init,
>       .ndo_open            = veth_open,
> @@ -1725,6 +1756,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.47.0

Reviewed-by: Aleksandr Loktionov <[email protected]>

Reply via email to