xref: /linux/net/devlink/netlink_gen.c (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
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/devlink.yaml */
4 /* YNL-GEN kernel source */
5 
6 #include <net/netlink.h>
7 #include <net/genetlink.h>
8 
9 #include "netlink_gen.h"
10 
11 #include <uapi/linux/devlink.h>
12 
13 /* Common nested types */
14 const struct nla_policy devlink_dl_port_function_nl_policy[DEVLINK_PORT_FN_ATTR_CAPS + 1] = {
15 	[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] = { .type = NLA_BINARY, },
16 	[DEVLINK_PORT_FN_ATTR_STATE] = NLA_POLICY_MAX(NLA_U8, 1),
17 	[DEVLINK_PORT_FN_ATTR_OPSTATE] = NLA_POLICY_MAX(NLA_U8, 1),
18 	[DEVLINK_PORT_FN_ATTR_CAPS] = NLA_POLICY_BITFIELD32(15),
19 };
20 
21 const struct nla_policy devlink_dl_selftest_id_nl_policy[DEVLINK_ATTR_SELFTEST_ID_FLASH + 1] = {
22 	[DEVLINK_ATTR_SELFTEST_ID_FLASH] = { .type = NLA_FLAG, },
23 };
24 
25 /* DEVLINK_CMD_GET - do */
26 static const struct nla_policy devlink_get_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
27 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
28 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
29 };
30 
31 /* DEVLINK_CMD_PORT_GET - do */
32 static const struct nla_policy devlink_port_get_do_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
33 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
34 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
35 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
36 };
37 
38 /* DEVLINK_CMD_PORT_GET - dump */
39 static const struct nla_policy devlink_port_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
40 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
41 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
42 };
43 
44 /* DEVLINK_CMD_PORT_SET - do */
45 static const struct nla_policy devlink_port_set_nl_policy[DEVLINK_ATTR_PORT_FUNCTION + 1] = {
46 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
47 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
48 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
49 	[DEVLINK_ATTR_PORT_TYPE] = NLA_POLICY_MAX(NLA_U16, 3),
50 	[DEVLINK_ATTR_PORT_FUNCTION] = NLA_POLICY_NESTED(devlink_dl_port_function_nl_policy),
51 };
52 
53 /* DEVLINK_CMD_PORT_NEW - do */
54 static const struct nla_policy devlink_port_new_nl_policy[DEVLINK_ATTR_PORT_PCI_SF_NUMBER + 1] = {
55 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
56 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
57 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
58 	[DEVLINK_ATTR_PORT_FLAVOUR] = NLA_POLICY_MAX(NLA_U16, 7),
59 	[DEVLINK_ATTR_PORT_PCI_PF_NUMBER] = { .type = NLA_U16, },
60 	[DEVLINK_ATTR_PORT_PCI_SF_NUMBER] = { .type = NLA_U32, },
61 	[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER] = { .type = NLA_U32, },
62 };
63 
64 /* DEVLINK_CMD_PORT_DEL - do */
65 static const struct nla_policy devlink_port_del_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
66 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
67 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
68 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
69 };
70 
71 /* DEVLINK_CMD_PORT_SPLIT - do */
72 static const struct nla_policy devlink_port_split_nl_policy[DEVLINK_ATTR_PORT_SPLIT_COUNT + 1] = {
73 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
74 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
75 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
76 	[DEVLINK_ATTR_PORT_SPLIT_COUNT] = { .type = NLA_U32, },
77 };
78 
79 /* DEVLINK_CMD_PORT_UNSPLIT - do */
80 static const struct nla_policy devlink_port_unsplit_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
81 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
82 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
83 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
84 };
85 
86 /* DEVLINK_CMD_SB_GET - do */
87 static const struct nla_policy devlink_sb_get_do_nl_policy[DEVLINK_ATTR_SB_INDEX + 1] = {
88 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
89 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
90 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
91 };
92 
93 /* DEVLINK_CMD_SB_GET - dump */
94 static const struct nla_policy devlink_sb_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
95 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
96 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
97 };
98 
99 /* DEVLINK_CMD_SB_POOL_GET - do */
100 static const struct nla_policy devlink_sb_pool_get_do_nl_policy[DEVLINK_ATTR_SB_POOL_INDEX + 1] = {
101 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
102 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
103 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
104 	[DEVLINK_ATTR_SB_POOL_INDEX] = { .type = NLA_U16, },
105 };
106 
107 /* DEVLINK_CMD_SB_POOL_GET - dump */
108 static const struct nla_policy devlink_sb_pool_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
109 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
110 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
111 };
112 
113 /* DEVLINK_CMD_SB_POOL_SET - do */
114 static const struct nla_policy devlink_sb_pool_set_nl_policy[DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE + 1] = {
115 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
116 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
117 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
118 	[DEVLINK_ATTR_SB_POOL_INDEX] = { .type = NLA_U16, },
119 	[DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE] = NLA_POLICY_MAX(NLA_U8, 1),
120 	[DEVLINK_ATTR_SB_POOL_SIZE] = { .type = NLA_U32, },
121 };
122 
123 /* DEVLINK_CMD_SB_PORT_POOL_GET - do */
124 static const struct nla_policy devlink_sb_port_pool_get_do_nl_policy[DEVLINK_ATTR_SB_POOL_INDEX + 1] = {
125 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
126 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
127 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
128 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
129 	[DEVLINK_ATTR_SB_POOL_INDEX] = { .type = NLA_U16, },
130 };
131 
132 /* DEVLINK_CMD_SB_PORT_POOL_GET - dump */
133 static const struct nla_policy devlink_sb_port_pool_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
134 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
135 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
136 };
137 
138 /* DEVLINK_CMD_SB_PORT_POOL_SET - do */
139 static const struct nla_policy devlink_sb_port_pool_set_nl_policy[DEVLINK_ATTR_SB_THRESHOLD + 1] = {
140 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
141 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
142 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
143 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
144 	[DEVLINK_ATTR_SB_POOL_INDEX] = { .type = NLA_U16, },
145 	[DEVLINK_ATTR_SB_THRESHOLD] = { .type = NLA_U32, },
146 };
147 
148 /* DEVLINK_CMD_SB_TC_POOL_BIND_GET - do */
149 static const struct nla_policy devlink_sb_tc_pool_bind_get_do_nl_policy[DEVLINK_ATTR_SB_TC_INDEX + 1] = {
150 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
151 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
152 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
153 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
154 	[DEVLINK_ATTR_SB_POOL_TYPE] = NLA_POLICY_MAX(NLA_U8, 1),
155 	[DEVLINK_ATTR_SB_TC_INDEX] = { .type = NLA_U16, },
156 };
157 
158 /* DEVLINK_CMD_SB_TC_POOL_BIND_GET - dump */
159 static const struct nla_policy devlink_sb_tc_pool_bind_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
160 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
161 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
162 };
163 
164 /* DEVLINK_CMD_SB_TC_POOL_BIND_SET - do */
165 static const struct nla_policy devlink_sb_tc_pool_bind_set_nl_policy[DEVLINK_ATTR_SB_TC_INDEX + 1] = {
166 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
167 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
168 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
169 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
170 	[DEVLINK_ATTR_SB_POOL_INDEX] = { .type = NLA_U16, },
171 	[DEVLINK_ATTR_SB_POOL_TYPE] = NLA_POLICY_MAX(NLA_U8, 1),
172 	[DEVLINK_ATTR_SB_TC_INDEX] = { .type = NLA_U16, },
173 	[DEVLINK_ATTR_SB_THRESHOLD] = { .type = NLA_U32, },
174 };
175 
176 /* DEVLINK_CMD_SB_OCC_SNAPSHOT - do */
177 static const struct nla_policy devlink_sb_occ_snapshot_nl_policy[DEVLINK_ATTR_SB_INDEX + 1] = {
178 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
179 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
180 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
181 };
182 
183 /* DEVLINK_CMD_SB_OCC_MAX_CLEAR - do */
184 static const struct nla_policy devlink_sb_occ_max_clear_nl_policy[DEVLINK_ATTR_SB_INDEX + 1] = {
185 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
186 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
187 	[DEVLINK_ATTR_SB_INDEX] = { .type = NLA_U32, },
188 };
189 
190 /* DEVLINK_CMD_ESWITCH_GET - do */
191 static const struct nla_policy devlink_eswitch_get_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
192 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
193 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
194 };
195 
196 /* DEVLINK_CMD_ESWITCH_SET - do */
197 static const struct nla_policy devlink_eswitch_set_nl_policy[DEVLINK_ATTR_ESWITCH_ENCAP_MODE + 1] = {
198 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
199 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
200 	[DEVLINK_ATTR_ESWITCH_MODE] = NLA_POLICY_MAX(NLA_U16, 1),
201 	[DEVLINK_ATTR_ESWITCH_INLINE_MODE] = NLA_POLICY_MAX(NLA_U8, 3),
202 	[DEVLINK_ATTR_ESWITCH_ENCAP_MODE] = NLA_POLICY_MAX(NLA_U8, 1),
203 };
204 
205 /* DEVLINK_CMD_DPIPE_TABLE_GET - do */
206 static const struct nla_policy devlink_dpipe_table_get_nl_policy[DEVLINK_ATTR_DPIPE_TABLE_NAME + 1] = {
207 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
208 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
209 	[DEVLINK_ATTR_DPIPE_TABLE_NAME] = { .type = NLA_NUL_STRING, },
210 };
211 
212 /* DEVLINK_CMD_DPIPE_ENTRIES_GET - do */
213 static const struct nla_policy devlink_dpipe_entries_get_nl_policy[DEVLINK_ATTR_DPIPE_TABLE_NAME + 1] = {
214 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
215 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
216 	[DEVLINK_ATTR_DPIPE_TABLE_NAME] = { .type = NLA_NUL_STRING, },
217 };
218 
219 /* DEVLINK_CMD_DPIPE_HEADERS_GET - do */
220 static const struct nla_policy devlink_dpipe_headers_get_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
221 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
222 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
223 };
224 
225 /* DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET - do */
226 static const struct nla_policy devlink_dpipe_table_counters_set_nl_policy[DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED + 1] = {
227 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
228 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
229 	[DEVLINK_ATTR_DPIPE_TABLE_NAME] = { .type = NLA_NUL_STRING, },
230 	[DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED] = { .type = NLA_U8, },
231 };
232 
233 /* DEVLINK_CMD_RESOURCE_SET - do */
234 static const struct nla_policy devlink_resource_set_nl_policy[DEVLINK_ATTR_RESOURCE_SIZE + 1] = {
235 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
236 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
237 	[DEVLINK_ATTR_RESOURCE_ID] = { .type = NLA_U64, },
238 	[DEVLINK_ATTR_RESOURCE_SIZE] = { .type = NLA_U64, },
239 };
240 
241 /* DEVLINK_CMD_RESOURCE_DUMP - do */
242 static const struct nla_policy devlink_resource_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
243 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
244 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
245 };
246 
247 /* DEVLINK_CMD_RELOAD - do */
248 static const struct nla_policy devlink_reload_nl_policy[DEVLINK_ATTR_RELOAD_LIMITS + 1] = {
249 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
250 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
251 	[DEVLINK_ATTR_RELOAD_ACTION] = NLA_POLICY_RANGE(NLA_U8, 1, 2),
252 	[DEVLINK_ATTR_RELOAD_LIMITS] = NLA_POLICY_BITFIELD32(6),
253 	[DEVLINK_ATTR_NETNS_PID] = { .type = NLA_U32, },
254 	[DEVLINK_ATTR_NETNS_FD] = { .type = NLA_U32, },
255 	[DEVLINK_ATTR_NETNS_ID] = { .type = NLA_U32, },
256 };
257 
258 /* DEVLINK_CMD_PARAM_GET - do */
259 static const struct nla_policy devlink_param_get_do_nl_policy[DEVLINK_ATTR_PARAM_NAME + 1] = {
260 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
261 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
262 	[DEVLINK_ATTR_PARAM_NAME] = { .type = NLA_NUL_STRING, },
263 };
264 
265 /* DEVLINK_CMD_PARAM_GET - dump */
266 static const struct nla_policy devlink_param_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
267 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
268 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
269 };
270 
271 /* DEVLINK_CMD_PARAM_SET - do */
272 static const struct nla_policy devlink_param_set_nl_policy[DEVLINK_ATTR_PARAM_VALUE_CMODE + 1] = {
273 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
274 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
275 	[DEVLINK_ATTR_PARAM_NAME] = { .type = NLA_NUL_STRING, },
276 	[DEVLINK_ATTR_PARAM_TYPE] = { .type = NLA_U8, },
277 	[DEVLINK_ATTR_PARAM_VALUE_CMODE] = NLA_POLICY_MAX(NLA_U8, 2),
278 };
279 
280 /* DEVLINK_CMD_REGION_GET - do */
281 static const struct nla_policy devlink_region_get_do_nl_policy[DEVLINK_ATTR_REGION_NAME + 1] = {
282 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
283 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
284 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
285 	[DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING, },
286 };
287 
288 /* DEVLINK_CMD_REGION_GET - dump */
289 static const struct nla_policy devlink_region_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
290 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
291 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
292 };
293 
294 /* DEVLINK_CMD_REGION_NEW - do */
295 static const struct nla_policy devlink_region_new_nl_policy[DEVLINK_ATTR_REGION_SNAPSHOT_ID + 1] = {
296 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
297 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
298 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
299 	[DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING, },
300 	[DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32, },
301 };
302 
303 /* DEVLINK_CMD_REGION_DEL - do */
304 static const struct nla_policy devlink_region_del_nl_policy[DEVLINK_ATTR_REGION_SNAPSHOT_ID + 1] = {
305 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
306 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
307 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
308 	[DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING, },
309 	[DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32, },
310 };
311 
312 /* DEVLINK_CMD_REGION_READ - dump */
313 static const struct nla_policy devlink_region_read_nl_policy[DEVLINK_ATTR_REGION_DIRECT + 1] = {
314 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
315 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
316 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
317 	[DEVLINK_ATTR_REGION_NAME] = { .type = NLA_NUL_STRING, },
318 	[DEVLINK_ATTR_REGION_SNAPSHOT_ID] = { .type = NLA_U32, },
319 	[DEVLINK_ATTR_REGION_DIRECT] = { .type = NLA_FLAG, },
320 	[DEVLINK_ATTR_REGION_CHUNK_ADDR] = { .type = NLA_U64, },
321 	[DEVLINK_ATTR_REGION_CHUNK_LEN] = { .type = NLA_U64, },
322 };
323 
324 /* DEVLINK_CMD_PORT_PARAM_GET - do */
325 static const struct nla_policy devlink_port_param_get_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
326 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
327 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
328 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
329 };
330 
331 /* DEVLINK_CMD_PORT_PARAM_SET - do */
332 static const struct nla_policy devlink_port_param_set_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
333 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
334 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
335 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
336 };
337 
338 /* DEVLINK_CMD_INFO_GET - do */
339 static const struct nla_policy devlink_info_get_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
340 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
341 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
342 };
343 
344 /* DEVLINK_CMD_HEALTH_REPORTER_GET - do */
345 static const struct nla_policy devlink_health_reporter_get_do_nl_policy[DEVLINK_ATTR_HEALTH_REPORTER_NAME + 1] = {
346 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
347 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
348 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
349 	[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING, },
350 };
351 
352 /* DEVLINK_CMD_HEALTH_REPORTER_GET - dump */
353 static const struct nla_policy devlink_health_reporter_get_dump_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
354 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
355 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
356 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
357 };
358 
359 /* DEVLINK_CMD_HEALTH_REPORTER_SET - do */
360 static const struct nla_policy devlink_health_reporter_set_nl_policy[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP + 1] = {
361 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
362 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
363 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
364 	[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING, },
365 	[DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD] = { .type = NLA_U64, },
366 	[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER] = { .type = NLA_U8, },
367 	[DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP] = { .type = NLA_U8, },
368 };
369 
370 /* DEVLINK_CMD_HEALTH_REPORTER_RECOVER - do */
371 static const struct nla_policy devlink_health_reporter_recover_nl_policy[DEVLINK_ATTR_HEALTH_REPORTER_NAME + 1] = {
372 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
373 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
374 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
375 	[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING, },
376 };
377 
378 /* DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE - do */
379 static const struct nla_policy devlink_health_reporter_diagnose_nl_policy[DEVLINK_ATTR_HEALTH_REPORTER_NAME + 1] = {
380 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
381 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
382 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
383 	[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING, },
384 };
385 
386 /* DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET - dump */
387 static const struct nla_policy devlink_health_reporter_dump_get_nl_policy[DEVLINK_ATTR_HEALTH_REPORTER_NAME + 1] = {
388 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
389 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
390 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
391 	[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING, },
392 };
393 
394 /* DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR - do */
395 static const struct nla_policy devlink_health_reporter_dump_clear_nl_policy[DEVLINK_ATTR_HEALTH_REPORTER_NAME + 1] = {
396 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
397 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
398 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
399 	[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING, },
400 };
401 
402 /* DEVLINK_CMD_FLASH_UPDATE - do */
403 static const struct nla_policy devlink_flash_update_nl_policy[DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK + 1] = {
404 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
405 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
406 	[DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME] = { .type = NLA_NUL_STRING, },
407 	[DEVLINK_ATTR_FLASH_UPDATE_COMPONENT] = { .type = NLA_NUL_STRING, },
408 	[DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK] = NLA_POLICY_BITFIELD32(3),
409 };
410 
411 /* DEVLINK_CMD_TRAP_GET - do */
412 static const struct nla_policy devlink_trap_get_do_nl_policy[DEVLINK_ATTR_TRAP_NAME + 1] = {
413 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
414 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
415 	[DEVLINK_ATTR_TRAP_NAME] = { .type = NLA_NUL_STRING, },
416 };
417 
418 /* DEVLINK_CMD_TRAP_GET - dump */
419 static const struct nla_policy devlink_trap_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
420 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
421 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
422 };
423 
424 /* DEVLINK_CMD_TRAP_SET - do */
425 static const struct nla_policy devlink_trap_set_nl_policy[DEVLINK_ATTR_TRAP_ACTION + 1] = {
426 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
427 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
428 	[DEVLINK_ATTR_TRAP_NAME] = { .type = NLA_NUL_STRING, },
429 	[DEVLINK_ATTR_TRAP_ACTION] = NLA_POLICY_MAX(NLA_U8, 2),
430 };
431 
432 /* DEVLINK_CMD_TRAP_GROUP_GET - do */
433 static const struct nla_policy devlink_trap_group_get_do_nl_policy[DEVLINK_ATTR_TRAP_GROUP_NAME + 1] = {
434 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
435 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
436 	[DEVLINK_ATTR_TRAP_GROUP_NAME] = { .type = NLA_NUL_STRING, },
437 };
438 
439 /* DEVLINK_CMD_TRAP_GROUP_GET - dump */
440 static const struct nla_policy devlink_trap_group_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
441 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
442 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
443 };
444 
445 /* DEVLINK_CMD_TRAP_GROUP_SET - do */
446 static const struct nla_policy devlink_trap_group_set_nl_policy[DEVLINK_ATTR_TRAP_POLICER_ID + 1] = {
447 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
448 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
449 	[DEVLINK_ATTR_TRAP_GROUP_NAME] = { .type = NLA_NUL_STRING, },
450 	[DEVLINK_ATTR_TRAP_ACTION] = NLA_POLICY_MAX(NLA_U8, 2),
451 	[DEVLINK_ATTR_TRAP_POLICER_ID] = { .type = NLA_U32, },
452 };
453 
454 /* DEVLINK_CMD_TRAP_POLICER_GET - do */
455 static const struct nla_policy devlink_trap_policer_get_do_nl_policy[DEVLINK_ATTR_TRAP_POLICER_ID + 1] = {
456 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
457 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
458 	[DEVLINK_ATTR_TRAP_POLICER_ID] = { .type = NLA_U32, },
459 };
460 
461 /* DEVLINK_CMD_TRAP_POLICER_GET - dump */
462 static const struct nla_policy devlink_trap_policer_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
463 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
464 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
465 };
466 
467 /* DEVLINK_CMD_TRAP_POLICER_SET - do */
468 static const struct nla_policy devlink_trap_policer_set_nl_policy[DEVLINK_ATTR_TRAP_POLICER_BURST + 1] = {
469 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
470 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
471 	[DEVLINK_ATTR_TRAP_POLICER_ID] = { .type = NLA_U32, },
472 	[DEVLINK_ATTR_TRAP_POLICER_RATE] = { .type = NLA_U64, },
473 	[DEVLINK_ATTR_TRAP_POLICER_BURST] = { .type = NLA_U64, },
474 };
475 
476 /* DEVLINK_CMD_HEALTH_REPORTER_TEST - do */
477 static const struct nla_policy devlink_health_reporter_test_nl_policy[DEVLINK_ATTR_HEALTH_REPORTER_NAME + 1] = {
478 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
479 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
480 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
481 	[DEVLINK_ATTR_HEALTH_REPORTER_NAME] = { .type = NLA_NUL_STRING, },
482 };
483 
484 /* DEVLINK_CMD_RATE_GET - do */
485 static const struct nla_policy devlink_rate_get_do_nl_policy[DEVLINK_ATTR_RATE_NODE_NAME + 1] = {
486 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
487 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
488 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
489 	[DEVLINK_ATTR_RATE_NODE_NAME] = { .type = NLA_NUL_STRING, },
490 };
491 
492 /* DEVLINK_CMD_RATE_GET - dump */
493 static const struct nla_policy devlink_rate_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
494 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
495 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
496 };
497 
498 /* DEVLINK_CMD_RATE_SET - do */
499 static const struct nla_policy devlink_rate_set_nl_policy[DEVLINK_ATTR_RATE_TX_WEIGHT + 1] = {
500 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
501 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
502 	[DEVLINK_ATTR_RATE_NODE_NAME] = { .type = NLA_NUL_STRING, },
503 	[DEVLINK_ATTR_RATE_TX_SHARE] = { .type = NLA_U64, },
504 	[DEVLINK_ATTR_RATE_TX_MAX] = { .type = NLA_U64, },
505 	[DEVLINK_ATTR_RATE_TX_PRIORITY] = { .type = NLA_U32, },
506 	[DEVLINK_ATTR_RATE_TX_WEIGHT] = { .type = NLA_U32, },
507 	[DEVLINK_ATTR_RATE_PARENT_NODE_NAME] = { .type = NLA_NUL_STRING, },
508 };
509 
510 /* DEVLINK_CMD_RATE_NEW - do */
511 static const struct nla_policy devlink_rate_new_nl_policy[DEVLINK_ATTR_RATE_TX_WEIGHT + 1] = {
512 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
513 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
514 	[DEVLINK_ATTR_RATE_NODE_NAME] = { .type = NLA_NUL_STRING, },
515 	[DEVLINK_ATTR_RATE_TX_SHARE] = { .type = NLA_U64, },
516 	[DEVLINK_ATTR_RATE_TX_MAX] = { .type = NLA_U64, },
517 	[DEVLINK_ATTR_RATE_TX_PRIORITY] = { .type = NLA_U32, },
518 	[DEVLINK_ATTR_RATE_TX_WEIGHT] = { .type = NLA_U32, },
519 	[DEVLINK_ATTR_RATE_PARENT_NODE_NAME] = { .type = NLA_NUL_STRING, },
520 };
521 
522 /* DEVLINK_CMD_RATE_DEL - do */
523 static const struct nla_policy devlink_rate_del_nl_policy[DEVLINK_ATTR_RATE_NODE_NAME + 1] = {
524 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
525 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
526 	[DEVLINK_ATTR_RATE_NODE_NAME] = { .type = NLA_NUL_STRING, },
527 };
528 
529 /* DEVLINK_CMD_LINECARD_GET - do */
530 static const struct nla_policy devlink_linecard_get_do_nl_policy[DEVLINK_ATTR_LINECARD_INDEX + 1] = {
531 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
532 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
533 	[DEVLINK_ATTR_LINECARD_INDEX] = { .type = NLA_U32, },
534 };
535 
536 /* DEVLINK_CMD_LINECARD_GET - dump */
537 static const struct nla_policy devlink_linecard_get_dump_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
538 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
539 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
540 };
541 
542 /* DEVLINK_CMD_LINECARD_SET - do */
543 static const struct nla_policy devlink_linecard_set_nl_policy[DEVLINK_ATTR_LINECARD_TYPE + 1] = {
544 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
545 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
546 	[DEVLINK_ATTR_LINECARD_INDEX] = { .type = NLA_U32, },
547 	[DEVLINK_ATTR_LINECARD_TYPE] = { .type = NLA_NUL_STRING, },
548 };
549 
550 /* DEVLINK_CMD_SELFTESTS_GET - do */
551 static const struct nla_policy devlink_selftests_get_nl_policy[DEVLINK_ATTR_DEV_NAME + 1] = {
552 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
553 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
554 };
555 
556 /* DEVLINK_CMD_SELFTESTS_RUN - do */
557 static const struct nla_policy devlink_selftests_run_nl_policy[DEVLINK_ATTR_SELFTESTS + 1] = {
558 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
559 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
560 	[DEVLINK_ATTR_SELFTESTS] = NLA_POLICY_NESTED(devlink_dl_selftest_id_nl_policy),
561 };
562 
563 /* DEVLINK_CMD_NOTIFY_FILTER_SET - do */
564 static const struct nla_policy devlink_notify_filter_set_nl_policy[DEVLINK_ATTR_PORT_INDEX + 1] = {
565 	[DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
566 	[DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
567 	[DEVLINK_ATTR_PORT_INDEX] = { .type = NLA_U32, },
568 };
569 
570 /* Ops table for devlink */
571 const struct genl_split_ops devlink_nl_ops[74] = {
572 	{
573 		.cmd		= DEVLINK_CMD_GET,
574 		.validate	= GENL_DONT_VALIDATE_STRICT,
575 		.pre_doit	= devlink_nl_pre_doit,
576 		.doit		= devlink_nl_get_doit,
577 		.post_doit	= devlink_nl_post_doit,
578 		.policy		= devlink_get_nl_policy,
579 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
580 		.flags		= GENL_CMD_CAP_DO,
581 	},
582 	{
583 		.cmd		= DEVLINK_CMD_GET,
584 		.validate	= GENL_DONT_VALIDATE_DUMP,
585 		.dumpit		= devlink_nl_get_dumpit,
586 		.flags		= GENL_CMD_CAP_DUMP,
587 	},
588 	{
589 		.cmd		= DEVLINK_CMD_PORT_GET,
590 		.validate	= GENL_DONT_VALIDATE_STRICT,
591 		.pre_doit	= devlink_nl_pre_doit_port,
592 		.doit		= devlink_nl_port_get_doit,
593 		.post_doit	= devlink_nl_post_doit,
594 		.policy		= devlink_port_get_do_nl_policy,
595 		.maxattr	= DEVLINK_ATTR_PORT_INDEX,
596 		.flags		= GENL_CMD_CAP_DO,
597 	},
598 	{
599 		.cmd		= DEVLINK_CMD_PORT_GET,
600 		.dumpit		= devlink_nl_port_get_dumpit,
601 		.policy		= devlink_port_get_dump_nl_policy,
602 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
603 		.flags		= GENL_CMD_CAP_DUMP,
604 	},
605 	{
606 		.cmd		= DEVLINK_CMD_PORT_SET,
607 		.validate	= GENL_DONT_VALIDATE_STRICT,
608 		.pre_doit	= devlink_nl_pre_doit_port,
609 		.doit		= devlink_nl_port_set_doit,
610 		.post_doit	= devlink_nl_post_doit,
611 		.policy		= devlink_port_set_nl_policy,
612 		.maxattr	= DEVLINK_ATTR_PORT_FUNCTION,
613 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
614 	},
615 	{
616 		.cmd		= DEVLINK_CMD_PORT_NEW,
617 		.validate	= GENL_DONT_VALIDATE_STRICT,
618 		.pre_doit	= devlink_nl_pre_doit,
619 		.doit		= devlink_nl_port_new_doit,
620 		.post_doit	= devlink_nl_post_doit,
621 		.policy		= devlink_port_new_nl_policy,
622 		.maxattr	= DEVLINK_ATTR_PORT_PCI_SF_NUMBER,
623 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
624 	},
625 	{
626 		.cmd		= DEVLINK_CMD_PORT_DEL,
627 		.validate	= GENL_DONT_VALIDATE_STRICT,
628 		.pre_doit	= devlink_nl_pre_doit_port,
629 		.doit		= devlink_nl_port_del_doit,
630 		.post_doit	= devlink_nl_post_doit,
631 		.policy		= devlink_port_del_nl_policy,
632 		.maxattr	= DEVLINK_ATTR_PORT_INDEX,
633 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
634 	},
635 	{
636 		.cmd		= DEVLINK_CMD_PORT_SPLIT,
637 		.validate	= GENL_DONT_VALIDATE_STRICT,
638 		.pre_doit	= devlink_nl_pre_doit_port,
639 		.doit		= devlink_nl_port_split_doit,
640 		.post_doit	= devlink_nl_post_doit,
641 		.policy		= devlink_port_split_nl_policy,
642 		.maxattr	= DEVLINK_ATTR_PORT_SPLIT_COUNT,
643 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
644 	},
645 	{
646 		.cmd		= DEVLINK_CMD_PORT_UNSPLIT,
647 		.validate	= GENL_DONT_VALIDATE_STRICT,
648 		.pre_doit	= devlink_nl_pre_doit_port,
649 		.doit		= devlink_nl_port_unsplit_doit,
650 		.post_doit	= devlink_nl_post_doit,
651 		.policy		= devlink_port_unsplit_nl_policy,
652 		.maxattr	= DEVLINK_ATTR_PORT_INDEX,
653 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
654 	},
655 	{
656 		.cmd		= DEVLINK_CMD_SB_GET,
657 		.validate	= GENL_DONT_VALIDATE_STRICT,
658 		.pre_doit	= devlink_nl_pre_doit,
659 		.doit		= devlink_nl_sb_get_doit,
660 		.post_doit	= devlink_nl_post_doit,
661 		.policy		= devlink_sb_get_do_nl_policy,
662 		.maxattr	= DEVLINK_ATTR_SB_INDEX,
663 		.flags		= GENL_CMD_CAP_DO,
664 	},
665 	{
666 		.cmd		= DEVLINK_CMD_SB_GET,
667 		.dumpit		= devlink_nl_sb_get_dumpit,
668 		.policy		= devlink_sb_get_dump_nl_policy,
669 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
670 		.flags		= GENL_CMD_CAP_DUMP,
671 	},
672 	{
673 		.cmd		= DEVLINK_CMD_SB_POOL_GET,
674 		.validate	= GENL_DONT_VALIDATE_STRICT,
675 		.pre_doit	= devlink_nl_pre_doit,
676 		.doit		= devlink_nl_sb_pool_get_doit,
677 		.post_doit	= devlink_nl_post_doit,
678 		.policy		= devlink_sb_pool_get_do_nl_policy,
679 		.maxattr	= DEVLINK_ATTR_SB_POOL_INDEX,
680 		.flags		= GENL_CMD_CAP_DO,
681 	},
682 	{
683 		.cmd		= DEVLINK_CMD_SB_POOL_GET,
684 		.dumpit		= devlink_nl_sb_pool_get_dumpit,
685 		.policy		= devlink_sb_pool_get_dump_nl_policy,
686 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
687 		.flags		= GENL_CMD_CAP_DUMP,
688 	},
689 	{
690 		.cmd		= DEVLINK_CMD_SB_POOL_SET,
691 		.validate	= GENL_DONT_VALIDATE_STRICT,
692 		.pre_doit	= devlink_nl_pre_doit,
693 		.doit		= devlink_nl_sb_pool_set_doit,
694 		.post_doit	= devlink_nl_post_doit,
695 		.policy		= devlink_sb_pool_set_nl_policy,
696 		.maxattr	= DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE,
697 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
698 	},
699 	{
700 		.cmd		= DEVLINK_CMD_SB_PORT_POOL_GET,
701 		.validate	= GENL_DONT_VALIDATE_STRICT,
702 		.pre_doit	= devlink_nl_pre_doit_port,
703 		.doit		= devlink_nl_sb_port_pool_get_doit,
704 		.post_doit	= devlink_nl_post_doit,
705 		.policy		= devlink_sb_port_pool_get_do_nl_policy,
706 		.maxattr	= DEVLINK_ATTR_SB_POOL_INDEX,
707 		.flags		= GENL_CMD_CAP_DO,
708 	},
709 	{
710 		.cmd		= DEVLINK_CMD_SB_PORT_POOL_GET,
711 		.dumpit		= devlink_nl_sb_port_pool_get_dumpit,
712 		.policy		= devlink_sb_port_pool_get_dump_nl_policy,
713 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
714 		.flags		= GENL_CMD_CAP_DUMP,
715 	},
716 	{
717 		.cmd		= DEVLINK_CMD_SB_PORT_POOL_SET,
718 		.validate	= GENL_DONT_VALIDATE_STRICT,
719 		.pre_doit	= devlink_nl_pre_doit_port,
720 		.doit		= devlink_nl_sb_port_pool_set_doit,
721 		.post_doit	= devlink_nl_post_doit,
722 		.policy		= devlink_sb_port_pool_set_nl_policy,
723 		.maxattr	= DEVLINK_ATTR_SB_THRESHOLD,
724 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
725 	},
726 	{
727 		.cmd		= DEVLINK_CMD_SB_TC_POOL_BIND_GET,
728 		.validate	= GENL_DONT_VALIDATE_STRICT,
729 		.pre_doit	= devlink_nl_pre_doit_port,
730 		.doit		= devlink_nl_sb_tc_pool_bind_get_doit,
731 		.post_doit	= devlink_nl_post_doit,
732 		.policy		= devlink_sb_tc_pool_bind_get_do_nl_policy,
733 		.maxattr	= DEVLINK_ATTR_SB_TC_INDEX,
734 		.flags		= GENL_CMD_CAP_DO,
735 	},
736 	{
737 		.cmd		= DEVLINK_CMD_SB_TC_POOL_BIND_GET,
738 		.dumpit		= devlink_nl_sb_tc_pool_bind_get_dumpit,
739 		.policy		= devlink_sb_tc_pool_bind_get_dump_nl_policy,
740 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
741 		.flags		= GENL_CMD_CAP_DUMP,
742 	},
743 	{
744 		.cmd		= DEVLINK_CMD_SB_TC_POOL_BIND_SET,
745 		.validate	= GENL_DONT_VALIDATE_STRICT,
746 		.pre_doit	= devlink_nl_pre_doit_port,
747 		.doit		= devlink_nl_sb_tc_pool_bind_set_doit,
748 		.post_doit	= devlink_nl_post_doit,
749 		.policy		= devlink_sb_tc_pool_bind_set_nl_policy,
750 		.maxattr	= DEVLINK_ATTR_SB_TC_INDEX,
751 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
752 	},
753 	{
754 		.cmd		= DEVLINK_CMD_SB_OCC_SNAPSHOT,
755 		.validate	= GENL_DONT_VALIDATE_STRICT,
756 		.pre_doit	= devlink_nl_pre_doit,
757 		.doit		= devlink_nl_sb_occ_snapshot_doit,
758 		.post_doit	= devlink_nl_post_doit,
759 		.policy		= devlink_sb_occ_snapshot_nl_policy,
760 		.maxattr	= DEVLINK_ATTR_SB_INDEX,
761 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
762 	},
763 	{
764 		.cmd		= DEVLINK_CMD_SB_OCC_MAX_CLEAR,
765 		.validate	= GENL_DONT_VALIDATE_STRICT,
766 		.pre_doit	= devlink_nl_pre_doit,
767 		.doit		= devlink_nl_sb_occ_max_clear_doit,
768 		.post_doit	= devlink_nl_post_doit,
769 		.policy		= devlink_sb_occ_max_clear_nl_policy,
770 		.maxattr	= DEVLINK_ATTR_SB_INDEX,
771 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
772 	},
773 	{
774 		.cmd		= DEVLINK_CMD_ESWITCH_GET,
775 		.validate	= GENL_DONT_VALIDATE_STRICT,
776 		.pre_doit	= devlink_nl_pre_doit,
777 		.doit		= devlink_nl_eswitch_get_doit,
778 		.post_doit	= devlink_nl_post_doit,
779 		.policy		= devlink_eswitch_get_nl_policy,
780 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
781 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
782 	},
783 	{
784 		.cmd		= DEVLINK_CMD_ESWITCH_SET,
785 		.validate	= GENL_DONT_VALIDATE_STRICT,
786 		.pre_doit	= devlink_nl_pre_doit,
787 		.doit		= devlink_nl_eswitch_set_doit,
788 		.post_doit	= devlink_nl_post_doit,
789 		.policy		= devlink_eswitch_set_nl_policy,
790 		.maxattr	= DEVLINK_ATTR_ESWITCH_ENCAP_MODE,
791 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
792 	},
793 	{
794 		.cmd		= DEVLINK_CMD_DPIPE_TABLE_GET,
795 		.validate	= GENL_DONT_VALIDATE_STRICT,
796 		.pre_doit	= devlink_nl_pre_doit,
797 		.doit		= devlink_nl_dpipe_table_get_doit,
798 		.post_doit	= devlink_nl_post_doit,
799 		.policy		= devlink_dpipe_table_get_nl_policy,
800 		.maxattr	= DEVLINK_ATTR_DPIPE_TABLE_NAME,
801 		.flags		= GENL_CMD_CAP_DO,
802 	},
803 	{
804 		.cmd		= DEVLINK_CMD_DPIPE_ENTRIES_GET,
805 		.validate	= GENL_DONT_VALIDATE_STRICT,
806 		.pre_doit	= devlink_nl_pre_doit,
807 		.doit		= devlink_nl_dpipe_entries_get_doit,
808 		.post_doit	= devlink_nl_post_doit,
809 		.policy		= devlink_dpipe_entries_get_nl_policy,
810 		.maxattr	= DEVLINK_ATTR_DPIPE_TABLE_NAME,
811 		.flags		= GENL_CMD_CAP_DO,
812 	},
813 	{
814 		.cmd		= DEVLINK_CMD_DPIPE_HEADERS_GET,
815 		.validate	= GENL_DONT_VALIDATE_STRICT,
816 		.pre_doit	= devlink_nl_pre_doit,
817 		.doit		= devlink_nl_dpipe_headers_get_doit,
818 		.post_doit	= devlink_nl_post_doit,
819 		.policy		= devlink_dpipe_headers_get_nl_policy,
820 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
821 		.flags		= GENL_CMD_CAP_DO,
822 	},
823 	{
824 		.cmd		= DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET,
825 		.validate	= GENL_DONT_VALIDATE_STRICT,
826 		.pre_doit	= devlink_nl_pre_doit,
827 		.doit		= devlink_nl_dpipe_table_counters_set_doit,
828 		.post_doit	= devlink_nl_post_doit,
829 		.policy		= devlink_dpipe_table_counters_set_nl_policy,
830 		.maxattr	= DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED,
831 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
832 	},
833 	{
834 		.cmd		= DEVLINK_CMD_RESOURCE_SET,
835 		.validate	= GENL_DONT_VALIDATE_STRICT,
836 		.pre_doit	= devlink_nl_pre_doit,
837 		.doit		= devlink_nl_resource_set_doit,
838 		.post_doit	= devlink_nl_post_doit,
839 		.policy		= devlink_resource_set_nl_policy,
840 		.maxattr	= DEVLINK_ATTR_RESOURCE_SIZE,
841 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
842 	},
843 	{
844 		.cmd		= DEVLINK_CMD_RESOURCE_DUMP,
845 		.validate	= GENL_DONT_VALIDATE_STRICT,
846 		.pre_doit	= devlink_nl_pre_doit,
847 		.doit		= devlink_nl_resource_dump_doit,
848 		.post_doit	= devlink_nl_post_doit,
849 		.policy		= devlink_resource_dump_nl_policy,
850 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
851 		.flags		= GENL_CMD_CAP_DO,
852 	},
853 	{
854 		.cmd		= DEVLINK_CMD_RELOAD,
855 		.validate	= GENL_DONT_VALIDATE_STRICT,
856 		.pre_doit	= devlink_nl_pre_doit_dev_lock,
857 		.doit		= devlink_nl_reload_doit,
858 		.post_doit	= devlink_nl_post_doit_dev_lock,
859 		.policy		= devlink_reload_nl_policy,
860 		.maxattr	= DEVLINK_ATTR_RELOAD_LIMITS,
861 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
862 	},
863 	{
864 		.cmd		= DEVLINK_CMD_PARAM_GET,
865 		.validate	= GENL_DONT_VALIDATE_STRICT,
866 		.pre_doit	= devlink_nl_pre_doit,
867 		.doit		= devlink_nl_param_get_doit,
868 		.post_doit	= devlink_nl_post_doit,
869 		.policy		= devlink_param_get_do_nl_policy,
870 		.maxattr	= DEVLINK_ATTR_PARAM_NAME,
871 		.flags		= GENL_CMD_CAP_DO,
872 	},
873 	{
874 		.cmd		= DEVLINK_CMD_PARAM_GET,
875 		.dumpit		= devlink_nl_param_get_dumpit,
876 		.policy		= devlink_param_get_dump_nl_policy,
877 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
878 		.flags		= GENL_CMD_CAP_DUMP,
879 	},
880 	{
881 		.cmd		= DEVLINK_CMD_PARAM_SET,
882 		.validate	= GENL_DONT_VALIDATE_STRICT,
883 		.pre_doit	= devlink_nl_pre_doit,
884 		.doit		= devlink_nl_param_set_doit,
885 		.post_doit	= devlink_nl_post_doit,
886 		.policy		= devlink_param_set_nl_policy,
887 		.maxattr	= DEVLINK_ATTR_PARAM_VALUE_CMODE,
888 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
889 	},
890 	{
891 		.cmd		= DEVLINK_CMD_REGION_GET,
892 		.validate	= GENL_DONT_VALIDATE_STRICT,
893 		.pre_doit	= devlink_nl_pre_doit_port_optional,
894 		.doit		= devlink_nl_region_get_doit,
895 		.post_doit	= devlink_nl_post_doit,
896 		.policy		= devlink_region_get_do_nl_policy,
897 		.maxattr	= DEVLINK_ATTR_REGION_NAME,
898 		.flags		= GENL_CMD_CAP_DO,
899 	},
900 	{
901 		.cmd		= DEVLINK_CMD_REGION_GET,
902 		.dumpit		= devlink_nl_region_get_dumpit,
903 		.policy		= devlink_region_get_dump_nl_policy,
904 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
905 		.flags		= GENL_CMD_CAP_DUMP,
906 	},
907 	{
908 		.cmd		= DEVLINK_CMD_REGION_NEW,
909 		.validate	= GENL_DONT_VALIDATE_STRICT,
910 		.pre_doit	= devlink_nl_pre_doit_port_optional,
911 		.doit		= devlink_nl_region_new_doit,
912 		.post_doit	= devlink_nl_post_doit,
913 		.policy		= devlink_region_new_nl_policy,
914 		.maxattr	= DEVLINK_ATTR_REGION_SNAPSHOT_ID,
915 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
916 	},
917 	{
918 		.cmd		= DEVLINK_CMD_REGION_DEL,
919 		.validate	= GENL_DONT_VALIDATE_STRICT,
920 		.pre_doit	= devlink_nl_pre_doit_port_optional,
921 		.doit		= devlink_nl_region_del_doit,
922 		.post_doit	= devlink_nl_post_doit,
923 		.policy		= devlink_region_del_nl_policy,
924 		.maxattr	= DEVLINK_ATTR_REGION_SNAPSHOT_ID,
925 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
926 	},
927 	{
928 		.cmd		= DEVLINK_CMD_REGION_READ,
929 		.validate	= GENL_DONT_VALIDATE_DUMP_STRICT,
930 		.dumpit		= devlink_nl_region_read_dumpit,
931 		.policy		= devlink_region_read_nl_policy,
932 		.maxattr	= DEVLINK_ATTR_REGION_DIRECT,
933 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
934 	},
935 	{
936 		.cmd		= DEVLINK_CMD_PORT_PARAM_GET,
937 		.validate	= GENL_DONT_VALIDATE_STRICT,
938 		.pre_doit	= devlink_nl_pre_doit_port,
939 		.doit		= devlink_nl_port_param_get_doit,
940 		.post_doit	= devlink_nl_post_doit,
941 		.policy		= devlink_port_param_get_nl_policy,
942 		.maxattr	= DEVLINK_ATTR_PORT_INDEX,
943 		.flags		= GENL_CMD_CAP_DO,
944 	},
945 	{
946 		.cmd		= DEVLINK_CMD_PORT_PARAM_GET,
947 		.validate	= GENL_DONT_VALIDATE_DUMP_STRICT,
948 		.dumpit		= devlink_nl_port_param_get_dumpit,
949 		.flags		= GENL_CMD_CAP_DUMP,
950 	},
951 	{
952 		.cmd		= DEVLINK_CMD_PORT_PARAM_SET,
953 		.validate	= GENL_DONT_VALIDATE_STRICT,
954 		.pre_doit	= devlink_nl_pre_doit_port,
955 		.doit		= devlink_nl_port_param_set_doit,
956 		.post_doit	= devlink_nl_post_doit,
957 		.policy		= devlink_port_param_set_nl_policy,
958 		.maxattr	= DEVLINK_ATTR_PORT_INDEX,
959 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
960 	},
961 	{
962 		.cmd		= DEVLINK_CMD_INFO_GET,
963 		.validate	= GENL_DONT_VALIDATE_STRICT,
964 		.pre_doit	= devlink_nl_pre_doit,
965 		.doit		= devlink_nl_info_get_doit,
966 		.post_doit	= devlink_nl_post_doit,
967 		.policy		= devlink_info_get_nl_policy,
968 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
969 		.flags		= GENL_CMD_CAP_DO,
970 	},
971 	{
972 		.cmd		= DEVLINK_CMD_INFO_GET,
973 		.validate	= GENL_DONT_VALIDATE_DUMP,
974 		.dumpit		= devlink_nl_info_get_dumpit,
975 		.flags		= GENL_CMD_CAP_DUMP,
976 	},
977 	{
978 		.cmd		= DEVLINK_CMD_HEALTH_REPORTER_GET,
979 		.validate	= GENL_DONT_VALIDATE_STRICT,
980 		.pre_doit	= devlink_nl_pre_doit_port_optional,
981 		.doit		= devlink_nl_health_reporter_get_doit,
982 		.post_doit	= devlink_nl_post_doit,
983 		.policy		= devlink_health_reporter_get_do_nl_policy,
984 		.maxattr	= DEVLINK_ATTR_HEALTH_REPORTER_NAME,
985 		.flags		= GENL_CMD_CAP_DO,
986 	},
987 	{
988 		.cmd		= DEVLINK_CMD_HEALTH_REPORTER_GET,
989 		.dumpit		= devlink_nl_health_reporter_get_dumpit,
990 		.policy		= devlink_health_reporter_get_dump_nl_policy,
991 		.maxattr	= DEVLINK_ATTR_PORT_INDEX,
992 		.flags		= GENL_CMD_CAP_DUMP,
993 	},
994 	{
995 		.cmd		= DEVLINK_CMD_HEALTH_REPORTER_SET,
996 		.validate	= GENL_DONT_VALIDATE_STRICT,
997 		.pre_doit	= devlink_nl_pre_doit_port_optional,
998 		.doit		= devlink_nl_health_reporter_set_doit,
999 		.post_doit	= devlink_nl_post_doit,
1000 		.policy		= devlink_health_reporter_set_nl_policy,
1001 		.maxattr	= DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP,
1002 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1003 	},
1004 	{
1005 		.cmd		= DEVLINK_CMD_HEALTH_REPORTER_RECOVER,
1006 		.validate	= GENL_DONT_VALIDATE_STRICT,
1007 		.pre_doit	= devlink_nl_pre_doit_port_optional,
1008 		.doit		= devlink_nl_health_reporter_recover_doit,
1009 		.post_doit	= devlink_nl_post_doit,
1010 		.policy		= devlink_health_reporter_recover_nl_policy,
1011 		.maxattr	= DEVLINK_ATTR_HEALTH_REPORTER_NAME,
1012 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1013 	},
1014 	{
1015 		.cmd		= DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE,
1016 		.validate	= GENL_DONT_VALIDATE_STRICT,
1017 		.pre_doit	= devlink_nl_pre_doit_port_optional,
1018 		.doit		= devlink_nl_health_reporter_diagnose_doit,
1019 		.post_doit	= devlink_nl_post_doit,
1020 		.policy		= devlink_health_reporter_diagnose_nl_policy,
1021 		.maxattr	= DEVLINK_ATTR_HEALTH_REPORTER_NAME,
1022 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1023 	},
1024 	{
1025 		.cmd		= DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET,
1026 		.validate	= GENL_DONT_VALIDATE_DUMP_STRICT,
1027 		.dumpit		= devlink_nl_health_reporter_dump_get_dumpit,
1028 		.policy		= devlink_health_reporter_dump_get_nl_policy,
1029 		.maxattr	= DEVLINK_ATTR_HEALTH_REPORTER_NAME,
1030 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP,
1031 	},
1032 	{
1033 		.cmd		= DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
1034 		.validate	= GENL_DONT_VALIDATE_STRICT,
1035 		.pre_doit	= devlink_nl_pre_doit_port_optional,
1036 		.doit		= devlink_nl_health_reporter_dump_clear_doit,
1037 		.post_doit	= devlink_nl_post_doit,
1038 		.policy		= devlink_health_reporter_dump_clear_nl_policy,
1039 		.maxattr	= DEVLINK_ATTR_HEALTH_REPORTER_NAME,
1040 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1041 	},
1042 	{
1043 		.cmd		= DEVLINK_CMD_FLASH_UPDATE,
1044 		.validate	= GENL_DONT_VALIDATE_STRICT,
1045 		.pre_doit	= devlink_nl_pre_doit,
1046 		.doit		= devlink_nl_flash_update_doit,
1047 		.post_doit	= devlink_nl_post_doit,
1048 		.policy		= devlink_flash_update_nl_policy,
1049 		.maxattr	= DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK,
1050 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1051 	},
1052 	{
1053 		.cmd		= DEVLINK_CMD_TRAP_GET,
1054 		.validate	= GENL_DONT_VALIDATE_STRICT,
1055 		.pre_doit	= devlink_nl_pre_doit,
1056 		.doit		= devlink_nl_trap_get_doit,
1057 		.post_doit	= devlink_nl_post_doit,
1058 		.policy		= devlink_trap_get_do_nl_policy,
1059 		.maxattr	= DEVLINK_ATTR_TRAP_NAME,
1060 		.flags		= GENL_CMD_CAP_DO,
1061 	},
1062 	{
1063 		.cmd		= DEVLINK_CMD_TRAP_GET,
1064 		.dumpit		= devlink_nl_trap_get_dumpit,
1065 		.policy		= devlink_trap_get_dump_nl_policy,
1066 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
1067 		.flags		= GENL_CMD_CAP_DUMP,
1068 	},
1069 	{
1070 		.cmd		= DEVLINK_CMD_TRAP_SET,
1071 		.validate	= GENL_DONT_VALIDATE_STRICT,
1072 		.pre_doit	= devlink_nl_pre_doit,
1073 		.doit		= devlink_nl_trap_set_doit,
1074 		.post_doit	= devlink_nl_post_doit,
1075 		.policy		= devlink_trap_set_nl_policy,
1076 		.maxattr	= DEVLINK_ATTR_TRAP_ACTION,
1077 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1078 	},
1079 	{
1080 		.cmd		= DEVLINK_CMD_TRAP_GROUP_GET,
1081 		.validate	= GENL_DONT_VALIDATE_STRICT,
1082 		.pre_doit	= devlink_nl_pre_doit,
1083 		.doit		= devlink_nl_trap_group_get_doit,
1084 		.post_doit	= devlink_nl_post_doit,
1085 		.policy		= devlink_trap_group_get_do_nl_policy,
1086 		.maxattr	= DEVLINK_ATTR_TRAP_GROUP_NAME,
1087 		.flags		= GENL_CMD_CAP_DO,
1088 	},
1089 	{
1090 		.cmd		= DEVLINK_CMD_TRAP_GROUP_GET,
1091 		.dumpit		= devlink_nl_trap_group_get_dumpit,
1092 		.policy		= devlink_trap_group_get_dump_nl_policy,
1093 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
1094 		.flags		= GENL_CMD_CAP_DUMP,
1095 	},
1096 	{
1097 		.cmd		= DEVLINK_CMD_TRAP_GROUP_SET,
1098 		.validate	= GENL_DONT_VALIDATE_STRICT,
1099 		.pre_doit	= devlink_nl_pre_doit,
1100 		.doit		= devlink_nl_trap_group_set_doit,
1101 		.post_doit	= devlink_nl_post_doit,
1102 		.policy		= devlink_trap_group_set_nl_policy,
1103 		.maxattr	= DEVLINK_ATTR_TRAP_POLICER_ID,
1104 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1105 	},
1106 	{
1107 		.cmd		= DEVLINK_CMD_TRAP_POLICER_GET,
1108 		.validate	= GENL_DONT_VALIDATE_STRICT,
1109 		.pre_doit	= devlink_nl_pre_doit,
1110 		.doit		= devlink_nl_trap_policer_get_doit,
1111 		.post_doit	= devlink_nl_post_doit,
1112 		.policy		= devlink_trap_policer_get_do_nl_policy,
1113 		.maxattr	= DEVLINK_ATTR_TRAP_POLICER_ID,
1114 		.flags		= GENL_CMD_CAP_DO,
1115 	},
1116 	{
1117 		.cmd		= DEVLINK_CMD_TRAP_POLICER_GET,
1118 		.dumpit		= devlink_nl_trap_policer_get_dumpit,
1119 		.policy		= devlink_trap_policer_get_dump_nl_policy,
1120 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
1121 		.flags		= GENL_CMD_CAP_DUMP,
1122 	},
1123 	{
1124 		.cmd		= DEVLINK_CMD_TRAP_POLICER_SET,
1125 		.validate	= GENL_DONT_VALIDATE_STRICT,
1126 		.pre_doit	= devlink_nl_pre_doit,
1127 		.doit		= devlink_nl_trap_policer_set_doit,
1128 		.post_doit	= devlink_nl_post_doit,
1129 		.policy		= devlink_trap_policer_set_nl_policy,
1130 		.maxattr	= DEVLINK_ATTR_TRAP_POLICER_BURST,
1131 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1132 	},
1133 	{
1134 		.cmd		= DEVLINK_CMD_HEALTH_REPORTER_TEST,
1135 		.validate	= GENL_DONT_VALIDATE_STRICT,
1136 		.pre_doit	= devlink_nl_pre_doit_port_optional,
1137 		.doit		= devlink_nl_health_reporter_test_doit,
1138 		.post_doit	= devlink_nl_post_doit,
1139 		.policy		= devlink_health_reporter_test_nl_policy,
1140 		.maxattr	= DEVLINK_ATTR_HEALTH_REPORTER_NAME,
1141 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1142 	},
1143 	{
1144 		.cmd		= DEVLINK_CMD_RATE_GET,
1145 		.validate	= GENL_DONT_VALIDATE_STRICT,
1146 		.pre_doit	= devlink_nl_pre_doit,
1147 		.doit		= devlink_nl_rate_get_doit,
1148 		.post_doit	= devlink_nl_post_doit,
1149 		.policy		= devlink_rate_get_do_nl_policy,
1150 		.maxattr	= DEVLINK_ATTR_RATE_NODE_NAME,
1151 		.flags		= GENL_CMD_CAP_DO,
1152 	},
1153 	{
1154 		.cmd		= DEVLINK_CMD_RATE_GET,
1155 		.dumpit		= devlink_nl_rate_get_dumpit,
1156 		.policy		= devlink_rate_get_dump_nl_policy,
1157 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
1158 		.flags		= GENL_CMD_CAP_DUMP,
1159 	},
1160 	{
1161 		.cmd		= DEVLINK_CMD_RATE_SET,
1162 		.validate	= GENL_DONT_VALIDATE_STRICT,
1163 		.pre_doit	= devlink_nl_pre_doit,
1164 		.doit		= devlink_nl_rate_set_doit,
1165 		.post_doit	= devlink_nl_post_doit,
1166 		.policy		= devlink_rate_set_nl_policy,
1167 		.maxattr	= DEVLINK_ATTR_RATE_TX_WEIGHT,
1168 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1169 	},
1170 	{
1171 		.cmd		= DEVLINK_CMD_RATE_NEW,
1172 		.validate	= GENL_DONT_VALIDATE_STRICT,
1173 		.pre_doit	= devlink_nl_pre_doit,
1174 		.doit		= devlink_nl_rate_new_doit,
1175 		.post_doit	= devlink_nl_post_doit,
1176 		.policy		= devlink_rate_new_nl_policy,
1177 		.maxattr	= DEVLINK_ATTR_RATE_TX_WEIGHT,
1178 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1179 	},
1180 	{
1181 		.cmd		= DEVLINK_CMD_RATE_DEL,
1182 		.validate	= GENL_DONT_VALIDATE_STRICT,
1183 		.pre_doit	= devlink_nl_pre_doit,
1184 		.doit		= devlink_nl_rate_del_doit,
1185 		.post_doit	= devlink_nl_post_doit,
1186 		.policy		= devlink_rate_del_nl_policy,
1187 		.maxattr	= DEVLINK_ATTR_RATE_NODE_NAME,
1188 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1189 	},
1190 	{
1191 		.cmd		= DEVLINK_CMD_LINECARD_GET,
1192 		.validate	= GENL_DONT_VALIDATE_STRICT,
1193 		.pre_doit	= devlink_nl_pre_doit,
1194 		.doit		= devlink_nl_linecard_get_doit,
1195 		.post_doit	= devlink_nl_post_doit,
1196 		.policy		= devlink_linecard_get_do_nl_policy,
1197 		.maxattr	= DEVLINK_ATTR_LINECARD_INDEX,
1198 		.flags		= GENL_CMD_CAP_DO,
1199 	},
1200 	{
1201 		.cmd		= DEVLINK_CMD_LINECARD_GET,
1202 		.dumpit		= devlink_nl_linecard_get_dumpit,
1203 		.policy		= devlink_linecard_get_dump_nl_policy,
1204 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
1205 		.flags		= GENL_CMD_CAP_DUMP,
1206 	},
1207 	{
1208 		.cmd		= DEVLINK_CMD_LINECARD_SET,
1209 		.validate	= GENL_DONT_VALIDATE_STRICT,
1210 		.pre_doit	= devlink_nl_pre_doit,
1211 		.doit		= devlink_nl_linecard_set_doit,
1212 		.post_doit	= devlink_nl_post_doit,
1213 		.policy		= devlink_linecard_set_nl_policy,
1214 		.maxattr	= DEVLINK_ATTR_LINECARD_TYPE,
1215 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1216 	},
1217 	{
1218 		.cmd		= DEVLINK_CMD_SELFTESTS_GET,
1219 		.validate	= GENL_DONT_VALIDATE_STRICT,
1220 		.pre_doit	= devlink_nl_pre_doit,
1221 		.doit		= devlink_nl_selftests_get_doit,
1222 		.post_doit	= devlink_nl_post_doit,
1223 		.policy		= devlink_selftests_get_nl_policy,
1224 		.maxattr	= DEVLINK_ATTR_DEV_NAME,
1225 		.flags		= GENL_CMD_CAP_DO,
1226 	},
1227 	{
1228 		.cmd		= DEVLINK_CMD_SELFTESTS_GET,
1229 		.validate	= GENL_DONT_VALIDATE_DUMP,
1230 		.dumpit		= devlink_nl_selftests_get_dumpit,
1231 		.flags		= GENL_CMD_CAP_DUMP,
1232 	},
1233 	{
1234 		.cmd		= DEVLINK_CMD_SELFTESTS_RUN,
1235 		.validate	= GENL_DONT_VALIDATE_STRICT,
1236 		.pre_doit	= devlink_nl_pre_doit,
1237 		.doit		= devlink_nl_selftests_run_doit,
1238 		.post_doit	= devlink_nl_post_doit,
1239 		.policy		= devlink_selftests_run_nl_policy,
1240 		.maxattr	= DEVLINK_ATTR_SELFTESTS,
1241 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
1242 	},
1243 	{
1244 		.cmd		= DEVLINK_CMD_NOTIFY_FILTER_SET,
1245 		.doit		= devlink_nl_notify_filter_set_doit,
1246 		.policy		= devlink_notify_filter_set_nl_policy,
1247 		.maxattr	= DEVLINK_ATTR_PORT_INDEX,
1248 		.flags		= GENL_CMD_CAP_DO,
1249 	},
1250 };
1251