Merge branch 'tools-ynl-auto-gen-for-all-genetlink-families'
Jakub Kicinski says: ==================== 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. ==================== Link: https://lore.kernel.org/r/20240202004926.447803-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
0eb1ec426c
@ -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)
|
||||
|
@ -14,7 +14,10 @@ YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \
|
||||
|
||||
TOOL:=../ynl-gen-c.py
|
||||
|
||||
GENS:=ethtool devlink handshake fou netdev nfsd
|
||||
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})
|
||||
|
1
tools/net/ynl/samples/.gitignore
vendored
1
tools/net/ynl/samples/.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
ethtool
|
||||
devlink
|
||||
netdev
|
||||
ovs
|
||||
page-pool
|
60
tools/net/ynl/samples/ovs.c
Normal file
60
tools/net/ynl/samples/ovs.c
Normal file
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user