ynl: add ignore-index flag for indexed-array
Subsystems (4)
cover ynl: add ignore-index flag for indexed-array
This patchset adds a way to mark if an indedex array is just an array, and the index is uninteresting, as previously discussed[1].
Which is the case in most of the indexed-arrays in the current specs.
As the name indexed-array kinda implies that the index is interesting, then I am using ignore-index to mark if the index is unused.
This adds some noise to YNL, and as it's only few indexed-arrays which actually use the index, then if we can come up with some good naming, it may be better to reverse it so it's the default behaviour.
[1]
https://lore.kernel.org/r/[email protected]/
Asbjørn Sloth Tønnesen (7):
netlink: specs: add ignore-index flag for indexed-array
tools: ynl: support ignore-index in indexed-array decoding
tools: ynl: support ignore-index in indexed-array encoding
netlink: specs: nl80211: set ignore-index on indexed-arrays
netlink: specs: nlctrl: set ignore-index on indexed-arrays
netlink: specs: rt-link: set ignore-index on indexed-arrays
netlink: specs: tc: set ignore-index on indexed-arrays
Documentation/netlink/genetlink-c.yaml | 6 ++++++ Documentation/netlink/genetlink-legacy.yaml | 6 ++++++ Documentation/netlink/netlink-raw.yaml | 6 ++++++ Documentation/netlink/specs/nl80211.yaml | 8 ++++++++ Documentation/netlink/specs/nlctrl.yaml | 2 ++ Documentation/netlink/specs/rt-link.yaml | 2 ++ Documentation/netlink/specs/tc.yaml | 1 + .../userspace-api/netlink/genetlink-legacy.rst | 3 +++ tools/net/ynl/pyynl/lib/ynl.py | 18 ++++++++++++------ 9 files changed, 46 insertions(+), 6 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/7 netlink: specs: add ignore-index flag for indexed-array
Add a new YNL attribute ignore-index as a way to indicate that a given indexed-array attribute is really just used as an array, and hence the nested attribute-type aka. the index is unimportant.
This means that the kernel never uses the index when processing received netlink messages, and that it doesn't add any additional information when sent by the kernel.
For backward compatibility reasons the kernel can continue to set the index to a non-zero value in netlink messages, but it can safely be disregarded by clients when ignore-index is set to true.
When the index is non-zero, it is often just an incremental iterator value, which provides no additional value, as the order of the array elements is already known based on the order in the netlink message.
ignore-index is not added for the genetlink protocol, as any new families should use multi-attributes, unless they need the index.
--- Documentation/netlink/genetlink-c.yaml | 6 ++++++ Documentation/netlink/genetlink-legacy.yaml | 6 ++++++ Documentation/netlink/netlink-raw.yaml | 6 ++++++ Documentation/userspace-api/netlink/genetlink-legacy.rst | 3 +++ 4 files changed, 21 insertions(+)
Documentation/netlink/genetlink-c.yaml +6 -0
@@ -184,6 +184,12 @@ properties: nested-attributes: description: Name of the space (sub-space) used inside the attribute. type: string + ignore-index: + description: | + The indexed-array is just an array. The index, aka. the + nested attribute-type, can be disregarded, as it doesn't + contain anything interesting. + type: boolean enum: description: Name of the enum type used for the attribute. type: string
Documentation/netlink/genetlink-legacy.yaml +6 -0
@@ -233,6 +233,12 @@ properties: nested-attributes: description: Name of the space (sub-space) used inside the attribute. type: string + ignore-index: + description: | + The indexed-array is just an array. The index, aka. the + nested attribute-type, can be disregarded, as it doesn't + contain anything interesting. + type: boolean enum: description: Name of the enum type used for the attribute. type: string
Documentation/netlink/netlink-raw.yaml +6 -0
@@ -251,6 +251,12 @@ properties: nested-attributes: description: Name of the space (sub-space) used inside the attribute. type: string + ignore-index: + description: | + The indexed-array is just an array. The index, aka. the + nested attribute-type, can be disregarded, as it doesn't + contain anything interesting. + type: boolean enum: description: Name of the enum type used for the attribute. type: string
Documentation/userspace-api/netlink/genetlink-legacy.rst +3 -0
@@ -53,6 +53,9 @@ indexed-array limiting its size to 64kB). The ``ENTRY`` nests are special and have the index of the entry as their type instead of normal attribute type. +When ``ignore-index`` is set to ``true``, then the ``indexed-array`` is +just an array, and the index can be disregarded. + A ``sub-type`` is needed to describe what type in the ``ENTRY``. A ``nest`` ``sub-type`` means there are nest arrays in the ``ENTRY``, with the structure looks like::
Signature · 1 line
2.51.0
PATCH 2/7 tools: ynl: support ignore-index in indexed-array decoding
In reply to Asbjørn Sloth TønnesenWhen decoding indexed-arrays with ignore-index set, then elide the index, aka. the nested attribute-type.
Previously the index was always preserved for sub-type nest, but was elided for all other sub-types.
I have opted to reuse the existing subattr variable, as renaming it will render the diff unreadable at least for this version.
Output if rates does NOT have ignore-index set:
$ ./tools/net/ynl/pyynl/cli.py --family nl80211 --dump get-wiphy
[...]
'rates': [{0: {'rate': 60}},
{1: {'rate': 90}},
{2: {'rate': 120}},
{3: {'rate': 180}},
{4: {'rate': 240}},
[...]Output if rates has ignore-index set to true:
$ ./tools/net/ynl/pyynl/cli.py --family nl80211 --dump get-wiphy
[...]
'rates': [{'rate': 60},
{'rate': 90},
{'rate': 120},
{'rate': 180},
{'rate': 240},
[...]If the above example had to be passed back though --json, then it now aligns with the new output format, and would look like this:
--json '{"rates":[ {"rate":60}, {"rate":90}, ... ]}'
--- tools/net/ynl/pyynl/lib/ynl.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
tools/net/ynl/pyynl/lib/ynl.py +7 -4
@@ -690,23 +690,26 @@ class YnlFamily(SpecFamily): item = NlAttr(attr.raw, offset) offset += item.full_len + subattr = None if attr_spec["sub-type"] == 'nest': - subattrs = self._decode(NlAttrs(item.raw), attr_spec['nested-attributes']) - decoded.append({ item.type: subattrs }) + subattr = self._decode(NlAttrs(item.raw), attr_spec['nested-attributes']) elif attr_spec["sub-type"] == 'binary': subattr = item.as_bin() if attr_spec.display_hint: subattr = self._formatted_string(subattr, attr_spec.display_hint) - decoded.append(subattr) elif attr_spec["sub-type"] in NlAttr.type_formats: subattr = item.as_scalar(attr_spec['sub-type'], attr_spec.byte_order) if 'enum' in attr_spec: subattr = self._decode_enum(subattr, attr_spec) elif attr_spec.display_hint: subattr = self._formatted_string(subattr, attr_spec.display_hint) - decoded.append(subattr) else: raise Exception(f'Unknown {attr_spec["sub-type"]} with name {attr_spec["name"]}') + + if attr_spec.get('ignore-index', False): + decoded.append(subattr) + else: + decoded.append({ item.type: subattr }) return decoded def _decode_nest_type_value(self, attr, attr_spec):
Signature · 1 line
2.51.0
PATCH 3/7 tools: ynl: support ignore-index in indexed-array encoding
In reply to Asbjørn Sloth TønnesenWhen parsing indexed-array attributes to cli.py's --json, then previously the index would always be set incrementally.
This patch adds support for setting arbitrary indexes, when ignore-index is set to false or is unspecified.
When ignore-index is set to true, then it retains the current input format, and it's alignment with the output from cli.py.
The below examples are fictive as rates is not used in requests. The implementation have been tested with a newer version of the previously posted wireguard spec[1].
When rates have ignore-index set to false (or unspecified):
--json '{"rates":[ [0,{"rate":60}], [42,{"rate":90}] ]}'
When rates have ignore-index set to true:
--json '{"rates":[ {"rate":60}, {"rate":90} ]}'
[1] https://lore.kernel.org/netdev/[email protected]/
--- tools/net/ynl/pyynl/lib/ynl.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
tools/net/ynl/pyynl/lib/ynl.py +5 -2
@@ -566,8 +566,9 @@ class YnlFamily(SpecFamily): elif attr['type'] == 'indexed-array' and attr['sub-type'] == 'nest': nl_type |= Netlink.NLA_F_NESTED sub_space = attr['nested-attributes'] + ignore_idx = attr.get('ignore-index', False) attr_payload = self._encode_indexed_array(value, sub_space, - search_attrs) + search_attrs, ignore_idx) elif attr["type"] == 'flag': if not value: # If value is absent or false then skip attribute creation.
@@ -635,9 +636,11 @@ class YnlFamily(SpecFamily): sub_attrs) return attr_payload - def _encode_indexed_array(self, vals, sub_space, search_attrs): + def _encode_indexed_array(self, vals, sub_space, search_attrs, ignore_idx): attr_payload = b'' for i, val in enumerate(vals): + if not ignore_idx: + i, val = val[0], val[1] idx = i | Netlink.NLA_F_NESTED val_payload = self._add_nest_attrs(val, sub_space, search_attrs) attr_payload += self._add_attr_raw(idx, val_payload)
Signature · 1 line
2.51.0
PATCH 4/7 netlink: specs: nl80211: set ignore-index on indexed-arrays
In reply to Asbjørn Sloth TønnesenThe indexes in nl80211 indexed-arrays have no special meaning, they are just written with an iterator index, which refers to the order in which they have been packed into the netlink message.
Thus this patch sets ignore-index on these attributes.
Most of these are only used for dumping kernel state, and are never parsed by the kernel.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━┳━━━━━━━━┓ ┃ ┃ out/ ┃ input/ ┃ ignore ┃ ┃ Attribute ┃ dump ┃ parsed ┃ -index ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━╇━━━━━━━━┩ │ NL80211_ATTR_SUPPORTED_COMMANDS │ 1++ │ - │ yes │ │ NL80211_ATTR_INTERFACE_COMBINATIONS │ 1++ │ - │ yes │ │ NL80211_BAND_ATTR_FREQS │ 0++ │ - │ yes │ │ NL80211_BAND_ATTR_RATES │ 0++ │ - │ yes │ │ NL80211_BAND_ATTR_IFTYPE_DATA │ 1++ │ - │ yes │ │ NL80211_FREQUENCY_ATTR_WMM │ 0++ │ - │ yes │ │ NL80211_IFACE_COMB_LIMITS │ 1++ │ - │ yes │ │ NL80211_SAR_ATTR_SPECS │ 1++ │ yes(2) │ yes │ └─────────────────────────────────────┴──────┴────────┴────────┘
Where:
0++) incrementing index starting from 0
1++) incrementing index starting from 1
2) NL80211_SAR_ATTR_SPECS is parsed in nl80211_set_sar_specs(),
which doesn't use the index. Additionally it also has a NLA_POLICY_NESTED_ARRAY() policy, as defined in commit 1501d13596b9 ("netlink: add nested array policy validation"), meaning that the index has no meaning, and can be disregarded.
--- Documentation/netlink/specs/nl80211.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)
Documentation/netlink/specs/nl80211.yaml +8 -0
@@ -390,6 +390,7 @@ attribute-sets: name: supported-commands type: indexed-array sub-type: u32 + ignore-index: true enum: commands - name: frame
@@ -608,6 +609,7 @@ attribute-sets: name: interface-combinations type: indexed-array sub-type: nest + ignore-index: true nested-attributes: if-combination-attributes - name: software-iftypes
@@ -1307,11 +1309,13 @@ attribute-sets: name: freqs type: indexed-array sub-type: nest + ignore-index: true nested-attributes: frequency-attrs - name: rates type: indexed-array sub-type: nest + ignore-index: true nested-attributes: bitrate-attrs - name: ht-mcs-set
@@ -1335,6 +1339,7 @@ attribute-sets: name: iftype-data type: indexed-array sub-type: nest + ignore-index: true nested-attributes: iftype-data-attrs - name: edmg-channels
@@ -1418,6 +1423,7 @@ attribute-sets: name: wmm type: indexed-array sub-type: nest + ignore-index: true nested-attributes: wmm-attrs - name: no-he
@@ -1474,6 +1480,7 @@ attribute-sets: name: limits type: indexed-array sub-type: nest + ignore-index: true nested-attributes: iface-limit-attributes - name: maxnum
@@ -1613,6 +1620,7 @@ attribute-sets: name: specs type: indexed-array sub-type: nest + ignore-index: true nested-attributes: sar-specs - name: sar-specs
Signature · 1 line
2.51.0
PATCH 5/7 netlink: specs: nlctrl: set ignore-index on indexed-arrays
In reply to Asbjørn Sloth TønnesenThe indexes in nlctrl indexed-arrays have no special meaning, they are just written with an iterator index, which refers to the order in which they have been packed into the netlink message.
Thus this patch sets ignore-index on these attributes.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━┳━━━━━━━━┓ ┃ ┃ out/ ┃ input/ ┃ ignore ┃ ┃ Attribute ┃ dump ┃ parsed ┃ -index ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━╇━━━━━━━━┩ │ CTRL_ATTR_OPS │ 1++ │ - │ yes │ │ CTRL_ATTR_MCAST_GROUPS │ 1++ │ - │ yes │ └─────────────────────────────────────┴──────┴────────┴────────┘
Where:
1++) incrementing index starting from 1
--- Documentation/netlink/specs/nlctrl.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/netlink/specs/nlctrl.yaml +2 -0
@@ -67,11 +67,13 @@ attribute-sets: name: ops type: indexed-array sub-type: nest + ignore-index: true nested-attributes: op-attrs - name: mcast-groups type: indexed-array sub-type: nest + ignore-index: true nested-attributes: mcast-group-attrs - name: policy
Signature · 1 line
2.51.0
PATCH 6/7 netlink: specs: rt-link: set ignore-index on indexed-arrays
In reply to Asbjørn Sloth TønnesenMost of the indexes in rt-link indexed-arrays have no special meaning, they are just written with an iterator index, which refers to the order in which they have been packed into the netlink message.
Thus this patch sets ignore-index on these two attributes.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━┳━━━━━━━━┓ ┃ ┃ out/ ┃ input/ ┃ ignore ┃ ┃ Attribute ┃ dump ┃ parsed ┃ -index ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━╇━━━━━━━━┩ │ IFLA_BOND_ARP_IP_TARGET │ 0++ │ yes(1) │ yes │ │ IFLA_BOND_NS_IP6_TARGET │ 0++ │ yes(1) │ yes │ │ IFLA_OFFLOAD_XSTATS_HW_S_INFO │ (2) │ - │ no │ └─────────────────────────────────────┴──────┴────────┴────────┘
Where:
0++) incrementing index starting from 0
1) When parsed the index is unused.
2) IFLA_OFFLOAD_XSTATS_L3_STATS is used as index in
rtnl_offload_xstats_fill_hw_s_info().
--- Documentation/netlink/specs/rt-link.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/netlink/specs/rt-link.yaml +2 -0
@@ -1256,6 +1256,7 @@ attribute-sets: name: arp-ip-target type: indexed-array sub-type: u32 + ignore-index: true byte-order: big-endian display-hint: ipv4 -
@@ -1330,6 +1331,7 @@ attribute-sets: name: ns-ip6-target type: indexed-array sub-type: binary + ignore-index: true display-hint: ipv6 checks: exact-len: 16
Signature · 1 line
2.51.0
PATCH 7/7 netlink: specs: tc: set ignore-index on indexed-arrays
In reply to Asbjørn Sloth TønnesenThe indexes in tc indexed-arrays are mostly used for defining the priority winin an array of actions, and when parsed by the kernel they must be unique, and not exceed TCA_ACT_MAX_PRIO (32).
Therefore this patch only sets ignore-index on a single attribute TCA_CAKE_STATS_TIN_STATS, which is only used for dumping statistics, and never ingested by the kernel.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┓ ┃ ┃ out/ ┃ input/ ┃ ignore ┃ ┃ Attribute ┃ dump ┃ parsed ┃ -index ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━╇━━━━━━━━┩ │ TCA_BASIC_ACT │ 1++ (2) │ yes(3) │ no │ │ TCA_BPF_ACT │ 1++ (2) │ yes(3) │ no │ │ TCA_CAKE_STATS_TIN_STATS │ 1++ (4) │ - │ yes │ │ TCA_CGROUP_ACT │ 1++ (2) │ yes(3) │ no │ │ TCA_FLOWER_ACT │ 1++ (2) │ yes(3) │ no │ │ TCA_FW_ACT │ 1++ (2) │ yes(3) │ no │ │ TCA_MATCHALL_ACT │ 1++ (2) │ yes(3) │ no │ │ TCA_ROUTE4_ACT │ 1++ (2) │ yes(3) │ no │ │ TCA_U32_ACT │ 1++ (2) │ yes(3) │ no │ └──────────────────────────────────┴─────────┴────────┴────────┘
Where:
1++) incrementing index starting from 1
2) All _ACT are dumped with tcf_exts_dump() calling tcf_action_dump(). 3) Parsed in tcf_action_init(). 4) Dumped in cake_dump_stats().
--- Documentation/netlink/specs/tc.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/netlink/specs/tc.yaml +1 -0
@@ -2188,6 +2188,7 @@ attribute-sets: name: tin-stats type: indexed-array sub-type: nest + ignore-index: true nested-attributes: cake-tin-stats-attrs - name: deficit
Signature · 1 line
2.51.0
Jakub Kicinski
maintainerQuoted 11 lines · On Wed, 22 Oct 2025 18:26:53 +0000 Asbjørn Sloth Tønnesen wrote:
This patchset adds a way to mark if an indedex array is just an array, and the index is uninteresting, as previously discussed[1].
Which is the case in most of the indexed-arrays in the current specs.
As the name indexed-array kinda implies that the index is interesting, then I am using
ignore-indexto mark if the index is unused.This adds some noise to YNL, and as it's only few indexed-arrays which actually use the index, then if we can come up with some good naming, it may be better to reverse it so it's the default behaviour.
C code already does this, right? We just collect the attributes completely ignoring the index. So why do we need to extend the spec.
Have you found any case where the index matters and can be non-contiguous (other than the known TC kerfuffle).
FWIW another concept is what TypeValue does.
"Inject" the index into the child nest as an extra member. Most flexible but also prolly a PITA for user space to init those for requests.
Quoted 9 lines · Jakub Kicinski
Quoted 8 lines · On Wed, 22 Oct 2025 18:26:53 +0000 Asbjørn Sloth Tønnesen wrote:
This patchset adds a way to mark if an indedex array is just an array, and the index is uninteresting, as previously discussed[1].
Which is the case in most of the indexed-arrays in the current specs.
As the name indexed-array kinda implies that the index is interesting, then I am using
ignore-indexto mark if the index is unused.
Quoted 6 lines
Quoted 3 lines
This adds some noise to YNL, and as it's only few indexed-arrays which actually use the index, then if we can come up with some good naming, it may be better to reverse it so it's the default behaviour.
C code already does this, right? We just collect the attributes completely ignoring the index.
In the userspace C code, for sub-type nest the index is preserved in struct member idx, and elided for other sub-types.
Quoted 1 line
So why do we need to extend the spec.
For me it's mostly the naming "indexed-array". Earlier it was "array-nest", then we renamed it to "indexed-array" because it doesn't always contain nests. I think it's counter-intuitive to elide the index by default, for something called "indexed-array". The majority of the families using it don't care about the index.
What if we called it "ordered-array", and then always counted from 1 (for families that cares) when packing in user-space code?
Quoted 2 lines
Have you found any case where the index matters and can be non-contiguous (other than the known TC kerfuffle).
IFLA_OFFLOAD_XSTATS_HW_S_INFO could be re-defined as a nest, IFLA_OFFLOAD_XSTATS_L3_STATS is the only index atm.
IFLA_INET_CONF / IFLA_INET6_CONF is on input, but those are also special by having different types depending on direction.
I found a bunch of other ones, using a static index, but they can also be defined as a multi-attr wrapped in an additional outer nest, like IFLA_VF_VLAN_LIST already is.
Quoted 4 lines
FWIW another concept is what TypeValue does.
"Inject" the index into the child nest as an extra member. Most flexible but also prolly a PITA for user space to init those for requests.
Same as is done in the userspace C code for indexed-arrays with sub-type nest. For most families it doesn't matter if the C code inits the index or not.
Jakub Kicinski
maintainerQuoted 5 lines · On Thu, 23 Oct 2025 18:37:09 +0000 Asbjørn Sloth Tønnesen wrote:
Quoted 2 lines
C code already does this, right? We just collect the attributes completely ignoring the index.
In the userspace C code, for sub-type nest the index is preserved in struct member idx, and elided for other sub-types.
I see it now, I guess I added it for get but forgot to obey it for put :(
Quoted 8 lines
Quoted 1 line
So why do we need to extend the spec.
For me it's mostly the naming "indexed-array". Earlier it was "array-nest", then we renamed it to "indexed-array" because it doesn't always contain nests. I think it's counter-intuitive to elide the index by default, for something called "indexed-array". The majority of the families using it don't care about the index.
Quoted 8 lines
What if we called it "ordered-array", and then always counted from 1 (for families that cares) when packing in user-space code?
Quoted 2 lines
Have you found any case where the index matters and can be non-contiguous (other than the known TC kerfuffle).
IFLA_OFFLOAD_XSTATS_HW_S_INFOcould be re-defined as a nest,IFLA_OFFLOAD_XSTATS_L3_STATSis the only index atm.
Isn't that pretty much always true? If the index is significant the whole thing could be redefined as a nest, with names provided in the spec?
Quoted 6 lines
IFLA_INET_CONF/IFLA_INET6_CONFis on input, but those are also special by having different types depending on direction.I found a bunch of other ones, using a static index, but they can also be defined as a multi-attr wrapped in an additional outer nest, like
IFLA_VF_VLAN_LISTalready is.
Multi-attr with an outer nest should at least solve your wg problem I guess? If all the attrs have type of 0 we can make it a multi-attr.
Quoted 8 lines
Quoted 4 lines
FWIW another concept is what TypeValue does.
"Inject" the index into the child nest as an extra member. Most flexible but also prolly a PITA for user space to init those for requests.Same as is done in the userspace C code for indexed-arrays with sub-type nest. For most families it doesn't matter if the C code inits the index or not.
Quoted 9 lines · Jakub Kicinski
Quoted 5 lines · On Thu, 23 Oct 2025 18:37:09 +0000 Asbjørn Sloth Tønnesen wrote:
Quoted 2 lines
C code already does this, right? We just collect the attributes completely ignoring the index.
In the userspace C code, for sub-type nest the index is preserved in struct member idx, and elided for other sub-types.
I see it now, I guess I added it for get but forgot to obey it for put :(
I can fix that up in v2.
Do we wanna do the same for sub-type nest in the python client?
Quoted 14 lines
Quoted 14 lines
Quoted 1 line
So why do we need to extend the spec.
For me it's mostly the naming "indexed-array". Earlier it was "array-nest", then we renamed it to "indexed-array" because it doesn't always contain nests. I think it's counter-intuitive to elide the index by default, for something called "indexed-array". The majority of the families using it don't care about the index.
What if we called it "ordered-array", and then always counted from 1 (for families that cares) when packing in user-space code?
Quoted 2 lines
Have you found any case where the index matters and can be non-contiguous (other than the known TC kerfuffle).
Quoted 6 lines
Quoted 2 lines
IFLA_OFFLOAD_XSTATS_HW_S_INFOcould be re-defined as a nest,IFLA_OFFLOAD_XSTATS_L3_STATSis the only index atm.Isn't that pretty much always true? If the index is significant the whole thing could be redefined as a nest, with names provided in the spec?
I guess it depends on the range of indexes, the aboveIFLA_OFFLOAD_XSTATS_L3_STATS is aka. 3, so the new nest policy would be (0..2 = unused, 3 = .._L3_STATS}, which is fine, but for higher indexes
it might get a bit silly, but I haven't found any too high indexes.
NLBL_CIPSOV4_A_MLSCATLST has NLBL_CIPSOV4_A_MLSCAT which is 11, but that corner seams very dusty, so I don't expect that to get YNL support.
Nest + multi-attr is great for the cases where we want per-attr typing, like IFLA_PROP_LIST / IFLA_ALT_IFNAME, but a bit awkward if they all are nests with the same policy.
Quoted 9 lines
Quoted 6 lines
IFLA_INET_CONF/IFLA_INET6_CONFis on input, but those are also special by having different types depending on direction.I found a bunch of other ones, using a static index, but they can also be defined as a multi-attr wrapped in an additional outer nest, like
IFLA_VF_VLAN_LISTalready is.Multi-attr with an outer nest should at least solve your wg problem I guess? If all the attrs have type of 0 we can make it a multi-attr.
WG don't use the index, so it's fine with incrementing from 1.
Converting it to nest + multi-attr would require extra pollution in the UAPI, so I don't think I can get that past Jason. It would also be hard to shove in between the elements in the existing naming.
I am just trying to get the nits that came up in the previous discussions handled, so they are fixed when I submit the WG spec again, so that I don't have to go back and update it shortly after, as the WG/Jason bandwidth seams pretty limited atm.
Jakub Kicinski
maintainerQuoted 3 lines · On Fri, 24 Oct 2025 19:19:10 +0000 Asbjørn Sloth Tønnesen wrote:
Do we wanna do the same for sub-type nest in the python client?
as the WG/Jason bandwidth seams pretty limited atm.
Please focus on what's needed to get WG implemented.
My "bandwidth" for pondering cleanups that may not matter in practice is also limited. Main goal for YNL is new families. Polishing the old stuff is a huge time sink.