netlink: specs: remove phantom structs
Subsystems (3)
Jakub Kicinski
maintainerv2 cover netlink: specs: remove phantom structs
rt-netlink and nl80211 have a few structs which may be helpful for Python decoding of binary attrs, but which don't actually exist in the C uAPI. This prevents us from using struct pointers for binary types in C.
We could support this situation better in the codegen, or add these structs to uAPI. That said Johannes suggested we remove the WiFi structs for now, and the rt-link ones are semi-broken.
Drop the struct definitions, for now, if someone has a need to use such structs in Python (as opposed to them being defined for completeness) we can revist.
v2:
- pure rebase
v1: https://lore.kernel.org/[email protected]
Jakub Kicinski (4):
netlink: specs: nl80211: drop structs which are not uAPI
netlink: specs: ovs: correct struct names
netlink: specs: remove implicit structs for SNMP counters
netlink: specs: rt-link: remove implicit structs from devconf
Documentation/netlink/specs/nl80211.yaml | 68 ------- Documentation/netlink/specs/ovs_datapath.yaml | 10 +- Documentation/netlink/specs/ovs_vport.yaml | 5 +- Documentation/netlink/specs/rt-link.yaml | 167 +++--------------- 4 files changed, 28 insertions(+), 222 deletions(-)
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH v2 1/4 netlink: specs: nl80211: drop structs which are not uAPI
C codegen will soon use structs for binary types. A handful of structs in WiFi carry information elements from the wire, defined by the standard. The structs are not part of uAPI, so we can't use them in C directly. We could add them to the uAPI or add some annotation to tell the codegen to output a local version to the user header. The former seems arbitrary since we don't expose structs for most of the standard. The latter seems like a lot of work for a rare occurrence. Drop the struct info for now.
--- Documentation/netlink/specs/nl80211.yaml | 68 ------------------------ 1 file changed, 68 deletions(-)
Documentation/netlink/specs/nl80211.yaml +0 -68
@@ -203,71 +203,6 @@ protocol: genetlink-legacy - scan-random-mac-addr - sched-scan-random-mac-addr - no-random-mac-addr - - - name: ieee80211-mcs-info - type: struct - members: - - - name: rx-mask - type: binary - len: 10 - - - name: rx-highest - type: u16 - byte-order: little-endian - - - name: tx-params - type: u8 - - - name: reserved - type: binary - len: 3 - - - name: ieee80211-vht-mcs-info - type: struct - members: - - - name: rx-mcs-map - type: u16 - byte-order: little-endian - - - name: rx-highest - type: u16 - byte-order: little-endian - - - name: tx-mcs-map - type: u16 - byte-order: little-endian - - - name: tx-highest - type: u16 - byte-order: little-endian - - - name: ieee80211-ht-cap - type: struct - members: - - - name: cap-info - type: u16 - byte-order: little-endian - - - name: ampdu-params-info - type: u8 - - - name: mcs - type: binary - struct: ieee80211-mcs-info - - - name: extended-ht-cap-info - type: u16 - byte-order: little-endian - - - name: tx-bf-cap-info - type: u32 - byte-order: little-endian - - - name: antenna-selection-info - type: u8 - name: channel-type type: enum
@@ -761,7 +696,6 @@ protocol: genetlink-legacy - name: ht-capability-mask type: binary - struct: ieee80211-ht-cap - name: noack-map type: u16
@@ -1382,7 +1316,6 @@ protocol: genetlink-legacy - name: ht-mcs-set type: binary - struct: ieee80211-mcs-info - name: ht-capa type: u16
@@ -1395,7 +1328,6 @@ protocol: genetlink-legacy - name: vht-mcs-set type: binary - struct: ieee80211-vht-mcs-info - name: vht-capa type: u32
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH v2 2/4 netlink: specs: ovs: correct struct names
In reply to Jakub KicinskiC codegen will soon support using struct types for binary attrs. Correct the struct names in OvS specs.
--- Documentation/netlink/specs/ovs_datapath.yaml | 10 ++++------ Documentation/netlink/specs/ovs_vport.yaml | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-)
Documentation/netlink/specs/ovs_datapath.yaml +4 -6
@@ -35,8 +35,7 @@ uapi-header: linux/openvswitch.h name: dispatch-upcall-per-cpu doc: Allow per-cpu dispatch of upcalls - - name: datapath-stats - enum-name: ovs-dp-stats + name: ovs-dp-stats type: struct members: -
@@ -52,8 +51,7 @@ uapi-header: linux/openvswitch.h name: n-flows type: u64 - - name: megaflow-stats - enum-name: ovs-dp-megaflow-stats + name: ovs-dp-megaflow-stats type: struct members: -
@@ -88,11 +86,11 @@ uapi-header: linux/openvswitch.h - name: stats type: binary - struct: datapath-stats + struct: ovs-dp-stats - name: megaflow-stats type: binary - struct: megaflow-stats + struct: ovs-dp-megaflow-stats - name: user-features type: u32
Documentation/netlink/specs/ovs_vport.yaml +2 -3
@@ -23,9 +23,8 @@ uapi-header: linux/openvswitch.h name-prefix: ovs-vport-type- entries: [ unspec, netdev, internal, gre, vxlan, geneve ] - - name: vport-stats + name: ovs-vport-stats type: struct - enum-name: ovs-vport-stats members: - name: rx-packets
@@ -106,7 +105,7 @@ uapi-header: linux/openvswitch.h - name: stats type: binary - struct: vport-stats + struct: ovs-vport-stats - name: pad type: unused
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH v2 3/4 netlink: specs: remove implicit structs for SNMP counters
In reply to Jakub KicinskiuAPI doesn't define structs for the SNMP counters, just enums to index them as arrays. Switch to the same representation in the spec. C codegen will soon need all the struct types to actually exist.
Note that the existing definition was broken, anyway, as the first member should be the number of counters reported.
--- Documentation/netlink/specs/rt-link.yaml | 60 +++++------------------- 1 file changed, 12 insertions(+), 48 deletions(-)
Documentation/netlink/specs/rt-link.yaml +12 -48
@@ -585,138 +585,102 @@ protonum: 0 type: u32 - name: ifla-icmp6-stats - type: struct - members: + enum-name: + type: enum + entries: + - + name: num - name: inmsgs - type: u64 - name: inerrors - type: u64 - name: outmsgs - type: u64 - name: outerrors - type: u64 - name: csumerrors - type: u64 - name: ratelimithost - type: u64 - name: ifla-inet6-stats - type: struct - members: + enum-name: + type: enum + entries: + - + name: num - name: inpkts - type: u64 - name: inoctets - type: u64 - name: indelivers - type: u64 - name: outforwdatagrams - type: u64 - name: outpkts - type: u64 - name: outoctets - type: u64 - name: inhdrerrors - type: u64 - name: intoobigerrors - type: u64 - name: innoroutes - type: u64 - name: inaddrerrors - type: u64 - name: inunknownprotos - type: u64 - name: intruncatedpkts - type: u64 - name: indiscards - type: u64 - name: outdiscards - type: u64 - name: outnoroutes - type: u64 - name: reasmtimeout - type: u64 - name: reasmreqds - type: u64 - name: reasmoks - type: u64 - name: reasmfails - type: u64 - name: fragoks - type: u64 - name: fragfails - type: u64 - name: fragcreates - type: u64 - name: inmcastpkts - type: u64 - name: outmcastpkts - type: u64 - name: inbcastpkts - type: u64 - name: outbcastpkts - type: u64 - name: inmcastoctets - type: u64 - name: outmcastoctets - type: u64 - name: inbcastoctets - type: u64 - name: outbcastoctets - type: u64 - name: csumerrors - type: u64 - name: noectpkts - type: u64 - name: ect1-pkts - type: u64 - name: ect0-pkts - type: u64 - name: cepkts - type: u64 - name: reasm-overlaps - type: u64 - name: br-boolopt-multi type: struct members:
@@ -2195,7 +2159,7 @@ protonum: 0 - name: stats type: binary - struct: ifla-inet6-stats + sub-type: u64 - name: mcast type: binary
@@ -2206,7 +2170,7 @@ protonum: 0 - name: icmp6stats type: binary - struct: ifla-icmp6-stats + sub-type: u64 - name: token type: binary
Signature · 1 line
2.49.0
Jakub Kicinski
maintainerPATCH v2 4/4 netlink: specs: rt-link: remove implicit structs from devconf
In reply to Jakub Kicinskidevconf is even odder than SNMP. On input it reports an array of u32s which seem to be indexed by the enum values - 1. On output kernel expects a nest where each attr has the enum type as the nla type.
sub-type: u32 is probably best we can do right now.
--- Documentation/netlink/specs/rt-link.yaml | 107 +++-------------------- 1 file changed, 10 insertions(+), 97 deletions(-)
Documentation/netlink/specs/rt-link.yaml +10 -97
@@ -304,285 +304,196 @@ protonum: 0 type: u8 - name: ipv4-devconf - type: struct - members: + enum-name: + type: enum + entries: - name: forwarding - type: u32 - name: mc-forwarding - type: u32 - name: proxy-arp - type: u32 - name: accept-redirects - type: u32 - name: secure-redirects - type: u32 - name: send-redirects - type: u32 - name: shared-media - type: u32 - name: rp-filter - type: u32 - name: accept-source-route - type: u32 - name: bootp-relay - type: u32 - name: log-martians - type: u32 - name: tag - type: u32 - name: arpfilter - type: u32 - name: medium-id - type: u32 - name: noxfrm - type: u32 - name: nopolicy - type: u32 - name: force-igmp-version - type: u32 - name: arp-announce - type: u32 - name: arp-ignore - type: u32 - name: promote-secondaries - type: u32 - name: arp-accept - type: u32 - name: arp-notify - type: u32 - name: accept-local - type: u32 - name: src-vmark - type: u32 - name: proxy-arp-pvlan - type: u32 - name: route-localnet - type: u32 - name: igmpv2-unsolicited-report-interval - type: u32 - name: igmpv3-unsolicited-report-interval - type: u32 - name: ignore-routes-with-linkdown - type: u32 - name: drop-unicast-in-l2-multicast - type: u32 - name: drop-gratuitous-arp - type: u32 - name: bc-forwarding - type: u32 - name: arp-evict-nocarrier - type: u32 - name: ipv6-devconf - type: struct - members: + enum-name: + type: enum + entries: - name: forwarding - type: u32 - name: hoplimit - type: u32 - name: mtu6 - type: u32 - name: accept-ra - type: u32 - name: accept-redirects - type: u32 - name: autoconf - type: u32 - name: dad-transmits - type: u32 - name: rtr-solicits - type: u32 - name: rtr-solicit-interval - type: u32 - name: rtr-solicit-delay - type: u32 - name: use-tempaddr - type: u32 - name: temp-valid-lft - type: u32 - name: temp-prefered-lft - type: u32 - name: regen-max-retry - type: u32 - name: max-desync-factor - type: u32 - name: max-addresses - type: u32 - name: force-mld-version - type: u32 - name: accept-ra-defrtr - type: u32 - name: accept-ra-pinfo - type: u32 - name: accept-ra-rtr-pref - type: u32 - name: rtr-probe-interval - type: u32 - name: accept-ra-rt-info-max-plen - type: u32 - name: proxy-ndp - type: u32 - name: optimistic-dad - type: u32 - name: accept-source-route - type: u32 - name: mc-forwarding - type: u32 - name: disable-ipv6 - type: u32 - name: accept-dad - type: u32 - name: force-tllao - type: u32 - name: ndisc-notify - type: u32 - name: mldv1-unsolicited-report-interval - type: u32 - name: mldv2-unsolicited-report-interval - type: u32 - name: suppress-frag-ndisc - type: u32 - name: accept-ra-from-local - type: u32 - name: use-optimistic - type: u32 - name: accept-ra-mtu - type: u32 - name: stable-secret - type: u32 - name: use-oif-addrs-only - type: u32 - name: accept-ra-min-hop-limit - type: u32 - name: ignore-routes-with-linkdown - type: u32 - name: drop-unicast-in-l2-multicast - type: u32 - name: drop-unsolicited-na - type: u32 - name: keep-addr-on-down - type: u32 - name: rtr-solicit-max-interval - type: u32 - name: seg6-enabled - type: u32 - name: seg6-require-hmac - type: u32 - name: enhanced-dad - type: u32 - name: addr-gen-mode - type: u8 - name: disable-policy - type: u32 - name: accept-ra-rt-info-min-plen - type: u32 - name: ndisc-tclass - type: u32 - name: rpl-seg-enabled - type: u32 - name: ra-defrtr-metric - type: u32 - name: ioam6-enabled - type: u32 - name: ioam6-id - type: u32 - name: ioam6-id-wide - type: u32 - name: ndisc-evict-nocarrier - type: u32 - name: accept-untracked-na - type: u32 - name: ifla-icmp6-stats enum-name:
@@ -2144,7 +2055,8 @@ protonum: 0 - name: conf type: binary - struct: ipv4-devconf + sub-type: u32 + doc: u32 indexed by ipv4-devconf - 1 on output, on input it's a nest - name: ifla6-attrs name-prefix: ifla-inet6-
@@ -2155,7 +2067,8 @@ protonum: 0 - name: conf type: binary - struct: ipv6-devconf + sub-type: u32 + doc: u32 indexed by ipv6-devconf - 1 on output, on input it's a nest - name: stats type: binary
Signature · 1 line
2.49.0
Re: [PATCH net-next v2 3/4] netlink: specs: remove implicit structs for SNMP counters
In reply to Jakub KicinskiQuoted 8 lines · Jakub Kicinski
uAPI doesn't define structs for the SNMP counters, just enums to index them as arrays. Switch to the same representation in the spec. C codegen will soon need all the struct types to actually exist.
Note that the existing definition was broken, anyway, as the first member should be the number of counters reported.
Signed-off-by Jakub Kicinski <[email protected]>
Re: [PATCH net-next v2 4/4] netlink: specs: rt-link: remove implicit structs from devconf
In reply to Jakub KicinskiQuoted 7 lines · Jakub Kicinski
devconf is even odder than SNMP. On input it reports an array of u32s which seem to be indexed by the enum values - 1. On output kernel expects a nest where each attr has the enum type as the nla type.
sub-type: u32 is probably best we can do right now.
Signed-off-by Jakub Kicinski <[email protected]>
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 4 lines · On Tue, 6 May 2025 12:40:56 -0700 you wrote:
rt-netlink and nl80211 have a few structs which may be helpful for Python decoding of binary attrs, but which don't actually exist in the C uAPI. This prevents us from using struct pointers for binary types in C.
Quoted 8 lines
We could support this situation better in the codegen, or add these structs to uAPI. That said Johannes suggested we remove the WiFi structs for now, and the rt-link ones are semi-broken.
Drop the struct definitions, for now, if someone has a need to use such structs in Python (as opposed to them being defined for completeness) we can revist.[...]
Here is the summary with links:
- [net-next,v2,1/4] netlink: specs: nl80211: drop structs which are not uAPI
https://git.kernel.org/netdev/net-next/c/f22e764d7775 - [net-next,v2,2/4] netlink: specs: ovs: correct struct names https://git.kernel.org/netdev/net-next/c/6c2422396d53 - [net-next,v2,3/4] netlink: specs: remove implicit structs for SNMP counters https://git.kernel.org/netdev/net-next/c/ab91c140bea9 - [net-next,v2,4/4] netlink: specs: rt-link: remove implicit structs from devconf https://git.kernel.org/netdev/net-next/c/720447bd0b24
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html