Commit b9bcfc3b authored by Alessandro Marcolini's avatar Alessandro Marcolini Committed by Jakub Kicinski

tools: ynl: add support for encoding multi-attr

Multi-attr elements could not be encoded because of missing logic in the
ynl code. Enable encoding of these attributes by checking if the
attribute is a multi-attr and if the value to be processed is a list.

This has been tested both with the taprio and ets qdisc which contain
this kind of attributes.
Signed-off-by: default avatarAlessandro Marcolini <alessandromarcolini99@gmail.com>
Reviewed-by: default avatarDonald Hunter <donald.hunter@gmail.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/c5bc9f5797168dbf7a4379c42f38d5de8ac7f38a.1706962013.git.alessandromarcolini99@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 70ff9a91
......@@ -444,6 +444,13 @@ class YnlFamily(SpecFamily):
except KeyError:
raise Exception(f"Space '{space}' has no attribute '{name}'")
nl_type = attr.value
if attr.is_multi and isinstance(value, list):
attr_payload = b''
for subvalue in value:
attr_payload += self._add_attr(space, name, subvalue, search_attrs)
return attr_payload
if attr["type"] == 'nest':
nl_type |= Netlink.NLA_F_NESTED
attr_payload = b''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment