mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
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: Alessandro Marcolini <alessandromarcolini99@gmail.com> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/c5bc9f5797168dbf7a4379c42f38d5de8ac7f38a.1706962013.git.alessandromarcolini99@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
70ff9a91e8
commit
b9bcfc3bc9
|
@ -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''
|
||||
|
|
Loading…
Reference in a new issue