Re: [PATCH net-next v2 4/9] netlink: specs: devlink: fix resource-scope type
From: Hangbin Liu
Date: Sun Sep 27 2026 - 22:01:31 EST
On Fri, Sep 25, 2026 at 09:39:07PM +0000, Asbjørn Sloth Tønnesen wrote:
> The correct type for resource-scope is flags, not enum:
>
> - DEVLINK_RESOURCE_SCOPE_DEV is _BITUL(0) aka. 1, not 0.
> - DEVLINK_RESOURCE_SCOPE_PORT is _BITUL(1) aka. 2, not 1.
>
> This patch also removes "enum-as-flags", as it is now redundant,
> these changes does not change the generated policy.
>
> Before this patch, this generated devlink-user.c function call:
> devlink_resource_scope_str(DEVLINK_RESOURCE_SCOPE_DEV) returned "port",
> not "dev", as it didn't use ffs() to convert the value.
>
> CC: Jiri Pirko <jiri@xxxxxxxxxxx>
> CC: Tariq Toukan <tariqt@xxxxxxxxxx>
> Reviewed-by: Moshe Shemesh <moshe@xxxxxxxxxx>
> Reviewed-by: Jakub Kicinski <kuba@xxxxxxxxxx>
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@xxxxxxxxxxx>
> ---
> Note for Sashiko/Clashiko: Targeting net-next, so no "Fixes" tag.
>
> Documentation/netlink/specs/devlink.yaml | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
> index 1de0daa0f921..4706de628392 100644
> --- a/Documentation/netlink/specs/devlink.yaml
> +++ b/Documentation/netlink/specs/devlink.yaml
> @@ -158,7 +158,7 @@ definitions:
> -
> name: entry
> -
> - type: enum
> + type: flags
> name: resource-scope
> entries:
> -
> @@ -903,7 +903,6 @@ attribute-sets:
> name: resource-scope-mask
> type: u32
> enum: resource-scope
> - enum-as-flags: true
> doc: |
> Bitmask selecting which resource classes to include in a
> resource-dump response. Bit 0 (dev) selects device-level
> --
> 2.55.0
>
Reviewed-by: Hangbin Liu <liuhangbin@xxxxxxxxxx>