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 */
6 #include <net/netlink.h>
7 #include <net/genetlink.h>
9 #include "netdev-genl-gen.h"
11 #include <uapi/linux/netdev.h>
12 #include <linux/list.h>
14 /* Integer value ranges */
15 static const struct netlink_range_validation netdev_a_page_pool_id_range
= {
20 static const struct netlink_range_validation netdev_a_page_pool_ifindex_range
= {
25 /* Common nested types */
26 const struct nla_policy netdev_page_pool_info_nl_policy
[NETDEV_A_PAGE_POOL_IFINDEX
+ 1] = {
27 [NETDEV_A_PAGE_POOL_ID
] = NLA_POLICY_FULL_RANGE(NLA_UINT
, &netdev_a_page_pool_id_range
),
28 [NETDEV_A_PAGE_POOL_IFINDEX
] = NLA_POLICY_FULL_RANGE(NLA_U32
, &netdev_a_page_pool_ifindex_range
),
31 const struct nla_policy netdev_queue_id_nl_policy
[NETDEV_A_QUEUE_TYPE
+ 1] = {
32 [NETDEV_A_QUEUE_ID
] = { .type
= NLA_U32
, },
33 [NETDEV_A_QUEUE_TYPE
] = NLA_POLICY_MAX(NLA_U32
, 1),
36 /* NETDEV_CMD_DEV_GET - do */
37 static const struct nla_policy netdev_dev_get_nl_policy
[NETDEV_A_DEV_IFINDEX
+ 1] = {
38 [NETDEV_A_DEV_IFINDEX
] = NLA_POLICY_MIN(NLA_U32
, 1),
41 /* NETDEV_CMD_PAGE_POOL_GET - do */
42 #ifdef CONFIG_PAGE_POOL
43 static const struct nla_policy netdev_page_pool_get_nl_policy
[NETDEV_A_PAGE_POOL_ID
+ 1] = {
44 [NETDEV_A_PAGE_POOL_ID
] = NLA_POLICY_FULL_RANGE(NLA_UINT
, &netdev_a_page_pool_id_range
),
46 #endif /* CONFIG_PAGE_POOL */
48 /* NETDEV_CMD_PAGE_POOL_STATS_GET - do */
49 #ifdef CONFIG_PAGE_POOL_STATS
50 static const struct nla_policy netdev_page_pool_stats_get_nl_policy
[NETDEV_A_PAGE_POOL_STATS_INFO
+ 1] = {
51 [NETDEV_A_PAGE_POOL_STATS_INFO
] = NLA_POLICY_NESTED(netdev_page_pool_info_nl_policy
),
53 #endif /* CONFIG_PAGE_POOL_STATS */
55 /* NETDEV_CMD_QUEUE_GET - do */
56 static const struct nla_policy netdev_queue_get_do_nl_policy
[NETDEV_A_QUEUE_TYPE
+ 1] = {
57 [NETDEV_A_QUEUE_IFINDEX
] = NLA_POLICY_MIN(NLA_U32
, 1),
58 [NETDEV_A_QUEUE_TYPE
] = NLA_POLICY_MAX(NLA_U32
, 1),
59 [NETDEV_A_QUEUE_ID
] = { .type
= NLA_U32
, },
62 /* NETDEV_CMD_QUEUE_GET - dump */
63 static const struct nla_policy netdev_queue_get_dump_nl_policy
[NETDEV_A_QUEUE_IFINDEX
+ 1] = {
64 [NETDEV_A_QUEUE_IFINDEX
] = NLA_POLICY_MIN(NLA_U32
, 1),
67 /* NETDEV_CMD_NAPI_GET - do */
68 static const struct nla_policy netdev_napi_get_do_nl_policy
[NETDEV_A_NAPI_ID
+ 1] = {
69 [NETDEV_A_NAPI_ID
] = { .type
= NLA_U32
, },
72 /* NETDEV_CMD_NAPI_GET - dump */
73 static const struct nla_policy netdev_napi_get_dump_nl_policy
[NETDEV_A_NAPI_IFINDEX
+ 1] = {
74 [NETDEV_A_NAPI_IFINDEX
] = NLA_POLICY_MIN(NLA_U32
, 1),
77 /* NETDEV_CMD_QSTATS_GET - dump */
78 static const struct nla_policy netdev_qstats_get_nl_policy
[NETDEV_A_QSTATS_SCOPE
+ 1] = {
79 [NETDEV_A_QSTATS_IFINDEX
] = NLA_POLICY_MIN(NLA_U32
, 1),
80 [NETDEV_A_QSTATS_SCOPE
] = NLA_POLICY_MASK(NLA_UINT
, 0x1),
83 /* NETDEV_CMD_BIND_RX - do */
84 static const struct nla_policy netdev_bind_rx_nl_policy
[NETDEV_A_DMABUF_FD
+ 1] = {
85 [NETDEV_A_DMABUF_IFINDEX
] = NLA_POLICY_MIN(NLA_U32
, 1),
86 [NETDEV_A_DMABUF_FD
] = { .type
= NLA_U32
, },
87 [NETDEV_A_DMABUF_QUEUES
] = NLA_POLICY_NESTED(netdev_queue_id_nl_policy
),
90 /* Ops table for netdev */
91 static const struct genl_split_ops netdev_nl_ops
[] = {
93 .cmd
= NETDEV_CMD_DEV_GET
,
94 .doit
= netdev_nl_dev_get_doit
,
95 .policy
= netdev_dev_get_nl_policy
,
96 .maxattr
= NETDEV_A_DEV_IFINDEX
,
97 .flags
= GENL_CMD_CAP_DO
,
100 .cmd
= NETDEV_CMD_DEV_GET
,
101 .dumpit
= netdev_nl_dev_get_dumpit
,
102 .flags
= GENL_CMD_CAP_DUMP
,
104 #ifdef CONFIG_PAGE_POOL
106 .cmd
= NETDEV_CMD_PAGE_POOL_GET
,
107 .doit
= netdev_nl_page_pool_get_doit
,
108 .policy
= netdev_page_pool_get_nl_policy
,
109 .maxattr
= NETDEV_A_PAGE_POOL_ID
,
110 .flags
= GENL_CMD_CAP_DO
,
113 .cmd
= NETDEV_CMD_PAGE_POOL_GET
,
114 .dumpit
= netdev_nl_page_pool_get_dumpit
,
115 .flags
= GENL_CMD_CAP_DUMP
,
117 #endif /* CONFIG_PAGE_POOL */
118 #ifdef CONFIG_PAGE_POOL_STATS
120 .cmd
= NETDEV_CMD_PAGE_POOL_STATS_GET
,
121 .doit
= netdev_nl_page_pool_stats_get_doit
,
122 .policy
= netdev_page_pool_stats_get_nl_policy
,
123 .maxattr
= NETDEV_A_PAGE_POOL_STATS_INFO
,
124 .flags
= GENL_CMD_CAP_DO
,
127 .cmd
= NETDEV_CMD_PAGE_POOL_STATS_GET
,
128 .dumpit
= netdev_nl_page_pool_stats_get_dumpit
,
129 .flags
= GENL_CMD_CAP_DUMP
,
131 #endif /* CONFIG_PAGE_POOL_STATS */
133 .cmd
= NETDEV_CMD_QUEUE_GET
,
134 .doit
= netdev_nl_queue_get_doit
,
135 .policy
= netdev_queue_get_do_nl_policy
,
136 .maxattr
= NETDEV_A_QUEUE_TYPE
,
137 .flags
= GENL_CMD_CAP_DO
,
140 .cmd
= NETDEV_CMD_QUEUE_GET
,
141 .dumpit
= netdev_nl_queue_get_dumpit
,
142 .policy
= netdev_queue_get_dump_nl_policy
,
143 .maxattr
= NETDEV_A_QUEUE_IFINDEX
,
144 .flags
= GENL_CMD_CAP_DUMP
,
147 .cmd
= NETDEV_CMD_NAPI_GET
,
148 .doit
= netdev_nl_napi_get_doit
,
149 .policy
= netdev_napi_get_do_nl_policy
,
150 .maxattr
= NETDEV_A_NAPI_ID
,
151 .flags
= GENL_CMD_CAP_DO
,
154 .cmd
= NETDEV_CMD_NAPI_GET
,
155 .dumpit
= netdev_nl_napi_get_dumpit
,
156 .policy
= netdev_napi_get_dump_nl_policy
,
157 .maxattr
= NETDEV_A_NAPI_IFINDEX
,
158 .flags
= GENL_CMD_CAP_DUMP
,
161 .cmd
= NETDEV_CMD_QSTATS_GET
,
162 .dumpit
= netdev_nl_qstats_get_dumpit
,
163 .policy
= netdev_qstats_get_nl_policy
,
164 .maxattr
= NETDEV_A_QSTATS_SCOPE
,
165 .flags
= GENL_CMD_CAP_DUMP
,
168 .cmd
= NETDEV_CMD_BIND_RX
,
169 .doit
= netdev_nl_bind_rx_doit
,
170 .policy
= netdev_bind_rx_nl_policy
,
171 .maxattr
= NETDEV_A_DMABUF_FD
,
172 .flags
= GENL_ADMIN_PERM
| GENL_CMD_CAP_DO
,
176 static const struct genl_multicast_group netdev_nl_mcgrps
[] = {
177 [NETDEV_NLGRP_MGMT
] = { "mgmt", },
178 [NETDEV_NLGRP_PAGE_POOL
] = { "page-pool", },
181 struct genl_family netdev_nl_family __ro_after_init
= {
182 .name
= NETDEV_FAMILY_NAME
,
183 .version
= NETDEV_FAMILY_VERSION
,
185 .parallel_ops
= true,
186 .module
= THIS_MODULE
,
187 .split_ops
= netdev_nl_ops
,
188 .n_split_ops
= ARRAY_SIZE(netdev_nl_ops
),
189 .mcgrps
= netdev_nl_mcgrps
,
190 .n_mcgrps
= ARRAY_SIZE(netdev_nl_mcgrps
),
191 .sock_priv_size
= sizeof(struct list_head
),
192 .sock_priv_init
= (void *)netdev_nl_sock_priv_init
,
193 .sock_priv_destroy
= (void *)netdev_nl_sock_priv_destroy
,