Skip to content

Add the the capability to load HW RX checsum in eBPF programs#11052

Open
kernel-patches-daemon-bpf[bot] wants to merge 5 commits intobpf-next_basefrom
series/1053970=>bpf-next
Open

Add the the capability to load HW RX checsum in eBPF programs#11052
kernel-patches-daemon-bpf[bot] wants to merge 5 commits intobpf-next_basefrom
series/1053970=>bpf-next

Conversation

@kernel-patches-daemon-bpf
Copy link

Pull request for series with
subject: Add the the capability to load HW RX checsum in eBPF programs
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1053970

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 561085f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1053970
version: 2

@kernel-patches-review-bot
Copy link

commit 62409dc1970e8f75df71ca4a0e37440c48d3ba16
Author: Lorenzo Bianconi <lorenzo@kernel.org>

netlink: specs: Add XDP RX checksum capability to XDP metadata specs

This patch adds XDP RX checksum capability to the XDP metadata
infrastructure, introducing the bpf_xdp_metadata_rx_checksum() kfunc,
enum xdp_checksum, and the xmo_rx_checksum netdev callback.

> Moreover, introduce xmo_rx_checksum netdev callback in order allow the
> eBPF program bounded to the device to retrieve the RX checksum result

This isn't a bug, but "in order allow" should be "in order to allow",
and "bounded" should be "bound".

> diff --git a/net/core/xdp.c b/net/core/xdp.c
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c

[ ... ]

> +/**
> + * bpf_xdp_metadata_rx_checksum - Read XDP frame RX checksum.
> + * @ctx: XDP context pointer.
> + * @ip_summed: Return value pointer indicating checksum result.
> + * @cksum_meta: Return value pointer indicating checksum result metadata.
> + *
> + * In case of success, ``ip_summed`` is set to the RX checksum result. Possible
> + * values are:
> + * ``XDP_CHECKSUM_NONE``
> + * ``XDP_CHECKSUM_UNNECESSARY``
> + * ``XDP_CHECKSUM_COMPLETE``
> + *
> + * In case of success, ``cksum_meta`` contains the hw computed checksum value
> + * for ``XDP_CHECKSUM_COMPLETE`` or the ``csum_level`` for
> + * ``XDP_CHECKSUM_UNNECESSARY``. It is set to 0 for ``XDP_CHECKSUM_NONE``
> + *
> + * Return:
> + * * Returns 0 on success or ``-errno`` on error.
> + * * ``-EOPNOTSUPP`` : means device driver does not implement kfunc
> + * * ``-ENODATA``    : means no RX-timestamp available for this frame
                                      ^^^^^^^^^^^^

Should this say "RX-checksum" instead of "RX-timestamp"? This looks
like it was copied from bpf_xdp_metadata_rx_timestamp().

> + */
> +__bpf_kfunc int bpf_xdp_metadata_rx_checksum(const struct xdp_md *ctx,
> +					     enum xdp_checksum *ip_summed,
> +					     u32 *cksum_meta)
> +{
> +	return -EOPNOTSUPP;
> +}



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

In-Reply-To-Subject: netlink: specs: Add XDP RX checksum capability to XDP metadata specs
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21992879200

AI-authorship-score: low
AI-authorship-explanation: Grammar mistakes and copy-paste error in kdoc are characteristic of human authorship by a non-native English speaker; Lorenzo Bianconi is an established kernel contributor.
issues-found: 2
issue-severity-score: low
issue-severity-explanation: Both issues are documentation errors: a copy-paste error in the kdoc (-ENODATA description says RX-timestamp instead of RX-checksum) and commit message grammar mistakes; neither affects runtime behavior.

@kernel-patches-review-bot
Copy link

commit 2575749a24c12a529326767f6c56ffbaa255e638
Author: Lorenzo Bianconi <lorenzo@kernel.org>

net: veth: Add xmo_rx_checksum callback to veth driver

Adds the xmo_rx_checksum XDP metadata callback to the veth driver,
translating skb checksum state into enum xdp_checksum values for
eBPF programs.

> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 9982412fd7f2..3ec77599299a 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -1697,6 +1697,35 @@ 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;
> +
> +	*ip_summed = skb->ip_summed;

Is this assignment needed? Every branch in the switch below overwrites
*ip_summed, so this line has no effect. It looks like a leftover from v1
where the raw skb->ip_summed was the intended output value.

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

[ ... ]



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

In-Reply-To-Subject: net: veth: Add xmo_rx_checksum callback to veth driver
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21992879200

AI-authorship-score: low
AI-authorship-explanation: Multiple version iterations over months with incremental refinements, a non-native English typo, and a refactoring leftover are all characteristic of human development.
issues-found: 1
issue-severity-score: low
issue-severity-explanation: Dead code assignment from v1 refactoring leftover has no functional impact but is unnecessary.

@kernel-patches-review-bot
Copy link

commit 46a9e252f458a204c9c8ce143fcef4cfde25a702
Author: Lorenzo Bianconi <lorenzo@kernel.org>

net: ice: Add xmo_rx_checksum callback

Adds the xmo_rx_checksum XDP metadata callback to the ice driver,
refactoring the existing checksum logic into a shared ice_get_rx_csum()
helper used by both the SKB and XDP paths.

> Implement xmo_rx_checksum callback in ice driver to report RX checksum
> result to the eBPF program bounded to the NIC.
> Introduce ice_get_rx_csum utility routine in order to rx cksum codebase
> available in ice_rx_csum().

This isn't a bug, but the second sentence appears to have missing words.
Should it read something like "in order to make the rx checksum code
reusable from ice_rx_csum()"?



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

In-Reply-To-Subject: net: ice: Add xmo_rx_checksum callback
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21992879200

AI-authorship-score: low
AI-authorship-explanation: Garbled commit message sentence and non-native English errors are characteristic of human authorship; AI tools typically produce grammatically correct output.
issues-found: 1
issue-severity-score: low
issue-severity-explanation: The only issue found is a garbled sentence in the commit message; no functional code regressions were identified.

@kernel-patches-daemon-bpf
Copy link
Author

@kernel-patches-daemon-bpf
Copy link
Author

@kernel-patches-daemon-bpf
Copy link
Author

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: f632de6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1053970
version: 2

Introduce XDP RX checksum capability to XDP metadata specs. XDP RX
checksum will be use by devices capable of exposing receive checksum
result via bpf_xdp_metadata_rx_checksum().
Moreover, introduce xmo_rx_checksum netdev callback in order allow the
eBPF program bounded to the device to retrieve the RX checksum result
computed by the hw NIC.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Implement xmo_rx_checksum callback in veth driver to report RX checksum
result to the eBPF program bounded to the veth device.

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Implement xmo_rx_checksum callback in ice driver to report RX checksum
result to the eBPF program bounded to the NIC.
Introduce ice_get_rx_csum utility routine in order to rx cksum codebase
available in ice_rx_csum().

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Introduce support to xdp_metadata selftest for bpf_xdp_metadata_rx_checksum
kfunc.

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
…adat prog

Introduce the capability to dump HW rx checksum in xdp_hw_metadata
program via bpf_xdp_metadata_rx_checksum() kfunc.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 4c51f90
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1053970
version: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant