๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by netdev-bot+sashiko Sat, 28 Nov 2026 23:57
Re: [PATCH net-next v3 07/12] net/sched: flower: add psp_spi, psp_ver, and psp_dev matches
#23999
Author: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 23:57
84 lines
11761 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The new uAPI attribute TCA_FLOWER_KEY_PSP_VERSION is documented
  in two places in a way that contradicts how it is validated.

--

net/sched: flower: add psp_spi, psp_ver, and psp_dev matches

This adds a flow dissector key that is filled from the PSP Rx state
(SKB_EXT_PSP) of a decrypted packet. It also adds flower matches on the Rx
SPI, the PSP version and the PSP device ID. Rules that use these matches are
never offloaded, and they are rejected when skip_sw is set.

> diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
> index 14cff8f5da746..0cfa7425404bd 100644
> --- a/include/uapi/linux/pkt_cls.h
> +++ b/include/uapi/linux/pkt_cls.h
> @@ -561,6 +561,11 @@ enum {
>  	TCA_FLOWER_KEY_ENC_FLAGS,	/* be32 */
>  	TCA_FLOWER_KEY_ENC_FLAGS_MASK,	/* be32 */
>  
> +	TCA_FLOWER_KEY_PSP_SPI,		/* be32 */
> +	TCA_FLOWER_KEY_PSP_SPI_MASK,	/* be32 */
> +	TCA_FLOWER_KEY_PSP_VERSION,	/* u8, enum psp_version */
> +	TCA_FLOWER_KEY_PSP_DEV,		/* u32, PSP device ID */
> +
>  	__TCA_FLOWER_MAX,
>  };
>  
> diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
> index 23eba4a00a947..d7b6250f417bc 100644
> --- a/net/sched/cls_flower.c
> +++ b/net/sched/cls_flower.c

[ ... ]

> @@ -745,6 +763,12 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
>  	[TCA_FLOWER_KEY_SPI]		= { .type = NLA_U32 },
>  	[TCA_FLOWER_KEY_SPI_MASK]	= { .type = NLA_U32 },
>  	[TCA_FLOWER_L2_MISS]		= NLA_POLICY_MAX(NLA_U8, 1),
> +	[TCA_FLOWER_KEY_PSP_SPI]	= { .type = NLA_BE32 },
> +	[TCA_FLOWER_KEY_PSP_SPI_MASK]	= { .type = NLA_BE32 },
> +	/* the version field of the PSP header has 4 bits */
> +	[TCA_FLOWER_KEY_PSP_VERSION]	= NLA_POLICY_MAX(NLA_U8, 15),

[Severity: Low]
Should the uAPI comment and this policy agree on what the attribute holds?

The pkt_cls.h comment above says "u8, enum psp_version". The kernel-doc for
struct flow_dissector_key_psp in include/net/flow_dissector.h also says
"PSP version (enum psp_version)". In include/uapi/linux/psp.h, that enum
only defines the values 0 to 3:

enum psp_version {
	PSP_VERSION_HDR0_AES_GCM_128,
	PSP_VERSION_HDR0_AES_GCM_256,
	PSP_VERSION_HDR0_AES_GMAC_128,
	PSP_VERSION_HDR0_AES_GMAC_256,
};

fl_policy accepts values up to 15 here. The key-psp-version entry in
Documentation/netlink/specs/tc.yaml also uses "max: 15". The PSP genetlink
family checks the same enum for PSP_A_ASSOC_VERSION with
NLA_POLICY_MAX(NLA_U32, 3).

So fl_set_key() accepts psp_ver 4 through 15, but those rules can never
match. Rx SPIs and associations can only be created for versions 0 to 3
that the device lists in psd->caps->versions. The key value comes from
psp_dev_rcv(), which stores the raw 4-bit header field:

    pse->version = FIELD_GET(PSPHDR_VERFL_VERSION, psph->verfl);

This is new uAPI. Could the attribute be documented as the raw 4-bit PSP
header version field instead? Or could the policy and the spec be capped
at the highest enum psp_version value?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124221758.3230929-1-toddfreed%40meta.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads