[PATCH net-next 0/6] tools: ynl-gen: generate flags better

Asbjørn Sloth Tønnesen posted 6 patches 2 months ago
Documentation/netlink/genetlink-c.yaml        |  3 +
Documentation/netlink/genetlink-legacy.yaml   |  3 +
.../userspace-api/netlink/c-code-gen.rst      |  7 +-
include/uapi/linux/dpll.h                     |  6 +-
.../uapi/linux/ethtool_netlink_generated.h    | 20 ++---
include/uapi/linux/netdev.h                   | 34 ++++----
net/psp/psp-nl-gen.h                          |  4 +-
tools/include/uapi/linux/netdev.h             | 34 ++++----
tools/net/ynl/pyynl/lib/nlspec.py             |  7 +-
tools/net/ynl/pyynl/ynl_gen_c.py              | 79 +++++++++++--------
10 files changed, 117 insertions(+), 80 deletions(-)
[PATCH net-next 0/6] tools: ynl-gen: generate flags better
Posted by Asbjørn Sloth Tønnesen 2 months ago
This series focusses on increasing the quality of
the C code generated by ynl-gen for flags.

NB: I included a note in patch 6, on usage of the private
NETDEV_XDP_ACT_MASK in user-space.

Asbjørn Sloth Tønnesen (6):
  tools: ynl-gen: bitshift the flag values in the generated code
  tools: ynl-gen: refactor render-max enum generation
  tools: ynl-gen: use uapi mask definition in NLA_POLICY_MASK
  tools: ynl-gen: add generic p_wrap() helper
  tools: ynl-gen: construct bitflag masks in generated headers
  tools: ynl-gen: allow custom naming of render-max definitions

 Documentation/netlink/genetlink-c.yaml        |  3 +
 Documentation/netlink/genetlink-legacy.yaml   |  3 +
 .../userspace-api/netlink/c-code-gen.rst      |  7 +-
 include/uapi/linux/dpll.h                     |  6 +-
 .../uapi/linux/ethtool_netlink_generated.h    | 20 ++---
 include/uapi/linux/netdev.h                   | 34 ++++----
 net/psp/psp-nl-gen.h                          |  4 +-
 tools/include/uapi/linux/netdev.h             | 34 ++++----
 tools/net/ynl/pyynl/lib/nlspec.py             |  7 +-
 tools/net/ynl/pyynl/ynl_gen_c.py              | 79 +++++++++++--------
 10 files changed, 117 insertions(+), 80 deletions(-)

-- 
2.51.0

Re: [PATCH net-next 0/6] tools: ynl-gen: generate flags better
Posted by Jacob Keller 2 months ago

On 10/13/2025 9:49 AM, Asbjørn Sloth Tønnesen wrote:
> This series focusses on increasing the quality of
> the C code generated by ynl-gen for flags.
> 
> NB: I included a note in patch 6, on usage of the private
> NETDEV_XDP_ACT_MASK in user-space.
> 

Everything here is an improvement over the existing output. I would like
if we could use "BIT(N)" instead of "1U << N", but I think its better
than the current pre-computed values that you have to parse as bit values.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

> Asbjørn Sloth Tønnesen (6):
>   tools: ynl-gen: bitshift the flag values in the generated code
>   tools: ynl-gen: refactor render-max enum generation
>   tools: ynl-gen: use uapi mask definition in NLA_POLICY_MASK
>   tools: ynl-gen: add generic p_wrap() helper
>   tools: ynl-gen: construct bitflag masks in generated headers
>   tools: ynl-gen: allow custom naming of render-max definitions
> 
>  Documentation/netlink/genetlink-c.yaml        |  3 +
>  Documentation/netlink/genetlink-legacy.yaml   |  3 +
>  .../userspace-api/netlink/c-code-gen.rst      |  7 +-
>  include/uapi/linux/dpll.h                     |  6 +-
>  .../uapi/linux/ethtool_netlink_generated.h    | 20 ++---
>  include/uapi/linux/netdev.h                   | 34 ++++----
>  net/psp/psp-nl-gen.h                          |  4 +-
>  tools/include/uapi/linux/netdev.h             | 34 ++++----
>  tools/net/ynl/pyynl/lib/nlspec.py             |  7 +-
>  tools/net/ynl/pyynl/ynl_gen_c.py              | 79 +++++++++++--------
>  10 files changed, 117 insertions(+), 80 deletions(-)
>