Skip to contentSkip to conversation

tools: ynl: auto-gen for all genetlink families

PATCH Applied Jakub Kicinski 3 participants 8 messages Feb 2, 2024 – Feb 3, 2024

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

cover tools: ynl: auto-gen for all genetlink families

The code gen has caught up with all features required in genetlink families in Linux 6.8 already. We have also stopped committing auto- -generated user space code to the tree. Instead of listing all the families in the Makefile search the spec directory, and generate code for everything that's not legacy netlink.

Jakub Kicinski (3):
tools: ynl: include dpll and mptcp_pm in C codegen
tools: ynl: generate code for ovs families
tools: ynl: auto-gen for all genetlink families

 tools/net/ynl/Makefile.deps      |  2 ++
 tools/net/ynl/generated/Makefile |  5 ++-
 tools/net/ynl/samples/ovs.c      | 60 ++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 tools/net/ynl/samples/ovs.c
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/3 tools: ynl: include dpll and mptcp_pm in C codegen

The DPLL and mptcp_pm families are pretty clean, and YNL C codegen supports them fully with no changes. Add them to user space codegen so that C samples can be written, and we know immediately if changes to these families require YNL codegen work.

---
 tools/net/ynl/Makefile.deps      | 2 ++
 tools/net/ynl/generated/Makefile | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
tools/net/ynl/Makefile.deps +2 -0
index 3110f84dd029..e6154a1255f8 100644
@@ -15,7 +15,9 @@ UAPI_PATH:=../../../../include/uapi/
 get_hdr_inc=-D$(1) -include $(UAPI_PATH)/linux/$(2)
 
 CFLAGS_devlink:=$(call get_hdr_inc,_LINUX_DEVLINK_H_,devlink.h)
+CFLAGS_dpll:=$(call get_hdr_inc,_LINUX_DPLL_H_,dpll.h)
 CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h)
 CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h)
+CFLAGS_mptcp_pm:=$(call get_hdr_inc,_LINUX_MPTCP_PM_H_,mptcp_pm.h)
 CFLAGS_netdev:=$(call get_hdr_inc,_LINUX_NETDEV_H,netdev.h)
 CFLAGS_nfsd:=$(call get_hdr_inc,_LINUX_NFSD_NETLINK_H,nfsd_netlink.h)
tools/net/ynl/generated/Makefile +1 -1
index 84cbabdd02a8..0d826fd008ed 100644
@@ -14,7 +14,7 @@ YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \
 
 TOOL:=../ynl-gen-c.py
 
-GENS:=ethtool devlink handshake fou netdev nfsd
+GENS:=ethtool devlink dpll handshake fou mptcp_pm netdev nfsd
 SRCS=$(patsubst %,%-user.c,${GENS})
 HDRS=$(patsubst %,%-user.h,${GENS})
 OBJS=$(patsubst %,%-user.o,${GENS})
Signature · 1 line
2.43.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH net-next 1/3] tools: ynl: include dpll and mptcp_pm in C codegen

Quoted 6 lines · Fri, Feb 02, 2024 at 01:49:24AM CET, [email protected] wrote:

The DPLL and mptcp_pm families are pretty clean, and YNL C codegen supports them fully with no changes. Add them to user space codegen so that C samples can be written, and we know immediately if changes to these families require YNL codegen work.

author maintainer
#3 lore raw

PATCH 2/3 tools: ynl: generate code for ovs families

In reply to Jakub Kicinski

Add ovs_flow, ovs_vport and ovs_datapath to the families supported in C. ovs-flow has some circular nesting which is fun to deal with, but the necessary support has been added already in the previous release cycle.

Add a sample that proves that dealing with fixed headers does actually work correctly.

---
 tools/net/ynl/generated/Makefile |  2 +-
 tools/net/ynl/samples/ovs.c      | 60 ++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 tools/net/ynl/samples/ovs.c
tools/net/ynl/generated/Makefile +1 -1
index 0d826fd008ed..3b9f738c61b8 100644
@@ -14,7 +14,7 @@ YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \
 
 TOOL:=../ynl-gen-c.py
 
-GENS:=ethtool devlink dpll handshake fou mptcp_pm netdev nfsd
+GENS:=ethtool devlink dpll handshake fou mptcp_pm netdev nfsd ovs_datapath ovs_vport ovs_flow
 SRCS=$(patsubst %,%-user.c,${GENS})
 HDRS=$(patsubst %,%-user.h,${GENS})
 OBJS=$(patsubst %,%-user.o,${GENS})
tools/net/ynl/samples/ovs.c new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH net-next 2/3] tools: ynl: generate code for ovs families

Quoted 9 lines · Fri, Feb 02, 2024 at 01:49:25AM CET, [email protected] wrote:

Add ovs_flow, ovs_vport and ovs_datapath to the families supported in C. ovs-flow has some circular nesting which is fun to deal with, but the necessary support has been added already in the previous release cycle.

Add a sample that proves that dealing with fixed headers does actually work correctly.

author maintainer
#5 lore raw

PATCH 3/3 tools: ynl: auto-gen for all genetlink families

In reply to Jakub Kicinski

Instead of listing the genetlink families that we want to codegen for, always codegen for everyone. We can add an opt-out later but it seems like most families are not causing any issues, and yet folks forget to add them to the Makefile.

---
 tools/net/ynl/generated/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/net/ynl/generated/Makefile +4 -1
index 3b9f738c61b8..7135028cb449 100644
@@ -14,7 +14,10 @@ YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \
 
 TOOL:=../ynl-gen-c.py
 
-GENS:=ethtool devlink dpll handshake fou mptcp_pm netdev nfsd ovs_datapath ovs_vport ovs_flow
+GENS_PATHS=$(shell grep -nrI --files-without-match \
+		'protocol: netlink' \
+		../../../../Documentation/netlink/specs/)
+GENS=$(patsubst ../../../../Documentation/netlink/specs/%.yaml,%,${GENS_PATHS})
 SRCS=$(patsubst %,%-user.c,${GENS})
 HDRS=$(patsubst %,%-user.h,${GENS})
 OBJS=$(patsubst %,%-user.o,${GENS})
Signature · 1 line
2.43.0
#7 lore raw
In reply to Jakub Kicinski
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 6 lines · On Thu, 1 Feb 2024 16:49:23 -0800 you wrote:

The code gen has caught up with all features required in genetlink families in Linux 6.8 already. We have also stopped committing auto- -generated user space code to the tree. Instead of listing all the families in the Makefile search the spec directory, and generate code for everything that's not legacy netlink.

Quoted 6 lines

Jakub Kicinski (3):
tools: ynl: include dpll and mptcp_pm in C codegen
tools: ynl: generate code for ovs families
tools: ynl: auto-gen for all genetlink families

[...]

Here is the summary with links:
- [net-next,1/3] tools: ynl: include dpll and mptcp_pm in C codegen

    https://git.kernel.org/netdev/net-next/c/8f109e91b852
  - [net-next,2/3] tools: ynl: generate code for ovs families
    https://git.kernel.org/netdev/net-next/c/7c59c9c8f202
  - [net-next,3/3] tools: ynl: auto-gen for all genetlink families
    https://git.kernel.org/netdev/net-next/c/d2866539df7b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html