xref: /linux/net/core/netdev-genl-gen.c (revision d49010adae737638447369a4eff8f1aab736b076)
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 static const struct netlink_range_validation netdev_a_page_pool_ifindex_range = {
20 	.min	= 1ULL,
21 	.max	= 2147483647ULL,
22 };
23 
24 /* Common nested types */
25 const struct nla_policy netdev_page_pool_info_nl_policy[NETDEV_A_PAGE_POOL_IFINDEX + 1] = {
26 	[NETDEV_A_PAGE_POOL_ID] = NLA_POLICY_FULL_RANGE(NLA_UINT, &netdev_a_page_pool_id_range),
27 	[NETDEV_A_PAGE_POOL_IFINDEX] = NLA_POLICY_FULL_RANGE(NLA_U32, &netdev_a_page_pool_ifindex_range),
28 };
29 
30 /* NETDEV_CMD_DEV_GET - do */
31 static const struct nla_policy netdev_dev_get_nl_policy[NETDEV_A_DEV_IFINDEX + 1] = {
32 	[NETDEV_A_DEV_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),
33 };
34 
35 /* NETDEV_CMD_PAGE_POOL_GET - do */
36 #ifdef CONFIG_PAGE_POOL
37 static const struct nla_policy netdev_page_pool_get_nl_policy[NETDEV_A_PAGE_POOL_ID + 1] = {
38 	[NETDEV_A_PAGE_POOL_ID] = NLA_POLICY_FULL_RANGE(NLA_UINT, &netdev_a_page_pool_id_range),
39 };
40 #endif /* CONFIG_PAGE_POOL */
41 
42 /* NETDEV_CMD_PAGE_POOL_STATS_GET - do */
43 #ifdef CONFIG_PAGE_POOL_STATS
44 static const struct nla_policy netdev_page_pool_stats_get_nl_policy[NETDEV_A_PAGE_POOL_STATS_INFO + 1] = {
45 	[NETDEV_A_PAGE_POOL_STATS_INFO] = NLA_POLICY_NESTED(netdev_page_pool_info_nl_policy),
46 };
47 #endif /* CONFIG_PAGE_POOL_STATS */
48 
49 /* Ops table for netdev */
50 static const struct genl_split_ops netdev_nl_ops[] = {
51 	{
52 		.cmd		= NETDEV_CMD_DEV_GET,
53 		.doit		= netdev_nl_dev_get_doit,
54 		.policy		= netdev_dev_get_nl_policy,
55 		.maxattr	= NETDEV_A_DEV_IFINDEX,
56 		.flags		= GENL_CMD_CAP_DO,
57 	},
58 	{
59 		.cmd	= NETDEV_CMD_DEV_GET,
60 		.dumpit	= netdev_nl_dev_get_dumpit,
61 		.flags	= GENL_CMD_CAP_DUMP,
62 	},
63 #ifdef CONFIG_PAGE_POOL
64 	{
65 		.cmd		= NETDEV_CMD_PAGE_POOL_GET,
66 		.doit		= netdev_nl_page_pool_get_doit,
67 		.policy		= netdev_page_pool_get_nl_policy,
68 		.maxattr	= NETDEV_A_PAGE_POOL_ID,
69 		.flags		= GENL_CMD_CAP_DO,
70 	},
71 	{
72 		.cmd	= NETDEV_CMD_PAGE_POOL_GET,
73 		.dumpit	= netdev_nl_page_pool_get_dumpit,
74 		.flags	= GENL_CMD_CAP_DUMP,
75 	},
76 #endif /* CONFIG_PAGE_POOL */
77 #ifdef CONFIG_PAGE_POOL_STATS
78 	{
79 		.cmd		= NETDEV_CMD_PAGE_POOL_STATS_GET,
80 		.doit		= netdev_nl_page_pool_stats_get_doit,
81 		.policy		= netdev_page_pool_stats_get_nl_policy,
82 		.maxattr	= NETDEV_A_PAGE_POOL_STATS_INFO,
83 		.flags		= GENL_CMD_CAP_DO,
84 	},
85 	{
86 		.cmd	= NETDEV_CMD_PAGE_POOL_STATS_GET,
87 		.dumpit	= netdev_nl_page_pool_stats_get_dumpit,
88 		.flags	= GENL_CMD_CAP_DUMP,
89 	},
90 #endif /* CONFIG_PAGE_POOL_STATS */
91 };
92 
93 static const struct genl_multicast_group netdev_nl_mcgrps[] = {
94 	[NETDEV_NLGRP_MGMT] = { "mgmt", },
95 	[NETDEV_NLGRP_PAGE_POOL] = { "page-pool", },
96 };
97 
98 struct genl_family netdev_nl_family __ro_after_init = {
99 	.name		= NETDEV_FAMILY_NAME,
100 	.version	= NETDEV_FAMILY_VERSION,
101 	.netnsok	= true,
102 	.parallel_ops	= true,
103 	.module		= THIS_MODULE,
104 	.split_ops	= netdev_nl_ops,
105 	.n_split_ops	= ARRAY_SIZE(netdev_nl_ops),
106 	.mcgrps		= netdev_nl_mcgrps,
107 	.n_mcgrps	= ARRAY_SIZE(netdev_nl_mcgrps),
108 };
109