Thread (20 messages) 20 messages, 3 authors, 8d ago

Re: [PATCH net-next v2 4/9] netlink: specs: devlink: fix resource-scope type

flat view

From: Hangbin Liu <hidden>
Date: 2026-09-28 02:01:21
Also in: lkml

On Fri, Sep 25, 2026 at 09:39:07PM +0000, Asbjørn Sloth Tønnesen wrote:
quoted hunk ↗ jump to hunk
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@resnulli.us>
CC: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Moshe Shemesh <redacted>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Asbjørn Sloth Tønnesen <redacted>
---
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 <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help