Skip to contentSkip to conversation

tools: ynl: fix converting flags to names after recent cleanup

PATCH Applied Jakub Kicinski 2 participants 2 messages Oct 16, 2023 – Oct 18, 2023

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 tools: ynl: fix converting flags to names after recent cleanup

I recently cleaned up specs to not specify enum-as-flags when target enum is already defined as flags. YNL Python library did not convert flags, unfortunately, so this caused breakage for Stan and Willem.

Note that the nlspec.py abstraction already hides the differences between flags and enums (value vs user_value), so the changes are pretty trivial.

Fixes 0629f22ec130 ("ynl: netdev: drop unnecessary enum-as-flags")

---
CC: [email protected]
CC: [email protected]

---
 tools/net/ynl/lib/ynl.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/net/ynl/lib/ynl.py +1 -1
index cc2930633f98..be479bd9dfc8 100644
@@ -486,7 +486,7 @@ genl_family_name_to_id = None
 
     def _decode_enum(self, raw, attr_spec):
         enum = self.consts[attr_spec['enum']]
-        if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:
+        if enum.type == 'flags' or attr_spec.get('enum-as-flags', False):
             i = 0
             value = set()
             while raw:
Signature · 1 line
2.41.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 16 Oct 2023 14:39:37 -0700 you wrote:

I recently cleaned up specs to not specify enum-as-flags when target enum is already defined as flags. YNL Python library did not convert flags, unfortunately, so this caused breakage for Stan and Willem.

Note that the nlspec.py abstraction already hides the differences between flags and enums (value vs user_value), so the changes are pretty trivial.

[...]

Here is the summary with links:
- [net-next] tools: ynl: fix converting flags to names after recent cleanup

    https://git.kernel.org/netdev/net-next/c/9fea94d3a8ca

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html