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

bot+bpf-ci at kernel.org bot+bpf-ci at kernel.org
Tue Feb 10 17:54:57 UTC 2026


> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> --- 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;

Should cksum_meta return different values based on ip_summed?

The API documentation in net/core/xdp.c states that cksum_meta should contain:
- the hw computed checksum value for XDP_CHECKSUM_COMPLETE
- the csum_level for XDP_CHECKSUM_UNNECESSARY
- 0 for XDP_CHECKSUM_NONE and XDP_CHECKSUM_PARTIAL

The ice driver implementation in this same series handles these cases:

    switch (ip_summed) {
    case XDP_CHECKSUM_COMPLETE:
        *cksum_meta = csum_unfold(...);  /* hw computed checksum */
        break;
    case XDP_CHECKSUM_UNNECESSARY:
        if (tunnel)
            *cksum_meta = 1;  /* csum_level */
        break;
    default:
        *cksum_meta = 0;
        break;
    }

While veth typically handles locally generated packets (CHECKSUM_PARTIAL) or
packets with CHECKSUM_NONE, packets forwarded from other interfaces could have
CHECKSUM_COMPLETE or CHECKSUM_UNNECESSARY with csum_level > 0.

Would something like the following be more consistent with the API:

    switch (skb->ip_summed) {
    case CHECKSUM_COMPLETE:
        *cksum_meta = skb->csum;
        break;
    case CHECKSUM_UNNECESSARY:
        *cksum_meta = skb->csum_level;
        break;
    default:
        *cksum_meta = 0;
        break;
    }

> +
> +	return 0;
> +}

[ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21875603263

AI-authorship-score: low
AI-authorship-explanation: The commit follows established kernel patterns, has a concise commit message, and is authored by a known kernel contributor with extensive networking experience.
issues-found: 1
issue-severity-score: low
issue-severity-explanation: API inconsistency where cksum_meta always returns 0 instead of returning skb->csum for CHECKSUM_COMPLETE or skb->csum_level for CHECKSUM_UNNECESSARY as documented.


More information about the Intel-wired-lan mailing list