mbox series

[net-next,v2,0/7] netlink: specs: add a spec for nl80211 wiphy

Message ID 20241210161448.76799-1-donald.hunter@gmail.com
Headers show
Series netlink: specs: add a spec for nl80211 wiphy | expand

Message

Donald Hunter Dec. 10, 2024, 4:14 p.m. UTC
Add a rudimentary YNL spec for nl80211 that includes get-wiphy and
get-interface, along with some required enhancements to YNL and the
netlink schemas.

Patch 1 is a minor cleanup to prepare for patch 2
Patches 2-4 are new features for YNL
Patches 5-6 are schema updates for feature parity
Patch 7 is the new nl80211 spec

v1 -> v2
 - Add formatting hints support to patch 3, thanks Jakub
 - Raise exception for unhandled hints in patch 4, thanks Jakub
 - Update nl80211 spec w/ split-wiphy-dump in patch 7, thanks Johannes

Donald Hunter (7):
  tools/net/ynl: remove extraneous plural from variable names
  tools/net/ynl: support decoding indexed arrays as enums
  tools/net/ynl: support rendering C array members to strings
  tools/net/ynl: accept IP string inputs
  netlink: specs: support nested structs in genetlink legacy
  netlink: specs: add s8, s16 to genetlink schemas
  netlink: specs: wireless: add a spec for nl80211

 Documentation/netlink/genetlink-c.yaml      |    2 +-
 Documentation/netlink/genetlink-legacy.yaml |    5 +-
 Documentation/netlink/genetlink.yaml        |    2 +-
 Documentation/netlink/specs/nl80211.yaml    | 1938 +++++++++++++++++++
 tools/net/ynl/lib/ynl.py                    |   45 +-
 5 files changed, 1978 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/netlink/specs/nl80211.yaml

Comments

Simon Horman Dec. 11, 2024, 9:07 p.m. UTC | #1
On Tue, Dec 10, 2024 at 04:14:48PM +0000, Donald Hunter wrote:
> Add a rudimentary YNL spec for nl80211 that covers get-wiphy,
> get-interface and get-protocol-features.
> 
> ./tools/net/ynl/cli.py \
>     --spec Documentation/netlink/specs/nl80211.yaml \
>     --do get-protocol-features
> {'protocol-features': {'split-wiphy-dump'}}
> 
> ./tools/net/ynl/cli.py \
>     --spec Documentation/netlink/specs/nl80211.yaml \
>     --dump get-wiphy --json '{ "split-wiphy-dump": true }'
> 
> ./tools/net/ynl/cli.py \
>     --spec Documentation/netlink/specs/nl80211.yaml \
>     --dump get-interface
> 
> Signed-off-by: Donald Hunter <donald.hunter@gmail.com>

Hi Donald,

Perhaps I'm doing something silly here, or my environment is somehow
broken. But with this patch applied I see:

make -C tools/net/ynl/ distclean && make -C tools/net/ynl/

...

-e      GEN nl80211-user.c
Traceback (most recent call last):
  File "/home/horms/projects/linux/linux/tools/net/ynl/generated/../ynl-gen-c.py", line 3018, in <module>
    main()
  File "/home/horms/projects/linux/linux/tools/net/ynl/generated/../ynl-gen-c.py", line 2727, in main
    parsed = Family(args.spec, exclude_ops)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/horms/projects/linux/linux/tools/net/ynl/generated/../ynl-gen-c.py", line 928, in __init__
    super().__init__(file_name, exclude_ops=exclude_ops)
  File "/home/horms/projects/linux/linux/tools/net/ynl/lib/nlspec.py", line 480, in __init__
    elem.resolve()
  File "/home/horms/projects/linux/linux/tools/net/ynl/generated/../ynl-gen-c.py", line 946, in resolve
    self.resolve_up(super())
  File "/home/horms/projects/linux/linux/tools/net/ynl/lib/nlspec.py", line 53, in resolve_up
    up.resolve()
  File "/home/horms/projects/linux/linux/tools/net/ynl/lib/nlspec.py", line 588, in resolve
    attr_set = self.new_attr_set(elem)
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/horms/projects/linux/linux/tools/net/ynl/generated/../ynl-gen-c.py", line 992, in new_attr_set
    return AttrSet(self, elem)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/horms/projects/linux/linux/tools/net/ynl/generated/../ynl-gen-c.py", line 824, in __init__
    super().__init__(family, yaml)
  File "/home/horms/projects/linux/linux/tools/net/ynl/lib/nlspec.py", line 215, in __init__
    attr = self.new_attr(elem, val)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/horms/projects/linux/linux/tools/net/ynl/generated/../ynl-gen-c.py", line 873, in new_attr
    raise Exception(f'new_attr: unsupported sub-type {elem["sub-type"]}')
Exception: new_attr: unsupported sub-type u32
make[1]: *** [Makefile:37: nl80211-user.c] Error 1
Donald Hunter Dec. 11, 2024, 10:24 p.m. UTC | #2
On Wed, 11 Dec 2024 at 21:13, Simon Horman <horms@kernel.org> wrote:
>
> On Tue, Dec 10, 2024 at 04:14:48PM +0000, Donald Hunter wrote:
> > Add a rudimentary YNL spec for nl80211 that covers get-wiphy,
> > get-interface and get-protocol-features.
> >
> > ./tools/net/ynl/cli.py \
> >     --spec Documentation/netlink/specs/nl80211.yaml \
> >     --do get-protocol-features
> > {'protocol-features': {'split-wiphy-dump'}}
> >
> > ./tools/net/ynl/cli.py \
> >     --spec Documentation/netlink/specs/nl80211.yaml \
> >     --dump get-wiphy --json '{ "split-wiphy-dump": true }'
> >
> > ./tools/net/ynl/cli.py \
> >     --spec Documentation/netlink/specs/nl80211.yaml \
> >     --dump get-interface
> >
> > Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
>
> Hi Donald,
>
> Perhaps I'm doing something silly here, or my environment is somehow
> broken. But with this patch applied I see:
>
> make -C tools/net/ynl/ distclean && make -C tools/net/ynl/
> ...
> Exception: new_attr: unsupported sub-type u32
> make[1]: *** [Makefile:37: nl80211-user.c] Error 1

Hi Simon,

Thanks for reporting. It was also flagged up on patchwork. My bad. I
had a blind spot for checking the C build because the last few specs I
have worked on have been netlink-raw which don't have codegen. I'll
look at fixing this and any subsequent issues.

Thanks,
Donald.