]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools: ynl: decode enums in auto-ints
authorJakub Kicinski <kuba@kernel.org>
Tue, 8 Jul 2025 22:06:37 +0000 (15:06 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 11 Jul 2025 00:57:49 +0000 (17:57 -0700)
Use enum decoding on auto-ints. Looks like we only had enum
auto-ints for input values until now. Upcoming RSS work will
need this to declare an attribute with flags as a uint.

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20250708220640.2738464-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/pyynl/lib/ynl.py

index 61deb592306711f009cd8b2db7c040d917530282..7529bce174ff5563f1fc559dd180a83e2714867e 100644 (file)
@@ -762,6 +762,8 @@ class YnlFamily(SpecFamily):
                     decoded = True
                 elif attr_spec.is_auto_scalar:
                     decoded = attr.as_auto_scalar(attr_spec['type'], attr_spec.byte_order)
+                    if 'enum' in attr_spec:
+                        decoded = self._decode_enum(decoded, attr_spec)
                 elif attr_spec["type"] in NlAttr.type_formats:
                     decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order)
                     if 'enum' in attr_spec: