devlink: fix the enum behind DEVLINK_ATTR_RELOAD_LIMITS

DEVLINK_ATTR_RELOAD_LIMITS carries enum devlink_reload_limit, the spec
says enum devlink_reload_action. The two are unrelated, and have
a different set of values (bits 1, 2 vs bits 0, 1).

AFAICT this is a cosmetic change - both DEVLINK_RELOAD_LIMIT_UNSPEC
and the out of bounds bit 2 will be rejected either way because drivers
don't declare them as supported. User will see either a policy
validation failure or "Requested limit is not supported by the driver".

While at it annotate the right enum for reload-stats-limit

Link: https://patch.msgid.link/20260915161341.1053476-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2026-09-15 09:13:33 -07:00
parent 8181678a92
commit 6c53effab8
2 changed files with 15 additions and 2 deletions

View File

@ -174,6 +174,18 @@ definitions:
value: 1
-
name: fw-activate
-
type: enum
name: reload-limit
entries:
-
name: unspec
doc: no constraints
-
name: no-reset
doc: >-
No reset allowed, no down time allowed, no link flap and no
configuration is lost.
-
type: enum
name: param-cmode
@ -775,7 +787,7 @@ attribute-sets:
-
name: reload-limits
type: bitfield32
enum: reload-action
enum: reload-limit
enum-as-flags: true
-
name: dev-stats
@ -793,6 +805,7 @@ attribute-sets:
-
name: reload-stats-limit
type: u8
enum: reload-limit
-
name: reload-stats-value
type: u32

View File

@ -334,7 +334,7 @@ static const struct nla_policy devlink_reload_nl_policy[DEVLINK_ATTR_INDEX + 1]
[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
[DEVLINK_ATTR_INDEX] = NLA_POLICY_FULL_RANGE(NLA_UINT, &devlink_attr_index_range),
[DEVLINK_ATTR_RELOAD_ACTION] = NLA_POLICY_RANGE(NLA_U8, 1, 2),
[DEVLINK_ATTR_RELOAD_LIMITS] = NLA_POLICY_BITFIELD32(6),
[DEVLINK_ATTR_RELOAD_LIMITS] = NLA_POLICY_BITFIELD32(3),
[DEVLINK_ATTR_NETNS_PID] = { .type = NLA_U32, },
[DEVLINK_ATTR_NETNS_FD] = { .type = NLA_U32, },
[DEVLINK_ATTR_NETNS_ID] = { .type = NLA_U32, },