* [PATCH bpf-next 1/5] netlink: specs: Add XDP RX checksum capability to XDP metadata specs
2026-02-10 17:21 [PATCH bpf-next 0/5] Add the the capability to load HW RX checsum in eBPF programs Lorenzo Bianconi
@ 2026-02-10 17:21 ` Lorenzo Bianconi
2026-02-10 17:54 ` bot+bpf-ci
2026-02-13 5:18 ` Stanislav Fomichev
2026-02-10 17:21 ` [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver Lorenzo Bianconi
` (3 subsequent siblings)
4 siblings, 2 replies; 17+ messages in thread
From: Lorenzo Bianconi @ 2026-02-10 17:21 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrew Lunn, Tony Nguyen, Przemek Kitszel, Alexander Lobakin,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, Shuah Khan,
Maciej Fijalkowski
Cc: Jakub Sitnicki, netdev, bpf, intel-wired-lan, linux-kselftest,
Lorenzo Bianconi
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>
---
Documentation/netlink/specs/netdev.yaml | 5 +++++
include/net/xdp.h | 14 ++++++++++++++
include/uapi/linux/netdev.h | 3 +++
net/core/xdp.c | 29 +++++++++++++++++++++++++++++
tools/include/uapi/linux/netdev.h | 3 +++
5 files changed, 54 insertions(+)
diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
index 596c306ce52b8303b20680ff0cd34d4fd9db0e48..58eda634668a07860447a65d9fc2284839af6244 100644
--- a/Documentation/netlink/specs/netdev.yaml
+++ b/Documentation/netlink/specs/netdev.yaml
@@ -61,6 +61,11 @@ definitions:
doc: |
Device is capable of exposing receive packet VLAN tag via
bpf_xdp_metadata_rx_vlan_tag().
+ -
+ name: checksum
+ doc: |
+ Device is capable of exposing receive checksum result via
+ bpf_xdp_metadata_rx_checksum().
-
type: flags
name: xsk-flags
diff --git a/include/net/xdp.h b/include/net/xdp.h
index aa742f413c358575396530879af4570dc3fc18de..9ab9ac10ae2074b70618a9d4f32544d8b9a30b63 100644
--- a/include/net/xdp.h
+++ b/include/net/xdp.h
@@ -586,6 +586,10 @@ void xdp_attachment_setup(struct xdp_attachment_info *info,
NETDEV_XDP_RX_METADATA_VLAN_TAG, \
bpf_xdp_metadata_rx_vlan_tag, \
xmo_rx_vlan_tag) \
+ XDP_METADATA_KFUNC(XDP_METADATA_KFUNC_RX_CHECKSUM, \
+ NETDEV_XDP_RX_METADATA_CHECKSUM, \
+ bpf_xdp_metadata_rx_checksum, \
+ xmo_rx_checksum)
enum xdp_rx_metadata {
#define XDP_METADATA_KFUNC(name, _, __, ___) name,
@@ -643,12 +647,22 @@ enum xdp_rss_hash_type {
XDP_RSS_TYPE_L4_IPV6_SCTP_EX = XDP_RSS_TYPE_L4_IPV6_SCTP | XDP_RSS_L3_DYNHDR,
};
+enum xdp_checksum {
+ XDP_CHECKSUM_NONE = CHECKSUM_NONE,
+ XDP_CHECKSUM_UNNECESSARY = CHECKSUM_UNNECESSARY,
+ XDP_CHECKSUM_COMPLETE = CHECKSUM_COMPLETE,
+ XDP_CHECKSUM_PARTIAL = CHECKSUM_PARTIAL,
+};
+
struct xdp_metadata_ops {
int (*xmo_rx_timestamp)(const struct xdp_md *ctx, u64 *timestamp);
int (*xmo_rx_hash)(const struct xdp_md *ctx, u32 *hash,
enum xdp_rss_hash_type *rss_type);
int (*xmo_rx_vlan_tag)(const struct xdp_md *ctx, __be16 *vlan_proto,
u16 *vlan_tci);
+ int (*xmo_rx_checksum)(const struct xdp_md *ctx,
+ enum xdp_checksum *ip_summed,
+ u32 *cksum_meta);
};
#ifdef CONFIG_NET
diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
index e0b579a1df4f2126acec6c44c299e97bbbefe640..d20da430cfd57bc26b5ea2f406c27b48d8a81693 100644
--- a/include/uapi/linux/netdev.h
+++ b/include/uapi/linux/netdev.h
@@ -47,11 +47,14 @@ enum netdev_xdp_act {
* hash via bpf_xdp_metadata_rx_hash().
* @NETDEV_XDP_RX_METADATA_VLAN_TAG: Device is capable of exposing receive
* packet VLAN tag via bpf_xdp_metadata_rx_vlan_tag().
+ * @NETDEV_XDP_RX_METADATA_CHECKSUM: Device is capable of exposing receive
+ * checksum result via bpf_xdp_metadata_rx_checksum().
*/
enum netdev_xdp_rx_metadata {
NETDEV_XDP_RX_METADATA_TIMESTAMP = 1,
NETDEV_XDP_RX_METADATA_HASH = 2,
NETDEV_XDP_RX_METADATA_VLAN_TAG = 4,
+ NETDEV_XDP_RX_METADATA_CHECKSUM = 8,
};
/**
diff --git a/net/core/xdp.c b/net/core/xdp.c
index fee6d080ee85fc2d278bfdddfd1365633058ec06..e51346ad3031f28d11c11f8205da6cd954da82de 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -961,6 +961,35 @@ __bpf_kfunc int bpf_xdp_metadata_rx_vlan_tag(const struct xdp_md *ctx,
return -EOPNOTSUPP;
}
+/**
+ * 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``
+ * ``XDP_CHECKSUM_PARTIAL``
+ *
+ * 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`` and
+ * ``XDP_CHECKSUM_PARTIAL``.
+ *
+ * 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
+ */
+__bpf_kfunc int bpf_xdp_metadata_rx_checksum(const struct xdp_md *ctx,
+ u8 *ip_summed, u32 *cksum_meta)
+{
+ return -EOPNOTSUPP;
+}
+
__bpf_kfunc_end_defs();
BTF_KFUNCS_START(xdp_metadata_kfunc_ids)
diff --git a/tools/include/uapi/linux/netdev.h b/tools/include/uapi/linux/netdev.h
index e0b579a1df4f2126acec6c44c299e97bbbefe640..d20da430cfd57bc26b5ea2f406c27b48d8a81693 100644
--- a/tools/include/uapi/linux/netdev.h
+++ b/tools/include/uapi/linux/netdev.h
@@ -47,11 +47,14 @@ enum netdev_xdp_act {
* hash via bpf_xdp_metadata_rx_hash().
* @NETDEV_XDP_RX_METADATA_VLAN_TAG: Device is capable of exposing receive
* packet VLAN tag via bpf_xdp_metadata_rx_vlan_tag().
+ * @NETDEV_XDP_RX_METADATA_CHECKSUM: Device is capable of exposing receive
+ * checksum result via bpf_xdp_metadata_rx_checksum().
*/
enum netdev_xdp_rx_metadata {
NETDEV_XDP_RX_METADATA_TIMESTAMP = 1,
NETDEV_XDP_RX_METADATA_HASH = 2,
NETDEV_XDP_RX_METADATA_VLAN_TAG = 4,
+ NETDEV_XDP_RX_METADATA_CHECKSUM = 8,
};
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH bpf-next 1/5] netlink: specs: Add XDP RX checksum capability to XDP metadata specs
2026-02-10 17:21 ` [PATCH bpf-next 1/5] netlink: specs: Add XDP RX checksum capability to XDP metadata specs Lorenzo Bianconi
@ 2026-02-10 17:54 ` bot+bpf-ci
2026-02-13 5:18 ` Stanislav Fomichev
1 sibling, 0 replies; 17+ messages in thread
From: bot+bpf-ci @ 2026-02-10 17:54 UTC (permalink / raw)
To: lorenzo, donald.hunter, kuba, davem, edumazet, pabeni, horms, ast,
daniel, hawk, john.fastabend, sdf, andrew+netdev,
anthony.l.nguyen, przemyslaw.kitszel, aleksander.lobakin, andrii,
martin.lau, eddyz87, song, yonghong.song, kpsingh, haoluo, jolsa,
shuah, maciej.fijalkowski
Cc: jakub, netdev, bpf, intel-wired-lan, linux-kselftest, lorenzo,
ast, andrii, daniel, martin.lau, eddyz87, yonghong.song, clm,
ihor.solodrai
[-- Attachment #1: Type: text/plain, Size: 2758 bytes --]
> diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
> index 330ece2eabdb..dc62d572e3ac 100644
> --- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
> +++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
> @@ -110,6 +110,13 @@ int rx(struct xdp_md *ctx)
> else
> meta->hint_valid |= XDP_META_FIELD_VLAN_TAG;
>
> + err = bpf_xdp_metadata_rx_checksum(ctx, &meta->ip_summed,
> + &meta->cksum_meta);
This call to bpf_xdp_metadata_rx_checksum() appears to be missing its extern
declaration. The other kfuncs in this file have declarations like:
extern int bpf_xdp_metadata_rx_timestamp(const struct xdp_md *ctx,
__u64 *timestamp) __ksym;
extern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, __u32 *hash,
enum xdp_rss_hash_type *rss_type) __ksym;
extern int bpf_xdp_metadata_rx_vlan_tag(const struct xdp_md *ctx,
__be16 *vlan_proto,
__u16 *vlan_tci) __ksym;
Should there be a corresponding declaration for bpf_xdp_metadata_rx_checksum?
> + if (err)
> + meta->rx_cksum_err = err;
> + else
> + meta->hint_valid |= XDP_META_FIELD_CHECKSUM;
> +
> __sync_add_and_fetch(&pkts_redir, 1);
> return bpf_redirect_map(&xsk, ctx->rx_queue_index, XDP_PASS);
> }
> diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c
[ ... ]
> @@ -254,6 +277,11 @@ static void verify_xdp_metadata(void *data, clockid_t clock_id)
> printf("No rx_vlan_tci or rx_vlan_proto, err=%d\n",
> meta->rx_vlan_tag_err);
> }
> +
> + if (meta->hint_valid & XDP_META_FIELD_CHECKSUM)
> + print_rx_cksum(meta->ip_summed, meta->cksum_meta);
> + else
> + printf("No rx_chsum, err=%d\n", meta->rx_cksum_err);
^^^^^^
Minor typo: "rx_chsum" should be "rx_cksum" to match the variable naming
(rx_cksum_err) and be consistent with other similar messages.
---
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 is from an established kernel maintainer and follows existing code patterns, with the errors being typical human oversights (missing declaration, typo) rather than AI-generated issues.
issues-found: 2
issue-severity-score: medium
issue-severity-explanation: Missing extern declaration for kfunc will cause compilation failure of the BPF selftest program, plus a minor typo in error output.
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH bpf-next 1/5] netlink: specs: Add XDP RX checksum capability to XDP metadata specs
2026-02-10 17:21 ` [PATCH bpf-next 1/5] netlink: specs: Add XDP RX checksum capability to XDP metadata specs Lorenzo Bianconi
2026-02-10 17:54 ` bot+bpf-ci
@ 2026-02-13 5:18 ` Stanislav Fomichev
2026-02-13 10:40 ` Lorenzo Bianconi
1 sibling, 1 reply; 17+ messages in thread
From: Stanislav Fomichev @ 2026-02-13 5:18 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrew Lunn, Tony Nguyen, Przemek Kitszel, Alexander Lobakin,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, Shuah Khan,
Maciej Fijalkowski, Jakub Sitnicki, netdev, bpf, intel-wired-lan,
linux-kselftest
On 02/10, Lorenzo Bianconi wrote:
> 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>
> ---
> Documentation/netlink/specs/netdev.yaml | 5 +++++
> include/net/xdp.h | 14 ++++++++++++++
> include/uapi/linux/netdev.h | 3 +++
> net/core/xdp.c | 29 +++++++++++++++++++++++++++++
> tools/include/uapi/linux/netdev.h | 3 +++
> 5 files changed, 54 insertions(+)
>
> diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
> index 596c306ce52b8303b20680ff0cd34d4fd9db0e48..58eda634668a07860447a65d9fc2284839af6244 100644
> --- a/Documentation/netlink/specs/netdev.yaml
> +++ b/Documentation/netlink/specs/netdev.yaml
> @@ -61,6 +61,11 @@ definitions:
> doc: |
> Device is capable of exposing receive packet VLAN tag via
> bpf_xdp_metadata_rx_vlan_tag().
> + -
> + name: checksum
> + doc: |
> + Device is capable of exposing receive checksum result via
> + bpf_xdp_metadata_rx_checksum().
> -
> type: flags
> name: xsk-flags
> diff --git a/include/net/xdp.h b/include/net/xdp.h
> index aa742f413c358575396530879af4570dc3fc18de..9ab9ac10ae2074b70618a9d4f32544d8b9a30b63 100644
> --- a/include/net/xdp.h
> +++ b/include/net/xdp.h
> @@ -586,6 +586,10 @@ void xdp_attachment_setup(struct xdp_attachment_info *info,
> NETDEV_XDP_RX_METADATA_VLAN_TAG, \
> bpf_xdp_metadata_rx_vlan_tag, \
> xmo_rx_vlan_tag) \
> + XDP_METADATA_KFUNC(XDP_METADATA_KFUNC_RX_CHECKSUM, \
> + NETDEV_XDP_RX_METADATA_CHECKSUM, \
> + bpf_xdp_metadata_rx_checksum, \
> + xmo_rx_checksum)
>
> enum xdp_rx_metadata {
> #define XDP_METADATA_KFUNC(name, _, __, ___) name,
> @@ -643,12 +647,22 @@ enum xdp_rss_hash_type {
> XDP_RSS_TYPE_L4_IPV6_SCTP_EX = XDP_RSS_TYPE_L4_IPV6_SCTP | XDP_RSS_L3_DYNHDR,
> };
>
> +enum xdp_checksum {
> + XDP_CHECKSUM_NONE = CHECKSUM_NONE,
> + XDP_CHECKSUM_UNNECESSARY = CHECKSUM_UNNECESSARY,
> + XDP_CHECKSUM_COMPLETE = CHECKSUM_COMPLETE,
> + XDP_CHECKSUM_PARTIAL = CHECKSUM_PARTIAL,
> +};
> +
> struct xdp_metadata_ops {
> int (*xmo_rx_timestamp)(const struct xdp_md *ctx, u64 *timestamp);
> int (*xmo_rx_hash)(const struct xdp_md *ctx, u32 *hash,
> enum xdp_rss_hash_type *rss_type);
> int (*xmo_rx_vlan_tag)(const struct xdp_md *ctx, __be16 *vlan_proto,
> u16 *vlan_tci);
> + int (*xmo_rx_checksum)(const struct xdp_md *ctx,
> + enum xdp_checksum *ip_summed,
> + u32 *cksum_meta);
> };
>
> #ifdef CONFIG_NET
> diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> index e0b579a1df4f2126acec6c44c299e97bbbefe640..d20da430cfd57bc26b5ea2f406c27b48d8a81693 100644
> --- a/include/uapi/linux/netdev.h
> +++ b/include/uapi/linux/netdev.h
> @@ -47,11 +47,14 @@ enum netdev_xdp_act {
> * hash via bpf_xdp_metadata_rx_hash().
> * @NETDEV_XDP_RX_METADATA_VLAN_TAG: Device is capable of exposing receive
> * packet VLAN tag via bpf_xdp_metadata_rx_vlan_tag().
> + * @NETDEV_XDP_RX_METADATA_CHECKSUM: Device is capable of exposing receive
> + * checksum result via bpf_xdp_metadata_rx_checksum().
> */
> enum netdev_xdp_rx_metadata {
> NETDEV_XDP_RX_METADATA_TIMESTAMP = 1,
> NETDEV_XDP_RX_METADATA_HASH = 2,
> NETDEV_XDP_RX_METADATA_VLAN_TAG = 4,
> + NETDEV_XDP_RX_METADATA_CHECKSUM = 8,
> };
>
> /**
> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index fee6d080ee85fc2d278bfdddfd1365633058ec06..e51346ad3031f28d11c11f8205da6cd954da82de 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -961,6 +961,35 @@ __bpf_kfunc int bpf_xdp_metadata_rx_vlan_tag(const struct xdp_md *ctx,
> return -EOPNOTSUPP;
> }
>
> +/**
> + * 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``
> + * ``XDP_CHECKSUM_PARTIAL``
> + *
> + * 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`` and
> + * ``XDP_CHECKSUM_PARTIAL``.
> + *
> + * 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
> + */
> +__bpf_kfunc int bpf_xdp_metadata_rx_checksum(const struct xdp_md *ctx,
> + u8 *ip_summed, u32 *cksum_meta)
> +{
Any reason not to do enum xdp_checksum *ip_summed here as well?
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH bpf-next 1/5] netlink: specs: Add XDP RX checksum capability to XDP metadata specs
2026-02-13 5:18 ` Stanislav Fomichev
@ 2026-02-13 10:40 ` Lorenzo Bianconi
0 siblings, 0 replies; 17+ messages in thread
From: Lorenzo Bianconi @ 2026-02-13 10:40 UTC (permalink / raw)
To: Stanislav Fomichev
Cc: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrew Lunn, Tony Nguyen, Przemek Kitszel, Alexander Lobakin,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, Shuah Khan,
Maciej Fijalkowski, Jakub Sitnicki, netdev, bpf, intel-wired-lan,
linux-kselftest
[-- Attachment #1: Type: text/plain, Size: 5712 bytes --]
On Feb 12, Stanislav Fomichev wrote:
> On 02/10, Lorenzo Bianconi wrote:
> > 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>
> > ---
> > Documentation/netlink/specs/netdev.yaml | 5 +++++
> > include/net/xdp.h | 14 ++++++++++++++
> > include/uapi/linux/netdev.h | 3 +++
> > net/core/xdp.c | 29 +++++++++++++++++++++++++++++
> > tools/include/uapi/linux/netdev.h | 3 +++
> > 5 files changed, 54 insertions(+)
> >
> > diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml
> > index 596c306ce52b8303b20680ff0cd34d4fd9db0e48..58eda634668a07860447a65d9fc2284839af6244 100644
> > --- a/Documentation/netlink/specs/netdev.yaml
> > +++ b/Documentation/netlink/specs/netdev.yaml
> > @@ -61,6 +61,11 @@ definitions:
> > doc: |
> > Device is capable of exposing receive packet VLAN tag via
> > bpf_xdp_metadata_rx_vlan_tag().
> > + -
> > + name: checksum
> > + doc: |
> > + Device is capable of exposing receive checksum result via
> > + bpf_xdp_metadata_rx_checksum().
> > -
> > type: flags
> > name: xsk-flags
> > diff --git a/include/net/xdp.h b/include/net/xdp.h
> > index aa742f413c358575396530879af4570dc3fc18de..9ab9ac10ae2074b70618a9d4f32544d8b9a30b63 100644
> > --- a/include/net/xdp.h
> > +++ b/include/net/xdp.h
> > @@ -586,6 +586,10 @@ void xdp_attachment_setup(struct xdp_attachment_info *info,
> > NETDEV_XDP_RX_METADATA_VLAN_TAG, \
> > bpf_xdp_metadata_rx_vlan_tag, \
> > xmo_rx_vlan_tag) \
> > + XDP_METADATA_KFUNC(XDP_METADATA_KFUNC_RX_CHECKSUM, \
> > + NETDEV_XDP_RX_METADATA_CHECKSUM, \
> > + bpf_xdp_metadata_rx_checksum, \
> > + xmo_rx_checksum)
> >
> > enum xdp_rx_metadata {
> > #define XDP_METADATA_KFUNC(name, _, __, ___) name,
> > @@ -643,12 +647,22 @@ enum xdp_rss_hash_type {
> > XDP_RSS_TYPE_L4_IPV6_SCTP_EX = XDP_RSS_TYPE_L4_IPV6_SCTP | XDP_RSS_L3_DYNHDR,
> > };
> >
> > +enum xdp_checksum {
> > + XDP_CHECKSUM_NONE = CHECKSUM_NONE,
> > + XDP_CHECKSUM_UNNECESSARY = CHECKSUM_UNNECESSARY,
> > + XDP_CHECKSUM_COMPLETE = CHECKSUM_COMPLETE,
> > + XDP_CHECKSUM_PARTIAL = CHECKSUM_PARTIAL,
> > +};
> > +
> > struct xdp_metadata_ops {
> > int (*xmo_rx_timestamp)(const struct xdp_md *ctx, u64 *timestamp);
> > int (*xmo_rx_hash)(const struct xdp_md *ctx, u32 *hash,
> > enum xdp_rss_hash_type *rss_type);
> > int (*xmo_rx_vlan_tag)(const struct xdp_md *ctx, __be16 *vlan_proto,
> > u16 *vlan_tci);
> > + int (*xmo_rx_checksum)(const struct xdp_md *ctx,
> > + enum xdp_checksum *ip_summed,
> > + u32 *cksum_meta);
> > };
> >
> > #ifdef CONFIG_NET
> > diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> > index e0b579a1df4f2126acec6c44c299e97bbbefe640..d20da430cfd57bc26b5ea2f406c27b48d8a81693 100644
> > --- a/include/uapi/linux/netdev.h
> > +++ b/include/uapi/linux/netdev.h
> > @@ -47,11 +47,14 @@ enum netdev_xdp_act {
> > * hash via bpf_xdp_metadata_rx_hash().
> > * @NETDEV_XDP_RX_METADATA_VLAN_TAG: Device is capable of exposing receive
> > * packet VLAN tag via bpf_xdp_metadata_rx_vlan_tag().
> > + * @NETDEV_XDP_RX_METADATA_CHECKSUM: Device is capable of exposing receive
> > + * checksum result via bpf_xdp_metadata_rx_checksum().
> > */
> > enum netdev_xdp_rx_metadata {
> > NETDEV_XDP_RX_METADATA_TIMESTAMP = 1,
> > NETDEV_XDP_RX_METADATA_HASH = 2,
> > NETDEV_XDP_RX_METADATA_VLAN_TAG = 4,
> > + NETDEV_XDP_RX_METADATA_CHECKSUM = 8,
> > };
> >
> > /**
> > diff --git a/net/core/xdp.c b/net/core/xdp.c
> > index fee6d080ee85fc2d278bfdddfd1365633058ec06..e51346ad3031f28d11c11f8205da6cd954da82de 100644
> > --- a/net/core/xdp.c
> > +++ b/net/core/xdp.c
> > @@ -961,6 +961,35 @@ __bpf_kfunc int bpf_xdp_metadata_rx_vlan_tag(const struct xdp_md *ctx,
> > return -EOPNOTSUPP;
> > }
> >
> > +/**
> > + * 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``
> > + * ``XDP_CHECKSUM_PARTIAL``
> > + *
> > + * 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`` and
> > + * ``XDP_CHECKSUM_PARTIAL``.
> > + *
> > + * 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
> > + */
> > +__bpf_kfunc int bpf_xdp_metadata_rx_checksum(const struct xdp_md *ctx,
> > + u8 *ip_summed, u32 *cksum_meta)
> > +{
>
> Any reason not to do enum xdp_checksum *ip_summed here as well?
ack, I will fix it in v2.
Regards,
Lorenzo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver
2026-02-10 17:21 [PATCH bpf-next 0/5] Add the the capability to load HW RX checsum in eBPF programs Lorenzo Bianconi
2026-02-10 17:21 ` [PATCH bpf-next 1/5] netlink: specs: Add XDP RX checksum capability to XDP metadata specs Lorenzo Bianconi
@ 2026-02-10 17:21 ` Lorenzo Bianconi
2026-02-10 17:54 ` bot+bpf-ci
2026-02-11 8:04 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-02-10 17:21 ` [PATCH bpf-next 3/5] net: ice: Add xmo_rx_checksum callback Lorenzo Bianconi
` (2 subsequent siblings)
4 siblings, 2 replies; 17+ messages in thread
From: Lorenzo Bianconi @ 2026-02-10 17:21 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrew Lunn, Tony Nguyen, Przemek Kitszel, Alexander Lobakin,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, Shuah Khan,
Maciej Fijalkowski
Cc: Jakub Sitnicki, netdev, bpf, intel-wired-lan, linux-kselftest,
Lorenzo Bianconi
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..38b70ad62db7e92cccc6c6c9ed1f5573d8baf48b 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
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver
2026-02-10 17:21 ` [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver Lorenzo Bianconi
@ 2026-02-10 17:54 ` bot+bpf-ci
2026-02-11 8:04 ` [Intel-wired-lan] " Loktionov, Aleksandr
1 sibling, 0 replies; 17+ messages in thread
From: bot+bpf-ci @ 2026-02-10 17:54 UTC (permalink / raw)
To: lorenzo, donald.hunter, kuba, davem, edumazet, pabeni, horms, ast,
daniel, hawk, john.fastabend, sdf, andrew+netdev,
anthony.l.nguyen, przemyslaw.kitszel, aleksander.lobakin, andrii,
martin.lau, eddyz87, song, yonghong.song, kpsingh, haoluo, jolsa,
shuah, maciej.fijalkowski
Cc: jakub, netdev, bpf, intel-wired-lan, linux-kselftest, lorenzo,
ast, andrii, daniel, martin.lau, eddyz87, yonghong.song, clm,
ihor.solodrai
[-- Attachment #1: Type: text/plain, Size: 2597 bytes --]
> 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.
^ permalink raw reply [flat|nested] 17+ messages in thread* RE: [Intel-wired-lan] [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver
2026-02-10 17:21 ` [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver Lorenzo Bianconi
2026-02-10 17:54 ` bot+bpf-ci
@ 2026-02-11 8:04 ` Loktionov, Aleksandr
2026-02-13 15:22 ` Lorenzo Bianconi
1 sibling, 1 reply; 17+ messages in thread
From: Loktionov, Aleksandr @ 2026-02-11 8:04 UTC (permalink / raw)
To: Lorenzo Bianconi, Donald Hunter, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Stanislav Fomichev, Andrew Lunn, Nguyen, Anthony L,
Kitszel, Przemyslaw, Lobakin, Aleksander, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
KP Singh, Hao Luo, Jiri Olsa, Shuah Khan, Fijalkowski, Maciej
Cc: Jakub Sitnicki, netdev@vger.kernel.org, bpf@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Lorenzo Bianconi
> Sent: Tuesday, February 10, 2026 6:22 PM
> To: Donald Hunter <donald.hunter@gmail.com>; Jakub Kicinski
> <kuba@kernel.org>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Paolo Abeni <pabeni@redhat.com>; Simon Horman
> <horms@kernel.org>; Alexei Starovoitov <ast@kernel.org>; Daniel
> Borkmann <daniel@iogearbox.net>; Jesper Dangaard Brouer
> <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>;
> Stanislav Fomichev <sdf@fomichev.me>; Andrew Lunn
> <andrew+netdev@lunn.ch>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Lobakin, Aleksander
> <aleksander.lobakin@intel.com>; Andrii Nakryiko <andrii@kernel.org>;
> Martin KaFai Lau <martin.lau@linux.dev>; Eduard Zingerman
> <eddyz87@gmail.com>; Song Liu <song@kernel.org>; Yonghong Song
> <yonghong.song@linux.dev>; KP Singh <kpsingh@kernel.org>; Hao Luo
> <haoluo@google.com>; Jiri Olsa <jolsa@kernel.org>; Shuah Khan
> <shuah@kernel.org>; Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> 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 <lorenzo@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@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@intel.com>
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [Intel-wired-lan] [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver
2026-02-11 8:04 ` [Intel-wired-lan] " Loktionov, Aleksandr
@ 2026-02-13 15:22 ` Lorenzo Bianconi
0 siblings, 0 replies; 17+ messages in thread
From: Lorenzo Bianconi @ 2026-02-13 15:22 UTC (permalink / raw)
To: Loktionov, Aleksandr
Cc: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrew Lunn, Nguyen, Anthony L, Kitszel, Przemyslaw,
Lobakin, Aleksander, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, Shuah Khan, Fijalkowski, Maciej, Jakub Sitnicki,
netdev@vger.kernel.org, bpf@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 3580 bytes --]
>
>
> > -----Original Message-----
> > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> > Of Lorenzo Bianconi
> > Sent: Tuesday, February 10, 2026 6:22 PM
> > To: Donald Hunter <donald.hunter@gmail.com>; Jakub Kicinski
> > <kuba@kernel.org>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> > <edumazet@google.com>; Paolo Abeni <pabeni@redhat.com>; Simon Horman
> > <horms@kernel.org>; Alexei Starovoitov <ast@kernel.org>; Daniel
> > Borkmann <daniel@iogearbox.net>; Jesper Dangaard Brouer
> > <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>;
> > Stanislav Fomichev <sdf@fomichev.me>; Andrew Lunn
> > <andrew+netdev@lunn.ch>; Nguyen, Anthony L
> > <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> > <przemyslaw.kitszel@intel.com>; Lobakin, Aleksander
> > <aleksander.lobakin@intel.com>; Andrii Nakryiko <andrii@kernel.org>;
> > Martin KaFai Lau <martin.lau@linux.dev>; Eduard Zingerman
> > <eddyz87@gmail.com>; Song Liu <song@kernel.org>; Yonghong Song
> > <yonghong.song@linux.dev>; KP Singh <kpsingh@kernel.org>; Hao Luo
> > <haoluo@google.com>; Jiri Olsa <jolsa@kernel.org>; Shuah Khan
> > <shuah@kernel.org>; Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> > 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 <lorenzo@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@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@intel.com>
@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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH bpf-next 3/5] net: ice: Add xmo_rx_checksum callback
2026-02-10 17:21 [PATCH bpf-next 0/5] Add the the capability to load HW RX checsum in eBPF programs Lorenzo Bianconi
2026-02-10 17:21 ` [PATCH bpf-next 1/5] netlink: specs: Add XDP RX checksum capability to XDP metadata specs Lorenzo Bianconi
2026-02-10 17:21 ` [PATCH bpf-next 2/5] net: veth: Add xmo_rx_checksum callback to veth driver Lorenzo Bianconi
@ 2026-02-10 17:21 ` Lorenzo Bianconi
2026-02-10 17:54 ` bot+bpf-ci
2026-02-11 6:07 ` [Intel-wired-lan] " kernel test robot
2026-02-10 17:21 ` [PATCH bpf-next 4/5] selftests/bpf: Add selftest support for bpf_xdp_metadata_rx_checksum Lorenzo Bianconi
2026-02-10 17:21 ` [PATCH bpf-next 5/5] selftests/bpf: Add bpf_xdp_metadata_rx_checksum support to xdp_hw_metadat prog Lorenzo Bianconi
4 siblings, 2 replies; 17+ messages in thread
From: Lorenzo Bianconi @ 2026-02-10 17:21 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrew Lunn, Tony Nguyen, Przemek Kitszel, Alexander Lobakin,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, Shuah Khan,
Maciej Fijalkowski
Cc: Jakub Sitnicki, netdev, bpf, intel-wired-lan, linux-kselftest,
Lorenzo Bianconi
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>
---
drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 114 +++++++++++++++++---------
1 file changed, 74 insertions(+), 40 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
index 956da38d63b0032db238325dcff818bbd99478e9..508ef4b07a3b3a9816be760c08c81c3f569456a3 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
@@ -81,69 +81,45 @@ ice_rx_hash_to_skb(const struct ice_rx_ring *rx_ring,
libeth_rx_pt_set_hash(skb, hash, decoded);
}
-/**
- * ice_rx_gcs - Set generic checksum in skb
- * @skb: skb currently being received and modified
- * @rx_desc: receive descriptor
- */
-static void ice_rx_gcs(struct sk_buff *skb,
- const union ice_32b_rx_flex_desc *rx_desc)
-{
- const struct ice_32b_rx_flex_desc_nic *desc;
- u16 csum;
-
- desc = (struct ice_32b_rx_flex_desc_nic *)rx_desc;
- skb->ip_summed = CHECKSUM_COMPLETE;
- csum = (__force u16)desc->raw_csum;
- skb->csum = csum_unfold((__force __sum16)swab16(csum));
-}
-
-/**
- * ice_rx_csum - Indicate in skb if checksum is good
- * @ring: the ring we care about
- * @skb: skb currently being received and modified
- * @rx_desc: the receive descriptor
- * @ptype: the packet type decoded by hardware
- *
- * skb->protocol must be set before this function is called
- */
static void
-ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb,
- union ice_32b_rx_flex_desc *rx_desc, u16 ptype)
+ice_get_rx_csum(const union ice_32b_rx_flex_desc *rx_desc, u16 ptype,
+ struct ice_rx_ring *ring, enum xdp_checksum *ip_summed,
+ u32 *cksum_meta)
{
- struct libeth_rx_pt decoded;
+ struct libeth_rx_pt decoded = libie_rx_pt_parse(ptype);
u16 rx_status0, rx_status1;
bool ipv4, ipv6;
- /* Start with CHECKSUM_NONE and by default csum_level = 0 */
- skb->ip_summed = CHECKSUM_NONE;
-
- decoded = libie_rx_pt_parse(ptype);
if (!libeth_rx_pt_has_checksum(ring->netdev, decoded))
- return;
+ goto checksum_none;
rx_status0 = le16_to_cpu(rx_desc->wb.status_error0);
rx_status1 = le16_to_cpu(rx_desc->wb.status_error1);
-
if ((ring->flags & ICE_RX_FLAGS_RING_GCS) &&
rx_desc->wb.rxdid == ICE_RXDID_FLEX_NIC &&
(decoded.inner_prot == LIBETH_RX_PT_INNER_TCP ||
decoded.inner_prot == LIBETH_RX_PT_INNER_UDP ||
decoded.inner_prot == LIBETH_RX_PT_INNER_ICMP)) {
- ice_rx_gcs(skb, rx_desc);
+ const struct ice_32b_rx_flex_desc_nic *desc;
+ u16 csum;
+
+ desc = (struct ice_32b_rx_flex_desc_nic *)rx_desc;
+ *ip_summed = XDP_CHECKSUM_COMPLETE;
+ csum = (__force u16)desc->raw_csum;
+ *cksum_meta = csum_unfold((__force __sum16)swab16(csum));
return;
}
/* check if HW has decoded the packet and checksum */
if (!(rx_status0 & BIT(ICE_RX_FLEX_DESC_STATUS0_L3L4P_S)))
- return;
+ goto checksum_none;
ipv4 = libeth_rx_pt_get_ip_ver(decoded) == LIBETH_RX_PT_OUTER_IPV4;
ipv6 = libeth_rx_pt_get_ip_ver(decoded) == LIBETH_RX_PT_OUTER_IPV6;
if (ipv4 && (rx_status0 & (BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))) {
ring->vsi->back->hw_rx_eipe_error++;
- return;
+ goto checksum_none;
}
if (ipv4 && (rx_status0 & (BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_IPE_S))))
@@ -168,13 +144,46 @@ ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb,
* we are indicating we validated the inner checksum.
*/
if (decoded.tunnel_type >= LIBETH_RX_PT_TUNNEL_IP_GRENAT)
- skb->csum_level = 1;
+ *cksum_meta = 1;
- skb->ip_summed = CHECKSUM_UNNECESSARY;
+ *ip_summed = XDP_CHECKSUM_UNNECESSARY;
return;
checksum_fail:
ring->vsi->back->hw_csum_rx_error++;
+checksum_none:
+ *ip_summed = XDP_CHECKSUM_NONE;
+ *cksum_meta = 0;
+}
+
+/**
+ * ice_rx_csum - Indicate in skb if checksum is good
+ * @ring: the ring we care about
+ * @skb: skb currently being received and modified
+ * @rx_desc: the receive descriptor
+ * @ptype: the packet type decoded by hardware
+ *
+ * skb->protocol must be set before this function is called
+ */
+static void
+ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb,
+ union ice_32b_rx_flex_desc *rx_desc, u16 ptype)
+{
+ enum xdp_checksum ip_summed;
+ u32 cksum_meta;
+
+ ice_get_rx_csum(rx_desc, ptype, ring, &ip_summed, &cksum_meta);
+ switch (ip_summed) {
+ case XDP_CHECKSUM_UNNECESSARY:
+ skb->csum_level = cksum_meta;
+ break;
+ case XDP_CHECKSUM_COMPLETE:
+ skb->csum = cksum_meta;
+ break;
+ default:
+ break;
+ }
+ skb->ip_summed = ip_summed;
}
/**
@@ -569,6 +578,30 @@ static int ice_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash,
return 0;
}
+/**
+ * ice_xdp_rx_checksum - RX checksum XDP hint handler
+ * @ctx: XDP buff pointer
+ * @ip_summed: RX checksum result destination address
+ * @cksum_meta: XDP RX checksum metadata destination address
+ *
+ * Copy RX checksum result (if available) and its metadata to the
+ * destination address.
+ */
+static int ice_xdp_rx_checksum(const struct xdp_md *ctx,
+ enum xdp_checksum *ip_summed,
+ u32 *cksum_meta)
+{
+ const struct libeth_xdp_buff *xdp_ext = (void *)ctx;
+ const union ice_32b_rx_flex_desc *rx_desc = xdp_ext->desc;
+ struct ice_rx_ring *ring;
+
+ ring = libeth_xdp_buff_to_rq(xdp_ext, typeof(*ring), xdp_rxq);
+ ice_get_rx_csum(rx_desc, ice_get_ptype(rx_desc), ring, ip_summed,
+ cksum_meta);
+
+ return 0;
+}
+
/**
* ice_xdp_rx_vlan_tag - VLAN tag XDP hint handler
* @ctx: XDP buff pointer
@@ -601,4 +634,5 @@ const struct xdp_metadata_ops ice_xdp_md_ops = {
.xmo_rx_timestamp = ice_xdp_rx_hw_ts,
.xmo_rx_hash = ice_xdp_rx_hash,
.xmo_rx_vlan_tag = ice_xdp_rx_vlan_tag,
+ .xmo_rx_checksum = ice_xdp_rx_checksum,
};
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH bpf-next 3/5] net: ice: Add xmo_rx_checksum callback
2026-02-10 17:21 ` [PATCH bpf-next 3/5] net: ice: Add xmo_rx_checksum callback Lorenzo Bianconi
@ 2026-02-10 17:54 ` bot+bpf-ci
2026-02-11 6:07 ` [Intel-wired-lan] " kernel test robot
1 sibling, 0 replies; 17+ messages in thread
From: bot+bpf-ci @ 2026-02-10 17:54 UTC (permalink / raw)
To: lorenzo, donald.hunter, kuba, davem, edumazet, pabeni, horms, ast,
daniel, hawk, john.fastabend, sdf, andrew+netdev,
anthony.l.nguyen, przemyslaw.kitszel, aleksander.lobakin, andrii,
martin.lau, eddyz87, song, yonghong.song, kpsingh, haoluo, jolsa,
shuah, maciej.fijalkowski
Cc: jakub, netdev, bpf, intel-wired-lan, linux-kselftest, lorenzo,
ast, andrii, daniel, martin.lau, eddyz87, yonghong.song, clm,
ihor.solodrai
[-- Attachment #1: Type: text/plain, Size: 2426 bytes --]
> diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
[ ... ]
> @@ -168,16 +144,49 @@
> * we are indicating we validated the inner checksum.
> */
> if (decoded.tunnel_type >= LIBETH_RX_PT_TUNNEL_IP_GRENAT)
> - skb->csum_level = 1;
> + *cksum_meta = 1;
>
> - skb->ip_summed = CHECKSUM_UNNECESSARY;
> + *ip_summed = XDP_CHECKSUM_UNNECESSARY;
> return;
For non-tunneled packets that reach this return, is cksum_meta left
uninitialized? The tunnel_type check only sets *cksum_meta = 1 for
tunneled packets, but there's no else clause setting it to 0.
The caller ice_rx_csum() declares cksum_meta without initialization:
> +static void
> +ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb,
> + union ice_32b_rx_flex_desc *rx_desc, u16 ptype)
> +{
> + enum xdp_checksum ip_summed;
> + u32 cksum_meta;
> +
> + ice_get_rx_csum(rx_desc, ptype, ring, &ip_summed, &cksum_meta);
> + switch (ip_summed) {
> + case XDP_CHECKSUM_UNNECESSARY:
> + skb->csum_level = cksum_meta;
When ip_summed is XDP_CHECKSUM_UNNECESSARY and the packet is not tunneled,
this assigns an uninitialized value to skb->csum_level.
The original code relied on skb fields being pre-initialized to 0, but now
the refactored ice_get_rx_csum() needs to explicitly set *cksum_meta = 0
for the non-tunneled CHECKSUM_UNNECESSARY case, similar to how
checksum_none does.
> + break;
> + case XDP_CHECKSUM_COMPLETE:
> + skb->csum = cksum_meta;
> + break;
> + default:
> + break;
> + }
> + skb->ip_summed = ip_summed;
> +}
[ ... ]
---
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 shows typical human characteristics including a subtle uninitialized variable bug and minor grammatical imperfections in the commit message, both of which are patterns AI tools tend to avoid.
issues-found: 1
issue-severity-score: medium
issue-severity-explanation: Uninitialized variable causes skb->csum_level to receive garbage values for non-tunneled packets with valid checksums, potentially affecting network stack checksum handling.
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [Intel-wired-lan] [PATCH bpf-next 3/5] net: ice: Add xmo_rx_checksum callback
2026-02-10 17:21 ` [PATCH bpf-next 3/5] net: ice: Add xmo_rx_checksum callback Lorenzo Bianconi
2026-02-10 17:54 ` bot+bpf-ci
@ 2026-02-11 6:07 ` kernel test robot
1 sibling, 0 replies; 17+ messages in thread
From: kernel test robot @ 2026-02-11 6:07 UTC (permalink / raw)
To: Lorenzo Bianconi, Donald Hunter, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Stanislav Fomichev, Andrew Lunn, Tony Nguyen, Przemek Kitszel,
Alexander Lobakin, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, Yonghong Song, KP Singh, Hao Luo,
Jiri Olsa, Shuah Khan, Maciej Fijalkowski
Cc: oe-kbuild-all, netdev, Jakub Sitnicki, bpf, intel-wired-lan,
linux-kselftest
Hi Lorenzo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on db975debcb8c4cd367a78811bc1ba84c83f854bd]
url: https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Bianconi/netlink-specs-Add-XDP-RX-checksum-capability-to-XDP-metadata-specs/20260211-012550
base: db975debcb8c4cd367a78811bc1ba84c83f854bd
patch link: https://lore.kernel.org/r/20260210-bpf-xdp-meta-rxcksum-v1-3-e5d55caa0541%40kernel.org
patch subject: [Intel-wired-lan] [PATCH bpf-next 3/5] net: ice: Add xmo_rx_checksum callback
config: i386-randconfig-063-20260211 (https://download.01.org/0day-ci/archive/20260211/202602111429.7z0nNd0Q-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260211/202602111429.7z0nNd0Q-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602111429.7z0nNd0Q-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/intel/ice/ice_txrx_lib.c:109:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __wsum @@
drivers/net/ethernet/intel/ice/ice_txrx_lib.c:109:29: sparse: expected unsigned int [usertype]
drivers/net/ethernet/intel/ice/ice_txrx_lib.c:109:29: sparse: got restricted __wsum
>> drivers/net/ethernet/intel/ice/ice_txrx_lib.c:181:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __wsum [usertype] csum @@ got unsigned int [addressable] [usertype] cksum_meta @@
drivers/net/ethernet/intel/ice/ice_txrx_lib.c:181:27: sparse: expected restricted __wsum [usertype] csum
drivers/net/ethernet/intel/ice/ice_txrx_lib.c:181:27: sparse: got unsigned int [addressable] [usertype] cksum_meta
drivers/net/ethernet/intel/ice/ice_txrx_lib.c:515:9: sparse: sparse: context imbalance in 'ice_finalize_xdp_rx' - different lock contexts for basic block
vim +109 drivers/net/ethernet/intel/ice/ice_txrx_lib.c
83
84 static void
85 ice_get_rx_csum(const union ice_32b_rx_flex_desc *rx_desc, u16 ptype,
86 struct ice_rx_ring *ring, enum xdp_checksum *ip_summed,
87 u32 *cksum_meta)
88 {
89 struct libeth_rx_pt decoded = libie_rx_pt_parse(ptype);
90 u16 rx_status0, rx_status1;
91 bool ipv4, ipv6;
92
93 if (!libeth_rx_pt_has_checksum(ring->netdev, decoded))
94 goto checksum_none;
95
96 rx_status0 = le16_to_cpu(rx_desc->wb.status_error0);
97 rx_status1 = le16_to_cpu(rx_desc->wb.status_error1);
98 if ((ring->flags & ICE_RX_FLAGS_RING_GCS) &&
99 rx_desc->wb.rxdid == ICE_RXDID_FLEX_NIC &&
100 (decoded.inner_prot == LIBETH_RX_PT_INNER_TCP ||
101 decoded.inner_prot == LIBETH_RX_PT_INNER_UDP ||
102 decoded.inner_prot == LIBETH_RX_PT_INNER_ICMP)) {
103 const struct ice_32b_rx_flex_desc_nic *desc;
104 u16 csum;
105
106 desc = (struct ice_32b_rx_flex_desc_nic *)rx_desc;
107 *ip_summed = XDP_CHECKSUM_COMPLETE;
108 csum = (__force u16)desc->raw_csum;
> 109 *cksum_meta = csum_unfold((__force __sum16)swab16(csum));
110 return;
111 }
112
113 /* check if HW has decoded the packet and checksum */
114 if (!(rx_status0 & BIT(ICE_RX_FLEX_DESC_STATUS0_L3L4P_S)))
115 goto checksum_none;
116
117 ipv4 = libeth_rx_pt_get_ip_ver(decoded) == LIBETH_RX_PT_OUTER_IPV4;
118 ipv6 = libeth_rx_pt_get_ip_ver(decoded) == LIBETH_RX_PT_OUTER_IPV6;
119
120 if (ipv4 && (rx_status0 & (BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S)))) {
121 ring->vsi->back->hw_rx_eipe_error++;
122 goto checksum_none;
123 }
124
125 if (ipv4 && (rx_status0 & (BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_IPE_S))))
126 goto checksum_fail;
127
128 if (ipv6 && (rx_status0 & (BIT(ICE_RX_FLEX_DESC_STATUS0_IPV6EXADD_S))))
129 goto checksum_fail;
130
131 /* check for L4 errors and handle packets that were not able to be
132 * checksummed due to arrival speed
133 */
134 if (rx_status0 & BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_L4E_S))
135 goto checksum_fail;
136
137 /* check for outer UDP checksum error in tunneled packets */
138 if ((rx_status1 & BIT(ICE_RX_FLEX_DESC_STATUS1_NAT_S)) &&
139 (rx_status0 & BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
140 goto checksum_fail;
141
142 /* If there is an outer header present that might contain a checksum
143 * we need to bump the checksum level by 1 to reflect the fact that
144 * we are indicating we validated the inner checksum.
145 */
146 if (decoded.tunnel_type >= LIBETH_RX_PT_TUNNEL_IP_GRENAT)
147 *cksum_meta = 1;
148
149 *ip_summed = XDP_CHECKSUM_UNNECESSARY;
150 return;
151
152 checksum_fail:
153 ring->vsi->back->hw_csum_rx_error++;
154 checksum_none:
155 *ip_summed = XDP_CHECKSUM_NONE;
156 *cksum_meta = 0;
157 }
158
159 /**
160 * ice_rx_csum - Indicate in skb if checksum is good
161 * @ring: the ring we care about
162 * @skb: skb currently being received and modified
163 * @rx_desc: the receive descriptor
164 * @ptype: the packet type decoded by hardware
165 *
166 * skb->protocol must be set before this function is called
167 */
168 static void
169 ice_rx_csum(struct ice_rx_ring *ring, struct sk_buff *skb,
170 union ice_32b_rx_flex_desc *rx_desc, u16 ptype)
171 {
172 enum xdp_checksum ip_summed;
173 u32 cksum_meta;
174
175 ice_get_rx_csum(rx_desc, ptype, ring, &ip_summed, &cksum_meta);
176 switch (ip_summed) {
177 case XDP_CHECKSUM_UNNECESSARY:
178 skb->csum_level = cksum_meta;
179 break;
180 case XDP_CHECKSUM_COMPLETE:
> 181 skb->csum = cksum_meta;
182 break;
183 default:
184 break;
185 }
186 skb->ip_summed = ip_summed;
187 }
188
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH bpf-next 4/5] selftests/bpf: Add selftest support for bpf_xdp_metadata_rx_checksum
2026-02-10 17:21 [PATCH bpf-next 0/5] Add the the capability to load HW RX checsum in eBPF programs Lorenzo Bianconi
` (2 preceding siblings ...)
2026-02-10 17:21 ` [PATCH bpf-next 3/5] net: ice: Add xmo_rx_checksum callback Lorenzo Bianconi
@ 2026-02-10 17:21 ` Lorenzo Bianconi
2026-02-10 17:55 ` bot+bpf-ci
2026-02-11 8:05 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-02-10 17:21 ` [PATCH bpf-next 5/5] selftests/bpf: Add bpf_xdp_metadata_rx_checksum support to xdp_hw_metadat prog Lorenzo Bianconi
4 siblings, 2 replies; 17+ messages in thread
From: Lorenzo Bianconi @ 2026-02-10 17:21 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrew Lunn, Tony Nguyen, Przemek Kitszel, Alexander Lobakin,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, Shuah Khan,
Maciej Fijalkowski
Cc: Jakub Sitnicki, netdev, bpf, intel-wired-lan, linux-kselftest,
Lorenzo Bianconi
Introduce support to xdp_metadata selftest for bpf_xdp_metadata_rx_checksum
kfunc.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
tools/testing/selftests/bpf/prog_tests/xdp_metadata.c | 7 +++++++
tools/testing/selftests/bpf/progs/xdp_metadata.c | 1 +
tools/testing/selftests/bpf/xdp_metadata.h | 9 +++++++++
3 files changed, 17 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
index 19f92affc2daa23fdd869554e7a0475b86350a4f..707c98e664745763b01b638a537a797211ded4e1 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
@@ -258,6 +258,7 @@ static void refill_rx(struct xsk *xsk, __u64 addr)
static int verify_xsk_metadata(struct xsk *xsk, bool sent_from_af_xdp)
{
+ __u8 ip_summed = sent_from_af_xdp ? XDP_CHECKSUM_NONE : XDP_CHECKSUM_PARTIAL;
const struct xdp_desc *rx_desc;
struct pollfd fds = {};
struct xdp_meta *meta;
@@ -310,6 +311,12 @@ static int verify_xsk_metadata(struct xsk *xsk, bool sent_from_af_xdp)
if (!ASSERT_NEQ(meta->rx_hash, 0, "rx_hash"))
return -1;
+ if (!ASSERT_EQ(meta->ip_summed, ip_summed, "rx_ip_summed"))
+ return -1;
+
+ if (!ASSERT_EQ(meta->cksum_meta, 0, "rx_cksum_meta"))
+ return -1;
+
if (!sent_from_af_xdp) {
if (!ASSERT_NEQ(meta->rx_hash_type & XDP_RSS_TYPE_L4, 0, "rx_hash_type"))
return -1;
diff --git a/tools/testing/selftests/bpf/progs/xdp_metadata.c b/tools/testing/selftests/bpf/progs/xdp_metadata.c
index 09bb8a038d528cf26c5b314cc927915ac2796bf0..ef6a5584a1876a3c47440f21dca927ec783469dc 100644
--- a/tools/testing/selftests/bpf/progs/xdp_metadata.c
+++ b/tools/testing/selftests/bpf/progs/xdp_metadata.c
@@ -98,6 +98,7 @@ int rx(struct xdp_md *ctx)
bpf_xdp_metadata_rx_hash(ctx, &meta->rx_hash, &meta->rx_hash_type);
bpf_xdp_metadata_rx_vlan_tag(ctx, &meta->rx_vlan_proto,
&meta->rx_vlan_tci);
+ bpf_xdp_metadata_rx_checksum(ctx, &meta->ip_summed, &meta->cksum_meta);
return bpf_redirect_map(&xsk, ctx->rx_queue_index, XDP_PASS);
}
diff --git a/tools/testing/selftests/bpf/xdp_metadata.h b/tools/testing/selftests/bpf/xdp_metadata.h
index 87318ad1117a1d677af121f11778178532e2a562..a16f71488a34e6df23fec6dd7dde7b7989774618 100644
--- a/tools/testing/selftests/bpf/xdp_metadata.h
+++ b/tools/testing/selftests/bpf/xdp_metadata.h
@@ -30,6 +30,11 @@ enum xdp_meta_field {
XDP_META_FIELD_VLAN_TAG = BIT(2),
};
+#define XDP_CHECKSUM_NONE 0
+#define XDP_CHECKSUM_UNNECESSARY 1
+#define XDP_CHECKSUM_COMPLETE 2
+#define XDP_CHECKSUM_PARTIAL 3
+
struct xdp_meta {
union {
__u64 rx_timestamp;
@@ -48,5 +53,9 @@ struct xdp_meta {
};
__s32 rx_vlan_tag_err;
};
+ struct {
+ __u8 ip_summed;
+ __u32 cksum_meta;
+ };
enum xdp_meta_field hint_valid;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH bpf-next 4/5] selftests/bpf: Add selftest support for bpf_xdp_metadata_rx_checksum
2026-02-10 17:21 ` [PATCH bpf-next 4/5] selftests/bpf: Add selftest support for bpf_xdp_metadata_rx_checksum Lorenzo Bianconi
@ 2026-02-10 17:55 ` bot+bpf-ci
2026-02-11 8:05 ` [Intel-wired-lan] " Loktionov, Aleksandr
1 sibling, 0 replies; 17+ messages in thread
From: bot+bpf-ci @ 2026-02-10 17:55 UTC (permalink / raw)
To: lorenzo, donald.hunter, kuba, davem, edumazet, pabeni, horms, ast,
daniel, hawk, john.fastabend, sdf, andrew+netdev,
anthony.l.nguyen, przemyslaw.kitszel, aleksander.lobakin, andrii,
martin.lau, eddyz87, song, yonghong.song, kpsingh, haoluo, jolsa,
shuah, maciej.fijalkowski
Cc: jakub, netdev, bpf, intel-wired-lan, linux-kselftest, lorenzo,
ast, andrii, daniel, martin.lau, eddyz87, yonghong.song, clm,
ihor.solodrai
[-- Attachment #1: Type: text/plain, Size: 1908 bytes --]
> diff --git a/tools/testing/selftests/bpf/progs/xdp_metadata.c b/tools/testing/selftests/bpf/progs/xdp_metadata.c
> index 09bb8a038d52..ef6a5584a187 100644
> --- a/tools/testing/selftests/bpf/progs/xdp_metadata.c
> +++ b/tools/testing/selftests/bpf/progs/xdp_metadata.c
[ ... ]
> @@ -98,6 +98,7 @@ int rx(struct xdp_md *ctx)
> bpf_xdp_metadata_rx_hash(ctx, &meta->rx_hash, &meta->rx_hash_type);
> bpf_xdp_metadata_rx_vlan_tag(ctx, &meta->rx_vlan_proto,
> &meta->rx_vlan_tci);
> + bpf_xdp_metadata_rx_checksum(ctx, &meta->ip_summed, &meta->cksum_meta);
Is there a missing extern declaration for bpf_xdp_metadata_rx_checksum()?
The other kfuncs used in this file have extern declarations with __ksym:
extern int bpf_xdp_metadata_rx_timestamp(const struct xdp_md *ctx,
__u64 *timestamp) __ksym;
extern int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, __u32 *hash,
enum xdp_rss_hash_type *rss_type) __ksym;
extern int bpf_xdp_metadata_rx_vlan_tag(const struct xdp_md *ctx,
__be16 *vlan_proto,
__u16 *vlan_tci) __ksym;
Without a similar declaration for bpf_xdp_metadata_rx_checksum(), the BPF
program may fail to compile or link.
---
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 code follows standard BPF selftest patterns and appears to be written by a domain expert familiar with XDP metadata kfuncs.
issues-found: 1
issue-severity-score: medium
issue-severity-explanation: Missing extern declaration for bpf_xdp_metadata_rx_checksum kfunc will cause BPF program build failure.
^ permalink raw reply [flat|nested] 17+ messages in thread* RE: [Intel-wired-lan] [PATCH bpf-next 4/5] selftests/bpf: Add selftest support for bpf_xdp_metadata_rx_checksum
2026-02-10 17:21 ` [PATCH bpf-next 4/5] selftests/bpf: Add selftest support for bpf_xdp_metadata_rx_checksum Lorenzo Bianconi
2026-02-10 17:55 ` bot+bpf-ci
@ 2026-02-11 8:05 ` Loktionov, Aleksandr
1 sibling, 0 replies; 17+ messages in thread
From: Loktionov, Aleksandr @ 2026-02-11 8:05 UTC (permalink / raw)
To: Lorenzo Bianconi, Donald Hunter, Jakub Kicinski, David S. Miller,
Eric Dumazet, Paolo Abeni, Simon Horman, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Stanislav Fomichev, Andrew Lunn, Nguyen, Anthony L,
Kitszel, Przemyslaw, Lobakin, Aleksander, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
KP Singh, Hao Luo, Jiri Olsa, Shuah Khan, Fijalkowski, Maciej
Cc: Jakub Sitnicki, netdev@vger.kernel.org, bpf@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Lorenzo Bianconi
> Sent: Tuesday, February 10, 2026 6:22 PM
> To: Donald Hunter <donald.hunter@gmail.com>; Jakub Kicinski
> <kuba@kernel.org>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Paolo Abeni <pabeni@redhat.com>; Simon Horman
> <horms@kernel.org>; Alexei Starovoitov <ast@kernel.org>; Daniel
> Borkmann <daniel@iogearbox.net>; Jesper Dangaard Brouer
> <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>;
> Stanislav Fomichev <sdf@fomichev.me>; Andrew Lunn
> <andrew+netdev@lunn.ch>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Lobakin, Aleksander
> <aleksander.lobakin@intel.com>; Andrii Nakryiko <andrii@kernel.org>;
> Martin KaFai Lau <martin.lau@linux.dev>; Eduard Zingerman
> <eddyz87@gmail.com>; Song Liu <song@kernel.org>; Yonghong Song
> <yonghong.song@linux.dev>; KP Singh <kpsingh@kernel.org>; Hao Luo
> <haoluo@google.com>; Jiri Olsa <jolsa@kernel.org>; Shuah Khan
> <shuah@kernel.org>; Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> 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 <lorenzo@kernel.org>
> Subject: [Intel-wired-lan] [PATCH bpf-next 4/5] selftests/bpf: Add
> selftest support for bpf_xdp_metadata_rx_checksum
>
> Introduce support to xdp_metadata selftest for
> bpf_xdp_metadata_rx_checksum kfunc.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> tools/testing/selftests/bpf/prog_tests/xdp_metadata.c | 7 +++++++
> tools/testing/selftests/bpf/progs/xdp_metadata.c | 1 +
> tools/testing/selftests/bpf/xdp_metadata.h | 9 +++++++++
> 3 files changed, 17 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
> b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
> index
> 19f92affc2daa23fdd869554e7a0475b86350a4f..707c98e664745763b01b638a537a
> 797211ded4e1 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
> @@ -258,6 +258,7 @@ static void refill_rx(struct xsk *xsk, __u64 addr)
>
> static int verify_xsk_metadata(struct xsk *xsk, bool
> sent_from_af_xdp) {
> + __u8 ip_summed = sent_from_af_xdp ? XDP_CHECKSUM_NONE :
> +XDP_CHECKSUM_PARTIAL;
> const struct xdp_desc *rx_desc;
> struct pollfd fds = {};
> struct xdp_meta *meta;
> @@ -310,6 +311,12 @@ static int verify_xsk_metadata(struct xsk *xsk,
> bool sent_from_af_xdp)
> if (!ASSERT_NEQ(meta->rx_hash, 0, "rx_hash"))
> return -1;
>
> + if (!ASSERT_EQ(meta->ip_summed, ip_summed, "rx_ip_summed"))
> + return -1;
> +
> + if (!ASSERT_EQ(meta->cksum_meta, 0, "rx_cksum_meta"))
> + return -1;
> +
> if (!sent_from_af_xdp) {
> if (!ASSERT_NEQ(meta->rx_hash_type & XDP_RSS_TYPE_L4, 0,
> "rx_hash_type"))
> return -1;
> diff --git a/tools/testing/selftests/bpf/progs/xdp_metadata.c
> b/tools/testing/selftests/bpf/progs/xdp_metadata.c
> index
> 09bb8a038d528cf26c5b314cc927915ac2796bf0..ef6a5584a1876a3c47440f21dca9
> 27ec783469dc 100644
> --- a/tools/testing/selftests/bpf/progs/xdp_metadata.c
> +++ b/tools/testing/selftests/bpf/progs/xdp_metadata.c
> @@ -98,6 +98,7 @@ int rx(struct xdp_md *ctx)
> bpf_xdp_metadata_rx_hash(ctx, &meta->rx_hash, &meta-
> >rx_hash_type);
> bpf_xdp_metadata_rx_vlan_tag(ctx, &meta->rx_vlan_proto,
> &meta->rx_vlan_tci);
> + bpf_xdp_metadata_rx_checksum(ctx, &meta->ip_summed,
> +&meta->cksum_meta);
>
> return bpf_redirect_map(&xsk, ctx->rx_queue_index, XDP_PASS);
> } diff --git a/tools/testing/selftests/bpf/xdp_metadata.h
> b/tools/testing/selftests/bpf/xdp_metadata.h
> index
> 87318ad1117a1d677af121f11778178532e2a562..a16f71488a34e6df23fec6dd7dde
> 7b7989774618 100644
> --- a/tools/testing/selftests/bpf/xdp_metadata.h
> +++ b/tools/testing/selftests/bpf/xdp_metadata.h
> @@ -30,6 +30,11 @@ enum xdp_meta_field {
> XDP_META_FIELD_VLAN_TAG = BIT(2),
> };
>
> +#define XDP_CHECKSUM_NONE 0
> +#define XDP_CHECKSUM_UNNECESSARY 1
> +#define XDP_CHECKSUM_COMPLETE 2
> +#define XDP_CHECKSUM_PARTIAL 3
> +
> struct xdp_meta {
> union {
> __u64 rx_timestamp;
> @@ -48,5 +53,9 @@ struct xdp_meta {
> };
> __s32 rx_vlan_tag_err;
> };
> + struct {
> + __u8 ip_summed;
> + __u32 cksum_meta;
> + };
> enum xdp_meta_field hint_valid;
> };
>
> --
> 2.53.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH bpf-next 5/5] selftests/bpf: Add bpf_xdp_metadata_rx_checksum support to xdp_hw_metadat prog
2026-02-10 17:21 [PATCH bpf-next 0/5] Add the the capability to load HW RX checsum in eBPF programs Lorenzo Bianconi
` (3 preceding siblings ...)
2026-02-10 17:21 ` [PATCH bpf-next 4/5] selftests/bpf: Add selftest support for bpf_xdp_metadata_rx_checksum Lorenzo Bianconi
@ 2026-02-10 17:21 ` Lorenzo Bianconi
2026-02-10 17:54 ` bot+bpf-ci
4 siblings, 1 reply; 17+ messages in thread
From: Lorenzo Bianconi @ 2026-02-10 17:21 UTC (permalink / raw)
To: Donald Hunter, Jakub Kicinski, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Andrew Lunn, Tony Nguyen, Przemek Kitszel, Alexander Lobakin,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Hao Luo, Jiri Olsa, Shuah Khan,
Maciej Fijalkowski
Cc: Jakub Sitnicki, netdev, bpf, intel-wired-lan, linux-kselftest,
Lorenzo Bianconi
Introduce the capability to dump HW rx checksum in xdp_hw_metadat
program via bpf_xdp_metadata_rx_checksum() kfunc.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
.../testing/selftests/bpf/progs/xdp_hw_metadata.c | 7 ++++++
tools/testing/selftests/bpf/xdp_hw_metadata.c | 28 ++++++++++++++++++++++
tools/testing/selftests/bpf/xdp_metadata.h | 10 +++++---
3 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
index 330ece2eabdb454da2bb2cbd297d2b2dd6efddc0..dc62d572e3ac6e2ef173b330da515757ea543415 100644
--- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
+++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
@@ -110,6 +110,13 @@ int rx(struct xdp_md *ctx)
else
meta->hint_valid |= XDP_META_FIELD_VLAN_TAG;
+ err = bpf_xdp_metadata_rx_checksum(ctx, &meta->ip_summed,
+ &meta->cksum_meta);
+ if (err)
+ meta->rx_cksum_err = err;
+ else
+ meta->hint_valid |= XDP_META_FIELD_CHECKSUM;
+
__sync_add_and_fetch(&pkts_redir, 1);
return bpf_redirect_map(&xsk, ctx->rx_queue_index, XDP_PASS);
}
diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c
index 3d8de0d4c96a7afdf5f60b2fdff73c22b876ce54..5f4bd63b8a31586353e58e4f6472ee8ac9531a06 100644
--- a/tools/testing/selftests/bpf/xdp_hw_metadata.c
+++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c
@@ -8,6 +8,7 @@
* - Metadata verified:
* - rx_timestamp
* - rx_hash
+ * - rx_checksum
*
* TX:
* - UDP 9091 packets trigger TX reply
@@ -219,6 +220,28 @@ static void print_vlan_tci(__u16 tag)
printf("PCP=%u, DEI=%d, VID=0x%X\n", pcp, dei, vlan_id);
}
+static void print_rx_cksum(__u8 ip_summed, __u32 cksum_meta)
+{
+ const char *cksum = "CHECKSUM_NONE";
+
+ switch (ip_summed) {
+ case XDP_CHECKSUM_UNNECESSARY:
+ cksum = "CHECKSUM_UNNECESSARY";
+ break;
+ case XDP_CHECKSUM_COMPLETE:
+ cksum = "CHECKSUM_COMPLETE";
+ break;
+ case XDP_CHECKSUM_PARTIAL:
+ cksum = "CHECKSUM_PARTIAL";
+ break;
+ case XDP_CHECKSUM_NONE:
+ default:
+ break;
+ }
+
+ printf("rx-cksum: %s, csum_meta=0x%x\n", cksum, cksum_meta);
+}
+
static void verify_xdp_metadata(void *data, clockid_t clock_id)
{
struct xdp_meta *meta;
@@ -254,6 +277,11 @@ static void verify_xdp_metadata(void *data, clockid_t clock_id)
printf("No rx_vlan_tci or rx_vlan_proto, err=%d\n",
meta->rx_vlan_tag_err);
}
+
+ if (meta->hint_valid & XDP_META_FIELD_CHECKSUM)
+ print_rx_cksum(meta->ip_summed, meta->cksum_meta);
+ else
+ printf("No rx_chsum, err=%d\n", meta->rx_cksum_err);
}
static void verify_skb_metadata(int fd)
diff --git a/tools/testing/selftests/bpf/xdp_metadata.h b/tools/testing/selftests/bpf/xdp_metadata.h
index a16f71488a34e6df23fec6dd7dde7b7989774618..b7ab112da8032405ec0e3d699499f4a9c5cb91dc 100644
--- a/tools/testing/selftests/bpf/xdp_metadata.h
+++ b/tools/testing/selftests/bpf/xdp_metadata.h
@@ -28,6 +28,7 @@ enum xdp_meta_field {
XDP_META_FIELD_TS = BIT(0),
XDP_META_FIELD_RSS = BIT(1),
XDP_META_FIELD_VLAN_TAG = BIT(2),
+ XDP_META_FIELD_CHECKSUM = BIT(3),
};
#define XDP_CHECKSUM_NONE 0
@@ -53,9 +54,12 @@ struct xdp_meta {
};
__s32 rx_vlan_tag_err;
};
- struct {
- __u8 ip_summed;
- __u32 cksum_meta;
+ union {
+ struct {
+ __u8 ip_summed;
+ __u32 cksum_meta;
+ };
+ __s32 rx_cksum_err;
};
enum xdp_meta_field hint_valid;
};
--
2.53.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH bpf-next 5/5] selftests/bpf: Add bpf_xdp_metadata_rx_checksum support to xdp_hw_metadat prog
2026-02-10 17:21 ` [PATCH bpf-next 5/5] selftests/bpf: Add bpf_xdp_metadata_rx_checksum support to xdp_hw_metadat prog Lorenzo Bianconi
@ 2026-02-10 17:54 ` bot+bpf-ci
0 siblings, 0 replies; 17+ messages in thread
From: bot+bpf-ci @ 2026-02-10 17:54 UTC (permalink / raw)
To: lorenzo, donald.hunter, kuba, davem, edumazet, pabeni, horms, ast,
daniel, hawk, john.fastabend, sdf, andrew+netdev,
anthony.l.nguyen, przemyslaw.kitszel, aleksander.lobakin, andrii,
martin.lau, eddyz87, song, yonghong.song, kpsingh, haoluo, jolsa,
shuah, maciej.fijalkowski
Cc: jakub, netdev, bpf, intel-wired-lan, linux-kselftest, lorenzo,
ast, andrii, daniel, martin.lau, eddyz87, yonghong.song, clm,
ihor.solodrai
[-- Attachment #1: Type: text/plain, Size: 2066 bytes --]
> selftests/bpf: Add bpf_xdp_metadata_rx_checksum support to xdp_hw_metadat prog
This isn't a bug, but there's a typo in the subject line - "xdp_hw_metadat"
should be "xdp_hw_metadata".
> diff --git a/tools/testing/selftests/bpf/xdp_hw_metadata.c b/tools/testing/selftests/bpf/xdp_hw_metadata.c
> --- a/tools/testing/selftests/bpf/xdp_hw_metadata.c
> +++ b/tools/testing/selftests/bpf/xdp_hw_metadata.c
[ ... ]
> + if (meta->hint_valid & XDP_META_FIELD_CHECKSUM)
> + print_rx_cksum(meta->ip_summed, meta->cksum_meta);
> + else
> + printf("No rx_chsum, err=%d\n", meta->rx_cksum_err);
^^^^^^^^
Should "rx_chsum" be "rx_checksum"? The other error messages in this
function use the full field names: "rx_hash", "rx_timestamp",
"rx_vlan_tci".
> diff --git a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
> --- a/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
> +++ b/tools/testing/selftests/bpf/progs/xdp_hw_metadata.c
[ ... ]
> + err = bpf_xdp_metadata_rx_checksum(ctx, &meta->ip_summed,
> + &meta->cksum_meta);
The file declares extern __ksym for the other XDP metadata kfuncs:
extern int bpf_xdp_metadata_rx_timestamp(...) __ksym;
extern int bpf_xdp_metadata_rx_hash(...) __ksym;
extern int bpf_xdp_metadata_rx_vlan_tag(...) __ksym;
Should bpf_xdp_metadata_rx_checksum have a matching extern declaration
for consistency?
---
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 presence of typos and natural integration with existing kernel patterns suggest human authorship; no AI-like patterns detected.
issues-found: 3
issue-severity-score: low
issue-severity-explanation: Three minor issues found in test code: two typos (commit subject, error message) and a missing extern declaration for consistency.
^ permalink raw reply [flat|nested] 17+ messages in thread