* [PATCH net-next 0/3] tools: ynl: auto-gen for all genetlink families
@ 2024-02-02 0:49 Jakub Kicinski
2024-02-02 0:49 ` [PATCH net-next 1/3] tools: ynl: include dpll and mptcp_pm in C codegen Jakub Kicinski
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Jakub Kicinski @ 2024-02-02 0:49 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, jiri, donald.hunter, sdf,
Jakub Kicinski
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
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next 1/3] tools: ynl: include dpll and mptcp_pm in C codegen
2024-02-02 0:49 [PATCH net-next 0/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
@ 2024-02-02 0:49 ` Jakub Kicinski
2024-02-02 10:21 ` Jiri Pirko
2024-02-02 0:49 ` [PATCH net-next 2/3] tools: ynl: generate code for ovs families Jakub Kicinski
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2024-02-02 0:49 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, jiri, donald.hunter, sdf,
Jakub Kicinski
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.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
tools/net/ynl/Makefile.deps | 2 ++
tools/net/ynl/generated/Makefile | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/Makefile.deps b/tools/net/ynl/Makefile.deps
index 3110f84dd029..e6154a1255f8 100644
--- a/tools/net/ynl/Makefile.deps
+++ b/tools/net/ynl/Makefile.deps
@@ -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)
diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Makefile
index 84cbabdd02a8..0d826fd008ed 100644
--- a/tools/net/ynl/generated/Makefile
+++ b/tools/net/ynl/generated/Makefile
@@ -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})
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next 2/3] tools: ynl: generate code for ovs families
2024-02-02 0:49 [PATCH net-next 0/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
2024-02-02 0:49 ` [PATCH net-next 1/3] tools: ynl: include dpll and mptcp_pm in C codegen Jakub Kicinski
@ 2024-02-02 0:49 ` Jakub Kicinski
2024-02-02 10:24 ` Jiri Pirko
2024-02-02 0:49 ` [PATCH net-next 3/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
2024-02-03 5:20 ` [PATCH net-next 0/3] " patchwork-bot+netdevbpf
3 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2024-02-02 0:49 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, jiri, donald.hunter, sdf,
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.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
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
diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Makefile
index 0d826fd008ed..3b9f738c61b8 100644
--- a/tools/net/ynl/generated/Makefile
+++ b/tools/net/ynl/generated/Makefile
@@ -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})
diff --git a/tools/net/ynl/samples/ovs.c b/tools/net/ynl/samples/ovs.c
new file mode 100644
index 000000000000..3e975c003d77
--- /dev/null
+++ b/tools/net/ynl/samples/ovs.c
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <string.h>
+
+#include <ynl.h>
+
+#include "ovs_datapath-user.h"
+
+int main(int argc, char **argv)
+{
+ struct ynl_sock *ys;
+ int err;
+
+ ys = ynl_sock_create(&ynl_ovs_datapath_family, NULL);
+ if (!ys)
+ return 1;
+
+ if (argc > 1) {
+ struct ovs_datapath_new_req *req;
+
+ req = ovs_datapath_new_req_alloc();
+ if (!req)
+ goto err_close;
+
+ ovs_datapath_new_req_set_upcall_pid(req, 1);
+ ovs_datapath_new_req_set_name(req, argv[1]);
+
+ err = ovs_datapath_new(ys, req);
+ ovs_datapath_new_req_free(req);
+ if (err)
+ goto err_close;
+ } else {
+ struct ovs_datapath_get_req_dump *req;
+ struct ovs_datapath_get_list *dps;
+
+ printf("Dump:\n");
+ req = ovs_datapath_get_req_dump_alloc();
+
+ dps = ovs_datapath_get_dump(ys, req);
+ ovs_datapath_get_req_dump_free(req);
+ if (!dps)
+ goto err_close;
+
+ ynl_dump_foreach(dps, dp) {
+ printf(" %s(%d): pid:%u cache:%u\n",
+ dp->name, dp->_hdr.dp_ifindex,
+ dp->upcall_pid, dp->masks_cache_size);
+ }
+ ovs_datapath_get_list_free(dps);
+ }
+
+ ynl_sock_destroy(ys);
+
+ return 0;
+
+err_close:
+ fprintf(stderr, "YNL (%d): %s\n", ys->err.code, ys->err.msg);
+ ynl_sock_destroy(ys);
+ return 2;
+}
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next 3/3] tools: ynl: auto-gen for all genetlink families
2024-02-02 0:49 [PATCH net-next 0/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
2024-02-02 0:49 ` [PATCH net-next 1/3] tools: ynl: include dpll and mptcp_pm in C codegen Jakub Kicinski
2024-02-02 0:49 ` [PATCH net-next 2/3] tools: ynl: generate code for ovs families Jakub Kicinski
@ 2024-02-02 0:49 ` Jakub Kicinski
2024-02-02 10:25 ` Jiri Pirko
2024-02-03 5:20 ` [PATCH net-next 0/3] " patchwork-bot+netdevbpf
3 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2024-02-02 0:49 UTC (permalink / raw)
To: davem; +Cc: netdev, edumazet, pabeni, jiri, donald.hunter, sdf,
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.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
tools/net/ynl/generated/Makefile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Makefile
index 3b9f738c61b8..7135028cb449 100644
--- a/tools/net/ynl/generated/Makefile
+++ b/tools/net/ynl/generated/Makefile
@@ -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})
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 1/3] tools: ynl: include dpll and mptcp_pm in C codegen
2024-02-02 0:49 ` [PATCH net-next 1/3] tools: ynl: include dpll and mptcp_pm in C codegen Jakub Kicinski
@ 2024-02-02 10:21 ` Jiri Pirko
0 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2024-02-02 10:21 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, donald.hunter, sdf
Fri, Feb 02, 2024 at 01:49:24AM CET, kuba@kernel.org 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.
>
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 2/3] tools: ynl: generate code for ovs families
2024-02-02 0:49 ` [PATCH net-next 2/3] tools: ynl: generate code for ovs families Jakub Kicinski
@ 2024-02-02 10:24 ` Jiri Pirko
0 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2024-02-02 10:24 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, donald.hunter, sdf
Fri, Feb 02, 2024 at 01:49:25AM CET, kuba@kernel.org 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.
>
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 3/3] tools: ynl: auto-gen for all genetlink families
2024-02-02 0:49 ` [PATCH net-next 3/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
@ 2024-02-02 10:25 ` Jiri Pirko
0 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2024-02-02 10:25 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, donald.hunter, sdf
Fri, Feb 02, 2024 at 01:49:26AM CET, kuba@kernel.org wrote:
>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.
>
>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 0/3] tools: ynl: auto-gen for all genetlink families
2024-02-02 0:49 [PATCH net-next 0/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
` (2 preceding siblings ...)
2024-02-02 0:49 ` [PATCH net-next 3/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
@ 2024-02-03 5:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-03 5:20 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, jiri, donald.hunter, sdf
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
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.
>
> 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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-02-03 5:20 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02 0:49 [PATCH net-next 0/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
2024-02-02 0:49 ` [PATCH net-next 1/3] tools: ynl: include dpll and mptcp_pm in C codegen Jakub Kicinski
2024-02-02 10:21 ` Jiri Pirko
2024-02-02 0:49 ` [PATCH net-next 2/3] tools: ynl: generate code for ovs families Jakub Kicinski
2024-02-02 10:24 ` Jiri Pirko
2024-02-02 0:49 ` [PATCH net-next 3/3] tools: ynl: auto-gen for all genetlink families Jakub Kicinski
2024-02-02 10:25 ` Jiri Pirko
2024-02-03 5:20 ` [PATCH net-next 0/3] " patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).