Re: [PATCH net-next v3 11/11] wireguard: netlink: generate netlink code

Jakub Kicinski
2025-11-20T03:20:00Z

On Thu, 20 Nov 2025 03:46:39 +0100 Jason A. Donenfeld wrote:
> > Do you care about the exact cmdline of the python tool, or can we just
> > append:
> >
> > /* To regenerate run: tools/net/ynl/ynl-regen.sh */
>
> The args are non-trivial, right?

They aren't all that complicated TBH, quoting slightly modified from
tools/net/ynl/ynl-regen.sh:

$TOOL --mode $mode --$type --spec $KDIR/$yaml_spec $extra_args -o $output

The line just gets quote long for my taste with all the paths in place.

Somewhere along the line we added --cmp-out to make sure output isn't
modified on every regen attempt (for the benefit of incremental builds).

> The idea is so that these files can be regenerated in a few years
> when the ynl project has widely succeeded and we've all paged this
> out of our minds and forgotten how it all worked.

We run ./tools/net/ynl/ynl-regen.sh in our CI, checking if anything
diverged. Primarily because in early days, when codegen was modified
more often, I was worried we'll break the generation for some of the
specs.

The documentation also basically says "create the fake header where
you want the file to be and run ./tools/net/ynl/ynl-regen.sh".

https://docs.kernel.org/userspace-api/netlink/intro-specs.html#generating-kernel-code

Admittedly most of this comes down to "what Jakub found convenient
when developing the specs" :S