xref: /linux/net/core/netdev-genl-gen.c (revision 69cb4952b6f6a226c1c0a7ca400398aaa8f75cf2)
1 // SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2 /* Do not edit directly, auto-generated from: */
3 /*	Documentation/netlink/specs/netdev.yaml */
4 /* YNL-GEN kernel source */
5 
6 #include <net/netlink.h>
7 #include <net/genetlink.h>
8 
9 #include "netdev-genl-gen.h"
10 
11 #include <uapi/linux/netdev.h>
12 
13 /* Integer value ranges */
14 static const struct netlink_range_validation netdev_a_page_pool_id_range = {
15 	.min	= 1ULL,
16 	.max	= 4294967295ULL,
17 };
18 
19 /* NETDEV_CMD_DEV_GET - do */
20 static const struct nla_policy netdev_dev_get_nl_policy[NETDEV_A_DEV_IFINDEX + 1] = {
21 	[NETDEV_A_DEV_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),
22 };
23 
24 /* NETDEV_CMD_PAGE_POOL_GET - do */
25 #ifdef CONFIG_PAGE_POOL
26 static const struct nla_policy netdev_page_pool_get_nl_policy[NETDEV_A_PAGE_POOL_ID + 1] = {
27 	[NETDEV_A_PAGE_POOL_ID] = NLA_POLICY_FULL_RANGE(NLA_UINT, &netdev_a_page_pool_id_range),
28 };
29 #endif /* CONFIG_PAGE_POOL */
30 
31 /* Ops table for netdev */
32 static const struct genl_split_ops netdev_nl_ops[] = {
33 	{
34 		.cmd		= NETDEV_CMD_DEV_GET,
35 		.doit		= netdev_nl_dev_get_doit,
36 		.policy		= netdev_dev_get_nl_policy,
37 		.maxattr	= NETDEV_A_DEV_IFINDEX,
38 		.flags		= GENL_CMD_CAP_DO,
39 	},
40 	{
41 		.cmd	= NETDEV_CMD_DEV_GET,
42 		.dumpit	= netdev_nl_dev_get_dumpit,
43 		.flags	= GENL_CMD_CAP_DUMP,
44 	},
45 #ifdef CONFIG_PAGE_POOL
46 	{
47 		.cmd		= NETDEV_CMD_PAGE_POOL_GET,
48 		.doit		= netdev_nl_page_pool_get_doit,
49 		.policy		= netdev_page_pool_get_nl_policy,
50 		.maxattr	= NETDEV_A_PAGE_POOL_ID,
51 		.flags		= GENL_CMD_CAP_DO,
52 	},
53 	{
54 		.cmd	= NETDEV_CMD_PAGE_POOL_GET,
55 		.dumpit	= netdev_nl_page_pool_get_dumpit,
56 		.flags	= GENL_CMD_CAP_DUMP,
57 	},
58 #endif /* CONFIG_PAGE_POOL */
59 };
60 
61 static const struct genl_multicast_group netdev_nl_mcgrps[] = {
62 	[NETDEV_NLGRP_MGMT] = { "mgmt", },
63 	[NETDEV_NLGRP_PAGE_POOL] = { "page-pool", },
64 };
65 
66 struct genl_family netdev_nl_family __ro_after_init = {
67 	.name		= NETDEV_FAMILY_NAME,
68 	.version	= NETDEV_FAMILY_VERSION,
69 	.netnsok	= true,
70 	.parallel_ops	= true,
71 	.module		= THIS_MODULE,
72 	.split_ops	= netdev_nl_ops,
73 	.n_split_ops	= ARRAY_SIZE(netdev_nl_ops),
74 	.mcgrps		= netdev_nl_mcgrps,
75 	.n_mcgrps	= ARRAY_SIZE(netdev_nl_mcgrps),
76 };
77