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/ethtool.yaml */
4 /* YNL-GEN user header */
5 /* YNL-ARG --user-header linux/ethtool_netlink.h --exclude-op stats-get */
6
7 #ifndef _LINUX_ETHTOOL_GEN_H
8 #define _LINUX_ETHTOOL_GEN_H
9
10 #include <stdlib.h>
11 #include <string.h>
12 #include <linux/types.h>
13 #include <linux/ethtool.h>
14
15 struct ynl_sock;
16
17 extern const struct ynl_family ynl_ethtool_family;
18
19 /* Enums */
20 const char *ethtool_op_str(int op);
21 const char *ethtool_udp_tunnel_type_str(int value);
22 const char *ethtool_stringset_str(enum ethtool_stringset value);
23
24 /* Common nested types */
25 struct ethtool_header {
26 struct {
27 __u32 dev_index:1;
28 __u32 dev_name_len;
29 __u32 flags:1;
30 } _present;
31
32 __u32 dev_index;
33 char *dev_name;
34 __u32 flags;
35 };
36
37 struct ethtool_pause_stat {
38 struct {
39 __u32 tx_frames:1;
40 __u32 rx_frames:1;
41 } _present;
42
43 __u64 tx_frames;
44 __u64 rx_frames;
45 };
46
47 struct ethtool_cable_test_tdr_cfg {
48 struct {
49 __u32 first:1;
50 __u32 last:1;
51 __u32 step:1;
52 __u32 pair:1;
53 } _present;
54
55 __u32 first;
56 __u32 last;
57 __u32 step;
58 __u8 pair;
59 };
60
61 struct ethtool_fec_stat {
62 struct {
63 __u32 corrected_len;
64 __u32 uncorr_len;
65 __u32 corr_bits_len;
66 } _present;
67
68 void *corrected;
69 void *uncorr;
70 void *corr_bits;
71 };
72
73 struct ethtool_mm_stat {
74 struct {
75 __u32 reassembly_errors:1;
76 __u32 smd_errors:1;
77 __u32 reassembly_ok:1;
78 __u32 rx_frag_count:1;
79 __u32 tx_frag_count:1;
80 __u32 hold_count:1;
81 } _present;
82
83 __u64 reassembly_errors;
84 __u64 smd_errors;
85 __u64 reassembly_ok;
86 __u64 rx_frag_count;
87 __u64 tx_frag_count;
88 __u64 hold_count;
89 };
90
91 struct ethtool_cable_result {
92 struct {
93 __u32 pair:1;
94 __u32 code:1;
95 } _present;
96
97 __u8 pair;
98 __u8 code;
99 };
100
101 struct ethtool_cable_fault_length {
102 struct {
103 __u32 pair:1;
104 __u32 cm:1;
105 } _present;
106
107 __u8 pair;
108 __u32 cm;
109 };
110
111 struct ethtool_bitset_bit {
112 struct {
113 __u32 index:1;
114 __u32 name_len;
115 __u32 value:1;
116 } _present;
117
118 __u32 index;
119 char *name;
120 };
121
122 struct ethtool_tunnel_udp_entry {
123 struct {
124 __u32 port:1;
125 __u32 type:1;
126 } _present;
127
128 __u16 port /* big-endian */;
129 __u32 type;
130 };
131
132 struct ethtool_string {
133 struct {
134 __u32 index:1;
135 __u32 value_len;
136 } _present;
137
138 __u32 index;
139 char *value;
140 };
141
142 struct ethtool_cable_nest {
143 struct {
144 __u32 result:1;
145 __u32 fault_length:1;
146 } _present;
147
148 struct ethtool_cable_result result;
149 struct ethtool_cable_fault_length fault_length;
150 };
151
152 struct ethtool_bitset_bits {
153 unsigned int n_bit;
154 struct ethtool_bitset_bit *bit;
155 };
156
157 struct ethtool_strings {
158 unsigned int n_string;
159 struct ethtool_string *string;
160 };
161
162 struct ethtool_bitset {
163 struct {
164 __u32 nomask:1;
165 __u32 size:1;
166 __u32 bits:1;
167 } _present;
168
169 __u32 size;
170 struct ethtool_bitset_bits bits;
171 };
172
173 struct ethtool_stringset_ {
174 struct {
175 __u32 id:1;
176 __u32 count:1;
177 } _present;
178
179 __u32 id;
180 __u32 count;
181 unsigned int n_strings;
182 struct ethtool_strings *strings;
183 };
184
185 struct ethtool_tunnel_udp_table {
186 struct {
187 __u32 size:1;
188 __u32 types:1;
189 } _present;
190
191 __u32 size;
192 struct ethtool_bitset types;
193 unsigned int n_entry;
194 struct ethtool_tunnel_udp_entry *entry;
195 };
196
197 struct ethtool_stringsets {
198 unsigned int n_stringset;
199 struct ethtool_stringset_ *stringset;
200 };
201
202 struct ethtool_tunnel_udp {
203 struct {
204 __u32 table:1;
205 } _present;
206
207 struct ethtool_tunnel_udp_table table;
208 };
209
210 /* ============== ETHTOOL_MSG_STRSET_GET ============== */
211 /* ETHTOOL_MSG_STRSET_GET - do */
212 struct ethtool_strset_get_req {
213 struct {
214 __u32 header:1;
215 __u32 stringsets:1;
216 __u32 counts_only:1;
217 } _present;
218
219 struct ethtool_header header;
220 struct ethtool_stringsets stringsets;
221 };
222
ethtool_strset_get_req_alloc(void)223 static inline struct ethtool_strset_get_req *ethtool_strset_get_req_alloc(void)
224 {
225 return calloc(1, sizeof(struct ethtool_strset_get_req));
226 }
227 void ethtool_strset_get_req_free(struct ethtool_strset_get_req *req);
228
229 static inline void
ethtool_strset_get_req_set_header_dev_index(struct ethtool_strset_get_req * req,__u32 dev_index)230 ethtool_strset_get_req_set_header_dev_index(struct ethtool_strset_get_req *req,
231 __u32 dev_index)
232 {
233 req->_present.header = 1;
234 req->header._present.dev_index = 1;
235 req->header.dev_index = dev_index;
236 }
237 static inline void
ethtool_strset_get_req_set_header_dev_name(struct ethtool_strset_get_req * req,const char * dev_name)238 ethtool_strset_get_req_set_header_dev_name(struct ethtool_strset_get_req *req,
239 const char *dev_name)
240 {
241 free(req->header.dev_name);
242 req->header._present.dev_name_len = strlen(dev_name);
243 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
244 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
245 req->header.dev_name[req->header._present.dev_name_len] = 0;
246 }
247 static inline void
ethtool_strset_get_req_set_header_flags(struct ethtool_strset_get_req * req,__u32 flags)248 ethtool_strset_get_req_set_header_flags(struct ethtool_strset_get_req *req,
249 __u32 flags)
250 {
251 req->_present.header = 1;
252 req->header._present.flags = 1;
253 req->header.flags = flags;
254 }
255 static inline void
__ethtool_strset_get_req_set_stringsets_stringset(struct ethtool_strset_get_req * req,struct ethtool_stringset_ * stringset,unsigned int n_stringset)256 __ethtool_strset_get_req_set_stringsets_stringset(struct ethtool_strset_get_req *req,
257 struct ethtool_stringset_ *stringset,
258 unsigned int n_stringset)
259 {
260 free(req->stringsets.stringset);
261 req->stringsets.stringset = stringset;
262 req->stringsets.n_stringset = n_stringset;
263 }
264 static inline void
ethtool_strset_get_req_set_counts_only(struct ethtool_strset_get_req * req)265 ethtool_strset_get_req_set_counts_only(struct ethtool_strset_get_req *req)
266 {
267 req->_present.counts_only = 1;
268 }
269
270 struct ethtool_strset_get_rsp {
271 struct {
272 __u32 header:1;
273 __u32 stringsets:1;
274 } _present;
275
276 struct ethtool_header header;
277 struct ethtool_stringsets stringsets;
278 };
279
280 void ethtool_strset_get_rsp_free(struct ethtool_strset_get_rsp *rsp);
281
282 /*
283 * Get string set from the kernel.
284 */
285 struct ethtool_strset_get_rsp *
286 ethtool_strset_get(struct ynl_sock *ys, struct ethtool_strset_get_req *req);
287
288 /* ETHTOOL_MSG_STRSET_GET - dump */
289 struct ethtool_strset_get_req_dump {
290 struct {
291 __u32 header:1;
292 __u32 stringsets:1;
293 __u32 counts_only:1;
294 } _present;
295
296 struct ethtool_header header;
297 struct ethtool_stringsets stringsets;
298 };
299
300 static inline struct ethtool_strset_get_req_dump *
ethtool_strset_get_req_dump_alloc(void)301 ethtool_strset_get_req_dump_alloc(void)
302 {
303 return calloc(1, sizeof(struct ethtool_strset_get_req_dump));
304 }
305 void ethtool_strset_get_req_dump_free(struct ethtool_strset_get_req_dump *req);
306
307 static inline void
ethtool_strset_get_req_dump_set_header_dev_index(struct ethtool_strset_get_req_dump * req,__u32 dev_index)308 ethtool_strset_get_req_dump_set_header_dev_index(struct ethtool_strset_get_req_dump *req,
309 __u32 dev_index)
310 {
311 req->_present.header = 1;
312 req->header._present.dev_index = 1;
313 req->header.dev_index = dev_index;
314 }
315 static inline void
ethtool_strset_get_req_dump_set_header_dev_name(struct ethtool_strset_get_req_dump * req,const char * dev_name)316 ethtool_strset_get_req_dump_set_header_dev_name(struct ethtool_strset_get_req_dump *req,
317 const char *dev_name)
318 {
319 free(req->header.dev_name);
320 req->header._present.dev_name_len = strlen(dev_name);
321 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
322 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
323 req->header.dev_name[req->header._present.dev_name_len] = 0;
324 }
325 static inline void
ethtool_strset_get_req_dump_set_header_flags(struct ethtool_strset_get_req_dump * req,__u32 flags)326 ethtool_strset_get_req_dump_set_header_flags(struct ethtool_strset_get_req_dump *req,
327 __u32 flags)
328 {
329 req->_present.header = 1;
330 req->header._present.flags = 1;
331 req->header.flags = flags;
332 }
333 static inline void
__ethtool_strset_get_req_dump_set_stringsets_stringset(struct ethtool_strset_get_req_dump * req,struct ethtool_stringset_ * stringset,unsigned int n_stringset)334 __ethtool_strset_get_req_dump_set_stringsets_stringset(struct ethtool_strset_get_req_dump *req,
335 struct ethtool_stringset_ *stringset,
336 unsigned int n_stringset)
337 {
338 free(req->stringsets.stringset);
339 req->stringsets.stringset = stringset;
340 req->stringsets.n_stringset = n_stringset;
341 }
342 static inline void
ethtool_strset_get_req_dump_set_counts_only(struct ethtool_strset_get_req_dump * req)343 ethtool_strset_get_req_dump_set_counts_only(struct ethtool_strset_get_req_dump *req)
344 {
345 req->_present.counts_only = 1;
346 }
347
348 struct ethtool_strset_get_list {
349 struct ethtool_strset_get_list *next;
350 struct ethtool_strset_get_rsp obj __attribute__ ((aligned (8)));
351 };
352
353 void ethtool_strset_get_list_free(struct ethtool_strset_get_list *rsp);
354
355 struct ethtool_strset_get_list *
356 ethtool_strset_get_dump(struct ynl_sock *ys,
357 struct ethtool_strset_get_req_dump *req);
358
359 /* ============== ETHTOOL_MSG_LINKINFO_GET ============== */
360 /* ETHTOOL_MSG_LINKINFO_GET - do */
361 struct ethtool_linkinfo_get_req {
362 struct {
363 __u32 header:1;
364 } _present;
365
366 struct ethtool_header header;
367 };
368
369 static inline struct ethtool_linkinfo_get_req *
ethtool_linkinfo_get_req_alloc(void)370 ethtool_linkinfo_get_req_alloc(void)
371 {
372 return calloc(1, sizeof(struct ethtool_linkinfo_get_req));
373 }
374 void ethtool_linkinfo_get_req_free(struct ethtool_linkinfo_get_req *req);
375
376 static inline void
ethtool_linkinfo_get_req_set_header_dev_index(struct ethtool_linkinfo_get_req * req,__u32 dev_index)377 ethtool_linkinfo_get_req_set_header_dev_index(struct ethtool_linkinfo_get_req *req,
378 __u32 dev_index)
379 {
380 req->_present.header = 1;
381 req->header._present.dev_index = 1;
382 req->header.dev_index = dev_index;
383 }
384 static inline void
ethtool_linkinfo_get_req_set_header_dev_name(struct ethtool_linkinfo_get_req * req,const char * dev_name)385 ethtool_linkinfo_get_req_set_header_dev_name(struct ethtool_linkinfo_get_req *req,
386 const char *dev_name)
387 {
388 free(req->header.dev_name);
389 req->header._present.dev_name_len = strlen(dev_name);
390 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
391 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
392 req->header.dev_name[req->header._present.dev_name_len] = 0;
393 }
394 static inline void
ethtool_linkinfo_get_req_set_header_flags(struct ethtool_linkinfo_get_req * req,__u32 flags)395 ethtool_linkinfo_get_req_set_header_flags(struct ethtool_linkinfo_get_req *req,
396 __u32 flags)
397 {
398 req->_present.header = 1;
399 req->header._present.flags = 1;
400 req->header.flags = flags;
401 }
402
403 struct ethtool_linkinfo_get_rsp {
404 struct {
405 __u32 header:1;
406 __u32 port:1;
407 __u32 phyaddr:1;
408 __u32 tp_mdix:1;
409 __u32 tp_mdix_ctrl:1;
410 __u32 transceiver:1;
411 } _present;
412
413 struct ethtool_header header;
414 __u8 port;
415 __u8 phyaddr;
416 __u8 tp_mdix;
417 __u8 tp_mdix_ctrl;
418 __u8 transceiver;
419 };
420
421 void ethtool_linkinfo_get_rsp_free(struct ethtool_linkinfo_get_rsp *rsp);
422
423 /*
424 * Get link info.
425 */
426 struct ethtool_linkinfo_get_rsp *
427 ethtool_linkinfo_get(struct ynl_sock *ys, struct ethtool_linkinfo_get_req *req);
428
429 /* ETHTOOL_MSG_LINKINFO_GET - dump */
430 struct ethtool_linkinfo_get_req_dump {
431 struct {
432 __u32 header:1;
433 } _present;
434
435 struct ethtool_header header;
436 };
437
438 static inline struct ethtool_linkinfo_get_req_dump *
ethtool_linkinfo_get_req_dump_alloc(void)439 ethtool_linkinfo_get_req_dump_alloc(void)
440 {
441 return calloc(1, sizeof(struct ethtool_linkinfo_get_req_dump));
442 }
443 void
444 ethtool_linkinfo_get_req_dump_free(struct ethtool_linkinfo_get_req_dump *req);
445
446 static inline void
ethtool_linkinfo_get_req_dump_set_header_dev_index(struct ethtool_linkinfo_get_req_dump * req,__u32 dev_index)447 ethtool_linkinfo_get_req_dump_set_header_dev_index(struct ethtool_linkinfo_get_req_dump *req,
448 __u32 dev_index)
449 {
450 req->_present.header = 1;
451 req->header._present.dev_index = 1;
452 req->header.dev_index = dev_index;
453 }
454 static inline void
ethtool_linkinfo_get_req_dump_set_header_dev_name(struct ethtool_linkinfo_get_req_dump * req,const char * dev_name)455 ethtool_linkinfo_get_req_dump_set_header_dev_name(struct ethtool_linkinfo_get_req_dump *req,
456 const char *dev_name)
457 {
458 free(req->header.dev_name);
459 req->header._present.dev_name_len = strlen(dev_name);
460 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
461 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
462 req->header.dev_name[req->header._present.dev_name_len] = 0;
463 }
464 static inline void
ethtool_linkinfo_get_req_dump_set_header_flags(struct ethtool_linkinfo_get_req_dump * req,__u32 flags)465 ethtool_linkinfo_get_req_dump_set_header_flags(struct ethtool_linkinfo_get_req_dump *req,
466 __u32 flags)
467 {
468 req->_present.header = 1;
469 req->header._present.flags = 1;
470 req->header.flags = flags;
471 }
472
473 struct ethtool_linkinfo_get_list {
474 struct ethtool_linkinfo_get_list *next;
475 struct ethtool_linkinfo_get_rsp obj __attribute__ ((aligned (8)));
476 };
477
478 void ethtool_linkinfo_get_list_free(struct ethtool_linkinfo_get_list *rsp);
479
480 struct ethtool_linkinfo_get_list *
481 ethtool_linkinfo_get_dump(struct ynl_sock *ys,
482 struct ethtool_linkinfo_get_req_dump *req);
483
484 /* ETHTOOL_MSG_LINKINFO_GET - notify */
485 struct ethtool_linkinfo_get_ntf {
486 __u16 family;
487 __u8 cmd;
488 struct ynl_ntf_base_type *next;
489 void (*free)(struct ethtool_linkinfo_get_ntf *ntf);
490 struct ethtool_linkinfo_get_rsp obj __attribute__ ((aligned (8)));
491 };
492
493 void ethtool_linkinfo_get_ntf_free(struct ethtool_linkinfo_get_ntf *rsp);
494
495 /* ============== ETHTOOL_MSG_LINKINFO_SET ============== */
496 /* ETHTOOL_MSG_LINKINFO_SET - do */
497 struct ethtool_linkinfo_set_req {
498 struct {
499 __u32 header:1;
500 __u32 port:1;
501 __u32 phyaddr:1;
502 __u32 tp_mdix:1;
503 __u32 tp_mdix_ctrl:1;
504 __u32 transceiver:1;
505 } _present;
506
507 struct ethtool_header header;
508 __u8 port;
509 __u8 phyaddr;
510 __u8 tp_mdix;
511 __u8 tp_mdix_ctrl;
512 __u8 transceiver;
513 };
514
515 static inline struct ethtool_linkinfo_set_req *
ethtool_linkinfo_set_req_alloc(void)516 ethtool_linkinfo_set_req_alloc(void)
517 {
518 return calloc(1, sizeof(struct ethtool_linkinfo_set_req));
519 }
520 void ethtool_linkinfo_set_req_free(struct ethtool_linkinfo_set_req *req);
521
522 static inline void
ethtool_linkinfo_set_req_set_header_dev_index(struct ethtool_linkinfo_set_req * req,__u32 dev_index)523 ethtool_linkinfo_set_req_set_header_dev_index(struct ethtool_linkinfo_set_req *req,
524 __u32 dev_index)
525 {
526 req->_present.header = 1;
527 req->header._present.dev_index = 1;
528 req->header.dev_index = dev_index;
529 }
530 static inline void
ethtool_linkinfo_set_req_set_header_dev_name(struct ethtool_linkinfo_set_req * req,const char * dev_name)531 ethtool_linkinfo_set_req_set_header_dev_name(struct ethtool_linkinfo_set_req *req,
532 const char *dev_name)
533 {
534 free(req->header.dev_name);
535 req->header._present.dev_name_len = strlen(dev_name);
536 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
537 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
538 req->header.dev_name[req->header._present.dev_name_len] = 0;
539 }
540 static inline void
ethtool_linkinfo_set_req_set_header_flags(struct ethtool_linkinfo_set_req * req,__u32 flags)541 ethtool_linkinfo_set_req_set_header_flags(struct ethtool_linkinfo_set_req *req,
542 __u32 flags)
543 {
544 req->_present.header = 1;
545 req->header._present.flags = 1;
546 req->header.flags = flags;
547 }
548 static inline void
ethtool_linkinfo_set_req_set_port(struct ethtool_linkinfo_set_req * req,__u8 port)549 ethtool_linkinfo_set_req_set_port(struct ethtool_linkinfo_set_req *req,
550 __u8 port)
551 {
552 req->_present.port = 1;
553 req->port = port;
554 }
555 static inline void
ethtool_linkinfo_set_req_set_phyaddr(struct ethtool_linkinfo_set_req * req,__u8 phyaddr)556 ethtool_linkinfo_set_req_set_phyaddr(struct ethtool_linkinfo_set_req *req,
557 __u8 phyaddr)
558 {
559 req->_present.phyaddr = 1;
560 req->phyaddr = phyaddr;
561 }
562 static inline void
ethtool_linkinfo_set_req_set_tp_mdix(struct ethtool_linkinfo_set_req * req,__u8 tp_mdix)563 ethtool_linkinfo_set_req_set_tp_mdix(struct ethtool_linkinfo_set_req *req,
564 __u8 tp_mdix)
565 {
566 req->_present.tp_mdix = 1;
567 req->tp_mdix = tp_mdix;
568 }
569 static inline void
ethtool_linkinfo_set_req_set_tp_mdix_ctrl(struct ethtool_linkinfo_set_req * req,__u8 tp_mdix_ctrl)570 ethtool_linkinfo_set_req_set_tp_mdix_ctrl(struct ethtool_linkinfo_set_req *req,
571 __u8 tp_mdix_ctrl)
572 {
573 req->_present.tp_mdix_ctrl = 1;
574 req->tp_mdix_ctrl = tp_mdix_ctrl;
575 }
576 static inline void
ethtool_linkinfo_set_req_set_transceiver(struct ethtool_linkinfo_set_req * req,__u8 transceiver)577 ethtool_linkinfo_set_req_set_transceiver(struct ethtool_linkinfo_set_req *req,
578 __u8 transceiver)
579 {
580 req->_present.transceiver = 1;
581 req->transceiver = transceiver;
582 }
583
584 /*
585 * Set link info.
586 */
587 int ethtool_linkinfo_set(struct ynl_sock *ys,
588 struct ethtool_linkinfo_set_req *req);
589
590 /* ============== ETHTOOL_MSG_LINKMODES_GET ============== */
591 /* ETHTOOL_MSG_LINKMODES_GET - do */
592 struct ethtool_linkmodes_get_req {
593 struct {
594 __u32 header:1;
595 } _present;
596
597 struct ethtool_header header;
598 };
599
600 static inline struct ethtool_linkmodes_get_req *
ethtool_linkmodes_get_req_alloc(void)601 ethtool_linkmodes_get_req_alloc(void)
602 {
603 return calloc(1, sizeof(struct ethtool_linkmodes_get_req));
604 }
605 void ethtool_linkmodes_get_req_free(struct ethtool_linkmodes_get_req *req);
606
607 static inline void
ethtool_linkmodes_get_req_set_header_dev_index(struct ethtool_linkmodes_get_req * req,__u32 dev_index)608 ethtool_linkmodes_get_req_set_header_dev_index(struct ethtool_linkmodes_get_req *req,
609 __u32 dev_index)
610 {
611 req->_present.header = 1;
612 req->header._present.dev_index = 1;
613 req->header.dev_index = dev_index;
614 }
615 static inline void
ethtool_linkmodes_get_req_set_header_dev_name(struct ethtool_linkmodes_get_req * req,const char * dev_name)616 ethtool_linkmodes_get_req_set_header_dev_name(struct ethtool_linkmodes_get_req *req,
617 const char *dev_name)
618 {
619 free(req->header.dev_name);
620 req->header._present.dev_name_len = strlen(dev_name);
621 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
622 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
623 req->header.dev_name[req->header._present.dev_name_len] = 0;
624 }
625 static inline void
ethtool_linkmodes_get_req_set_header_flags(struct ethtool_linkmodes_get_req * req,__u32 flags)626 ethtool_linkmodes_get_req_set_header_flags(struct ethtool_linkmodes_get_req *req,
627 __u32 flags)
628 {
629 req->_present.header = 1;
630 req->header._present.flags = 1;
631 req->header.flags = flags;
632 }
633
634 struct ethtool_linkmodes_get_rsp {
635 struct {
636 __u32 header:1;
637 __u32 autoneg:1;
638 __u32 ours:1;
639 __u32 peer:1;
640 __u32 speed:1;
641 __u32 duplex:1;
642 __u32 master_slave_cfg:1;
643 __u32 master_slave_state:1;
644 __u32 lanes:1;
645 __u32 rate_matching:1;
646 } _present;
647
648 struct ethtool_header header;
649 __u8 autoneg;
650 struct ethtool_bitset ours;
651 struct ethtool_bitset peer;
652 __u32 speed;
653 __u8 duplex;
654 __u8 master_slave_cfg;
655 __u8 master_slave_state;
656 __u32 lanes;
657 __u8 rate_matching;
658 };
659
660 void ethtool_linkmodes_get_rsp_free(struct ethtool_linkmodes_get_rsp *rsp);
661
662 /*
663 * Get link modes.
664 */
665 struct ethtool_linkmodes_get_rsp *
666 ethtool_linkmodes_get(struct ynl_sock *ys,
667 struct ethtool_linkmodes_get_req *req);
668
669 /* ETHTOOL_MSG_LINKMODES_GET - dump */
670 struct ethtool_linkmodes_get_req_dump {
671 struct {
672 __u32 header:1;
673 } _present;
674
675 struct ethtool_header header;
676 };
677
678 static inline struct ethtool_linkmodes_get_req_dump *
ethtool_linkmodes_get_req_dump_alloc(void)679 ethtool_linkmodes_get_req_dump_alloc(void)
680 {
681 return calloc(1, sizeof(struct ethtool_linkmodes_get_req_dump));
682 }
683 void
684 ethtool_linkmodes_get_req_dump_free(struct ethtool_linkmodes_get_req_dump *req);
685
686 static inline void
ethtool_linkmodes_get_req_dump_set_header_dev_index(struct ethtool_linkmodes_get_req_dump * req,__u32 dev_index)687 ethtool_linkmodes_get_req_dump_set_header_dev_index(struct ethtool_linkmodes_get_req_dump *req,
688 __u32 dev_index)
689 {
690 req->_present.header = 1;
691 req->header._present.dev_index = 1;
692 req->header.dev_index = dev_index;
693 }
694 static inline void
ethtool_linkmodes_get_req_dump_set_header_dev_name(struct ethtool_linkmodes_get_req_dump * req,const char * dev_name)695 ethtool_linkmodes_get_req_dump_set_header_dev_name(struct ethtool_linkmodes_get_req_dump *req,
696 const char *dev_name)
697 {
698 free(req->header.dev_name);
699 req->header._present.dev_name_len = strlen(dev_name);
700 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
701 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
702 req->header.dev_name[req->header._present.dev_name_len] = 0;
703 }
704 static inline void
ethtool_linkmodes_get_req_dump_set_header_flags(struct ethtool_linkmodes_get_req_dump * req,__u32 flags)705 ethtool_linkmodes_get_req_dump_set_header_flags(struct ethtool_linkmodes_get_req_dump *req,
706 __u32 flags)
707 {
708 req->_present.header = 1;
709 req->header._present.flags = 1;
710 req->header.flags = flags;
711 }
712
713 struct ethtool_linkmodes_get_list {
714 struct ethtool_linkmodes_get_list *next;
715 struct ethtool_linkmodes_get_rsp obj __attribute__ ((aligned (8)));
716 };
717
718 void ethtool_linkmodes_get_list_free(struct ethtool_linkmodes_get_list *rsp);
719
720 struct ethtool_linkmodes_get_list *
721 ethtool_linkmodes_get_dump(struct ynl_sock *ys,
722 struct ethtool_linkmodes_get_req_dump *req);
723
724 /* ETHTOOL_MSG_LINKMODES_GET - notify */
725 struct ethtool_linkmodes_get_ntf {
726 __u16 family;
727 __u8 cmd;
728 struct ynl_ntf_base_type *next;
729 void (*free)(struct ethtool_linkmodes_get_ntf *ntf);
730 struct ethtool_linkmodes_get_rsp obj __attribute__ ((aligned (8)));
731 };
732
733 void ethtool_linkmodes_get_ntf_free(struct ethtool_linkmodes_get_ntf *rsp);
734
735 /* ============== ETHTOOL_MSG_LINKMODES_SET ============== */
736 /* ETHTOOL_MSG_LINKMODES_SET - do */
737 struct ethtool_linkmodes_set_req {
738 struct {
739 __u32 header:1;
740 __u32 autoneg:1;
741 __u32 ours:1;
742 __u32 peer:1;
743 __u32 speed:1;
744 __u32 duplex:1;
745 __u32 master_slave_cfg:1;
746 __u32 master_slave_state:1;
747 __u32 lanes:1;
748 __u32 rate_matching:1;
749 } _present;
750
751 struct ethtool_header header;
752 __u8 autoneg;
753 struct ethtool_bitset ours;
754 struct ethtool_bitset peer;
755 __u32 speed;
756 __u8 duplex;
757 __u8 master_slave_cfg;
758 __u8 master_slave_state;
759 __u32 lanes;
760 __u8 rate_matching;
761 };
762
763 static inline struct ethtool_linkmodes_set_req *
ethtool_linkmodes_set_req_alloc(void)764 ethtool_linkmodes_set_req_alloc(void)
765 {
766 return calloc(1, sizeof(struct ethtool_linkmodes_set_req));
767 }
768 void ethtool_linkmodes_set_req_free(struct ethtool_linkmodes_set_req *req);
769
770 static inline void
ethtool_linkmodes_set_req_set_header_dev_index(struct ethtool_linkmodes_set_req * req,__u32 dev_index)771 ethtool_linkmodes_set_req_set_header_dev_index(struct ethtool_linkmodes_set_req *req,
772 __u32 dev_index)
773 {
774 req->_present.header = 1;
775 req->header._present.dev_index = 1;
776 req->header.dev_index = dev_index;
777 }
778 static inline void
ethtool_linkmodes_set_req_set_header_dev_name(struct ethtool_linkmodes_set_req * req,const char * dev_name)779 ethtool_linkmodes_set_req_set_header_dev_name(struct ethtool_linkmodes_set_req *req,
780 const char *dev_name)
781 {
782 free(req->header.dev_name);
783 req->header._present.dev_name_len = strlen(dev_name);
784 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
785 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
786 req->header.dev_name[req->header._present.dev_name_len] = 0;
787 }
788 static inline void
ethtool_linkmodes_set_req_set_header_flags(struct ethtool_linkmodes_set_req * req,__u32 flags)789 ethtool_linkmodes_set_req_set_header_flags(struct ethtool_linkmodes_set_req *req,
790 __u32 flags)
791 {
792 req->_present.header = 1;
793 req->header._present.flags = 1;
794 req->header.flags = flags;
795 }
796 static inline void
ethtool_linkmodes_set_req_set_autoneg(struct ethtool_linkmodes_set_req * req,__u8 autoneg)797 ethtool_linkmodes_set_req_set_autoneg(struct ethtool_linkmodes_set_req *req,
798 __u8 autoneg)
799 {
800 req->_present.autoneg = 1;
801 req->autoneg = autoneg;
802 }
803 static inline void
ethtool_linkmodes_set_req_set_ours_nomask(struct ethtool_linkmodes_set_req * req)804 ethtool_linkmodes_set_req_set_ours_nomask(struct ethtool_linkmodes_set_req *req)
805 {
806 req->_present.ours = 1;
807 req->ours._present.nomask = 1;
808 }
809 static inline void
ethtool_linkmodes_set_req_set_ours_size(struct ethtool_linkmodes_set_req * req,__u32 size)810 ethtool_linkmodes_set_req_set_ours_size(struct ethtool_linkmodes_set_req *req,
811 __u32 size)
812 {
813 req->_present.ours = 1;
814 req->ours._present.size = 1;
815 req->ours.size = size;
816 }
817 static inline void
__ethtool_linkmodes_set_req_set_ours_bits_bit(struct ethtool_linkmodes_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)818 __ethtool_linkmodes_set_req_set_ours_bits_bit(struct ethtool_linkmodes_set_req *req,
819 struct ethtool_bitset_bit *bit,
820 unsigned int n_bit)
821 {
822 free(req->ours.bits.bit);
823 req->ours.bits.bit = bit;
824 req->ours.bits.n_bit = n_bit;
825 }
826 static inline void
ethtool_linkmodes_set_req_set_peer_nomask(struct ethtool_linkmodes_set_req * req)827 ethtool_linkmodes_set_req_set_peer_nomask(struct ethtool_linkmodes_set_req *req)
828 {
829 req->_present.peer = 1;
830 req->peer._present.nomask = 1;
831 }
832 static inline void
ethtool_linkmodes_set_req_set_peer_size(struct ethtool_linkmodes_set_req * req,__u32 size)833 ethtool_linkmodes_set_req_set_peer_size(struct ethtool_linkmodes_set_req *req,
834 __u32 size)
835 {
836 req->_present.peer = 1;
837 req->peer._present.size = 1;
838 req->peer.size = size;
839 }
840 static inline void
__ethtool_linkmodes_set_req_set_peer_bits_bit(struct ethtool_linkmodes_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)841 __ethtool_linkmodes_set_req_set_peer_bits_bit(struct ethtool_linkmodes_set_req *req,
842 struct ethtool_bitset_bit *bit,
843 unsigned int n_bit)
844 {
845 free(req->peer.bits.bit);
846 req->peer.bits.bit = bit;
847 req->peer.bits.n_bit = n_bit;
848 }
849 static inline void
ethtool_linkmodes_set_req_set_speed(struct ethtool_linkmodes_set_req * req,__u32 speed)850 ethtool_linkmodes_set_req_set_speed(struct ethtool_linkmodes_set_req *req,
851 __u32 speed)
852 {
853 req->_present.speed = 1;
854 req->speed = speed;
855 }
856 static inline void
ethtool_linkmodes_set_req_set_duplex(struct ethtool_linkmodes_set_req * req,__u8 duplex)857 ethtool_linkmodes_set_req_set_duplex(struct ethtool_linkmodes_set_req *req,
858 __u8 duplex)
859 {
860 req->_present.duplex = 1;
861 req->duplex = duplex;
862 }
863 static inline void
ethtool_linkmodes_set_req_set_master_slave_cfg(struct ethtool_linkmodes_set_req * req,__u8 master_slave_cfg)864 ethtool_linkmodes_set_req_set_master_slave_cfg(struct ethtool_linkmodes_set_req *req,
865 __u8 master_slave_cfg)
866 {
867 req->_present.master_slave_cfg = 1;
868 req->master_slave_cfg = master_slave_cfg;
869 }
870 static inline void
ethtool_linkmodes_set_req_set_master_slave_state(struct ethtool_linkmodes_set_req * req,__u8 master_slave_state)871 ethtool_linkmodes_set_req_set_master_slave_state(struct ethtool_linkmodes_set_req *req,
872 __u8 master_slave_state)
873 {
874 req->_present.master_slave_state = 1;
875 req->master_slave_state = master_slave_state;
876 }
877 static inline void
ethtool_linkmodes_set_req_set_lanes(struct ethtool_linkmodes_set_req * req,__u32 lanes)878 ethtool_linkmodes_set_req_set_lanes(struct ethtool_linkmodes_set_req *req,
879 __u32 lanes)
880 {
881 req->_present.lanes = 1;
882 req->lanes = lanes;
883 }
884 static inline void
ethtool_linkmodes_set_req_set_rate_matching(struct ethtool_linkmodes_set_req * req,__u8 rate_matching)885 ethtool_linkmodes_set_req_set_rate_matching(struct ethtool_linkmodes_set_req *req,
886 __u8 rate_matching)
887 {
888 req->_present.rate_matching = 1;
889 req->rate_matching = rate_matching;
890 }
891
892 /*
893 * Set link modes.
894 */
895 int ethtool_linkmodes_set(struct ynl_sock *ys,
896 struct ethtool_linkmodes_set_req *req);
897
898 /* ============== ETHTOOL_MSG_LINKSTATE_GET ============== */
899 /* ETHTOOL_MSG_LINKSTATE_GET - do */
900 struct ethtool_linkstate_get_req {
901 struct {
902 __u32 header:1;
903 } _present;
904
905 struct ethtool_header header;
906 };
907
908 static inline struct ethtool_linkstate_get_req *
ethtool_linkstate_get_req_alloc(void)909 ethtool_linkstate_get_req_alloc(void)
910 {
911 return calloc(1, sizeof(struct ethtool_linkstate_get_req));
912 }
913 void ethtool_linkstate_get_req_free(struct ethtool_linkstate_get_req *req);
914
915 static inline void
ethtool_linkstate_get_req_set_header_dev_index(struct ethtool_linkstate_get_req * req,__u32 dev_index)916 ethtool_linkstate_get_req_set_header_dev_index(struct ethtool_linkstate_get_req *req,
917 __u32 dev_index)
918 {
919 req->_present.header = 1;
920 req->header._present.dev_index = 1;
921 req->header.dev_index = dev_index;
922 }
923 static inline void
ethtool_linkstate_get_req_set_header_dev_name(struct ethtool_linkstate_get_req * req,const char * dev_name)924 ethtool_linkstate_get_req_set_header_dev_name(struct ethtool_linkstate_get_req *req,
925 const char *dev_name)
926 {
927 free(req->header.dev_name);
928 req->header._present.dev_name_len = strlen(dev_name);
929 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
930 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
931 req->header.dev_name[req->header._present.dev_name_len] = 0;
932 }
933 static inline void
ethtool_linkstate_get_req_set_header_flags(struct ethtool_linkstate_get_req * req,__u32 flags)934 ethtool_linkstate_get_req_set_header_flags(struct ethtool_linkstate_get_req *req,
935 __u32 flags)
936 {
937 req->_present.header = 1;
938 req->header._present.flags = 1;
939 req->header.flags = flags;
940 }
941
942 struct ethtool_linkstate_get_rsp {
943 struct {
944 __u32 header:1;
945 __u32 link:1;
946 __u32 sqi:1;
947 __u32 sqi_max:1;
948 __u32 ext_state:1;
949 __u32 ext_substate:1;
950 __u32 ext_down_cnt:1;
951 } _present;
952
953 struct ethtool_header header;
954 __u8 link;
955 __u32 sqi;
956 __u32 sqi_max;
957 __u8 ext_state;
958 __u8 ext_substate;
959 __u32 ext_down_cnt;
960 };
961
962 void ethtool_linkstate_get_rsp_free(struct ethtool_linkstate_get_rsp *rsp);
963
964 /*
965 * Get link state.
966 */
967 struct ethtool_linkstate_get_rsp *
968 ethtool_linkstate_get(struct ynl_sock *ys,
969 struct ethtool_linkstate_get_req *req);
970
971 /* ETHTOOL_MSG_LINKSTATE_GET - dump */
972 struct ethtool_linkstate_get_req_dump {
973 struct {
974 __u32 header:1;
975 } _present;
976
977 struct ethtool_header header;
978 };
979
980 static inline struct ethtool_linkstate_get_req_dump *
ethtool_linkstate_get_req_dump_alloc(void)981 ethtool_linkstate_get_req_dump_alloc(void)
982 {
983 return calloc(1, sizeof(struct ethtool_linkstate_get_req_dump));
984 }
985 void
986 ethtool_linkstate_get_req_dump_free(struct ethtool_linkstate_get_req_dump *req);
987
988 static inline void
ethtool_linkstate_get_req_dump_set_header_dev_index(struct ethtool_linkstate_get_req_dump * req,__u32 dev_index)989 ethtool_linkstate_get_req_dump_set_header_dev_index(struct ethtool_linkstate_get_req_dump *req,
990 __u32 dev_index)
991 {
992 req->_present.header = 1;
993 req->header._present.dev_index = 1;
994 req->header.dev_index = dev_index;
995 }
996 static inline void
ethtool_linkstate_get_req_dump_set_header_dev_name(struct ethtool_linkstate_get_req_dump * req,const char * dev_name)997 ethtool_linkstate_get_req_dump_set_header_dev_name(struct ethtool_linkstate_get_req_dump *req,
998 const char *dev_name)
999 {
1000 free(req->header.dev_name);
1001 req->header._present.dev_name_len = strlen(dev_name);
1002 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1003 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1004 req->header.dev_name[req->header._present.dev_name_len] = 0;
1005 }
1006 static inline void
ethtool_linkstate_get_req_dump_set_header_flags(struct ethtool_linkstate_get_req_dump * req,__u32 flags)1007 ethtool_linkstate_get_req_dump_set_header_flags(struct ethtool_linkstate_get_req_dump *req,
1008 __u32 flags)
1009 {
1010 req->_present.header = 1;
1011 req->header._present.flags = 1;
1012 req->header.flags = flags;
1013 }
1014
1015 struct ethtool_linkstate_get_list {
1016 struct ethtool_linkstate_get_list *next;
1017 struct ethtool_linkstate_get_rsp obj __attribute__ ((aligned (8)));
1018 };
1019
1020 void ethtool_linkstate_get_list_free(struct ethtool_linkstate_get_list *rsp);
1021
1022 struct ethtool_linkstate_get_list *
1023 ethtool_linkstate_get_dump(struct ynl_sock *ys,
1024 struct ethtool_linkstate_get_req_dump *req);
1025
1026 /* ============== ETHTOOL_MSG_DEBUG_GET ============== */
1027 /* ETHTOOL_MSG_DEBUG_GET - do */
1028 struct ethtool_debug_get_req {
1029 struct {
1030 __u32 header:1;
1031 } _present;
1032
1033 struct ethtool_header header;
1034 };
1035
ethtool_debug_get_req_alloc(void)1036 static inline struct ethtool_debug_get_req *ethtool_debug_get_req_alloc(void)
1037 {
1038 return calloc(1, sizeof(struct ethtool_debug_get_req));
1039 }
1040 void ethtool_debug_get_req_free(struct ethtool_debug_get_req *req);
1041
1042 static inline void
ethtool_debug_get_req_set_header_dev_index(struct ethtool_debug_get_req * req,__u32 dev_index)1043 ethtool_debug_get_req_set_header_dev_index(struct ethtool_debug_get_req *req,
1044 __u32 dev_index)
1045 {
1046 req->_present.header = 1;
1047 req->header._present.dev_index = 1;
1048 req->header.dev_index = dev_index;
1049 }
1050 static inline void
ethtool_debug_get_req_set_header_dev_name(struct ethtool_debug_get_req * req,const char * dev_name)1051 ethtool_debug_get_req_set_header_dev_name(struct ethtool_debug_get_req *req,
1052 const char *dev_name)
1053 {
1054 free(req->header.dev_name);
1055 req->header._present.dev_name_len = strlen(dev_name);
1056 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1057 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1058 req->header.dev_name[req->header._present.dev_name_len] = 0;
1059 }
1060 static inline void
ethtool_debug_get_req_set_header_flags(struct ethtool_debug_get_req * req,__u32 flags)1061 ethtool_debug_get_req_set_header_flags(struct ethtool_debug_get_req *req,
1062 __u32 flags)
1063 {
1064 req->_present.header = 1;
1065 req->header._present.flags = 1;
1066 req->header.flags = flags;
1067 }
1068
1069 struct ethtool_debug_get_rsp {
1070 struct {
1071 __u32 header:1;
1072 __u32 msgmask:1;
1073 } _present;
1074
1075 struct ethtool_header header;
1076 struct ethtool_bitset msgmask;
1077 };
1078
1079 void ethtool_debug_get_rsp_free(struct ethtool_debug_get_rsp *rsp);
1080
1081 /*
1082 * Get debug message mask.
1083 */
1084 struct ethtool_debug_get_rsp *
1085 ethtool_debug_get(struct ynl_sock *ys, struct ethtool_debug_get_req *req);
1086
1087 /* ETHTOOL_MSG_DEBUG_GET - dump */
1088 struct ethtool_debug_get_req_dump {
1089 struct {
1090 __u32 header:1;
1091 } _present;
1092
1093 struct ethtool_header header;
1094 };
1095
1096 static inline struct ethtool_debug_get_req_dump *
ethtool_debug_get_req_dump_alloc(void)1097 ethtool_debug_get_req_dump_alloc(void)
1098 {
1099 return calloc(1, sizeof(struct ethtool_debug_get_req_dump));
1100 }
1101 void ethtool_debug_get_req_dump_free(struct ethtool_debug_get_req_dump *req);
1102
1103 static inline void
ethtool_debug_get_req_dump_set_header_dev_index(struct ethtool_debug_get_req_dump * req,__u32 dev_index)1104 ethtool_debug_get_req_dump_set_header_dev_index(struct ethtool_debug_get_req_dump *req,
1105 __u32 dev_index)
1106 {
1107 req->_present.header = 1;
1108 req->header._present.dev_index = 1;
1109 req->header.dev_index = dev_index;
1110 }
1111 static inline void
ethtool_debug_get_req_dump_set_header_dev_name(struct ethtool_debug_get_req_dump * req,const char * dev_name)1112 ethtool_debug_get_req_dump_set_header_dev_name(struct ethtool_debug_get_req_dump *req,
1113 const char *dev_name)
1114 {
1115 free(req->header.dev_name);
1116 req->header._present.dev_name_len = strlen(dev_name);
1117 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1118 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1119 req->header.dev_name[req->header._present.dev_name_len] = 0;
1120 }
1121 static inline void
ethtool_debug_get_req_dump_set_header_flags(struct ethtool_debug_get_req_dump * req,__u32 flags)1122 ethtool_debug_get_req_dump_set_header_flags(struct ethtool_debug_get_req_dump *req,
1123 __u32 flags)
1124 {
1125 req->_present.header = 1;
1126 req->header._present.flags = 1;
1127 req->header.flags = flags;
1128 }
1129
1130 struct ethtool_debug_get_list {
1131 struct ethtool_debug_get_list *next;
1132 struct ethtool_debug_get_rsp obj __attribute__ ((aligned (8)));
1133 };
1134
1135 void ethtool_debug_get_list_free(struct ethtool_debug_get_list *rsp);
1136
1137 struct ethtool_debug_get_list *
1138 ethtool_debug_get_dump(struct ynl_sock *ys,
1139 struct ethtool_debug_get_req_dump *req);
1140
1141 /* ETHTOOL_MSG_DEBUG_GET - notify */
1142 struct ethtool_debug_get_ntf {
1143 __u16 family;
1144 __u8 cmd;
1145 struct ynl_ntf_base_type *next;
1146 void (*free)(struct ethtool_debug_get_ntf *ntf);
1147 struct ethtool_debug_get_rsp obj __attribute__ ((aligned (8)));
1148 };
1149
1150 void ethtool_debug_get_ntf_free(struct ethtool_debug_get_ntf *rsp);
1151
1152 /* ============== ETHTOOL_MSG_DEBUG_SET ============== */
1153 /* ETHTOOL_MSG_DEBUG_SET - do */
1154 struct ethtool_debug_set_req {
1155 struct {
1156 __u32 header:1;
1157 __u32 msgmask:1;
1158 } _present;
1159
1160 struct ethtool_header header;
1161 struct ethtool_bitset msgmask;
1162 };
1163
ethtool_debug_set_req_alloc(void)1164 static inline struct ethtool_debug_set_req *ethtool_debug_set_req_alloc(void)
1165 {
1166 return calloc(1, sizeof(struct ethtool_debug_set_req));
1167 }
1168 void ethtool_debug_set_req_free(struct ethtool_debug_set_req *req);
1169
1170 static inline void
ethtool_debug_set_req_set_header_dev_index(struct ethtool_debug_set_req * req,__u32 dev_index)1171 ethtool_debug_set_req_set_header_dev_index(struct ethtool_debug_set_req *req,
1172 __u32 dev_index)
1173 {
1174 req->_present.header = 1;
1175 req->header._present.dev_index = 1;
1176 req->header.dev_index = dev_index;
1177 }
1178 static inline void
ethtool_debug_set_req_set_header_dev_name(struct ethtool_debug_set_req * req,const char * dev_name)1179 ethtool_debug_set_req_set_header_dev_name(struct ethtool_debug_set_req *req,
1180 const char *dev_name)
1181 {
1182 free(req->header.dev_name);
1183 req->header._present.dev_name_len = strlen(dev_name);
1184 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1185 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1186 req->header.dev_name[req->header._present.dev_name_len] = 0;
1187 }
1188 static inline void
ethtool_debug_set_req_set_header_flags(struct ethtool_debug_set_req * req,__u32 flags)1189 ethtool_debug_set_req_set_header_flags(struct ethtool_debug_set_req *req,
1190 __u32 flags)
1191 {
1192 req->_present.header = 1;
1193 req->header._present.flags = 1;
1194 req->header.flags = flags;
1195 }
1196 static inline void
ethtool_debug_set_req_set_msgmask_nomask(struct ethtool_debug_set_req * req)1197 ethtool_debug_set_req_set_msgmask_nomask(struct ethtool_debug_set_req *req)
1198 {
1199 req->_present.msgmask = 1;
1200 req->msgmask._present.nomask = 1;
1201 }
1202 static inline void
ethtool_debug_set_req_set_msgmask_size(struct ethtool_debug_set_req * req,__u32 size)1203 ethtool_debug_set_req_set_msgmask_size(struct ethtool_debug_set_req *req,
1204 __u32 size)
1205 {
1206 req->_present.msgmask = 1;
1207 req->msgmask._present.size = 1;
1208 req->msgmask.size = size;
1209 }
1210 static inline void
__ethtool_debug_set_req_set_msgmask_bits_bit(struct ethtool_debug_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)1211 __ethtool_debug_set_req_set_msgmask_bits_bit(struct ethtool_debug_set_req *req,
1212 struct ethtool_bitset_bit *bit,
1213 unsigned int n_bit)
1214 {
1215 free(req->msgmask.bits.bit);
1216 req->msgmask.bits.bit = bit;
1217 req->msgmask.bits.n_bit = n_bit;
1218 }
1219
1220 /*
1221 * Set debug message mask.
1222 */
1223 int ethtool_debug_set(struct ynl_sock *ys, struct ethtool_debug_set_req *req);
1224
1225 /* ============== ETHTOOL_MSG_WOL_GET ============== */
1226 /* ETHTOOL_MSG_WOL_GET - do */
1227 struct ethtool_wol_get_req {
1228 struct {
1229 __u32 header:1;
1230 } _present;
1231
1232 struct ethtool_header header;
1233 };
1234
ethtool_wol_get_req_alloc(void)1235 static inline struct ethtool_wol_get_req *ethtool_wol_get_req_alloc(void)
1236 {
1237 return calloc(1, sizeof(struct ethtool_wol_get_req));
1238 }
1239 void ethtool_wol_get_req_free(struct ethtool_wol_get_req *req);
1240
1241 static inline void
ethtool_wol_get_req_set_header_dev_index(struct ethtool_wol_get_req * req,__u32 dev_index)1242 ethtool_wol_get_req_set_header_dev_index(struct ethtool_wol_get_req *req,
1243 __u32 dev_index)
1244 {
1245 req->_present.header = 1;
1246 req->header._present.dev_index = 1;
1247 req->header.dev_index = dev_index;
1248 }
1249 static inline void
ethtool_wol_get_req_set_header_dev_name(struct ethtool_wol_get_req * req,const char * dev_name)1250 ethtool_wol_get_req_set_header_dev_name(struct ethtool_wol_get_req *req,
1251 const char *dev_name)
1252 {
1253 free(req->header.dev_name);
1254 req->header._present.dev_name_len = strlen(dev_name);
1255 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1256 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1257 req->header.dev_name[req->header._present.dev_name_len] = 0;
1258 }
1259 static inline void
ethtool_wol_get_req_set_header_flags(struct ethtool_wol_get_req * req,__u32 flags)1260 ethtool_wol_get_req_set_header_flags(struct ethtool_wol_get_req *req,
1261 __u32 flags)
1262 {
1263 req->_present.header = 1;
1264 req->header._present.flags = 1;
1265 req->header.flags = flags;
1266 }
1267
1268 struct ethtool_wol_get_rsp {
1269 struct {
1270 __u32 header:1;
1271 __u32 modes:1;
1272 __u32 sopass_len;
1273 } _present;
1274
1275 struct ethtool_header header;
1276 struct ethtool_bitset modes;
1277 void *sopass;
1278 };
1279
1280 void ethtool_wol_get_rsp_free(struct ethtool_wol_get_rsp *rsp);
1281
1282 /*
1283 * Get WOL params.
1284 */
1285 struct ethtool_wol_get_rsp *
1286 ethtool_wol_get(struct ynl_sock *ys, struct ethtool_wol_get_req *req);
1287
1288 /* ETHTOOL_MSG_WOL_GET - dump */
1289 struct ethtool_wol_get_req_dump {
1290 struct {
1291 __u32 header:1;
1292 } _present;
1293
1294 struct ethtool_header header;
1295 };
1296
1297 static inline struct ethtool_wol_get_req_dump *
ethtool_wol_get_req_dump_alloc(void)1298 ethtool_wol_get_req_dump_alloc(void)
1299 {
1300 return calloc(1, sizeof(struct ethtool_wol_get_req_dump));
1301 }
1302 void ethtool_wol_get_req_dump_free(struct ethtool_wol_get_req_dump *req);
1303
1304 static inline void
ethtool_wol_get_req_dump_set_header_dev_index(struct ethtool_wol_get_req_dump * req,__u32 dev_index)1305 ethtool_wol_get_req_dump_set_header_dev_index(struct ethtool_wol_get_req_dump *req,
1306 __u32 dev_index)
1307 {
1308 req->_present.header = 1;
1309 req->header._present.dev_index = 1;
1310 req->header.dev_index = dev_index;
1311 }
1312 static inline void
ethtool_wol_get_req_dump_set_header_dev_name(struct ethtool_wol_get_req_dump * req,const char * dev_name)1313 ethtool_wol_get_req_dump_set_header_dev_name(struct ethtool_wol_get_req_dump *req,
1314 const char *dev_name)
1315 {
1316 free(req->header.dev_name);
1317 req->header._present.dev_name_len = strlen(dev_name);
1318 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1319 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1320 req->header.dev_name[req->header._present.dev_name_len] = 0;
1321 }
1322 static inline void
ethtool_wol_get_req_dump_set_header_flags(struct ethtool_wol_get_req_dump * req,__u32 flags)1323 ethtool_wol_get_req_dump_set_header_flags(struct ethtool_wol_get_req_dump *req,
1324 __u32 flags)
1325 {
1326 req->_present.header = 1;
1327 req->header._present.flags = 1;
1328 req->header.flags = flags;
1329 }
1330
1331 struct ethtool_wol_get_list {
1332 struct ethtool_wol_get_list *next;
1333 struct ethtool_wol_get_rsp obj __attribute__ ((aligned (8)));
1334 };
1335
1336 void ethtool_wol_get_list_free(struct ethtool_wol_get_list *rsp);
1337
1338 struct ethtool_wol_get_list *
1339 ethtool_wol_get_dump(struct ynl_sock *ys, struct ethtool_wol_get_req_dump *req);
1340
1341 /* ETHTOOL_MSG_WOL_GET - notify */
1342 struct ethtool_wol_get_ntf {
1343 __u16 family;
1344 __u8 cmd;
1345 struct ynl_ntf_base_type *next;
1346 void (*free)(struct ethtool_wol_get_ntf *ntf);
1347 struct ethtool_wol_get_rsp obj __attribute__ ((aligned (8)));
1348 };
1349
1350 void ethtool_wol_get_ntf_free(struct ethtool_wol_get_ntf *rsp);
1351
1352 /* ============== ETHTOOL_MSG_WOL_SET ============== */
1353 /* ETHTOOL_MSG_WOL_SET - do */
1354 struct ethtool_wol_set_req {
1355 struct {
1356 __u32 header:1;
1357 __u32 modes:1;
1358 __u32 sopass_len;
1359 } _present;
1360
1361 struct ethtool_header header;
1362 struct ethtool_bitset modes;
1363 void *sopass;
1364 };
1365
ethtool_wol_set_req_alloc(void)1366 static inline struct ethtool_wol_set_req *ethtool_wol_set_req_alloc(void)
1367 {
1368 return calloc(1, sizeof(struct ethtool_wol_set_req));
1369 }
1370 void ethtool_wol_set_req_free(struct ethtool_wol_set_req *req);
1371
1372 static inline void
ethtool_wol_set_req_set_header_dev_index(struct ethtool_wol_set_req * req,__u32 dev_index)1373 ethtool_wol_set_req_set_header_dev_index(struct ethtool_wol_set_req *req,
1374 __u32 dev_index)
1375 {
1376 req->_present.header = 1;
1377 req->header._present.dev_index = 1;
1378 req->header.dev_index = dev_index;
1379 }
1380 static inline void
ethtool_wol_set_req_set_header_dev_name(struct ethtool_wol_set_req * req,const char * dev_name)1381 ethtool_wol_set_req_set_header_dev_name(struct ethtool_wol_set_req *req,
1382 const char *dev_name)
1383 {
1384 free(req->header.dev_name);
1385 req->header._present.dev_name_len = strlen(dev_name);
1386 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1387 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1388 req->header.dev_name[req->header._present.dev_name_len] = 0;
1389 }
1390 static inline void
ethtool_wol_set_req_set_header_flags(struct ethtool_wol_set_req * req,__u32 flags)1391 ethtool_wol_set_req_set_header_flags(struct ethtool_wol_set_req *req,
1392 __u32 flags)
1393 {
1394 req->_present.header = 1;
1395 req->header._present.flags = 1;
1396 req->header.flags = flags;
1397 }
1398 static inline void
ethtool_wol_set_req_set_modes_nomask(struct ethtool_wol_set_req * req)1399 ethtool_wol_set_req_set_modes_nomask(struct ethtool_wol_set_req *req)
1400 {
1401 req->_present.modes = 1;
1402 req->modes._present.nomask = 1;
1403 }
1404 static inline void
ethtool_wol_set_req_set_modes_size(struct ethtool_wol_set_req * req,__u32 size)1405 ethtool_wol_set_req_set_modes_size(struct ethtool_wol_set_req *req, __u32 size)
1406 {
1407 req->_present.modes = 1;
1408 req->modes._present.size = 1;
1409 req->modes.size = size;
1410 }
1411 static inline void
__ethtool_wol_set_req_set_modes_bits_bit(struct ethtool_wol_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)1412 __ethtool_wol_set_req_set_modes_bits_bit(struct ethtool_wol_set_req *req,
1413 struct ethtool_bitset_bit *bit,
1414 unsigned int n_bit)
1415 {
1416 free(req->modes.bits.bit);
1417 req->modes.bits.bit = bit;
1418 req->modes.bits.n_bit = n_bit;
1419 }
1420 static inline void
ethtool_wol_set_req_set_sopass(struct ethtool_wol_set_req * req,const void * sopass,size_t len)1421 ethtool_wol_set_req_set_sopass(struct ethtool_wol_set_req *req,
1422 const void *sopass, size_t len)
1423 {
1424 free(req->sopass);
1425 req->_present.sopass_len = len;
1426 req->sopass = malloc(req->_present.sopass_len);
1427 memcpy(req->sopass, sopass, req->_present.sopass_len);
1428 }
1429
1430 /*
1431 * Set WOL params.
1432 */
1433 int ethtool_wol_set(struct ynl_sock *ys, struct ethtool_wol_set_req *req);
1434
1435 /* ============== ETHTOOL_MSG_FEATURES_GET ============== */
1436 /* ETHTOOL_MSG_FEATURES_GET - do */
1437 struct ethtool_features_get_req {
1438 struct {
1439 __u32 header:1;
1440 } _present;
1441
1442 struct ethtool_header header;
1443 };
1444
1445 static inline struct ethtool_features_get_req *
ethtool_features_get_req_alloc(void)1446 ethtool_features_get_req_alloc(void)
1447 {
1448 return calloc(1, sizeof(struct ethtool_features_get_req));
1449 }
1450 void ethtool_features_get_req_free(struct ethtool_features_get_req *req);
1451
1452 static inline void
ethtool_features_get_req_set_header_dev_index(struct ethtool_features_get_req * req,__u32 dev_index)1453 ethtool_features_get_req_set_header_dev_index(struct ethtool_features_get_req *req,
1454 __u32 dev_index)
1455 {
1456 req->_present.header = 1;
1457 req->header._present.dev_index = 1;
1458 req->header.dev_index = dev_index;
1459 }
1460 static inline void
ethtool_features_get_req_set_header_dev_name(struct ethtool_features_get_req * req,const char * dev_name)1461 ethtool_features_get_req_set_header_dev_name(struct ethtool_features_get_req *req,
1462 const char *dev_name)
1463 {
1464 free(req->header.dev_name);
1465 req->header._present.dev_name_len = strlen(dev_name);
1466 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1467 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1468 req->header.dev_name[req->header._present.dev_name_len] = 0;
1469 }
1470 static inline void
ethtool_features_get_req_set_header_flags(struct ethtool_features_get_req * req,__u32 flags)1471 ethtool_features_get_req_set_header_flags(struct ethtool_features_get_req *req,
1472 __u32 flags)
1473 {
1474 req->_present.header = 1;
1475 req->header._present.flags = 1;
1476 req->header.flags = flags;
1477 }
1478
1479 struct ethtool_features_get_rsp {
1480 struct {
1481 __u32 header:1;
1482 __u32 hw:1;
1483 __u32 wanted:1;
1484 __u32 active:1;
1485 __u32 nochange:1;
1486 } _present;
1487
1488 struct ethtool_header header;
1489 struct ethtool_bitset hw;
1490 struct ethtool_bitset wanted;
1491 struct ethtool_bitset active;
1492 struct ethtool_bitset nochange;
1493 };
1494
1495 void ethtool_features_get_rsp_free(struct ethtool_features_get_rsp *rsp);
1496
1497 /*
1498 * Get features.
1499 */
1500 struct ethtool_features_get_rsp *
1501 ethtool_features_get(struct ynl_sock *ys, struct ethtool_features_get_req *req);
1502
1503 /* ETHTOOL_MSG_FEATURES_GET - dump */
1504 struct ethtool_features_get_req_dump {
1505 struct {
1506 __u32 header:1;
1507 } _present;
1508
1509 struct ethtool_header header;
1510 };
1511
1512 static inline struct ethtool_features_get_req_dump *
ethtool_features_get_req_dump_alloc(void)1513 ethtool_features_get_req_dump_alloc(void)
1514 {
1515 return calloc(1, sizeof(struct ethtool_features_get_req_dump));
1516 }
1517 void
1518 ethtool_features_get_req_dump_free(struct ethtool_features_get_req_dump *req);
1519
1520 static inline void
ethtool_features_get_req_dump_set_header_dev_index(struct ethtool_features_get_req_dump * req,__u32 dev_index)1521 ethtool_features_get_req_dump_set_header_dev_index(struct ethtool_features_get_req_dump *req,
1522 __u32 dev_index)
1523 {
1524 req->_present.header = 1;
1525 req->header._present.dev_index = 1;
1526 req->header.dev_index = dev_index;
1527 }
1528 static inline void
ethtool_features_get_req_dump_set_header_dev_name(struct ethtool_features_get_req_dump * req,const char * dev_name)1529 ethtool_features_get_req_dump_set_header_dev_name(struct ethtool_features_get_req_dump *req,
1530 const char *dev_name)
1531 {
1532 free(req->header.dev_name);
1533 req->header._present.dev_name_len = strlen(dev_name);
1534 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1535 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1536 req->header.dev_name[req->header._present.dev_name_len] = 0;
1537 }
1538 static inline void
ethtool_features_get_req_dump_set_header_flags(struct ethtool_features_get_req_dump * req,__u32 flags)1539 ethtool_features_get_req_dump_set_header_flags(struct ethtool_features_get_req_dump *req,
1540 __u32 flags)
1541 {
1542 req->_present.header = 1;
1543 req->header._present.flags = 1;
1544 req->header.flags = flags;
1545 }
1546
1547 struct ethtool_features_get_list {
1548 struct ethtool_features_get_list *next;
1549 struct ethtool_features_get_rsp obj __attribute__ ((aligned (8)));
1550 };
1551
1552 void ethtool_features_get_list_free(struct ethtool_features_get_list *rsp);
1553
1554 struct ethtool_features_get_list *
1555 ethtool_features_get_dump(struct ynl_sock *ys,
1556 struct ethtool_features_get_req_dump *req);
1557
1558 /* ETHTOOL_MSG_FEATURES_GET - notify */
1559 struct ethtool_features_get_ntf {
1560 __u16 family;
1561 __u8 cmd;
1562 struct ynl_ntf_base_type *next;
1563 void (*free)(struct ethtool_features_get_ntf *ntf);
1564 struct ethtool_features_get_rsp obj __attribute__ ((aligned (8)));
1565 };
1566
1567 void ethtool_features_get_ntf_free(struct ethtool_features_get_ntf *rsp);
1568
1569 /* ============== ETHTOOL_MSG_FEATURES_SET ============== */
1570 /* ETHTOOL_MSG_FEATURES_SET - do */
1571 struct ethtool_features_set_req {
1572 struct {
1573 __u32 header:1;
1574 __u32 hw:1;
1575 __u32 wanted:1;
1576 __u32 active:1;
1577 __u32 nochange:1;
1578 } _present;
1579
1580 struct ethtool_header header;
1581 struct ethtool_bitset hw;
1582 struct ethtool_bitset wanted;
1583 struct ethtool_bitset active;
1584 struct ethtool_bitset nochange;
1585 };
1586
1587 static inline struct ethtool_features_set_req *
ethtool_features_set_req_alloc(void)1588 ethtool_features_set_req_alloc(void)
1589 {
1590 return calloc(1, sizeof(struct ethtool_features_set_req));
1591 }
1592 void ethtool_features_set_req_free(struct ethtool_features_set_req *req);
1593
1594 static inline void
ethtool_features_set_req_set_header_dev_index(struct ethtool_features_set_req * req,__u32 dev_index)1595 ethtool_features_set_req_set_header_dev_index(struct ethtool_features_set_req *req,
1596 __u32 dev_index)
1597 {
1598 req->_present.header = 1;
1599 req->header._present.dev_index = 1;
1600 req->header.dev_index = dev_index;
1601 }
1602 static inline void
ethtool_features_set_req_set_header_dev_name(struct ethtool_features_set_req * req,const char * dev_name)1603 ethtool_features_set_req_set_header_dev_name(struct ethtool_features_set_req *req,
1604 const char *dev_name)
1605 {
1606 free(req->header.dev_name);
1607 req->header._present.dev_name_len = strlen(dev_name);
1608 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1609 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1610 req->header.dev_name[req->header._present.dev_name_len] = 0;
1611 }
1612 static inline void
ethtool_features_set_req_set_header_flags(struct ethtool_features_set_req * req,__u32 flags)1613 ethtool_features_set_req_set_header_flags(struct ethtool_features_set_req *req,
1614 __u32 flags)
1615 {
1616 req->_present.header = 1;
1617 req->header._present.flags = 1;
1618 req->header.flags = flags;
1619 }
1620 static inline void
ethtool_features_set_req_set_hw_nomask(struct ethtool_features_set_req * req)1621 ethtool_features_set_req_set_hw_nomask(struct ethtool_features_set_req *req)
1622 {
1623 req->_present.hw = 1;
1624 req->hw._present.nomask = 1;
1625 }
1626 static inline void
ethtool_features_set_req_set_hw_size(struct ethtool_features_set_req * req,__u32 size)1627 ethtool_features_set_req_set_hw_size(struct ethtool_features_set_req *req,
1628 __u32 size)
1629 {
1630 req->_present.hw = 1;
1631 req->hw._present.size = 1;
1632 req->hw.size = size;
1633 }
1634 static inline void
__ethtool_features_set_req_set_hw_bits_bit(struct ethtool_features_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)1635 __ethtool_features_set_req_set_hw_bits_bit(struct ethtool_features_set_req *req,
1636 struct ethtool_bitset_bit *bit,
1637 unsigned int n_bit)
1638 {
1639 free(req->hw.bits.bit);
1640 req->hw.bits.bit = bit;
1641 req->hw.bits.n_bit = n_bit;
1642 }
1643 static inline void
ethtool_features_set_req_set_wanted_nomask(struct ethtool_features_set_req * req)1644 ethtool_features_set_req_set_wanted_nomask(struct ethtool_features_set_req *req)
1645 {
1646 req->_present.wanted = 1;
1647 req->wanted._present.nomask = 1;
1648 }
1649 static inline void
ethtool_features_set_req_set_wanted_size(struct ethtool_features_set_req * req,__u32 size)1650 ethtool_features_set_req_set_wanted_size(struct ethtool_features_set_req *req,
1651 __u32 size)
1652 {
1653 req->_present.wanted = 1;
1654 req->wanted._present.size = 1;
1655 req->wanted.size = size;
1656 }
1657 static inline void
__ethtool_features_set_req_set_wanted_bits_bit(struct ethtool_features_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)1658 __ethtool_features_set_req_set_wanted_bits_bit(struct ethtool_features_set_req *req,
1659 struct ethtool_bitset_bit *bit,
1660 unsigned int n_bit)
1661 {
1662 free(req->wanted.bits.bit);
1663 req->wanted.bits.bit = bit;
1664 req->wanted.bits.n_bit = n_bit;
1665 }
1666 static inline void
ethtool_features_set_req_set_active_nomask(struct ethtool_features_set_req * req)1667 ethtool_features_set_req_set_active_nomask(struct ethtool_features_set_req *req)
1668 {
1669 req->_present.active = 1;
1670 req->active._present.nomask = 1;
1671 }
1672 static inline void
ethtool_features_set_req_set_active_size(struct ethtool_features_set_req * req,__u32 size)1673 ethtool_features_set_req_set_active_size(struct ethtool_features_set_req *req,
1674 __u32 size)
1675 {
1676 req->_present.active = 1;
1677 req->active._present.size = 1;
1678 req->active.size = size;
1679 }
1680 static inline void
__ethtool_features_set_req_set_active_bits_bit(struct ethtool_features_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)1681 __ethtool_features_set_req_set_active_bits_bit(struct ethtool_features_set_req *req,
1682 struct ethtool_bitset_bit *bit,
1683 unsigned int n_bit)
1684 {
1685 free(req->active.bits.bit);
1686 req->active.bits.bit = bit;
1687 req->active.bits.n_bit = n_bit;
1688 }
1689 static inline void
ethtool_features_set_req_set_nochange_nomask(struct ethtool_features_set_req * req)1690 ethtool_features_set_req_set_nochange_nomask(struct ethtool_features_set_req *req)
1691 {
1692 req->_present.nochange = 1;
1693 req->nochange._present.nomask = 1;
1694 }
1695 static inline void
ethtool_features_set_req_set_nochange_size(struct ethtool_features_set_req * req,__u32 size)1696 ethtool_features_set_req_set_nochange_size(struct ethtool_features_set_req *req,
1697 __u32 size)
1698 {
1699 req->_present.nochange = 1;
1700 req->nochange._present.size = 1;
1701 req->nochange.size = size;
1702 }
1703 static inline void
__ethtool_features_set_req_set_nochange_bits_bit(struct ethtool_features_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)1704 __ethtool_features_set_req_set_nochange_bits_bit(struct ethtool_features_set_req *req,
1705 struct ethtool_bitset_bit *bit,
1706 unsigned int n_bit)
1707 {
1708 free(req->nochange.bits.bit);
1709 req->nochange.bits.bit = bit;
1710 req->nochange.bits.n_bit = n_bit;
1711 }
1712
1713 struct ethtool_features_set_rsp {
1714 struct {
1715 __u32 header:1;
1716 __u32 hw:1;
1717 __u32 wanted:1;
1718 __u32 active:1;
1719 __u32 nochange:1;
1720 } _present;
1721
1722 struct ethtool_header header;
1723 struct ethtool_bitset hw;
1724 struct ethtool_bitset wanted;
1725 struct ethtool_bitset active;
1726 struct ethtool_bitset nochange;
1727 };
1728
1729 void ethtool_features_set_rsp_free(struct ethtool_features_set_rsp *rsp);
1730
1731 /*
1732 * Set features.
1733 */
1734 struct ethtool_features_set_rsp *
1735 ethtool_features_set(struct ynl_sock *ys, struct ethtool_features_set_req *req);
1736
1737 /* ============== ETHTOOL_MSG_PRIVFLAGS_GET ============== */
1738 /* ETHTOOL_MSG_PRIVFLAGS_GET - do */
1739 struct ethtool_privflags_get_req {
1740 struct {
1741 __u32 header:1;
1742 } _present;
1743
1744 struct ethtool_header header;
1745 };
1746
1747 static inline struct ethtool_privflags_get_req *
ethtool_privflags_get_req_alloc(void)1748 ethtool_privflags_get_req_alloc(void)
1749 {
1750 return calloc(1, sizeof(struct ethtool_privflags_get_req));
1751 }
1752 void ethtool_privflags_get_req_free(struct ethtool_privflags_get_req *req);
1753
1754 static inline void
ethtool_privflags_get_req_set_header_dev_index(struct ethtool_privflags_get_req * req,__u32 dev_index)1755 ethtool_privflags_get_req_set_header_dev_index(struct ethtool_privflags_get_req *req,
1756 __u32 dev_index)
1757 {
1758 req->_present.header = 1;
1759 req->header._present.dev_index = 1;
1760 req->header.dev_index = dev_index;
1761 }
1762 static inline void
ethtool_privflags_get_req_set_header_dev_name(struct ethtool_privflags_get_req * req,const char * dev_name)1763 ethtool_privflags_get_req_set_header_dev_name(struct ethtool_privflags_get_req *req,
1764 const char *dev_name)
1765 {
1766 free(req->header.dev_name);
1767 req->header._present.dev_name_len = strlen(dev_name);
1768 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1769 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1770 req->header.dev_name[req->header._present.dev_name_len] = 0;
1771 }
1772 static inline void
ethtool_privflags_get_req_set_header_flags(struct ethtool_privflags_get_req * req,__u32 flags)1773 ethtool_privflags_get_req_set_header_flags(struct ethtool_privflags_get_req *req,
1774 __u32 flags)
1775 {
1776 req->_present.header = 1;
1777 req->header._present.flags = 1;
1778 req->header.flags = flags;
1779 }
1780
1781 struct ethtool_privflags_get_rsp {
1782 struct {
1783 __u32 header:1;
1784 __u32 flags:1;
1785 } _present;
1786
1787 struct ethtool_header header;
1788 struct ethtool_bitset flags;
1789 };
1790
1791 void ethtool_privflags_get_rsp_free(struct ethtool_privflags_get_rsp *rsp);
1792
1793 /*
1794 * Get device private flags.
1795 */
1796 struct ethtool_privflags_get_rsp *
1797 ethtool_privflags_get(struct ynl_sock *ys,
1798 struct ethtool_privflags_get_req *req);
1799
1800 /* ETHTOOL_MSG_PRIVFLAGS_GET - dump */
1801 struct ethtool_privflags_get_req_dump {
1802 struct {
1803 __u32 header:1;
1804 } _present;
1805
1806 struct ethtool_header header;
1807 };
1808
1809 static inline struct ethtool_privflags_get_req_dump *
ethtool_privflags_get_req_dump_alloc(void)1810 ethtool_privflags_get_req_dump_alloc(void)
1811 {
1812 return calloc(1, sizeof(struct ethtool_privflags_get_req_dump));
1813 }
1814 void
1815 ethtool_privflags_get_req_dump_free(struct ethtool_privflags_get_req_dump *req);
1816
1817 static inline void
ethtool_privflags_get_req_dump_set_header_dev_index(struct ethtool_privflags_get_req_dump * req,__u32 dev_index)1818 ethtool_privflags_get_req_dump_set_header_dev_index(struct ethtool_privflags_get_req_dump *req,
1819 __u32 dev_index)
1820 {
1821 req->_present.header = 1;
1822 req->header._present.dev_index = 1;
1823 req->header.dev_index = dev_index;
1824 }
1825 static inline void
ethtool_privflags_get_req_dump_set_header_dev_name(struct ethtool_privflags_get_req_dump * req,const char * dev_name)1826 ethtool_privflags_get_req_dump_set_header_dev_name(struct ethtool_privflags_get_req_dump *req,
1827 const char *dev_name)
1828 {
1829 free(req->header.dev_name);
1830 req->header._present.dev_name_len = strlen(dev_name);
1831 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1832 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1833 req->header.dev_name[req->header._present.dev_name_len] = 0;
1834 }
1835 static inline void
ethtool_privflags_get_req_dump_set_header_flags(struct ethtool_privflags_get_req_dump * req,__u32 flags)1836 ethtool_privflags_get_req_dump_set_header_flags(struct ethtool_privflags_get_req_dump *req,
1837 __u32 flags)
1838 {
1839 req->_present.header = 1;
1840 req->header._present.flags = 1;
1841 req->header.flags = flags;
1842 }
1843
1844 struct ethtool_privflags_get_list {
1845 struct ethtool_privflags_get_list *next;
1846 struct ethtool_privflags_get_rsp obj __attribute__ ((aligned (8)));
1847 };
1848
1849 void ethtool_privflags_get_list_free(struct ethtool_privflags_get_list *rsp);
1850
1851 struct ethtool_privflags_get_list *
1852 ethtool_privflags_get_dump(struct ynl_sock *ys,
1853 struct ethtool_privflags_get_req_dump *req);
1854
1855 /* ETHTOOL_MSG_PRIVFLAGS_GET - notify */
1856 struct ethtool_privflags_get_ntf {
1857 __u16 family;
1858 __u8 cmd;
1859 struct ynl_ntf_base_type *next;
1860 void (*free)(struct ethtool_privflags_get_ntf *ntf);
1861 struct ethtool_privflags_get_rsp obj __attribute__ ((aligned (8)));
1862 };
1863
1864 void ethtool_privflags_get_ntf_free(struct ethtool_privflags_get_ntf *rsp);
1865
1866 /* ============== ETHTOOL_MSG_PRIVFLAGS_SET ============== */
1867 /* ETHTOOL_MSG_PRIVFLAGS_SET - do */
1868 struct ethtool_privflags_set_req {
1869 struct {
1870 __u32 header:1;
1871 __u32 flags:1;
1872 } _present;
1873
1874 struct ethtool_header header;
1875 struct ethtool_bitset flags;
1876 };
1877
1878 static inline struct ethtool_privflags_set_req *
ethtool_privflags_set_req_alloc(void)1879 ethtool_privflags_set_req_alloc(void)
1880 {
1881 return calloc(1, sizeof(struct ethtool_privflags_set_req));
1882 }
1883 void ethtool_privflags_set_req_free(struct ethtool_privflags_set_req *req);
1884
1885 static inline void
ethtool_privflags_set_req_set_header_dev_index(struct ethtool_privflags_set_req * req,__u32 dev_index)1886 ethtool_privflags_set_req_set_header_dev_index(struct ethtool_privflags_set_req *req,
1887 __u32 dev_index)
1888 {
1889 req->_present.header = 1;
1890 req->header._present.dev_index = 1;
1891 req->header.dev_index = dev_index;
1892 }
1893 static inline void
ethtool_privflags_set_req_set_header_dev_name(struct ethtool_privflags_set_req * req,const char * dev_name)1894 ethtool_privflags_set_req_set_header_dev_name(struct ethtool_privflags_set_req *req,
1895 const char *dev_name)
1896 {
1897 free(req->header.dev_name);
1898 req->header._present.dev_name_len = strlen(dev_name);
1899 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1900 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1901 req->header.dev_name[req->header._present.dev_name_len] = 0;
1902 }
1903 static inline void
ethtool_privflags_set_req_set_header_flags(struct ethtool_privflags_set_req * req,__u32 flags)1904 ethtool_privflags_set_req_set_header_flags(struct ethtool_privflags_set_req *req,
1905 __u32 flags)
1906 {
1907 req->_present.header = 1;
1908 req->header._present.flags = 1;
1909 req->header.flags = flags;
1910 }
1911 static inline void
ethtool_privflags_set_req_set_flags_nomask(struct ethtool_privflags_set_req * req)1912 ethtool_privflags_set_req_set_flags_nomask(struct ethtool_privflags_set_req *req)
1913 {
1914 req->_present.flags = 1;
1915 req->flags._present.nomask = 1;
1916 }
1917 static inline void
ethtool_privflags_set_req_set_flags_size(struct ethtool_privflags_set_req * req,__u32 size)1918 ethtool_privflags_set_req_set_flags_size(struct ethtool_privflags_set_req *req,
1919 __u32 size)
1920 {
1921 req->_present.flags = 1;
1922 req->flags._present.size = 1;
1923 req->flags.size = size;
1924 }
1925 static inline void
__ethtool_privflags_set_req_set_flags_bits_bit(struct ethtool_privflags_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)1926 __ethtool_privflags_set_req_set_flags_bits_bit(struct ethtool_privflags_set_req *req,
1927 struct ethtool_bitset_bit *bit,
1928 unsigned int n_bit)
1929 {
1930 free(req->flags.bits.bit);
1931 req->flags.bits.bit = bit;
1932 req->flags.bits.n_bit = n_bit;
1933 }
1934
1935 /*
1936 * Set device private flags.
1937 */
1938 int ethtool_privflags_set(struct ynl_sock *ys,
1939 struct ethtool_privflags_set_req *req);
1940
1941 /* ============== ETHTOOL_MSG_RINGS_GET ============== */
1942 /* ETHTOOL_MSG_RINGS_GET - do */
1943 struct ethtool_rings_get_req {
1944 struct {
1945 __u32 header:1;
1946 } _present;
1947
1948 struct ethtool_header header;
1949 };
1950
ethtool_rings_get_req_alloc(void)1951 static inline struct ethtool_rings_get_req *ethtool_rings_get_req_alloc(void)
1952 {
1953 return calloc(1, sizeof(struct ethtool_rings_get_req));
1954 }
1955 void ethtool_rings_get_req_free(struct ethtool_rings_get_req *req);
1956
1957 static inline void
ethtool_rings_get_req_set_header_dev_index(struct ethtool_rings_get_req * req,__u32 dev_index)1958 ethtool_rings_get_req_set_header_dev_index(struct ethtool_rings_get_req *req,
1959 __u32 dev_index)
1960 {
1961 req->_present.header = 1;
1962 req->header._present.dev_index = 1;
1963 req->header.dev_index = dev_index;
1964 }
1965 static inline void
ethtool_rings_get_req_set_header_dev_name(struct ethtool_rings_get_req * req,const char * dev_name)1966 ethtool_rings_get_req_set_header_dev_name(struct ethtool_rings_get_req *req,
1967 const char *dev_name)
1968 {
1969 free(req->header.dev_name);
1970 req->header._present.dev_name_len = strlen(dev_name);
1971 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
1972 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
1973 req->header.dev_name[req->header._present.dev_name_len] = 0;
1974 }
1975 static inline void
ethtool_rings_get_req_set_header_flags(struct ethtool_rings_get_req * req,__u32 flags)1976 ethtool_rings_get_req_set_header_flags(struct ethtool_rings_get_req *req,
1977 __u32 flags)
1978 {
1979 req->_present.header = 1;
1980 req->header._present.flags = 1;
1981 req->header.flags = flags;
1982 }
1983
1984 struct ethtool_rings_get_rsp {
1985 struct {
1986 __u32 header:1;
1987 __u32 rx_max:1;
1988 __u32 rx_mini_max:1;
1989 __u32 rx_jumbo_max:1;
1990 __u32 tx_max:1;
1991 __u32 rx:1;
1992 __u32 rx_mini:1;
1993 __u32 rx_jumbo:1;
1994 __u32 tx:1;
1995 __u32 rx_buf_len:1;
1996 __u32 tcp_data_split:1;
1997 __u32 cqe_size:1;
1998 __u32 tx_push:1;
1999 __u32 rx_push:1;
2000 __u32 tx_push_buf_len:1;
2001 __u32 tx_push_buf_len_max:1;
2002 } _present;
2003
2004 struct ethtool_header header;
2005 __u32 rx_max;
2006 __u32 rx_mini_max;
2007 __u32 rx_jumbo_max;
2008 __u32 tx_max;
2009 __u32 rx;
2010 __u32 rx_mini;
2011 __u32 rx_jumbo;
2012 __u32 tx;
2013 __u32 rx_buf_len;
2014 __u8 tcp_data_split;
2015 __u32 cqe_size;
2016 __u8 tx_push;
2017 __u8 rx_push;
2018 __u32 tx_push_buf_len;
2019 __u32 tx_push_buf_len_max;
2020 };
2021
2022 void ethtool_rings_get_rsp_free(struct ethtool_rings_get_rsp *rsp);
2023
2024 /*
2025 * Get ring params.
2026 */
2027 struct ethtool_rings_get_rsp *
2028 ethtool_rings_get(struct ynl_sock *ys, struct ethtool_rings_get_req *req);
2029
2030 /* ETHTOOL_MSG_RINGS_GET - dump */
2031 struct ethtool_rings_get_req_dump {
2032 struct {
2033 __u32 header:1;
2034 } _present;
2035
2036 struct ethtool_header header;
2037 };
2038
2039 static inline struct ethtool_rings_get_req_dump *
ethtool_rings_get_req_dump_alloc(void)2040 ethtool_rings_get_req_dump_alloc(void)
2041 {
2042 return calloc(1, sizeof(struct ethtool_rings_get_req_dump));
2043 }
2044 void ethtool_rings_get_req_dump_free(struct ethtool_rings_get_req_dump *req);
2045
2046 static inline void
ethtool_rings_get_req_dump_set_header_dev_index(struct ethtool_rings_get_req_dump * req,__u32 dev_index)2047 ethtool_rings_get_req_dump_set_header_dev_index(struct ethtool_rings_get_req_dump *req,
2048 __u32 dev_index)
2049 {
2050 req->_present.header = 1;
2051 req->header._present.dev_index = 1;
2052 req->header.dev_index = dev_index;
2053 }
2054 static inline void
ethtool_rings_get_req_dump_set_header_dev_name(struct ethtool_rings_get_req_dump * req,const char * dev_name)2055 ethtool_rings_get_req_dump_set_header_dev_name(struct ethtool_rings_get_req_dump *req,
2056 const char *dev_name)
2057 {
2058 free(req->header.dev_name);
2059 req->header._present.dev_name_len = strlen(dev_name);
2060 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
2061 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
2062 req->header.dev_name[req->header._present.dev_name_len] = 0;
2063 }
2064 static inline void
ethtool_rings_get_req_dump_set_header_flags(struct ethtool_rings_get_req_dump * req,__u32 flags)2065 ethtool_rings_get_req_dump_set_header_flags(struct ethtool_rings_get_req_dump *req,
2066 __u32 flags)
2067 {
2068 req->_present.header = 1;
2069 req->header._present.flags = 1;
2070 req->header.flags = flags;
2071 }
2072
2073 struct ethtool_rings_get_list {
2074 struct ethtool_rings_get_list *next;
2075 struct ethtool_rings_get_rsp obj __attribute__ ((aligned (8)));
2076 };
2077
2078 void ethtool_rings_get_list_free(struct ethtool_rings_get_list *rsp);
2079
2080 struct ethtool_rings_get_list *
2081 ethtool_rings_get_dump(struct ynl_sock *ys,
2082 struct ethtool_rings_get_req_dump *req);
2083
2084 /* ETHTOOL_MSG_RINGS_GET - notify */
2085 struct ethtool_rings_get_ntf {
2086 __u16 family;
2087 __u8 cmd;
2088 struct ynl_ntf_base_type *next;
2089 void (*free)(struct ethtool_rings_get_ntf *ntf);
2090 struct ethtool_rings_get_rsp obj __attribute__ ((aligned (8)));
2091 };
2092
2093 void ethtool_rings_get_ntf_free(struct ethtool_rings_get_ntf *rsp);
2094
2095 /* ============== ETHTOOL_MSG_RINGS_SET ============== */
2096 /* ETHTOOL_MSG_RINGS_SET - do */
2097 struct ethtool_rings_set_req {
2098 struct {
2099 __u32 header:1;
2100 __u32 rx_max:1;
2101 __u32 rx_mini_max:1;
2102 __u32 rx_jumbo_max:1;
2103 __u32 tx_max:1;
2104 __u32 rx:1;
2105 __u32 rx_mini:1;
2106 __u32 rx_jumbo:1;
2107 __u32 tx:1;
2108 __u32 rx_buf_len:1;
2109 __u32 tcp_data_split:1;
2110 __u32 cqe_size:1;
2111 __u32 tx_push:1;
2112 __u32 rx_push:1;
2113 __u32 tx_push_buf_len:1;
2114 __u32 tx_push_buf_len_max:1;
2115 } _present;
2116
2117 struct ethtool_header header;
2118 __u32 rx_max;
2119 __u32 rx_mini_max;
2120 __u32 rx_jumbo_max;
2121 __u32 tx_max;
2122 __u32 rx;
2123 __u32 rx_mini;
2124 __u32 rx_jumbo;
2125 __u32 tx;
2126 __u32 rx_buf_len;
2127 __u8 tcp_data_split;
2128 __u32 cqe_size;
2129 __u8 tx_push;
2130 __u8 rx_push;
2131 __u32 tx_push_buf_len;
2132 __u32 tx_push_buf_len_max;
2133 };
2134
ethtool_rings_set_req_alloc(void)2135 static inline struct ethtool_rings_set_req *ethtool_rings_set_req_alloc(void)
2136 {
2137 return calloc(1, sizeof(struct ethtool_rings_set_req));
2138 }
2139 void ethtool_rings_set_req_free(struct ethtool_rings_set_req *req);
2140
2141 static inline void
ethtool_rings_set_req_set_header_dev_index(struct ethtool_rings_set_req * req,__u32 dev_index)2142 ethtool_rings_set_req_set_header_dev_index(struct ethtool_rings_set_req *req,
2143 __u32 dev_index)
2144 {
2145 req->_present.header = 1;
2146 req->header._present.dev_index = 1;
2147 req->header.dev_index = dev_index;
2148 }
2149 static inline void
ethtool_rings_set_req_set_header_dev_name(struct ethtool_rings_set_req * req,const char * dev_name)2150 ethtool_rings_set_req_set_header_dev_name(struct ethtool_rings_set_req *req,
2151 const char *dev_name)
2152 {
2153 free(req->header.dev_name);
2154 req->header._present.dev_name_len = strlen(dev_name);
2155 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
2156 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
2157 req->header.dev_name[req->header._present.dev_name_len] = 0;
2158 }
2159 static inline void
ethtool_rings_set_req_set_header_flags(struct ethtool_rings_set_req * req,__u32 flags)2160 ethtool_rings_set_req_set_header_flags(struct ethtool_rings_set_req *req,
2161 __u32 flags)
2162 {
2163 req->_present.header = 1;
2164 req->header._present.flags = 1;
2165 req->header.flags = flags;
2166 }
2167 static inline void
ethtool_rings_set_req_set_rx_max(struct ethtool_rings_set_req * req,__u32 rx_max)2168 ethtool_rings_set_req_set_rx_max(struct ethtool_rings_set_req *req,
2169 __u32 rx_max)
2170 {
2171 req->_present.rx_max = 1;
2172 req->rx_max = rx_max;
2173 }
2174 static inline void
ethtool_rings_set_req_set_rx_mini_max(struct ethtool_rings_set_req * req,__u32 rx_mini_max)2175 ethtool_rings_set_req_set_rx_mini_max(struct ethtool_rings_set_req *req,
2176 __u32 rx_mini_max)
2177 {
2178 req->_present.rx_mini_max = 1;
2179 req->rx_mini_max = rx_mini_max;
2180 }
2181 static inline void
ethtool_rings_set_req_set_rx_jumbo_max(struct ethtool_rings_set_req * req,__u32 rx_jumbo_max)2182 ethtool_rings_set_req_set_rx_jumbo_max(struct ethtool_rings_set_req *req,
2183 __u32 rx_jumbo_max)
2184 {
2185 req->_present.rx_jumbo_max = 1;
2186 req->rx_jumbo_max = rx_jumbo_max;
2187 }
2188 static inline void
ethtool_rings_set_req_set_tx_max(struct ethtool_rings_set_req * req,__u32 tx_max)2189 ethtool_rings_set_req_set_tx_max(struct ethtool_rings_set_req *req,
2190 __u32 tx_max)
2191 {
2192 req->_present.tx_max = 1;
2193 req->tx_max = tx_max;
2194 }
2195 static inline void
ethtool_rings_set_req_set_rx(struct ethtool_rings_set_req * req,__u32 rx)2196 ethtool_rings_set_req_set_rx(struct ethtool_rings_set_req *req, __u32 rx)
2197 {
2198 req->_present.rx = 1;
2199 req->rx = rx;
2200 }
2201 static inline void
ethtool_rings_set_req_set_rx_mini(struct ethtool_rings_set_req * req,__u32 rx_mini)2202 ethtool_rings_set_req_set_rx_mini(struct ethtool_rings_set_req *req,
2203 __u32 rx_mini)
2204 {
2205 req->_present.rx_mini = 1;
2206 req->rx_mini = rx_mini;
2207 }
2208 static inline void
ethtool_rings_set_req_set_rx_jumbo(struct ethtool_rings_set_req * req,__u32 rx_jumbo)2209 ethtool_rings_set_req_set_rx_jumbo(struct ethtool_rings_set_req *req,
2210 __u32 rx_jumbo)
2211 {
2212 req->_present.rx_jumbo = 1;
2213 req->rx_jumbo = rx_jumbo;
2214 }
2215 static inline void
ethtool_rings_set_req_set_tx(struct ethtool_rings_set_req * req,__u32 tx)2216 ethtool_rings_set_req_set_tx(struct ethtool_rings_set_req *req, __u32 tx)
2217 {
2218 req->_present.tx = 1;
2219 req->tx = tx;
2220 }
2221 static inline void
ethtool_rings_set_req_set_rx_buf_len(struct ethtool_rings_set_req * req,__u32 rx_buf_len)2222 ethtool_rings_set_req_set_rx_buf_len(struct ethtool_rings_set_req *req,
2223 __u32 rx_buf_len)
2224 {
2225 req->_present.rx_buf_len = 1;
2226 req->rx_buf_len = rx_buf_len;
2227 }
2228 static inline void
ethtool_rings_set_req_set_tcp_data_split(struct ethtool_rings_set_req * req,__u8 tcp_data_split)2229 ethtool_rings_set_req_set_tcp_data_split(struct ethtool_rings_set_req *req,
2230 __u8 tcp_data_split)
2231 {
2232 req->_present.tcp_data_split = 1;
2233 req->tcp_data_split = tcp_data_split;
2234 }
2235 static inline void
ethtool_rings_set_req_set_cqe_size(struct ethtool_rings_set_req * req,__u32 cqe_size)2236 ethtool_rings_set_req_set_cqe_size(struct ethtool_rings_set_req *req,
2237 __u32 cqe_size)
2238 {
2239 req->_present.cqe_size = 1;
2240 req->cqe_size = cqe_size;
2241 }
2242 static inline void
ethtool_rings_set_req_set_tx_push(struct ethtool_rings_set_req * req,__u8 tx_push)2243 ethtool_rings_set_req_set_tx_push(struct ethtool_rings_set_req *req,
2244 __u8 tx_push)
2245 {
2246 req->_present.tx_push = 1;
2247 req->tx_push = tx_push;
2248 }
2249 static inline void
ethtool_rings_set_req_set_rx_push(struct ethtool_rings_set_req * req,__u8 rx_push)2250 ethtool_rings_set_req_set_rx_push(struct ethtool_rings_set_req *req,
2251 __u8 rx_push)
2252 {
2253 req->_present.rx_push = 1;
2254 req->rx_push = rx_push;
2255 }
2256 static inline void
ethtool_rings_set_req_set_tx_push_buf_len(struct ethtool_rings_set_req * req,__u32 tx_push_buf_len)2257 ethtool_rings_set_req_set_tx_push_buf_len(struct ethtool_rings_set_req *req,
2258 __u32 tx_push_buf_len)
2259 {
2260 req->_present.tx_push_buf_len = 1;
2261 req->tx_push_buf_len = tx_push_buf_len;
2262 }
2263 static inline void
ethtool_rings_set_req_set_tx_push_buf_len_max(struct ethtool_rings_set_req * req,__u32 tx_push_buf_len_max)2264 ethtool_rings_set_req_set_tx_push_buf_len_max(struct ethtool_rings_set_req *req,
2265 __u32 tx_push_buf_len_max)
2266 {
2267 req->_present.tx_push_buf_len_max = 1;
2268 req->tx_push_buf_len_max = tx_push_buf_len_max;
2269 }
2270
2271 /*
2272 * Set ring params.
2273 */
2274 int ethtool_rings_set(struct ynl_sock *ys, struct ethtool_rings_set_req *req);
2275
2276 /* ============== ETHTOOL_MSG_CHANNELS_GET ============== */
2277 /* ETHTOOL_MSG_CHANNELS_GET - do */
2278 struct ethtool_channels_get_req {
2279 struct {
2280 __u32 header:1;
2281 } _present;
2282
2283 struct ethtool_header header;
2284 };
2285
2286 static inline struct ethtool_channels_get_req *
ethtool_channels_get_req_alloc(void)2287 ethtool_channels_get_req_alloc(void)
2288 {
2289 return calloc(1, sizeof(struct ethtool_channels_get_req));
2290 }
2291 void ethtool_channels_get_req_free(struct ethtool_channels_get_req *req);
2292
2293 static inline void
ethtool_channels_get_req_set_header_dev_index(struct ethtool_channels_get_req * req,__u32 dev_index)2294 ethtool_channels_get_req_set_header_dev_index(struct ethtool_channels_get_req *req,
2295 __u32 dev_index)
2296 {
2297 req->_present.header = 1;
2298 req->header._present.dev_index = 1;
2299 req->header.dev_index = dev_index;
2300 }
2301 static inline void
ethtool_channels_get_req_set_header_dev_name(struct ethtool_channels_get_req * req,const char * dev_name)2302 ethtool_channels_get_req_set_header_dev_name(struct ethtool_channels_get_req *req,
2303 const char *dev_name)
2304 {
2305 free(req->header.dev_name);
2306 req->header._present.dev_name_len = strlen(dev_name);
2307 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
2308 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
2309 req->header.dev_name[req->header._present.dev_name_len] = 0;
2310 }
2311 static inline void
ethtool_channels_get_req_set_header_flags(struct ethtool_channels_get_req * req,__u32 flags)2312 ethtool_channels_get_req_set_header_flags(struct ethtool_channels_get_req *req,
2313 __u32 flags)
2314 {
2315 req->_present.header = 1;
2316 req->header._present.flags = 1;
2317 req->header.flags = flags;
2318 }
2319
2320 struct ethtool_channels_get_rsp {
2321 struct {
2322 __u32 header:1;
2323 __u32 rx_max:1;
2324 __u32 tx_max:1;
2325 __u32 other_max:1;
2326 __u32 combined_max:1;
2327 __u32 rx_count:1;
2328 __u32 tx_count:1;
2329 __u32 other_count:1;
2330 __u32 combined_count:1;
2331 } _present;
2332
2333 struct ethtool_header header;
2334 __u32 rx_max;
2335 __u32 tx_max;
2336 __u32 other_max;
2337 __u32 combined_max;
2338 __u32 rx_count;
2339 __u32 tx_count;
2340 __u32 other_count;
2341 __u32 combined_count;
2342 };
2343
2344 void ethtool_channels_get_rsp_free(struct ethtool_channels_get_rsp *rsp);
2345
2346 /*
2347 * Get channel params.
2348 */
2349 struct ethtool_channels_get_rsp *
2350 ethtool_channels_get(struct ynl_sock *ys, struct ethtool_channels_get_req *req);
2351
2352 /* ETHTOOL_MSG_CHANNELS_GET - dump */
2353 struct ethtool_channels_get_req_dump {
2354 struct {
2355 __u32 header:1;
2356 } _present;
2357
2358 struct ethtool_header header;
2359 };
2360
2361 static inline struct ethtool_channels_get_req_dump *
ethtool_channels_get_req_dump_alloc(void)2362 ethtool_channels_get_req_dump_alloc(void)
2363 {
2364 return calloc(1, sizeof(struct ethtool_channels_get_req_dump));
2365 }
2366 void
2367 ethtool_channels_get_req_dump_free(struct ethtool_channels_get_req_dump *req);
2368
2369 static inline void
ethtool_channels_get_req_dump_set_header_dev_index(struct ethtool_channels_get_req_dump * req,__u32 dev_index)2370 ethtool_channels_get_req_dump_set_header_dev_index(struct ethtool_channels_get_req_dump *req,
2371 __u32 dev_index)
2372 {
2373 req->_present.header = 1;
2374 req->header._present.dev_index = 1;
2375 req->header.dev_index = dev_index;
2376 }
2377 static inline void
ethtool_channels_get_req_dump_set_header_dev_name(struct ethtool_channels_get_req_dump * req,const char * dev_name)2378 ethtool_channels_get_req_dump_set_header_dev_name(struct ethtool_channels_get_req_dump *req,
2379 const char *dev_name)
2380 {
2381 free(req->header.dev_name);
2382 req->header._present.dev_name_len = strlen(dev_name);
2383 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
2384 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
2385 req->header.dev_name[req->header._present.dev_name_len] = 0;
2386 }
2387 static inline void
ethtool_channels_get_req_dump_set_header_flags(struct ethtool_channels_get_req_dump * req,__u32 flags)2388 ethtool_channels_get_req_dump_set_header_flags(struct ethtool_channels_get_req_dump *req,
2389 __u32 flags)
2390 {
2391 req->_present.header = 1;
2392 req->header._present.flags = 1;
2393 req->header.flags = flags;
2394 }
2395
2396 struct ethtool_channels_get_list {
2397 struct ethtool_channels_get_list *next;
2398 struct ethtool_channels_get_rsp obj __attribute__ ((aligned (8)));
2399 };
2400
2401 void ethtool_channels_get_list_free(struct ethtool_channels_get_list *rsp);
2402
2403 struct ethtool_channels_get_list *
2404 ethtool_channels_get_dump(struct ynl_sock *ys,
2405 struct ethtool_channels_get_req_dump *req);
2406
2407 /* ETHTOOL_MSG_CHANNELS_GET - notify */
2408 struct ethtool_channels_get_ntf {
2409 __u16 family;
2410 __u8 cmd;
2411 struct ynl_ntf_base_type *next;
2412 void (*free)(struct ethtool_channels_get_ntf *ntf);
2413 struct ethtool_channels_get_rsp obj __attribute__ ((aligned (8)));
2414 };
2415
2416 void ethtool_channels_get_ntf_free(struct ethtool_channels_get_ntf *rsp);
2417
2418 /* ============== ETHTOOL_MSG_CHANNELS_SET ============== */
2419 /* ETHTOOL_MSG_CHANNELS_SET - do */
2420 struct ethtool_channels_set_req {
2421 struct {
2422 __u32 header:1;
2423 __u32 rx_max:1;
2424 __u32 tx_max:1;
2425 __u32 other_max:1;
2426 __u32 combined_max:1;
2427 __u32 rx_count:1;
2428 __u32 tx_count:1;
2429 __u32 other_count:1;
2430 __u32 combined_count:1;
2431 } _present;
2432
2433 struct ethtool_header header;
2434 __u32 rx_max;
2435 __u32 tx_max;
2436 __u32 other_max;
2437 __u32 combined_max;
2438 __u32 rx_count;
2439 __u32 tx_count;
2440 __u32 other_count;
2441 __u32 combined_count;
2442 };
2443
2444 static inline struct ethtool_channels_set_req *
ethtool_channels_set_req_alloc(void)2445 ethtool_channels_set_req_alloc(void)
2446 {
2447 return calloc(1, sizeof(struct ethtool_channels_set_req));
2448 }
2449 void ethtool_channels_set_req_free(struct ethtool_channels_set_req *req);
2450
2451 static inline void
ethtool_channels_set_req_set_header_dev_index(struct ethtool_channels_set_req * req,__u32 dev_index)2452 ethtool_channels_set_req_set_header_dev_index(struct ethtool_channels_set_req *req,
2453 __u32 dev_index)
2454 {
2455 req->_present.header = 1;
2456 req->header._present.dev_index = 1;
2457 req->header.dev_index = dev_index;
2458 }
2459 static inline void
ethtool_channels_set_req_set_header_dev_name(struct ethtool_channels_set_req * req,const char * dev_name)2460 ethtool_channels_set_req_set_header_dev_name(struct ethtool_channels_set_req *req,
2461 const char *dev_name)
2462 {
2463 free(req->header.dev_name);
2464 req->header._present.dev_name_len = strlen(dev_name);
2465 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
2466 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
2467 req->header.dev_name[req->header._present.dev_name_len] = 0;
2468 }
2469 static inline void
ethtool_channels_set_req_set_header_flags(struct ethtool_channels_set_req * req,__u32 flags)2470 ethtool_channels_set_req_set_header_flags(struct ethtool_channels_set_req *req,
2471 __u32 flags)
2472 {
2473 req->_present.header = 1;
2474 req->header._present.flags = 1;
2475 req->header.flags = flags;
2476 }
2477 static inline void
ethtool_channels_set_req_set_rx_max(struct ethtool_channels_set_req * req,__u32 rx_max)2478 ethtool_channels_set_req_set_rx_max(struct ethtool_channels_set_req *req,
2479 __u32 rx_max)
2480 {
2481 req->_present.rx_max = 1;
2482 req->rx_max = rx_max;
2483 }
2484 static inline void
ethtool_channels_set_req_set_tx_max(struct ethtool_channels_set_req * req,__u32 tx_max)2485 ethtool_channels_set_req_set_tx_max(struct ethtool_channels_set_req *req,
2486 __u32 tx_max)
2487 {
2488 req->_present.tx_max = 1;
2489 req->tx_max = tx_max;
2490 }
2491 static inline void
ethtool_channels_set_req_set_other_max(struct ethtool_channels_set_req * req,__u32 other_max)2492 ethtool_channels_set_req_set_other_max(struct ethtool_channels_set_req *req,
2493 __u32 other_max)
2494 {
2495 req->_present.other_max = 1;
2496 req->other_max = other_max;
2497 }
2498 static inline void
ethtool_channels_set_req_set_combined_max(struct ethtool_channels_set_req * req,__u32 combined_max)2499 ethtool_channels_set_req_set_combined_max(struct ethtool_channels_set_req *req,
2500 __u32 combined_max)
2501 {
2502 req->_present.combined_max = 1;
2503 req->combined_max = combined_max;
2504 }
2505 static inline void
ethtool_channels_set_req_set_rx_count(struct ethtool_channels_set_req * req,__u32 rx_count)2506 ethtool_channels_set_req_set_rx_count(struct ethtool_channels_set_req *req,
2507 __u32 rx_count)
2508 {
2509 req->_present.rx_count = 1;
2510 req->rx_count = rx_count;
2511 }
2512 static inline void
ethtool_channels_set_req_set_tx_count(struct ethtool_channels_set_req * req,__u32 tx_count)2513 ethtool_channels_set_req_set_tx_count(struct ethtool_channels_set_req *req,
2514 __u32 tx_count)
2515 {
2516 req->_present.tx_count = 1;
2517 req->tx_count = tx_count;
2518 }
2519 static inline void
ethtool_channels_set_req_set_other_count(struct ethtool_channels_set_req * req,__u32 other_count)2520 ethtool_channels_set_req_set_other_count(struct ethtool_channels_set_req *req,
2521 __u32 other_count)
2522 {
2523 req->_present.other_count = 1;
2524 req->other_count = other_count;
2525 }
2526 static inline void
ethtool_channels_set_req_set_combined_count(struct ethtool_channels_set_req * req,__u32 combined_count)2527 ethtool_channels_set_req_set_combined_count(struct ethtool_channels_set_req *req,
2528 __u32 combined_count)
2529 {
2530 req->_present.combined_count = 1;
2531 req->combined_count = combined_count;
2532 }
2533
2534 /*
2535 * Set channel params.
2536 */
2537 int ethtool_channels_set(struct ynl_sock *ys,
2538 struct ethtool_channels_set_req *req);
2539
2540 /* ============== ETHTOOL_MSG_COALESCE_GET ============== */
2541 /* ETHTOOL_MSG_COALESCE_GET - do */
2542 struct ethtool_coalesce_get_req {
2543 struct {
2544 __u32 header:1;
2545 } _present;
2546
2547 struct ethtool_header header;
2548 };
2549
2550 static inline struct ethtool_coalesce_get_req *
ethtool_coalesce_get_req_alloc(void)2551 ethtool_coalesce_get_req_alloc(void)
2552 {
2553 return calloc(1, sizeof(struct ethtool_coalesce_get_req));
2554 }
2555 void ethtool_coalesce_get_req_free(struct ethtool_coalesce_get_req *req);
2556
2557 static inline void
ethtool_coalesce_get_req_set_header_dev_index(struct ethtool_coalesce_get_req * req,__u32 dev_index)2558 ethtool_coalesce_get_req_set_header_dev_index(struct ethtool_coalesce_get_req *req,
2559 __u32 dev_index)
2560 {
2561 req->_present.header = 1;
2562 req->header._present.dev_index = 1;
2563 req->header.dev_index = dev_index;
2564 }
2565 static inline void
ethtool_coalesce_get_req_set_header_dev_name(struct ethtool_coalesce_get_req * req,const char * dev_name)2566 ethtool_coalesce_get_req_set_header_dev_name(struct ethtool_coalesce_get_req *req,
2567 const char *dev_name)
2568 {
2569 free(req->header.dev_name);
2570 req->header._present.dev_name_len = strlen(dev_name);
2571 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
2572 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
2573 req->header.dev_name[req->header._present.dev_name_len] = 0;
2574 }
2575 static inline void
ethtool_coalesce_get_req_set_header_flags(struct ethtool_coalesce_get_req * req,__u32 flags)2576 ethtool_coalesce_get_req_set_header_flags(struct ethtool_coalesce_get_req *req,
2577 __u32 flags)
2578 {
2579 req->_present.header = 1;
2580 req->header._present.flags = 1;
2581 req->header.flags = flags;
2582 }
2583
2584 struct ethtool_coalesce_get_rsp {
2585 struct {
2586 __u32 header:1;
2587 __u32 rx_usecs:1;
2588 __u32 rx_max_frames:1;
2589 __u32 rx_usecs_irq:1;
2590 __u32 rx_max_frames_irq:1;
2591 __u32 tx_usecs:1;
2592 __u32 tx_max_frames:1;
2593 __u32 tx_usecs_irq:1;
2594 __u32 tx_max_frames_irq:1;
2595 __u32 stats_block_usecs:1;
2596 __u32 use_adaptive_rx:1;
2597 __u32 use_adaptive_tx:1;
2598 __u32 pkt_rate_low:1;
2599 __u32 rx_usecs_low:1;
2600 __u32 rx_max_frames_low:1;
2601 __u32 tx_usecs_low:1;
2602 __u32 tx_max_frames_low:1;
2603 __u32 pkt_rate_high:1;
2604 __u32 rx_usecs_high:1;
2605 __u32 rx_max_frames_high:1;
2606 __u32 tx_usecs_high:1;
2607 __u32 tx_max_frames_high:1;
2608 __u32 rate_sample_interval:1;
2609 __u32 use_cqe_mode_tx:1;
2610 __u32 use_cqe_mode_rx:1;
2611 __u32 tx_aggr_max_bytes:1;
2612 __u32 tx_aggr_max_frames:1;
2613 __u32 tx_aggr_time_usecs:1;
2614 } _present;
2615
2616 struct ethtool_header header;
2617 __u32 rx_usecs;
2618 __u32 rx_max_frames;
2619 __u32 rx_usecs_irq;
2620 __u32 rx_max_frames_irq;
2621 __u32 tx_usecs;
2622 __u32 tx_max_frames;
2623 __u32 tx_usecs_irq;
2624 __u32 tx_max_frames_irq;
2625 __u32 stats_block_usecs;
2626 __u8 use_adaptive_rx;
2627 __u8 use_adaptive_tx;
2628 __u32 pkt_rate_low;
2629 __u32 rx_usecs_low;
2630 __u32 rx_max_frames_low;
2631 __u32 tx_usecs_low;
2632 __u32 tx_max_frames_low;
2633 __u32 pkt_rate_high;
2634 __u32 rx_usecs_high;
2635 __u32 rx_max_frames_high;
2636 __u32 tx_usecs_high;
2637 __u32 tx_max_frames_high;
2638 __u32 rate_sample_interval;
2639 __u8 use_cqe_mode_tx;
2640 __u8 use_cqe_mode_rx;
2641 __u32 tx_aggr_max_bytes;
2642 __u32 tx_aggr_max_frames;
2643 __u32 tx_aggr_time_usecs;
2644 };
2645
2646 void ethtool_coalesce_get_rsp_free(struct ethtool_coalesce_get_rsp *rsp);
2647
2648 /*
2649 * Get coalesce params.
2650 */
2651 struct ethtool_coalesce_get_rsp *
2652 ethtool_coalesce_get(struct ynl_sock *ys, struct ethtool_coalesce_get_req *req);
2653
2654 /* ETHTOOL_MSG_COALESCE_GET - dump */
2655 struct ethtool_coalesce_get_req_dump {
2656 struct {
2657 __u32 header:1;
2658 } _present;
2659
2660 struct ethtool_header header;
2661 };
2662
2663 static inline struct ethtool_coalesce_get_req_dump *
ethtool_coalesce_get_req_dump_alloc(void)2664 ethtool_coalesce_get_req_dump_alloc(void)
2665 {
2666 return calloc(1, sizeof(struct ethtool_coalesce_get_req_dump));
2667 }
2668 void
2669 ethtool_coalesce_get_req_dump_free(struct ethtool_coalesce_get_req_dump *req);
2670
2671 static inline void
ethtool_coalesce_get_req_dump_set_header_dev_index(struct ethtool_coalesce_get_req_dump * req,__u32 dev_index)2672 ethtool_coalesce_get_req_dump_set_header_dev_index(struct ethtool_coalesce_get_req_dump *req,
2673 __u32 dev_index)
2674 {
2675 req->_present.header = 1;
2676 req->header._present.dev_index = 1;
2677 req->header.dev_index = dev_index;
2678 }
2679 static inline void
ethtool_coalesce_get_req_dump_set_header_dev_name(struct ethtool_coalesce_get_req_dump * req,const char * dev_name)2680 ethtool_coalesce_get_req_dump_set_header_dev_name(struct ethtool_coalesce_get_req_dump *req,
2681 const char *dev_name)
2682 {
2683 free(req->header.dev_name);
2684 req->header._present.dev_name_len = strlen(dev_name);
2685 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
2686 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
2687 req->header.dev_name[req->header._present.dev_name_len] = 0;
2688 }
2689 static inline void
ethtool_coalesce_get_req_dump_set_header_flags(struct ethtool_coalesce_get_req_dump * req,__u32 flags)2690 ethtool_coalesce_get_req_dump_set_header_flags(struct ethtool_coalesce_get_req_dump *req,
2691 __u32 flags)
2692 {
2693 req->_present.header = 1;
2694 req->header._present.flags = 1;
2695 req->header.flags = flags;
2696 }
2697
2698 struct ethtool_coalesce_get_list {
2699 struct ethtool_coalesce_get_list *next;
2700 struct ethtool_coalesce_get_rsp obj __attribute__ ((aligned (8)));
2701 };
2702
2703 void ethtool_coalesce_get_list_free(struct ethtool_coalesce_get_list *rsp);
2704
2705 struct ethtool_coalesce_get_list *
2706 ethtool_coalesce_get_dump(struct ynl_sock *ys,
2707 struct ethtool_coalesce_get_req_dump *req);
2708
2709 /* ETHTOOL_MSG_COALESCE_GET - notify */
2710 struct ethtool_coalesce_get_ntf {
2711 __u16 family;
2712 __u8 cmd;
2713 struct ynl_ntf_base_type *next;
2714 void (*free)(struct ethtool_coalesce_get_ntf *ntf);
2715 struct ethtool_coalesce_get_rsp obj __attribute__ ((aligned (8)));
2716 };
2717
2718 void ethtool_coalesce_get_ntf_free(struct ethtool_coalesce_get_ntf *rsp);
2719
2720 /* ============== ETHTOOL_MSG_COALESCE_SET ============== */
2721 /* ETHTOOL_MSG_COALESCE_SET - do */
2722 struct ethtool_coalesce_set_req {
2723 struct {
2724 __u32 header:1;
2725 __u32 rx_usecs:1;
2726 __u32 rx_max_frames:1;
2727 __u32 rx_usecs_irq:1;
2728 __u32 rx_max_frames_irq:1;
2729 __u32 tx_usecs:1;
2730 __u32 tx_max_frames:1;
2731 __u32 tx_usecs_irq:1;
2732 __u32 tx_max_frames_irq:1;
2733 __u32 stats_block_usecs:1;
2734 __u32 use_adaptive_rx:1;
2735 __u32 use_adaptive_tx:1;
2736 __u32 pkt_rate_low:1;
2737 __u32 rx_usecs_low:1;
2738 __u32 rx_max_frames_low:1;
2739 __u32 tx_usecs_low:1;
2740 __u32 tx_max_frames_low:1;
2741 __u32 pkt_rate_high:1;
2742 __u32 rx_usecs_high:1;
2743 __u32 rx_max_frames_high:1;
2744 __u32 tx_usecs_high:1;
2745 __u32 tx_max_frames_high:1;
2746 __u32 rate_sample_interval:1;
2747 __u32 use_cqe_mode_tx:1;
2748 __u32 use_cqe_mode_rx:1;
2749 __u32 tx_aggr_max_bytes:1;
2750 __u32 tx_aggr_max_frames:1;
2751 __u32 tx_aggr_time_usecs:1;
2752 } _present;
2753
2754 struct ethtool_header header;
2755 __u32 rx_usecs;
2756 __u32 rx_max_frames;
2757 __u32 rx_usecs_irq;
2758 __u32 rx_max_frames_irq;
2759 __u32 tx_usecs;
2760 __u32 tx_max_frames;
2761 __u32 tx_usecs_irq;
2762 __u32 tx_max_frames_irq;
2763 __u32 stats_block_usecs;
2764 __u8 use_adaptive_rx;
2765 __u8 use_adaptive_tx;
2766 __u32 pkt_rate_low;
2767 __u32 rx_usecs_low;
2768 __u32 rx_max_frames_low;
2769 __u32 tx_usecs_low;
2770 __u32 tx_max_frames_low;
2771 __u32 pkt_rate_high;
2772 __u32 rx_usecs_high;
2773 __u32 rx_max_frames_high;
2774 __u32 tx_usecs_high;
2775 __u32 tx_max_frames_high;
2776 __u32 rate_sample_interval;
2777 __u8 use_cqe_mode_tx;
2778 __u8 use_cqe_mode_rx;
2779 __u32 tx_aggr_max_bytes;
2780 __u32 tx_aggr_max_frames;
2781 __u32 tx_aggr_time_usecs;
2782 };
2783
2784 static inline struct ethtool_coalesce_set_req *
ethtool_coalesce_set_req_alloc(void)2785 ethtool_coalesce_set_req_alloc(void)
2786 {
2787 return calloc(1, sizeof(struct ethtool_coalesce_set_req));
2788 }
2789 void ethtool_coalesce_set_req_free(struct ethtool_coalesce_set_req *req);
2790
2791 static inline void
ethtool_coalesce_set_req_set_header_dev_index(struct ethtool_coalesce_set_req * req,__u32 dev_index)2792 ethtool_coalesce_set_req_set_header_dev_index(struct ethtool_coalesce_set_req *req,
2793 __u32 dev_index)
2794 {
2795 req->_present.header = 1;
2796 req->header._present.dev_index = 1;
2797 req->header.dev_index = dev_index;
2798 }
2799 static inline void
ethtool_coalesce_set_req_set_header_dev_name(struct ethtool_coalesce_set_req * req,const char * dev_name)2800 ethtool_coalesce_set_req_set_header_dev_name(struct ethtool_coalesce_set_req *req,
2801 const char *dev_name)
2802 {
2803 free(req->header.dev_name);
2804 req->header._present.dev_name_len = strlen(dev_name);
2805 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
2806 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
2807 req->header.dev_name[req->header._present.dev_name_len] = 0;
2808 }
2809 static inline void
ethtool_coalesce_set_req_set_header_flags(struct ethtool_coalesce_set_req * req,__u32 flags)2810 ethtool_coalesce_set_req_set_header_flags(struct ethtool_coalesce_set_req *req,
2811 __u32 flags)
2812 {
2813 req->_present.header = 1;
2814 req->header._present.flags = 1;
2815 req->header.flags = flags;
2816 }
2817 static inline void
ethtool_coalesce_set_req_set_rx_usecs(struct ethtool_coalesce_set_req * req,__u32 rx_usecs)2818 ethtool_coalesce_set_req_set_rx_usecs(struct ethtool_coalesce_set_req *req,
2819 __u32 rx_usecs)
2820 {
2821 req->_present.rx_usecs = 1;
2822 req->rx_usecs = rx_usecs;
2823 }
2824 static inline void
ethtool_coalesce_set_req_set_rx_max_frames(struct ethtool_coalesce_set_req * req,__u32 rx_max_frames)2825 ethtool_coalesce_set_req_set_rx_max_frames(struct ethtool_coalesce_set_req *req,
2826 __u32 rx_max_frames)
2827 {
2828 req->_present.rx_max_frames = 1;
2829 req->rx_max_frames = rx_max_frames;
2830 }
2831 static inline void
ethtool_coalesce_set_req_set_rx_usecs_irq(struct ethtool_coalesce_set_req * req,__u32 rx_usecs_irq)2832 ethtool_coalesce_set_req_set_rx_usecs_irq(struct ethtool_coalesce_set_req *req,
2833 __u32 rx_usecs_irq)
2834 {
2835 req->_present.rx_usecs_irq = 1;
2836 req->rx_usecs_irq = rx_usecs_irq;
2837 }
2838 static inline void
ethtool_coalesce_set_req_set_rx_max_frames_irq(struct ethtool_coalesce_set_req * req,__u32 rx_max_frames_irq)2839 ethtool_coalesce_set_req_set_rx_max_frames_irq(struct ethtool_coalesce_set_req *req,
2840 __u32 rx_max_frames_irq)
2841 {
2842 req->_present.rx_max_frames_irq = 1;
2843 req->rx_max_frames_irq = rx_max_frames_irq;
2844 }
2845 static inline void
ethtool_coalesce_set_req_set_tx_usecs(struct ethtool_coalesce_set_req * req,__u32 tx_usecs)2846 ethtool_coalesce_set_req_set_tx_usecs(struct ethtool_coalesce_set_req *req,
2847 __u32 tx_usecs)
2848 {
2849 req->_present.tx_usecs = 1;
2850 req->tx_usecs = tx_usecs;
2851 }
2852 static inline void
ethtool_coalesce_set_req_set_tx_max_frames(struct ethtool_coalesce_set_req * req,__u32 tx_max_frames)2853 ethtool_coalesce_set_req_set_tx_max_frames(struct ethtool_coalesce_set_req *req,
2854 __u32 tx_max_frames)
2855 {
2856 req->_present.tx_max_frames = 1;
2857 req->tx_max_frames = tx_max_frames;
2858 }
2859 static inline void
ethtool_coalesce_set_req_set_tx_usecs_irq(struct ethtool_coalesce_set_req * req,__u32 tx_usecs_irq)2860 ethtool_coalesce_set_req_set_tx_usecs_irq(struct ethtool_coalesce_set_req *req,
2861 __u32 tx_usecs_irq)
2862 {
2863 req->_present.tx_usecs_irq = 1;
2864 req->tx_usecs_irq = tx_usecs_irq;
2865 }
2866 static inline void
ethtool_coalesce_set_req_set_tx_max_frames_irq(struct ethtool_coalesce_set_req * req,__u32 tx_max_frames_irq)2867 ethtool_coalesce_set_req_set_tx_max_frames_irq(struct ethtool_coalesce_set_req *req,
2868 __u32 tx_max_frames_irq)
2869 {
2870 req->_present.tx_max_frames_irq = 1;
2871 req->tx_max_frames_irq = tx_max_frames_irq;
2872 }
2873 static inline void
ethtool_coalesce_set_req_set_stats_block_usecs(struct ethtool_coalesce_set_req * req,__u32 stats_block_usecs)2874 ethtool_coalesce_set_req_set_stats_block_usecs(struct ethtool_coalesce_set_req *req,
2875 __u32 stats_block_usecs)
2876 {
2877 req->_present.stats_block_usecs = 1;
2878 req->stats_block_usecs = stats_block_usecs;
2879 }
2880 static inline void
ethtool_coalesce_set_req_set_use_adaptive_rx(struct ethtool_coalesce_set_req * req,__u8 use_adaptive_rx)2881 ethtool_coalesce_set_req_set_use_adaptive_rx(struct ethtool_coalesce_set_req *req,
2882 __u8 use_adaptive_rx)
2883 {
2884 req->_present.use_adaptive_rx = 1;
2885 req->use_adaptive_rx = use_adaptive_rx;
2886 }
2887 static inline void
ethtool_coalesce_set_req_set_use_adaptive_tx(struct ethtool_coalesce_set_req * req,__u8 use_adaptive_tx)2888 ethtool_coalesce_set_req_set_use_adaptive_tx(struct ethtool_coalesce_set_req *req,
2889 __u8 use_adaptive_tx)
2890 {
2891 req->_present.use_adaptive_tx = 1;
2892 req->use_adaptive_tx = use_adaptive_tx;
2893 }
2894 static inline void
ethtool_coalesce_set_req_set_pkt_rate_low(struct ethtool_coalesce_set_req * req,__u32 pkt_rate_low)2895 ethtool_coalesce_set_req_set_pkt_rate_low(struct ethtool_coalesce_set_req *req,
2896 __u32 pkt_rate_low)
2897 {
2898 req->_present.pkt_rate_low = 1;
2899 req->pkt_rate_low = pkt_rate_low;
2900 }
2901 static inline void
ethtool_coalesce_set_req_set_rx_usecs_low(struct ethtool_coalesce_set_req * req,__u32 rx_usecs_low)2902 ethtool_coalesce_set_req_set_rx_usecs_low(struct ethtool_coalesce_set_req *req,
2903 __u32 rx_usecs_low)
2904 {
2905 req->_present.rx_usecs_low = 1;
2906 req->rx_usecs_low = rx_usecs_low;
2907 }
2908 static inline void
ethtool_coalesce_set_req_set_rx_max_frames_low(struct ethtool_coalesce_set_req * req,__u32 rx_max_frames_low)2909 ethtool_coalesce_set_req_set_rx_max_frames_low(struct ethtool_coalesce_set_req *req,
2910 __u32 rx_max_frames_low)
2911 {
2912 req->_present.rx_max_frames_low = 1;
2913 req->rx_max_frames_low = rx_max_frames_low;
2914 }
2915 static inline void
ethtool_coalesce_set_req_set_tx_usecs_low(struct ethtool_coalesce_set_req * req,__u32 tx_usecs_low)2916 ethtool_coalesce_set_req_set_tx_usecs_low(struct ethtool_coalesce_set_req *req,
2917 __u32 tx_usecs_low)
2918 {
2919 req->_present.tx_usecs_low = 1;
2920 req->tx_usecs_low = tx_usecs_low;
2921 }
2922 static inline void
ethtool_coalesce_set_req_set_tx_max_frames_low(struct ethtool_coalesce_set_req * req,__u32 tx_max_frames_low)2923 ethtool_coalesce_set_req_set_tx_max_frames_low(struct ethtool_coalesce_set_req *req,
2924 __u32 tx_max_frames_low)
2925 {
2926 req->_present.tx_max_frames_low = 1;
2927 req->tx_max_frames_low = tx_max_frames_low;
2928 }
2929 static inline void
ethtool_coalesce_set_req_set_pkt_rate_high(struct ethtool_coalesce_set_req * req,__u32 pkt_rate_high)2930 ethtool_coalesce_set_req_set_pkt_rate_high(struct ethtool_coalesce_set_req *req,
2931 __u32 pkt_rate_high)
2932 {
2933 req->_present.pkt_rate_high = 1;
2934 req->pkt_rate_high = pkt_rate_high;
2935 }
2936 static inline void
ethtool_coalesce_set_req_set_rx_usecs_high(struct ethtool_coalesce_set_req * req,__u32 rx_usecs_high)2937 ethtool_coalesce_set_req_set_rx_usecs_high(struct ethtool_coalesce_set_req *req,
2938 __u32 rx_usecs_high)
2939 {
2940 req->_present.rx_usecs_high = 1;
2941 req->rx_usecs_high = rx_usecs_high;
2942 }
2943 static inline void
ethtool_coalesce_set_req_set_rx_max_frames_high(struct ethtool_coalesce_set_req * req,__u32 rx_max_frames_high)2944 ethtool_coalesce_set_req_set_rx_max_frames_high(struct ethtool_coalesce_set_req *req,
2945 __u32 rx_max_frames_high)
2946 {
2947 req->_present.rx_max_frames_high = 1;
2948 req->rx_max_frames_high = rx_max_frames_high;
2949 }
2950 static inline void
ethtool_coalesce_set_req_set_tx_usecs_high(struct ethtool_coalesce_set_req * req,__u32 tx_usecs_high)2951 ethtool_coalesce_set_req_set_tx_usecs_high(struct ethtool_coalesce_set_req *req,
2952 __u32 tx_usecs_high)
2953 {
2954 req->_present.tx_usecs_high = 1;
2955 req->tx_usecs_high = tx_usecs_high;
2956 }
2957 static inline void
ethtool_coalesce_set_req_set_tx_max_frames_high(struct ethtool_coalesce_set_req * req,__u32 tx_max_frames_high)2958 ethtool_coalesce_set_req_set_tx_max_frames_high(struct ethtool_coalesce_set_req *req,
2959 __u32 tx_max_frames_high)
2960 {
2961 req->_present.tx_max_frames_high = 1;
2962 req->tx_max_frames_high = tx_max_frames_high;
2963 }
2964 static inline void
ethtool_coalesce_set_req_set_rate_sample_interval(struct ethtool_coalesce_set_req * req,__u32 rate_sample_interval)2965 ethtool_coalesce_set_req_set_rate_sample_interval(struct ethtool_coalesce_set_req *req,
2966 __u32 rate_sample_interval)
2967 {
2968 req->_present.rate_sample_interval = 1;
2969 req->rate_sample_interval = rate_sample_interval;
2970 }
2971 static inline void
ethtool_coalesce_set_req_set_use_cqe_mode_tx(struct ethtool_coalesce_set_req * req,__u8 use_cqe_mode_tx)2972 ethtool_coalesce_set_req_set_use_cqe_mode_tx(struct ethtool_coalesce_set_req *req,
2973 __u8 use_cqe_mode_tx)
2974 {
2975 req->_present.use_cqe_mode_tx = 1;
2976 req->use_cqe_mode_tx = use_cqe_mode_tx;
2977 }
2978 static inline void
ethtool_coalesce_set_req_set_use_cqe_mode_rx(struct ethtool_coalesce_set_req * req,__u8 use_cqe_mode_rx)2979 ethtool_coalesce_set_req_set_use_cqe_mode_rx(struct ethtool_coalesce_set_req *req,
2980 __u8 use_cqe_mode_rx)
2981 {
2982 req->_present.use_cqe_mode_rx = 1;
2983 req->use_cqe_mode_rx = use_cqe_mode_rx;
2984 }
2985 static inline void
ethtool_coalesce_set_req_set_tx_aggr_max_bytes(struct ethtool_coalesce_set_req * req,__u32 tx_aggr_max_bytes)2986 ethtool_coalesce_set_req_set_tx_aggr_max_bytes(struct ethtool_coalesce_set_req *req,
2987 __u32 tx_aggr_max_bytes)
2988 {
2989 req->_present.tx_aggr_max_bytes = 1;
2990 req->tx_aggr_max_bytes = tx_aggr_max_bytes;
2991 }
2992 static inline void
ethtool_coalesce_set_req_set_tx_aggr_max_frames(struct ethtool_coalesce_set_req * req,__u32 tx_aggr_max_frames)2993 ethtool_coalesce_set_req_set_tx_aggr_max_frames(struct ethtool_coalesce_set_req *req,
2994 __u32 tx_aggr_max_frames)
2995 {
2996 req->_present.tx_aggr_max_frames = 1;
2997 req->tx_aggr_max_frames = tx_aggr_max_frames;
2998 }
2999 static inline void
ethtool_coalesce_set_req_set_tx_aggr_time_usecs(struct ethtool_coalesce_set_req * req,__u32 tx_aggr_time_usecs)3000 ethtool_coalesce_set_req_set_tx_aggr_time_usecs(struct ethtool_coalesce_set_req *req,
3001 __u32 tx_aggr_time_usecs)
3002 {
3003 req->_present.tx_aggr_time_usecs = 1;
3004 req->tx_aggr_time_usecs = tx_aggr_time_usecs;
3005 }
3006
3007 /*
3008 * Set coalesce params.
3009 */
3010 int ethtool_coalesce_set(struct ynl_sock *ys,
3011 struct ethtool_coalesce_set_req *req);
3012
3013 /* ============== ETHTOOL_MSG_PAUSE_GET ============== */
3014 /* ETHTOOL_MSG_PAUSE_GET - do */
3015 struct ethtool_pause_get_req {
3016 struct {
3017 __u32 header:1;
3018 } _present;
3019
3020 struct ethtool_header header;
3021 };
3022
ethtool_pause_get_req_alloc(void)3023 static inline struct ethtool_pause_get_req *ethtool_pause_get_req_alloc(void)
3024 {
3025 return calloc(1, sizeof(struct ethtool_pause_get_req));
3026 }
3027 void ethtool_pause_get_req_free(struct ethtool_pause_get_req *req);
3028
3029 static inline void
ethtool_pause_get_req_set_header_dev_index(struct ethtool_pause_get_req * req,__u32 dev_index)3030 ethtool_pause_get_req_set_header_dev_index(struct ethtool_pause_get_req *req,
3031 __u32 dev_index)
3032 {
3033 req->_present.header = 1;
3034 req->header._present.dev_index = 1;
3035 req->header.dev_index = dev_index;
3036 }
3037 static inline void
ethtool_pause_get_req_set_header_dev_name(struct ethtool_pause_get_req * req,const char * dev_name)3038 ethtool_pause_get_req_set_header_dev_name(struct ethtool_pause_get_req *req,
3039 const char *dev_name)
3040 {
3041 free(req->header.dev_name);
3042 req->header._present.dev_name_len = strlen(dev_name);
3043 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3044 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3045 req->header.dev_name[req->header._present.dev_name_len] = 0;
3046 }
3047 static inline void
ethtool_pause_get_req_set_header_flags(struct ethtool_pause_get_req * req,__u32 flags)3048 ethtool_pause_get_req_set_header_flags(struct ethtool_pause_get_req *req,
3049 __u32 flags)
3050 {
3051 req->_present.header = 1;
3052 req->header._present.flags = 1;
3053 req->header.flags = flags;
3054 }
3055
3056 struct ethtool_pause_get_rsp {
3057 struct {
3058 __u32 header:1;
3059 __u32 autoneg:1;
3060 __u32 rx:1;
3061 __u32 tx:1;
3062 __u32 stats:1;
3063 __u32 stats_src:1;
3064 } _present;
3065
3066 struct ethtool_header header;
3067 __u8 autoneg;
3068 __u8 rx;
3069 __u8 tx;
3070 struct ethtool_pause_stat stats;
3071 __u32 stats_src;
3072 };
3073
3074 void ethtool_pause_get_rsp_free(struct ethtool_pause_get_rsp *rsp);
3075
3076 /*
3077 * Get pause params.
3078 */
3079 struct ethtool_pause_get_rsp *
3080 ethtool_pause_get(struct ynl_sock *ys, struct ethtool_pause_get_req *req);
3081
3082 /* ETHTOOL_MSG_PAUSE_GET - dump */
3083 struct ethtool_pause_get_req_dump {
3084 struct {
3085 __u32 header:1;
3086 } _present;
3087
3088 struct ethtool_header header;
3089 };
3090
3091 static inline struct ethtool_pause_get_req_dump *
ethtool_pause_get_req_dump_alloc(void)3092 ethtool_pause_get_req_dump_alloc(void)
3093 {
3094 return calloc(1, sizeof(struct ethtool_pause_get_req_dump));
3095 }
3096 void ethtool_pause_get_req_dump_free(struct ethtool_pause_get_req_dump *req);
3097
3098 static inline void
ethtool_pause_get_req_dump_set_header_dev_index(struct ethtool_pause_get_req_dump * req,__u32 dev_index)3099 ethtool_pause_get_req_dump_set_header_dev_index(struct ethtool_pause_get_req_dump *req,
3100 __u32 dev_index)
3101 {
3102 req->_present.header = 1;
3103 req->header._present.dev_index = 1;
3104 req->header.dev_index = dev_index;
3105 }
3106 static inline void
ethtool_pause_get_req_dump_set_header_dev_name(struct ethtool_pause_get_req_dump * req,const char * dev_name)3107 ethtool_pause_get_req_dump_set_header_dev_name(struct ethtool_pause_get_req_dump *req,
3108 const char *dev_name)
3109 {
3110 free(req->header.dev_name);
3111 req->header._present.dev_name_len = strlen(dev_name);
3112 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3113 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3114 req->header.dev_name[req->header._present.dev_name_len] = 0;
3115 }
3116 static inline void
ethtool_pause_get_req_dump_set_header_flags(struct ethtool_pause_get_req_dump * req,__u32 flags)3117 ethtool_pause_get_req_dump_set_header_flags(struct ethtool_pause_get_req_dump *req,
3118 __u32 flags)
3119 {
3120 req->_present.header = 1;
3121 req->header._present.flags = 1;
3122 req->header.flags = flags;
3123 }
3124
3125 struct ethtool_pause_get_list {
3126 struct ethtool_pause_get_list *next;
3127 struct ethtool_pause_get_rsp obj __attribute__ ((aligned (8)));
3128 };
3129
3130 void ethtool_pause_get_list_free(struct ethtool_pause_get_list *rsp);
3131
3132 struct ethtool_pause_get_list *
3133 ethtool_pause_get_dump(struct ynl_sock *ys,
3134 struct ethtool_pause_get_req_dump *req);
3135
3136 /* ETHTOOL_MSG_PAUSE_GET - notify */
3137 struct ethtool_pause_get_ntf {
3138 __u16 family;
3139 __u8 cmd;
3140 struct ynl_ntf_base_type *next;
3141 void (*free)(struct ethtool_pause_get_ntf *ntf);
3142 struct ethtool_pause_get_rsp obj __attribute__ ((aligned (8)));
3143 };
3144
3145 void ethtool_pause_get_ntf_free(struct ethtool_pause_get_ntf *rsp);
3146
3147 /* ============== ETHTOOL_MSG_PAUSE_SET ============== */
3148 /* ETHTOOL_MSG_PAUSE_SET - do */
3149 struct ethtool_pause_set_req {
3150 struct {
3151 __u32 header:1;
3152 __u32 autoneg:1;
3153 __u32 rx:1;
3154 __u32 tx:1;
3155 __u32 stats:1;
3156 __u32 stats_src:1;
3157 } _present;
3158
3159 struct ethtool_header header;
3160 __u8 autoneg;
3161 __u8 rx;
3162 __u8 tx;
3163 struct ethtool_pause_stat stats;
3164 __u32 stats_src;
3165 };
3166
ethtool_pause_set_req_alloc(void)3167 static inline struct ethtool_pause_set_req *ethtool_pause_set_req_alloc(void)
3168 {
3169 return calloc(1, sizeof(struct ethtool_pause_set_req));
3170 }
3171 void ethtool_pause_set_req_free(struct ethtool_pause_set_req *req);
3172
3173 static inline void
ethtool_pause_set_req_set_header_dev_index(struct ethtool_pause_set_req * req,__u32 dev_index)3174 ethtool_pause_set_req_set_header_dev_index(struct ethtool_pause_set_req *req,
3175 __u32 dev_index)
3176 {
3177 req->_present.header = 1;
3178 req->header._present.dev_index = 1;
3179 req->header.dev_index = dev_index;
3180 }
3181 static inline void
ethtool_pause_set_req_set_header_dev_name(struct ethtool_pause_set_req * req,const char * dev_name)3182 ethtool_pause_set_req_set_header_dev_name(struct ethtool_pause_set_req *req,
3183 const char *dev_name)
3184 {
3185 free(req->header.dev_name);
3186 req->header._present.dev_name_len = strlen(dev_name);
3187 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3188 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3189 req->header.dev_name[req->header._present.dev_name_len] = 0;
3190 }
3191 static inline void
ethtool_pause_set_req_set_header_flags(struct ethtool_pause_set_req * req,__u32 flags)3192 ethtool_pause_set_req_set_header_flags(struct ethtool_pause_set_req *req,
3193 __u32 flags)
3194 {
3195 req->_present.header = 1;
3196 req->header._present.flags = 1;
3197 req->header.flags = flags;
3198 }
3199 static inline void
ethtool_pause_set_req_set_autoneg(struct ethtool_pause_set_req * req,__u8 autoneg)3200 ethtool_pause_set_req_set_autoneg(struct ethtool_pause_set_req *req,
3201 __u8 autoneg)
3202 {
3203 req->_present.autoneg = 1;
3204 req->autoneg = autoneg;
3205 }
3206 static inline void
ethtool_pause_set_req_set_rx(struct ethtool_pause_set_req * req,__u8 rx)3207 ethtool_pause_set_req_set_rx(struct ethtool_pause_set_req *req, __u8 rx)
3208 {
3209 req->_present.rx = 1;
3210 req->rx = rx;
3211 }
3212 static inline void
ethtool_pause_set_req_set_tx(struct ethtool_pause_set_req * req,__u8 tx)3213 ethtool_pause_set_req_set_tx(struct ethtool_pause_set_req *req, __u8 tx)
3214 {
3215 req->_present.tx = 1;
3216 req->tx = tx;
3217 }
3218 static inline void
ethtool_pause_set_req_set_stats_tx_frames(struct ethtool_pause_set_req * req,__u64 tx_frames)3219 ethtool_pause_set_req_set_stats_tx_frames(struct ethtool_pause_set_req *req,
3220 __u64 tx_frames)
3221 {
3222 req->_present.stats = 1;
3223 req->stats._present.tx_frames = 1;
3224 req->stats.tx_frames = tx_frames;
3225 }
3226 static inline void
ethtool_pause_set_req_set_stats_rx_frames(struct ethtool_pause_set_req * req,__u64 rx_frames)3227 ethtool_pause_set_req_set_stats_rx_frames(struct ethtool_pause_set_req *req,
3228 __u64 rx_frames)
3229 {
3230 req->_present.stats = 1;
3231 req->stats._present.rx_frames = 1;
3232 req->stats.rx_frames = rx_frames;
3233 }
3234 static inline void
ethtool_pause_set_req_set_stats_src(struct ethtool_pause_set_req * req,__u32 stats_src)3235 ethtool_pause_set_req_set_stats_src(struct ethtool_pause_set_req *req,
3236 __u32 stats_src)
3237 {
3238 req->_present.stats_src = 1;
3239 req->stats_src = stats_src;
3240 }
3241
3242 /*
3243 * Set pause params.
3244 */
3245 int ethtool_pause_set(struct ynl_sock *ys, struct ethtool_pause_set_req *req);
3246
3247 /* ============== ETHTOOL_MSG_EEE_GET ============== */
3248 /* ETHTOOL_MSG_EEE_GET - do */
3249 struct ethtool_eee_get_req {
3250 struct {
3251 __u32 header:1;
3252 } _present;
3253
3254 struct ethtool_header header;
3255 };
3256
ethtool_eee_get_req_alloc(void)3257 static inline struct ethtool_eee_get_req *ethtool_eee_get_req_alloc(void)
3258 {
3259 return calloc(1, sizeof(struct ethtool_eee_get_req));
3260 }
3261 void ethtool_eee_get_req_free(struct ethtool_eee_get_req *req);
3262
3263 static inline void
ethtool_eee_get_req_set_header_dev_index(struct ethtool_eee_get_req * req,__u32 dev_index)3264 ethtool_eee_get_req_set_header_dev_index(struct ethtool_eee_get_req *req,
3265 __u32 dev_index)
3266 {
3267 req->_present.header = 1;
3268 req->header._present.dev_index = 1;
3269 req->header.dev_index = dev_index;
3270 }
3271 static inline void
ethtool_eee_get_req_set_header_dev_name(struct ethtool_eee_get_req * req,const char * dev_name)3272 ethtool_eee_get_req_set_header_dev_name(struct ethtool_eee_get_req *req,
3273 const char *dev_name)
3274 {
3275 free(req->header.dev_name);
3276 req->header._present.dev_name_len = strlen(dev_name);
3277 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3278 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3279 req->header.dev_name[req->header._present.dev_name_len] = 0;
3280 }
3281 static inline void
ethtool_eee_get_req_set_header_flags(struct ethtool_eee_get_req * req,__u32 flags)3282 ethtool_eee_get_req_set_header_flags(struct ethtool_eee_get_req *req,
3283 __u32 flags)
3284 {
3285 req->_present.header = 1;
3286 req->header._present.flags = 1;
3287 req->header.flags = flags;
3288 }
3289
3290 struct ethtool_eee_get_rsp {
3291 struct {
3292 __u32 header:1;
3293 __u32 modes_ours:1;
3294 __u32 modes_peer:1;
3295 __u32 active:1;
3296 __u32 enabled:1;
3297 __u32 tx_lpi_enabled:1;
3298 __u32 tx_lpi_timer:1;
3299 } _present;
3300
3301 struct ethtool_header header;
3302 struct ethtool_bitset modes_ours;
3303 struct ethtool_bitset modes_peer;
3304 __u8 active;
3305 __u8 enabled;
3306 __u8 tx_lpi_enabled;
3307 __u32 tx_lpi_timer;
3308 };
3309
3310 void ethtool_eee_get_rsp_free(struct ethtool_eee_get_rsp *rsp);
3311
3312 /*
3313 * Get eee params.
3314 */
3315 struct ethtool_eee_get_rsp *
3316 ethtool_eee_get(struct ynl_sock *ys, struct ethtool_eee_get_req *req);
3317
3318 /* ETHTOOL_MSG_EEE_GET - dump */
3319 struct ethtool_eee_get_req_dump {
3320 struct {
3321 __u32 header:1;
3322 } _present;
3323
3324 struct ethtool_header header;
3325 };
3326
3327 static inline struct ethtool_eee_get_req_dump *
ethtool_eee_get_req_dump_alloc(void)3328 ethtool_eee_get_req_dump_alloc(void)
3329 {
3330 return calloc(1, sizeof(struct ethtool_eee_get_req_dump));
3331 }
3332 void ethtool_eee_get_req_dump_free(struct ethtool_eee_get_req_dump *req);
3333
3334 static inline void
ethtool_eee_get_req_dump_set_header_dev_index(struct ethtool_eee_get_req_dump * req,__u32 dev_index)3335 ethtool_eee_get_req_dump_set_header_dev_index(struct ethtool_eee_get_req_dump *req,
3336 __u32 dev_index)
3337 {
3338 req->_present.header = 1;
3339 req->header._present.dev_index = 1;
3340 req->header.dev_index = dev_index;
3341 }
3342 static inline void
ethtool_eee_get_req_dump_set_header_dev_name(struct ethtool_eee_get_req_dump * req,const char * dev_name)3343 ethtool_eee_get_req_dump_set_header_dev_name(struct ethtool_eee_get_req_dump *req,
3344 const char *dev_name)
3345 {
3346 free(req->header.dev_name);
3347 req->header._present.dev_name_len = strlen(dev_name);
3348 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3349 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3350 req->header.dev_name[req->header._present.dev_name_len] = 0;
3351 }
3352 static inline void
ethtool_eee_get_req_dump_set_header_flags(struct ethtool_eee_get_req_dump * req,__u32 flags)3353 ethtool_eee_get_req_dump_set_header_flags(struct ethtool_eee_get_req_dump *req,
3354 __u32 flags)
3355 {
3356 req->_present.header = 1;
3357 req->header._present.flags = 1;
3358 req->header.flags = flags;
3359 }
3360
3361 struct ethtool_eee_get_list {
3362 struct ethtool_eee_get_list *next;
3363 struct ethtool_eee_get_rsp obj __attribute__ ((aligned (8)));
3364 };
3365
3366 void ethtool_eee_get_list_free(struct ethtool_eee_get_list *rsp);
3367
3368 struct ethtool_eee_get_list *
3369 ethtool_eee_get_dump(struct ynl_sock *ys, struct ethtool_eee_get_req_dump *req);
3370
3371 /* ETHTOOL_MSG_EEE_GET - notify */
3372 struct ethtool_eee_get_ntf {
3373 __u16 family;
3374 __u8 cmd;
3375 struct ynl_ntf_base_type *next;
3376 void (*free)(struct ethtool_eee_get_ntf *ntf);
3377 struct ethtool_eee_get_rsp obj __attribute__ ((aligned (8)));
3378 };
3379
3380 void ethtool_eee_get_ntf_free(struct ethtool_eee_get_ntf *rsp);
3381
3382 /* ============== ETHTOOL_MSG_EEE_SET ============== */
3383 /* ETHTOOL_MSG_EEE_SET - do */
3384 struct ethtool_eee_set_req {
3385 struct {
3386 __u32 header:1;
3387 __u32 modes_ours:1;
3388 __u32 modes_peer:1;
3389 __u32 active:1;
3390 __u32 enabled:1;
3391 __u32 tx_lpi_enabled:1;
3392 __u32 tx_lpi_timer:1;
3393 } _present;
3394
3395 struct ethtool_header header;
3396 struct ethtool_bitset modes_ours;
3397 struct ethtool_bitset modes_peer;
3398 __u8 active;
3399 __u8 enabled;
3400 __u8 tx_lpi_enabled;
3401 __u32 tx_lpi_timer;
3402 };
3403
ethtool_eee_set_req_alloc(void)3404 static inline struct ethtool_eee_set_req *ethtool_eee_set_req_alloc(void)
3405 {
3406 return calloc(1, sizeof(struct ethtool_eee_set_req));
3407 }
3408 void ethtool_eee_set_req_free(struct ethtool_eee_set_req *req);
3409
3410 static inline void
ethtool_eee_set_req_set_header_dev_index(struct ethtool_eee_set_req * req,__u32 dev_index)3411 ethtool_eee_set_req_set_header_dev_index(struct ethtool_eee_set_req *req,
3412 __u32 dev_index)
3413 {
3414 req->_present.header = 1;
3415 req->header._present.dev_index = 1;
3416 req->header.dev_index = dev_index;
3417 }
3418 static inline void
ethtool_eee_set_req_set_header_dev_name(struct ethtool_eee_set_req * req,const char * dev_name)3419 ethtool_eee_set_req_set_header_dev_name(struct ethtool_eee_set_req *req,
3420 const char *dev_name)
3421 {
3422 free(req->header.dev_name);
3423 req->header._present.dev_name_len = strlen(dev_name);
3424 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3425 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3426 req->header.dev_name[req->header._present.dev_name_len] = 0;
3427 }
3428 static inline void
ethtool_eee_set_req_set_header_flags(struct ethtool_eee_set_req * req,__u32 flags)3429 ethtool_eee_set_req_set_header_flags(struct ethtool_eee_set_req *req,
3430 __u32 flags)
3431 {
3432 req->_present.header = 1;
3433 req->header._present.flags = 1;
3434 req->header.flags = flags;
3435 }
3436 static inline void
ethtool_eee_set_req_set_modes_ours_nomask(struct ethtool_eee_set_req * req)3437 ethtool_eee_set_req_set_modes_ours_nomask(struct ethtool_eee_set_req *req)
3438 {
3439 req->_present.modes_ours = 1;
3440 req->modes_ours._present.nomask = 1;
3441 }
3442 static inline void
ethtool_eee_set_req_set_modes_ours_size(struct ethtool_eee_set_req * req,__u32 size)3443 ethtool_eee_set_req_set_modes_ours_size(struct ethtool_eee_set_req *req,
3444 __u32 size)
3445 {
3446 req->_present.modes_ours = 1;
3447 req->modes_ours._present.size = 1;
3448 req->modes_ours.size = size;
3449 }
3450 static inline void
__ethtool_eee_set_req_set_modes_ours_bits_bit(struct ethtool_eee_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)3451 __ethtool_eee_set_req_set_modes_ours_bits_bit(struct ethtool_eee_set_req *req,
3452 struct ethtool_bitset_bit *bit,
3453 unsigned int n_bit)
3454 {
3455 free(req->modes_ours.bits.bit);
3456 req->modes_ours.bits.bit = bit;
3457 req->modes_ours.bits.n_bit = n_bit;
3458 }
3459 static inline void
ethtool_eee_set_req_set_modes_peer_nomask(struct ethtool_eee_set_req * req)3460 ethtool_eee_set_req_set_modes_peer_nomask(struct ethtool_eee_set_req *req)
3461 {
3462 req->_present.modes_peer = 1;
3463 req->modes_peer._present.nomask = 1;
3464 }
3465 static inline void
ethtool_eee_set_req_set_modes_peer_size(struct ethtool_eee_set_req * req,__u32 size)3466 ethtool_eee_set_req_set_modes_peer_size(struct ethtool_eee_set_req *req,
3467 __u32 size)
3468 {
3469 req->_present.modes_peer = 1;
3470 req->modes_peer._present.size = 1;
3471 req->modes_peer.size = size;
3472 }
3473 static inline void
__ethtool_eee_set_req_set_modes_peer_bits_bit(struct ethtool_eee_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)3474 __ethtool_eee_set_req_set_modes_peer_bits_bit(struct ethtool_eee_set_req *req,
3475 struct ethtool_bitset_bit *bit,
3476 unsigned int n_bit)
3477 {
3478 free(req->modes_peer.bits.bit);
3479 req->modes_peer.bits.bit = bit;
3480 req->modes_peer.bits.n_bit = n_bit;
3481 }
3482 static inline void
ethtool_eee_set_req_set_active(struct ethtool_eee_set_req * req,__u8 active)3483 ethtool_eee_set_req_set_active(struct ethtool_eee_set_req *req, __u8 active)
3484 {
3485 req->_present.active = 1;
3486 req->active = active;
3487 }
3488 static inline void
ethtool_eee_set_req_set_enabled(struct ethtool_eee_set_req * req,__u8 enabled)3489 ethtool_eee_set_req_set_enabled(struct ethtool_eee_set_req *req, __u8 enabled)
3490 {
3491 req->_present.enabled = 1;
3492 req->enabled = enabled;
3493 }
3494 static inline void
ethtool_eee_set_req_set_tx_lpi_enabled(struct ethtool_eee_set_req * req,__u8 tx_lpi_enabled)3495 ethtool_eee_set_req_set_tx_lpi_enabled(struct ethtool_eee_set_req *req,
3496 __u8 tx_lpi_enabled)
3497 {
3498 req->_present.tx_lpi_enabled = 1;
3499 req->tx_lpi_enabled = tx_lpi_enabled;
3500 }
3501 static inline void
ethtool_eee_set_req_set_tx_lpi_timer(struct ethtool_eee_set_req * req,__u32 tx_lpi_timer)3502 ethtool_eee_set_req_set_tx_lpi_timer(struct ethtool_eee_set_req *req,
3503 __u32 tx_lpi_timer)
3504 {
3505 req->_present.tx_lpi_timer = 1;
3506 req->tx_lpi_timer = tx_lpi_timer;
3507 }
3508
3509 /*
3510 * Set eee params.
3511 */
3512 int ethtool_eee_set(struct ynl_sock *ys, struct ethtool_eee_set_req *req);
3513
3514 /* ============== ETHTOOL_MSG_TSINFO_GET ============== */
3515 /* ETHTOOL_MSG_TSINFO_GET - do */
3516 struct ethtool_tsinfo_get_req {
3517 struct {
3518 __u32 header:1;
3519 } _present;
3520
3521 struct ethtool_header header;
3522 };
3523
ethtool_tsinfo_get_req_alloc(void)3524 static inline struct ethtool_tsinfo_get_req *ethtool_tsinfo_get_req_alloc(void)
3525 {
3526 return calloc(1, sizeof(struct ethtool_tsinfo_get_req));
3527 }
3528 void ethtool_tsinfo_get_req_free(struct ethtool_tsinfo_get_req *req);
3529
3530 static inline void
ethtool_tsinfo_get_req_set_header_dev_index(struct ethtool_tsinfo_get_req * req,__u32 dev_index)3531 ethtool_tsinfo_get_req_set_header_dev_index(struct ethtool_tsinfo_get_req *req,
3532 __u32 dev_index)
3533 {
3534 req->_present.header = 1;
3535 req->header._present.dev_index = 1;
3536 req->header.dev_index = dev_index;
3537 }
3538 static inline void
ethtool_tsinfo_get_req_set_header_dev_name(struct ethtool_tsinfo_get_req * req,const char * dev_name)3539 ethtool_tsinfo_get_req_set_header_dev_name(struct ethtool_tsinfo_get_req *req,
3540 const char *dev_name)
3541 {
3542 free(req->header.dev_name);
3543 req->header._present.dev_name_len = strlen(dev_name);
3544 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3545 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3546 req->header.dev_name[req->header._present.dev_name_len] = 0;
3547 }
3548 static inline void
ethtool_tsinfo_get_req_set_header_flags(struct ethtool_tsinfo_get_req * req,__u32 flags)3549 ethtool_tsinfo_get_req_set_header_flags(struct ethtool_tsinfo_get_req *req,
3550 __u32 flags)
3551 {
3552 req->_present.header = 1;
3553 req->header._present.flags = 1;
3554 req->header.flags = flags;
3555 }
3556
3557 struct ethtool_tsinfo_get_rsp {
3558 struct {
3559 __u32 header:1;
3560 __u32 timestamping:1;
3561 __u32 tx_types:1;
3562 __u32 rx_filters:1;
3563 __u32 phc_index:1;
3564 } _present;
3565
3566 struct ethtool_header header;
3567 struct ethtool_bitset timestamping;
3568 struct ethtool_bitset tx_types;
3569 struct ethtool_bitset rx_filters;
3570 __u32 phc_index;
3571 };
3572
3573 void ethtool_tsinfo_get_rsp_free(struct ethtool_tsinfo_get_rsp *rsp);
3574
3575 /*
3576 * Get tsinfo params.
3577 */
3578 struct ethtool_tsinfo_get_rsp *
3579 ethtool_tsinfo_get(struct ynl_sock *ys, struct ethtool_tsinfo_get_req *req);
3580
3581 /* ETHTOOL_MSG_TSINFO_GET - dump */
3582 struct ethtool_tsinfo_get_req_dump {
3583 struct {
3584 __u32 header:1;
3585 } _present;
3586
3587 struct ethtool_header header;
3588 };
3589
3590 static inline struct ethtool_tsinfo_get_req_dump *
ethtool_tsinfo_get_req_dump_alloc(void)3591 ethtool_tsinfo_get_req_dump_alloc(void)
3592 {
3593 return calloc(1, sizeof(struct ethtool_tsinfo_get_req_dump));
3594 }
3595 void ethtool_tsinfo_get_req_dump_free(struct ethtool_tsinfo_get_req_dump *req);
3596
3597 static inline void
ethtool_tsinfo_get_req_dump_set_header_dev_index(struct ethtool_tsinfo_get_req_dump * req,__u32 dev_index)3598 ethtool_tsinfo_get_req_dump_set_header_dev_index(struct ethtool_tsinfo_get_req_dump *req,
3599 __u32 dev_index)
3600 {
3601 req->_present.header = 1;
3602 req->header._present.dev_index = 1;
3603 req->header.dev_index = dev_index;
3604 }
3605 static inline void
ethtool_tsinfo_get_req_dump_set_header_dev_name(struct ethtool_tsinfo_get_req_dump * req,const char * dev_name)3606 ethtool_tsinfo_get_req_dump_set_header_dev_name(struct ethtool_tsinfo_get_req_dump *req,
3607 const char *dev_name)
3608 {
3609 free(req->header.dev_name);
3610 req->header._present.dev_name_len = strlen(dev_name);
3611 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3612 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3613 req->header.dev_name[req->header._present.dev_name_len] = 0;
3614 }
3615 static inline void
ethtool_tsinfo_get_req_dump_set_header_flags(struct ethtool_tsinfo_get_req_dump * req,__u32 flags)3616 ethtool_tsinfo_get_req_dump_set_header_flags(struct ethtool_tsinfo_get_req_dump *req,
3617 __u32 flags)
3618 {
3619 req->_present.header = 1;
3620 req->header._present.flags = 1;
3621 req->header.flags = flags;
3622 }
3623
3624 struct ethtool_tsinfo_get_list {
3625 struct ethtool_tsinfo_get_list *next;
3626 struct ethtool_tsinfo_get_rsp obj __attribute__ ((aligned (8)));
3627 };
3628
3629 void ethtool_tsinfo_get_list_free(struct ethtool_tsinfo_get_list *rsp);
3630
3631 struct ethtool_tsinfo_get_list *
3632 ethtool_tsinfo_get_dump(struct ynl_sock *ys,
3633 struct ethtool_tsinfo_get_req_dump *req);
3634
3635 /* ============== ETHTOOL_MSG_CABLE_TEST_ACT ============== */
3636 /* ETHTOOL_MSG_CABLE_TEST_ACT - do */
3637 struct ethtool_cable_test_act_req {
3638 struct {
3639 __u32 header:1;
3640 } _present;
3641
3642 struct ethtool_header header;
3643 };
3644
3645 static inline struct ethtool_cable_test_act_req *
ethtool_cable_test_act_req_alloc(void)3646 ethtool_cable_test_act_req_alloc(void)
3647 {
3648 return calloc(1, sizeof(struct ethtool_cable_test_act_req));
3649 }
3650 void ethtool_cable_test_act_req_free(struct ethtool_cable_test_act_req *req);
3651
3652 static inline void
ethtool_cable_test_act_req_set_header_dev_index(struct ethtool_cable_test_act_req * req,__u32 dev_index)3653 ethtool_cable_test_act_req_set_header_dev_index(struct ethtool_cable_test_act_req *req,
3654 __u32 dev_index)
3655 {
3656 req->_present.header = 1;
3657 req->header._present.dev_index = 1;
3658 req->header.dev_index = dev_index;
3659 }
3660 static inline void
ethtool_cable_test_act_req_set_header_dev_name(struct ethtool_cable_test_act_req * req,const char * dev_name)3661 ethtool_cable_test_act_req_set_header_dev_name(struct ethtool_cable_test_act_req *req,
3662 const char *dev_name)
3663 {
3664 free(req->header.dev_name);
3665 req->header._present.dev_name_len = strlen(dev_name);
3666 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3667 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3668 req->header.dev_name[req->header._present.dev_name_len] = 0;
3669 }
3670 static inline void
ethtool_cable_test_act_req_set_header_flags(struct ethtool_cable_test_act_req * req,__u32 flags)3671 ethtool_cable_test_act_req_set_header_flags(struct ethtool_cable_test_act_req *req,
3672 __u32 flags)
3673 {
3674 req->_present.header = 1;
3675 req->header._present.flags = 1;
3676 req->header.flags = flags;
3677 }
3678
3679 /*
3680 * Cable test.
3681 */
3682 int ethtool_cable_test_act(struct ynl_sock *ys,
3683 struct ethtool_cable_test_act_req *req);
3684
3685 /* ============== ETHTOOL_MSG_CABLE_TEST_TDR_ACT ============== */
3686 /* ETHTOOL_MSG_CABLE_TEST_TDR_ACT - do */
3687 struct ethtool_cable_test_tdr_act_req {
3688 struct {
3689 __u32 header:1;
3690 } _present;
3691
3692 struct ethtool_header header;
3693 };
3694
3695 static inline struct ethtool_cable_test_tdr_act_req *
ethtool_cable_test_tdr_act_req_alloc(void)3696 ethtool_cable_test_tdr_act_req_alloc(void)
3697 {
3698 return calloc(1, sizeof(struct ethtool_cable_test_tdr_act_req));
3699 }
3700 void
3701 ethtool_cable_test_tdr_act_req_free(struct ethtool_cable_test_tdr_act_req *req);
3702
3703 static inline void
ethtool_cable_test_tdr_act_req_set_header_dev_index(struct ethtool_cable_test_tdr_act_req * req,__u32 dev_index)3704 ethtool_cable_test_tdr_act_req_set_header_dev_index(struct ethtool_cable_test_tdr_act_req *req,
3705 __u32 dev_index)
3706 {
3707 req->_present.header = 1;
3708 req->header._present.dev_index = 1;
3709 req->header.dev_index = dev_index;
3710 }
3711 static inline void
ethtool_cable_test_tdr_act_req_set_header_dev_name(struct ethtool_cable_test_tdr_act_req * req,const char * dev_name)3712 ethtool_cable_test_tdr_act_req_set_header_dev_name(struct ethtool_cable_test_tdr_act_req *req,
3713 const char *dev_name)
3714 {
3715 free(req->header.dev_name);
3716 req->header._present.dev_name_len = strlen(dev_name);
3717 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3718 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3719 req->header.dev_name[req->header._present.dev_name_len] = 0;
3720 }
3721 static inline void
ethtool_cable_test_tdr_act_req_set_header_flags(struct ethtool_cable_test_tdr_act_req * req,__u32 flags)3722 ethtool_cable_test_tdr_act_req_set_header_flags(struct ethtool_cable_test_tdr_act_req *req,
3723 __u32 flags)
3724 {
3725 req->_present.header = 1;
3726 req->header._present.flags = 1;
3727 req->header.flags = flags;
3728 }
3729
3730 /*
3731 * Cable test TDR.
3732 */
3733 int ethtool_cable_test_tdr_act(struct ynl_sock *ys,
3734 struct ethtool_cable_test_tdr_act_req *req);
3735
3736 /* ============== ETHTOOL_MSG_TUNNEL_INFO_GET ============== */
3737 /* ETHTOOL_MSG_TUNNEL_INFO_GET - do */
3738 struct ethtool_tunnel_info_get_req {
3739 struct {
3740 __u32 header:1;
3741 } _present;
3742
3743 struct ethtool_header header;
3744 };
3745
3746 static inline struct ethtool_tunnel_info_get_req *
ethtool_tunnel_info_get_req_alloc(void)3747 ethtool_tunnel_info_get_req_alloc(void)
3748 {
3749 return calloc(1, sizeof(struct ethtool_tunnel_info_get_req));
3750 }
3751 void ethtool_tunnel_info_get_req_free(struct ethtool_tunnel_info_get_req *req);
3752
3753 static inline void
ethtool_tunnel_info_get_req_set_header_dev_index(struct ethtool_tunnel_info_get_req * req,__u32 dev_index)3754 ethtool_tunnel_info_get_req_set_header_dev_index(struct ethtool_tunnel_info_get_req *req,
3755 __u32 dev_index)
3756 {
3757 req->_present.header = 1;
3758 req->header._present.dev_index = 1;
3759 req->header.dev_index = dev_index;
3760 }
3761 static inline void
ethtool_tunnel_info_get_req_set_header_dev_name(struct ethtool_tunnel_info_get_req * req,const char * dev_name)3762 ethtool_tunnel_info_get_req_set_header_dev_name(struct ethtool_tunnel_info_get_req *req,
3763 const char *dev_name)
3764 {
3765 free(req->header.dev_name);
3766 req->header._present.dev_name_len = strlen(dev_name);
3767 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3768 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3769 req->header.dev_name[req->header._present.dev_name_len] = 0;
3770 }
3771 static inline void
ethtool_tunnel_info_get_req_set_header_flags(struct ethtool_tunnel_info_get_req * req,__u32 flags)3772 ethtool_tunnel_info_get_req_set_header_flags(struct ethtool_tunnel_info_get_req *req,
3773 __u32 flags)
3774 {
3775 req->_present.header = 1;
3776 req->header._present.flags = 1;
3777 req->header.flags = flags;
3778 }
3779
3780 struct ethtool_tunnel_info_get_rsp {
3781 struct {
3782 __u32 header:1;
3783 __u32 udp_ports:1;
3784 } _present;
3785
3786 struct ethtool_header header;
3787 struct ethtool_tunnel_udp udp_ports;
3788 };
3789
3790 void ethtool_tunnel_info_get_rsp_free(struct ethtool_tunnel_info_get_rsp *rsp);
3791
3792 /*
3793 * Get tsinfo params.
3794 */
3795 struct ethtool_tunnel_info_get_rsp *
3796 ethtool_tunnel_info_get(struct ynl_sock *ys,
3797 struct ethtool_tunnel_info_get_req *req);
3798
3799 /* ETHTOOL_MSG_TUNNEL_INFO_GET - dump */
3800 struct ethtool_tunnel_info_get_req_dump {
3801 struct {
3802 __u32 header:1;
3803 } _present;
3804
3805 struct ethtool_header header;
3806 };
3807
3808 static inline struct ethtool_tunnel_info_get_req_dump *
ethtool_tunnel_info_get_req_dump_alloc(void)3809 ethtool_tunnel_info_get_req_dump_alloc(void)
3810 {
3811 return calloc(1, sizeof(struct ethtool_tunnel_info_get_req_dump));
3812 }
3813 void
3814 ethtool_tunnel_info_get_req_dump_free(struct ethtool_tunnel_info_get_req_dump *req);
3815
3816 static inline void
ethtool_tunnel_info_get_req_dump_set_header_dev_index(struct ethtool_tunnel_info_get_req_dump * req,__u32 dev_index)3817 ethtool_tunnel_info_get_req_dump_set_header_dev_index(struct ethtool_tunnel_info_get_req_dump *req,
3818 __u32 dev_index)
3819 {
3820 req->_present.header = 1;
3821 req->header._present.dev_index = 1;
3822 req->header.dev_index = dev_index;
3823 }
3824 static inline void
ethtool_tunnel_info_get_req_dump_set_header_dev_name(struct ethtool_tunnel_info_get_req_dump * req,const char * dev_name)3825 ethtool_tunnel_info_get_req_dump_set_header_dev_name(struct ethtool_tunnel_info_get_req_dump *req,
3826 const char *dev_name)
3827 {
3828 free(req->header.dev_name);
3829 req->header._present.dev_name_len = strlen(dev_name);
3830 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3831 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3832 req->header.dev_name[req->header._present.dev_name_len] = 0;
3833 }
3834 static inline void
ethtool_tunnel_info_get_req_dump_set_header_flags(struct ethtool_tunnel_info_get_req_dump * req,__u32 flags)3835 ethtool_tunnel_info_get_req_dump_set_header_flags(struct ethtool_tunnel_info_get_req_dump *req,
3836 __u32 flags)
3837 {
3838 req->_present.header = 1;
3839 req->header._present.flags = 1;
3840 req->header.flags = flags;
3841 }
3842
3843 struct ethtool_tunnel_info_get_list {
3844 struct ethtool_tunnel_info_get_list *next;
3845 struct ethtool_tunnel_info_get_rsp obj __attribute__ ((aligned (8)));
3846 };
3847
3848 void
3849 ethtool_tunnel_info_get_list_free(struct ethtool_tunnel_info_get_list *rsp);
3850
3851 struct ethtool_tunnel_info_get_list *
3852 ethtool_tunnel_info_get_dump(struct ynl_sock *ys,
3853 struct ethtool_tunnel_info_get_req_dump *req);
3854
3855 /* ============== ETHTOOL_MSG_FEC_GET ============== */
3856 /* ETHTOOL_MSG_FEC_GET - do */
3857 struct ethtool_fec_get_req {
3858 struct {
3859 __u32 header:1;
3860 } _present;
3861
3862 struct ethtool_header header;
3863 };
3864
ethtool_fec_get_req_alloc(void)3865 static inline struct ethtool_fec_get_req *ethtool_fec_get_req_alloc(void)
3866 {
3867 return calloc(1, sizeof(struct ethtool_fec_get_req));
3868 }
3869 void ethtool_fec_get_req_free(struct ethtool_fec_get_req *req);
3870
3871 static inline void
ethtool_fec_get_req_set_header_dev_index(struct ethtool_fec_get_req * req,__u32 dev_index)3872 ethtool_fec_get_req_set_header_dev_index(struct ethtool_fec_get_req *req,
3873 __u32 dev_index)
3874 {
3875 req->_present.header = 1;
3876 req->header._present.dev_index = 1;
3877 req->header.dev_index = dev_index;
3878 }
3879 static inline void
ethtool_fec_get_req_set_header_dev_name(struct ethtool_fec_get_req * req,const char * dev_name)3880 ethtool_fec_get_req_set_header_dev_name(struct ethtool_fec_get_req *req,
3881 const char *dev_name)
3882 {
3883 free(req->header.dev_name);
3884 req->header._present.dev_name_len = strlen(dev_name);
3885 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3886 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3887 req->header.dev_name[req->header._present.dev_name_len] = 0;
3888 }
3889 static inline void
ethtool_fec_get_req_set_header_flags(struct ethtool_fec_get_req * req,__u32 flags)3890 ethtool_fec_get_req_set_header_flags(struct ethtool_fec_get_req *req,
3891 __u32 flags)
3892 {
3893 req->_present.header = 1;
3894 req->header._present.flags = 1;
3895 req->header.flags = flags;
3896 }
3897
3898 struct ethtool_fec_get_rsp {
3899 struct {
3900 __u32 header:1;
3901 __u32 modes:1;
3902 __u32 auto_:1;
3903 __u32 active:1;
3904 __u32 stats:1;
3905 } _present;
3906
3907 struct ethtool_header header;
3908 struct ethtool_bitset modes;
3909 __u8 auto_;
3910 __u32 active;
3911 struct ethtool_fec_stat stats;
3912 };
3913
3914 void ethtool_fec_get_rsp_free(struct ethtool_fec_get_rsp *rsp);
3915
3916 /*
3917 * Get FEC params.
3918 */
3919 struct ethtool_fec_get_rsp *
3920 ethtool_fec_get(struct ynl_sock *ys, struct ethtool_fec_get_req *req);
3921
3922 /* ETHTOOL_MSG_FEC_GET - dump */
3923 struct ethtool_fec_get_req_dump {
3924 struct {
3925 __u32 header:1;
3926 } _present;
3927
3928 struct ethtool_header header;
3929 };
3930
3931 static inline struct ethtool_fec_get_req_dump *
ethtool_fec_get_req_dump_alloc(void)3932 ethtool_fec_get_req_dump_alloc(void)
3933 {
3934 return calloc(1, sizeof(struct ethtool_fec_get_req_dump));
3935 }
3936 void ethtool_fec_get_req_dump_free(struct ethtool_fec_get_req_dump *req);
3937
3938 static inline void
ethtool_fec_get_req_dump_set_header_dev_index(struct ethtool_fec_get_req_dump * req,__u32 dev_index)3939 ethtool_fec_get_req_dump_set_header_dev_index(struct ethtool_fec_get_req_dump *req,
3940 __u32 dev_index)
3941 {
3942 req->_present.header = 1;
3943 req->header._present.dev_index = 1;
3944 req->header.dev_index = dev_index;
3945 }
3946 static inline void
ethtool_fec_get_req_dump_set_header_dev_name(struct ethtool_fec_get_req_dump * req,const char * dev_name)3947 ethtool_fec_get_req_dump_set_header_dev_name(struct ethtool_fec_get_req_dump *req,
3948 const char *dev_name)
3949 {
3950 free(req->header.dev_name);
3951 req->header._present.dev_name_len = strlen(dev_name);
3952 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
3953 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
3954 req->header.dev_name[req->header._present.dev_name_len] = 0;
3955 }
3956 static inline void
ethtool_fec_get_req_dump_set_header_flags(struct ethtool_fec_get_req_dump * req,__u32 flags)3957 ethtool_fec_get_req_dump_set_header_flags(struct ethtool_fec_get_req_dump *req,
3958 __u32 flags)
3959 {
3960 req->_present.header = 1;
3961 req->header._present.flags = 1;
3962 req->header.flags = flags;
3963 }
3964
3965 struct ethtool_fec_get_list {
3966 struct ethtool_fec_get_list *next;
3967 struct ethtool_fec_get_rsp obj __attribute__ ((aligned (8)));
3968 };
3969
3970 void ethtool_fec_get_list_free(struct ethtool_fec_get_list *rsp);
3971
3972 struct ethtool_fec_get_list *
3973 ethtool_fec_get_dump(struct ynl_sock *ys, struct ethtool_fec_get_req_dump *req);
3974
3975 /* ETHTOOL_MSG_FEC_GET - notify */
3976 struct ethtool_fec_get_ntf {
3977 __u16 family;
3978 __u8 cmd;
3979 struct ynl_ntf_base_type *next;
3980 void (*free)(struct ethtool_fec_get_ntf *ntf);
3981 struct ethtool_fec_get_rsp obj __attribute__ ((aligned (8)));
3982 };
3983
3984 void ethtool_fec_get_ntf_free(struct ethtool_fec_get_ntf *rsp);
3985
3986 /* ============== ETHTOOL_MSG_FEC_SET ============== */
3987 /* ETHTOOL_MSG_FEC_SET - do */
3988 struct ethtool_fec_set_req {
3989 struct {
3990 __u32 header:1;
3991 __u32 modes:1;
3992 __u32 auto_:1;
3993 __u32 active:1;
3994 __u32 stats:1;
3995 } _present;
3996
3997 struct ethtool_header header;
3998 struct ethtool_bitset modes;
3999 __u8 auto_;
4000 __u32 active;
4001 struct ethtool_fec_stat stats;
4002 };
4003
ethtool_fec_set_req_alloc(void)4004 static inline struct ethtool_fec_set_req *ethtool_fec_set_req_alloc(void)
4005 {
4006 return calloc(1, sizeof(struct ethtool_fec_set_req));
4007 }
4008 void ethtool_fec_set_req_free(struct ethtool_fec_set_req *req);
4009
4010 static inline void
ethtool_fec_set_req_set_header_dev_index(struct ethtool_fec_set_req * req,__u32 dev_index)4011 ethtool_fec_set_req_set_header_dev_index(struct ethtool_fec_set_req *req,
4012 __u32 dev_index)
4013 {
4014 req->_present.header = 1;
4015 req->header._present.dev_index = 1;
4016 req->header.dev_index = dev_index;
4017 }
4018 static inline void
ethtool_fec_set_req_set_header_dev_name(struct ethtool_fec_set_req * req,const char * dev_name)4019 ethtool_fec_set_req_set_header_dev_name(struct ethtool_fec_set_req *req,
4020 const char *dev_name)
4021 {
4022 free(req->header.dev_name);
4023 req->header._present.dev_name_len = strlen(dev_name);
4024 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4025 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4026 req->header.dev_name[req->header._present.dev_name_len] = 0;
4027 }
4028 static inline void
ethtool_fec_set_req_set_header_flags(struct ethtool_fec_set_req * req,__u32 flags)4029 ethtool_fec_set_req_set_header_flags(struct ethtool_fec_set_req *req,
4030 __u32 flags)
4031 {
4032 req->_present.header = 1;
4033 req->header._present.flags = 1;
4034 req->header.flags = flags;
4035 }
4036 static inline void
ethtool_fec_set_req_set_modes_nomask(struct ethtool_fec_set_req * req)4037 ethtool_fec_set_req_set_modes_nomask(struct ethtool_fec_set_req *req)
4038 {
4039 req->_present.modes = 1;
4040 req->modes._present.nomask = 1;
4041 }
4042 static inline void
ethtool_fec_set_req_set_modes_size(struct ethtool_fec_set_req * req,__u32 size)4043 ethtool_fec_set_req_set_modes_size(struct ethtool_fec_set_req *req, __u32 size)
4044 {
4045 req->_present.modes = 1;
4046 req->modes._present.size = 1;
4047 req->modes.size = size;
4048 }
4049 static inline void
__ethtool_fec_set_req_set_modes_bits_bit(struct ethtool_fec_set_req * req,struct ethtool_bitset_bit * bit,unsigned int n_bit)4050 __ethtool_fec_set_req_set_modes_bits_bit(struct ethtool_fec_set_req *req,
4051 struct ethtool_bitset_bit *bit,
4052 unsigned int n_bit)
4053 {
4054 free(req->modes.bits.bit);
4055 req->modes.bits.bit = bit;
4056 req->modes.bits.n_bit = n_bit;
4057 }
4058 static inline void
ethtool_fec_set_req_set_auto_(struct ethtool_fec_set_req * req,__u8 auto_)4059 ethtool_fec_set_req_set_auto_(struct ethtool_fec_set_req *req, __u8 auto_)
4060 {
4061 req->_present.auto_ = 1;
4062 req->auto_ = auto_;
4063 }
4064 static inline void
ethtool_fec_set_req_set_active(struct ethtool_fec_set_req * req,__u32 active)4065 ethtool_fec_set_req_set_active(struct ethtool_fec_set_req *req, __u32 active)
4066 {
4067 req->_present.active = 1;
4068 req->active = active;
4069 }
4070 static inline void
ethtool_fec_set_req_set_stats_corrected(struct ethtool_fec_set_req * req,const void * corrected,size_t len)4071 ethtool_fec_set_req_set_stats_corrected(struct ethtool_fec_set_req *req,
4072 const void *corrected, size_t len)
4073 {
4074 free(req->stats.corrected);
4075 req->stats._present.corrected_len = len;
4076 req->stats.corrected = malloc(req->stats._present.corrected_len);
4077 memcpy(req->stats.corrected, corrected, req->stats._present.corrected_len);
4078 }
4079 static inline void
ethtool_fec_set_req_set_stats_uncorr(struct ethtool_fec_set_req * req,const void * uncorr,size_t len)4080 ethtool_fec_set_req_set_stats_uncorr(struct ethtool_fec_set_req *req,
4081 const void *uncorr, size_t len)
4082 {
4083 free(req->stats.uncorr);
4084 req->stats._present.uncorr_len = len;
4085 req->stats.uncorr = malloc(req->stats._present.uncorr_len);
4086 memcpy(req->stats.uncorr, uncorr, req->stats._present.uncorr_len);
4087 }
4088 static inline void
ethtool_fec_set_req_set_stats_corr_bits(struct ethtool_fec_set_req * req,const void * corr_bits,size_t len)4089 ethtool_fec_set_req_set_stats_corr_bits(struct ethtool_fec_set_req *req,
4090 const void *corr_bits, size_t len)
4091 {
4092 free(req->stats.corr_bits);
4093 req->stats._present.corr_bits_len = len;
4094 req->stats.corr_bits = malloc(req->stats._present.corr_bits_len);
4095 memcpy(req->stats.corr_bits, corr_bits, req->stats._present.corr_bits_len);
4096 }
4097
4098 /*
4099 * Set FEC params.
4100 */
4101 int ethtool_fec_set(struct ynl_sock *ys, struct ethtool_fec_set_req *req);
4102
4103 /* ============== ETHTOOL_MSG_MODULE_EEPROM_GET ============== */
4104 /* ETHTOOL_MSG_MODULE_EEPROM_GET - do */
4105 struct ethtool_module_eeprom_get_req {
4106 struct {
4107 __u32 header:1;
4108 } _present;
4109
4110 struct ethtool_header header;
4111 };
4112
4113 static inline struct ethtool_module_eeprom_get_req *
ethtool_module_eeprom_get_req_alloc(void)4114 ethtool_module_eeprom_get_req_alloc(void)
4115 {
4116 return calloc(1, sizeof(struct ethtool_module_eeprom_get_req));
4117 }
4118 void
4119 ethtool_module_eeprom_get_req_free(struct ethtool_module_eeprom_get_req *req);
4120
4121 static inline void
ethtool_module_eeprom_get_req_set_header_dev_index(struct ethtool_module_eeprom_get_req * req,__u32 dev_index)4122 ethtool_module_eeprom_get_req_set_header_dev_index(struct ethtool_module_eeprom_get_req *req,
4123 __u32 dev_index)
4124 {
4125 req->_present.header = 1;
4126 req->header._present.dev_index = 1;
4127 req->header.dev_index = dev_index;
4128 }
4129 static inline void
ethtool_module_eeprom_get_req_set_header_dev_name(struct ethtool_module_eeprom_get_req * req,const char * dev_name)4130 ethtool_module_eeprom_get_req_set_header_dev_name(struct ethtool_module_eeprom_get_req *req,
4131 const char *dev_name)
4132 {
4133 free(req->header.dev_name);
4134 req->header._present.dev_name_len = strlen(dev_name);
4135 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4136 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4137 req->header.dev_name[req->header._present.dev_name_len] = 0;
4138 }
4139 static inline void
ethtool_module_eeprom_get_req_set_header_flags(struct ethtool_module_eeprom_get_req * req,__u32 flags)4140 ethtool_module_eeprom_get_req_set_header_flags(struct ethtool_module_eeprom_get_req *req,
4141 __u32 flags)
4142 {
4143 req->_present.header = 1;
4144 req->header._present.flags = 1;
4145 req->header.flags = flags;
4146 }
4147
4148 struct ethtool_module_eeprom_get_rsp {
4149 struct {
4150 __u32 header:1;
4151 __u32 offset:1;
4152 __u32 length:1;
4153 __u32 page:1;
4154 __u32 bank:1;
4155 __u32 i2c_address:1;
4156 __u32 data_len;
4157 } _present;
4158
4159 struct ethtool_header header;
4160 __u32 offset;
4161 __u32 length;
4162 __u8 page;
4163 __u8 bank;
4164 __u8 i2c_address;
4165 void *data;
4166 };
4167
4168 void
4169 ethtool_module_eeprom_get_rsp_free(struct ethtool_module_eeprom_get_rsp *rsp);
4170
4171 /*
4172 * Get module EEPROM params.
4173 */
4174 struct ethtool_module_eeprom_get_rsp *
4175 ethtool_module_eeprom_get(struct ynl_sock *ys,
4176 struct ethtool_module_eeprom_get_req *req);
4177
4178 /* ETHTOOL_MSG_MODULE_EEPROM_GET - dump */
4179 struct ethtool_module_eeprom_get_req_dump {
4180 struct {
4181 __u32 header:1;
4182 } _present;
4183
4184 struct ethtool_header header;
4185 };
4186
4187 static inline struct ethtool_module_eeprom_get_req_dump *
ethtool_module_eeprom_get_req_dump_alloc(void)4188 ethtool_module_eeprom_get_req_dump_alloc(void)
4189 {
4190 return calloc(1, sizeof(struct ethtool_module_eeprom_get_req_dump));
4191 }
4192 void
4193 ethtool_module_eeprom_get_req_dump_free(struct ethtool_module_eeprom_get_req_dump *req);
4194
4195 static inline void
ethtool_module_eeprom_get_req_dump_set_header_dev_index(struct ethtool_module_eeprom_get_req_dump * req,__u32 dev_index)4196 ethtool_module_eeprom_get_req_dump_set_header_dev_index(struct ethtool_module_eeprom_get_req_dump *req,
4197 __u32 dev_index)
4198 {
4199 req->_present.header = 1;
4200 req->header._present.dev_index = 1;
4201 req->header.dev_index = dev_index;
4202 }
4203 static inline void
ethtool_module_eeprom_get_req_dump_set_header_dev_name(struct ethtool_module_eeprom_get_req_dump * req,const char * dev_name)4204 ethtool_module_eeprom_get_req_dump_set_header_dev_name(struct ethtool_module_eeprom_get_req_dump *req,
4205 const char *dev_name)
4206 {
4207 free(req->header.dev_name);
4208 req->header._present.dev_name_len = strlen(dev_name);
4209 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4210 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4211 req->header.dev_name[req->header._present.dev_name_len] = 0;
4212 }
4213 static inline void
ethtool_module_eeprom_get_req_dump_set_header_flags(struct ethtool_module_eeprom_get_req_dump * req,__u32 flags)4214 ethtool_module_eeprom_get_req_dump_set_header_flags(struct ethtool_module_eeprom_get_req_dump *req,
4215 __u32 flags)
4216 {
4217 req->_present.header = 1;
4218 req->header._present.flags = 1;
4219 req->header.flags = flags;
4220 }
4221
4222 struct ethtool_module_eeprom_get_list {
4223 struct ethtool_module_eeprom_get_list *next;
4224 struct ethtool_module_eeprom_get_rsp obj __attribute__ ((aligned (8)));
4225 };
4226
4227 void
4228 ethtool_module_eeprom_get_list_free(struct ethtool_module_eeprom_get_list *rsp);
4229
4230 struct ethtool_module_eeprom_get_list *
4231 ethtool_module_eeprom_get_dump(struct ynl_sock *ys,
4232 struct ethtool_module_eeprom_get_req_dump *req);
4233
4234 /* ============== ETHTOOL_MSG_PHC_VCLOCKS_GET ============== */
4235 /* ETHTOOL_MSG_PHC_VCLOCKS_GET - do */
4236 struct ethtool_phc_vclocks_get_req {
4237 struct {
4238 __u32 header:1;
4239 } _present;
4240
4241 struct ethtool_header header;
4242 };
4243
4244 static inline struct ethtool_phc_vclocks_get_req *
ethtool_phc_vclocks_get_req_alloc(void)4245 ethtool_phc_vclocks_get_req_alloc(void)
4246 {
4247 return calloc(1, sizeof(struct ethtool_phc_vclocks_get_req));
4248 }
4249 void ethtool_phc_vclocks_get_req_free(struct ethtool_phc_vclocks_get_req *req);
4250
4251 static inline void
ethtool_phc_vclocks_get_req_set_header_dev_index(struct ethtool_phc_vclocks_get_req * req,__u32 dev_index)4252 ethtool_phc_vclocks_get_req_set_header_dev_index(struct ethtool_phc_vclocks_get_req *req,
4253 __u32 dev_index)
4254 {
4255 req->_present.header = 1;
4256 req->header._present.dev_index = 1;
4257 req->header.dev_index = dev_index;
4258 }
4259 static inline void
ethtool_phc_vclocks_get_req_set_header_dev_name(struct ethtool_phc_vclocks_get_req * req,const char * dev_name)4260 ethtool_phc_vclocks_get_req_set_header_dev_name(struct ethtool_phc_vclocks_get_req *req,
4261 const char *dev_name)
4262 {
4263 free(req->header.dev_name);
4264 req->header._present.dev_name_len = strlen(dev_name);
4265 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4266 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4267 req->header.dev_name[req->header._present.dev_name_len] = 0;
4268 }
4269 static inline void
ethtool_phc_vclocks_get_req_set_header_flags(struct ethtool_phc_vclocks_get_req * req,__u32 flags)4270 ethtool_phc_vclocks_get_req_set_header_flags(struct ethtool_phc_vclocks_get_req *req,
4271 __u32 flags)
4272 {
4273 req->_present.header = 1;
4274 req->header._present.flags = 1;
4275 req->header.flags = flags;
4276 }
4277
4278 struct ethtool_phc_vclocks_get_rsp {
4279 struct {
4280 __u32 header:1;
4281 __u32 num:1;
4282 } _present;
4283
4284 struct ethtool_header header;
4285 __u32 num;
4286 };
4287
4288 void ethtool_phc_vclocks_get_rsp_free(struct ethtool_phc_vclocks_get_rsp *rsp);
4289
4290 /*
4291 * Get PHC VCLOCKs.
4292 */
4293 struct ethtool_phc_vclocks_get_rsp *
4294 ethtool_phc_vclocks_get(struct ynl_sock *ys,
4295 struct ethtool_phc_vclocks_get_req *req);
4296
4297 /* ETHTOOL_MSG_PHC_VCLOCKS_GET - dump */
4298 struct ethtool_phc_vclocks_get_req_dump {
4299 struct {
4300 __u32 header:1;
4301 } _present;
4302
4303 struct ethtool_header header;
4304 };
4305
4306 static inline struct ethtool_phc_vclocks_get_req_dump *
ethtool_phc_vclocks_get_req_dump_alloc(void)4307 ethtool_phc_vclocks_get_req_dump_alloc(void)
4308 {
4309 return calloc(1, sizeof(struct ethtool_phc_vclocks_get_req_dump));
4310 }
4311 void
4312 ethtool_phc_vclocks_get_req_dump_free(struct ethtool_phc_vclocks_get_req_dump *req);
4313
4314 static inline void
ethtool_phc_vclocks_get_req_dump_set_header_dev_index(struct ethtool_phc_vclocks_get_req_dump * req,__u32 dev_index)4315 ethtool_phc_vclocks_get_req_dump_set_header_dev_index(struct ethtool_phc_vclocks_get_req_dump *req,
4316 __u32 dev_index)
4317 {
4318 req->_present.header = 1;
4319 req->header._present.dev_index = 1;
4320 req->header.dev_index = dev_index;
4321 }
4322 static inline void
ethtool_phc_vclocks_get_req_dump_set_header_dev_name(struct ethtool_phc_vclocks_get_req_dump * req,const char * dev_name)4323 ethtool_phc_vclocks_get_req_dump_set_header_dev_name(struct ethtool_phc_vclocks_get_req_dump *req,
4324 const char *dev_name)
4325 {
4326 free(req->header.dev_name);
4327 req->header._present.dev_name_len = strlen(dev_name);
4328 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4329 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4330 req->header.dev_name[req->header._present.dev_name_len] = 0;
4331 }
4332 static inline void
ethtool_phc_vclocks_get_req_dump_set_header_flags(struct ethtool_phc_vclocks_get_req_dump * req,__u32 flags)4333 ethtool_phc_vclocks_get_req_dump_set_header_flags(struct ethtool_phc_vclocks_get_req_dump *req,
4334 __u32 flags)
4335 {
4336 req->_present.header = 1;
4337 req->header._present.flags = 1;
4338 req->header.flags = flags;
4339 }
4340
4341 struct ethtool_phc_vclocks_get_list {
4342 struct ethtool_phc_vclocks_get_list *next;
4343 struct ethtool_phc_vclocks_get_rsp obj __attribute__ ((aligned (8)));
4344 };
4345
4346 void
4347 ethtool_phc_vclocks_get_list_free(struct ethtool_phc_vclocks_get_list *rsp);
4348
4349 struct ethtool_phc_vclocks_get_list *
4350 ethtool_phc_vclocks_get_dump(struct ynl_sock *ys,
4351 struct ethtool_phc_vclocks_get_req_dump *req);
4352
4353 /* ============== ETHTOOL_MSG_MODULE_GET ============== */
4354 /* ETHTOOL_MSG_MODULE_GET - do */
4355 struct ethtool_module_get_req {
4356 struct {
4357 __u32 header:1;
4358 } _present;
4359
4360 struct ethtool_header header;
4361 };
4362
ethtool_module_get_req_alloc(void)4363 static inline struct ethtool_module_get_req *ethtool_module_get_req_alloc(void)
4364 {
4365 return calloc(1, sizeof(struct ethtool_module_get_req));
4366 }
4367 void ethtool_module_get_req_free(struct ethtool_module_get_req *req);
4368
4369 static inline void
ethtool_module_get_req_set_header_dev_index(struct ethtool_module_get_req * req,__u32 dev_index)4370 ethtool_module_get_req_set_header_dev_index(struct ethtool_module_get_req *req,
4371 __u32 dev_index)
4372 {
4373 req->_present.header = 1;
4374 req->header._present.dev_index = 1;
4375 req->header.dev_index = dev_index;
4376 }
4377 static inline void
ethtool_module_get_req_set_header_dev_name(struct ethtool_module_get_req * req,const char * dev_name)4378 ethtool_module_get_req_set_header_dev_name(struct ethtool_module_get_req *req,
4379 const char *dev_name)
4380 {
4381 free(req->header.dev_name);
4382 req->header._present.dev_name_len = strlen(dev_name);
4383 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4384 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4385 req->header.dev_name[req->header._present.dev_name_len] = 0;
4386 }
4387 static inline void
ethtool_module_get_req_set_header_flags(struct ethtool_module_get_req * req,__u32 flags)4388 ethtool_module_get_req_set_header_flags(struct ethtool_module_get_req *req,
4389 __u32 flags)
4390 {
4391 req->_present.header = 1;
4392 req->header._present.flags = 1;
4393 req->header.flags = flags;
4394 }
4395
4396 struct ethtool_module_get_rsp {
4397 struct {
4398 __u32 header:1;
4399 __u32 power_mode_policy:1;
4400 __u32 power_mode:1;
4401 } _present;
4402
4403 struct ethtool_header header;
4404 __u8 power_mode_policy;
4405 __u8 power_mode;
4406 };
4407
4408 void ethtool_module_get_rsp_free(struct ethtool_module_get_rsp *rsp);
4409
4410 /*
4411 * Get module params.
4412 */
4413 struct ethtool_module_get_rsp *
4414 ethtool_module_get(struct ynl_sock *ys, struct ethtool_module_get_req *req);
4415
4416 /* ETHTOOL_MSG_MODULE_GET - dump */
4417 struct ethtool_module_get_req_dump {
4418 struct {
4419 __u32 header:1;
4420 } _present;
4421
4422 struct ethtool_header header;
4423 };
4424
4425 static inline struct ethtool_module_get_req_dump *
ethtool_module_get_req_dump_alloc(void)4426 ethtool_module_get_req_dump_alloc(void)
4427 {
4428 return calloc(1, sizeof(struct ethtool_module_get_req_dump));
4429 }
4430 void ethtool_module_get_req_dump_free(struct ethtool_module_get_req_dump *req);
4431
4432 static inline void
ethtool_module_get_req_dump_set_header_dev_index(struct ethtool_module_get_req_dump * req,__u32 dev_index)4433 ethtool_module_get_req_dump_set_header_dev_index(struct ethtool_module_get_req_dump *req,
4434 __u32 dev_index)
4435 {
4436 req->_present.header = 1;
4437 req->header._present.dev_index = 1;
4438 req->header.dev_index = dev_index;
4439 }
4440 static inline void
ethtool_module_get_req_dump_set_header_dev_name(struct ethtool_module_get_req_dump * req,const char * dev_name)4441 ethtool_module_get_req_dump_set_header_dev_name(struct ethtool_module_get_req_dump *req,
4442 const char *dev_name)
4443 {
4444 free(req->header.dev_name);
4445 req->header._present.dev_name_len = strlen(dev_name);
4446 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4447 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4448 req->header.dev_name[req->header._present.dev_name_len] = 0;
4449 }
4450 static inline void
ethtool_module_get_req_dump_set_header_flags(struct ethtool_module_get_req_dump * req,__u32 flags)4451 ethtool_module_get_req_dump_set_header_flags(struct ethtool_module_get_req_dump *req,
4452 __u32 flags)
4453 {
4454 req->_present.header = 1;
4455 req->header._present.flags = 1;
4456 req->header.flags = flags;
4457 }
4458
4459 struct ethtool_module_get_list {
4460 struct ethtool_module_get_list *next;
4461 struct ethtool_module_get_rsp obj __attribute__ ((aligned (8)));
4462 };
4463
4464 void ethtool_module_get_list_free(struct ethtool_module_get_list *rsp);
4465
4466 struct ethtool_module_get_list *
4467 ethtool_module_get_dump(struct ynl_sock *ys,
4468 struct ethtool_module_get_req_dump *req);
4469
4470 /* ETHTOOL_MSG_MODULE_GET - notify */
4471 struct ethtool_module_get_ntf {
4472 __u16 family;
4473 __u8 cmd;
4474 struct ynl_ntf_base_type *next;
4475 void (*free)(struct ethtool_module_get_ntf *ntf);
4476 struct ethtool_module_get_rsp obj __attribute__ ((aligned (8)));
4477 };
4478
4479 void ethtool_module_get_ntf_free(struct ethtool_module_get_ntf *rsp);
4480
4481 /* ============== ETHTOOL_MSG_MODULE_SET ============== */
4482 /* ETHTOOL_MSG_MODULE_SET - do */
4483 struct ethtool_module_set_req {
4484 struct {
4485 __u32 header:1;
4486 __u32 power_mode_policy:1;
4487 __u32 power_mode:1;
4488 } _present;
4489
4490 struct ethtool_header header;
4491 __u8 power_mode_policy;
4492 __u8 power_mode;
4493 };
4494
ethtool_module_set_req_alloc(void)4495 static inline struct ethtool_module_set_req *ethtool_module_set_req_alloc(void)
4496 {
4497 return calloc(1, sizeof(struct ethtool_module_set_req));
4498 }
4499 void ethtool_module_set_req_free(struct ethtool_module_set_req *req);
4500
4501 static inline void
ethtool_module_set_req_set_header_dev_index(struct ethtool_module_set_req * req,__u32 dev_index)4502 ethtool_module_set_req_set_header_dev_index(struct ethtool_module_set_req *req,
4503 __u32 dev_index)
4504 {
4505 req->_present.header = 1;
4506 req->header._present.dev_index = 1;
4507 req->header.dev_index = dev_index;
4508 }
4509 static inline void
ethtool_module_set_req_set_header_dev_name(struct ethtool_module_set_req * req,const char * dev_name)4510 ethtool_module_set_req_set_header_dev_name(struct ethtool_module_set_req *req,
4511 const char *dev_name)
4512 {
4513 free(req->header.dev_name);
4514 req->header._present.dev_name_len = strlen(dev_name);
4515 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4516 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4517 req->header.dev_name[req->header._present.dev_name_len] = 0;
4518 }
4519 static inline void
ethtool_module_set_req_set_header_flags(struct ethtool_module_set_req * req,__u32 flags)4520 ethtool_module_set_req_set_header_flags(struct ethtool_module_set_req *req,
4521 __u32 flags)
4522 {
4523 req->_present.header = 1;
4524 req->header._present.flags = 1;
4525 req->header.flags = flags;
4526 }
4527 static inline void
ethtool_module_set_req_set_power_mode_policy(struct ethtool_module_set_req * req,__u8 power_mode_policy)4528 ethtool_module_set_req_set_power_mode_policy(struct ethtool_module_set_req *req,
4529 __u8 power_mode_policy)
4530 {
4531 req->_present.power_mode_policy = 1;
4532 req->power_mode_policy = power_mode_policy;
4533 }
4534 static inline void
ethtool_module_set_req_set_power_mode(struct ethtool_module_set_req * req,__u8 power_mode)4535 ethtool_module_set_req_set_power_mode(struct ethtool_module_set_req *req,
4536 __u8 power_mode)
4537 {
4538 req->_present.power_mode = 1;
4539 req->power_mode = power_mode;
4540 }
4541
4542 /*
4543 * Set module params.
4544 */
4545 int ethtool_module_set(struct ynl_sock *ys, struct ethtool_module_set_req *req);
4546
4547 /* ============== ETHTOOL_MSG_PSE_GET ============== */
4548 /* ETHTOOL_MSG_PSE_GET - do */
4549 struct ethtool_pse_get_req {
4550 struct {
4551 __u32 header:1;
4552 } _present;
4553
4554 struct ethtool_header header;
4555 };
4556
ethtool_pse_get_req_alloc(void)4557 static inline struct ethtool_pse_get_req *ethtool_pse_get_req_alloc(void)
4558 {
4559 return calloc(1, sizeof(struct ethtool_pse_get_req));
4560 }
4561 void ethtool_pse_get_req_free(struct ethtool_pse_get_req *req);
4562
4563 static inline void
ethtool_pse_get_req_set_header_dev_index(struct ethtool_pse_get_req * req,__u32 dev_index)4564 ethtool_pse_get_req_set_header_dev_index(struct ethtool_pse_get_req *req,
4565 __u32 dev_index)
4566 {
4567 req->_present.header = 1;
4568 req->header._present.dev_index = 1;
4569 req->header.dev_index = dev_index;
4570 }
4571 static inline void
ethtool_pse_get_req_set_header_dev_name(struct ethtool_pse_get_req * req,const char * dev_name)4572 ethtool_pse_get_req_set_header_dev_name(struct ethtool_pse_get_req *req,
4573 const char *dev_name)
4574 {
4575 free(req->header.dev_name);
4576 req->header._present.dev_name_len = strlen(dev_name);
4577 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4578 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4579 req->header.dev_name[req->header._present.dev_name_len] = 0;
4580 }
4581 static inline void
ethtool_pse_get_req_set_header_flags(struct ethtool_pse_get_req * req,__u32 flags)4582 ethtool_pse_get_req_set_header_flags(struct ethtool_pse_get_req *req,
4583 __u32 flags)
4584 {
4585 req->_present.header = 1;
4586 req->header._present.flags = 1;
4587 req->header.flags = flags;
4588 }
4589
4590 struct ethtool_pse_get_rsp {
4591 struct {
4592 __u32 header:1;
4593 __u32 admin_state:1;
4594 __u32 admin_control:1;
4595 __u32 pw_d_status:1;
4596 } _present;
4597
4598 struct ethtool_header header;
4599 __u32 admin_state;
4600 __u32 admin_control;
4601 __u32 pw_d_status;
4602 };
4603
4604 void ethtool_pse_get_rsp_free(struct ethtool_pse_get_rsp *rsp);
4605
4606 /*
4607 * Get Power Sourcing Equipment params.
4608 */
4609 struct ethtool_pse_get_rsp *
4610 ethtool_pse_get(struct ynl_sock *ys, struct ethtool_pse_get_req *req);
4611
4612 /* ETHTOOL_MSG_PSE_GET - dump */
4613 struct ethtool_pse_get_req_dump {
4614 struct {
4615 __u32 header:1;
4616 } _present;
4617
4618 struct ethtool_header header;
4619 };
4620
4621 static inline struct ethtool_pse_get_req_dump *
ethtool_pse_get_req_dump_alloc(void)4622 ethtool_pse_get_req_dump_alloc(void)
4623 {
4624 return calloc(1, sizeof(struct ethtool_pse_get_req_dump));
4625 }
4626 void ethtool_pse_get_req_dump_free(struct ethtool_pse_get_req_dump *req);
4627
4628 static inline void
ethtool_pse_get_req_dump_set_header_dev_index(struct ethtool_pse_get_req_dump * req,__u32 dev_index)4629 ethtool_pse_get_req_dump_set_header_dev_index(struct ethtool_pse_get_req_dump *req,
4630 __u32 dev_index)
4631 {
4632 req->_present.header = 1;
4633 req->header._present.dev_index = 1;
4634 req->header.dev_index = dev_index;
4635 }
4636 static inline void
ethtool_pse_get_req_dump_set_header_dev_name(struct ethtool_pse_get_req_dump * req,const char * dev_name)4637 ethtool_pse_get_req_dump_set_header_dev_name(struct ethtool_pse_get_req_dump *req,
4638 const char *dev_name)
4639 {
4640 free(req->header.dev_name);
4641 req->header._present.dev_name_len = strlen(dev_name);
4642 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4643 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4644 req->header.dev_name[req->header._present.dev_name_len] = 0;
4645 }
4646 static inline void
ethtool_pse_get_req_dump_set_header_flags(struct ethtool_pse_get_req_dump * req,__u32 flags)4647 ethtool_pse_get_req_dump_set_header_flags(struct ethtool_pse_get_req_dump *req,
4648 __u32 flags)
4649 {
4650 req->_present.header = 1;
4651 req->header._present.flags = 1;
4652 req->header.flags = flags;
4653 }
4654
4655 struct ethtool_pse_get_list {
4656 struct ethtool_pse_get_list *next;
4657 struct ethtool_pse_get_rsp obj __attribute__ ((aligned (8)));
4658 };
4659
4660 void ethtool_pse_get_list_free(struct ethtool_pse_get_list *rsp);
4661
4662 struct ethtool_pse_get_list *
4663 ethtool_pse_get_dump(struct ynl_sock *ys, struct ethtool_pse_get_req_dump *req);
4664
4665 /* ============== ETHTOOL_MSG_PSE_SET ============== */
4666 /* ETHTOOL_MSG_PSE_SET - do */
4667 struct ethtool_pse_set_req {
4668 struct {
4669 __u32 header:1;
4670 __u32 admin_state:1;
4671 __u32 admin_control:1;
4672 __u32 pw_d_status:1;
4673 } _present;
4674
4675 struct ethtool_header header;
4676 __u32 admin_state;
4677 __u32 admin_control;
4678 __u32 pw_d_status;
4679 };
4680
ethtool_pse_set_req_alloc(void)4681 static inline struct ethtool_pse_set_req *ethtool_pse_set_req_alloc(void)
4682 {
4683 return calloc(1, sizeof(struct ethtool_pse_set_req));
4684 }
4685 void ethtool_pse_set_req_free(struct ethtool_pse_set_req *req);
4686
4687 static inline void
ethtool_pse_set_req_set_header_dev_index(struct ethtool_pse_set_req * req,__u32 dev_index)4688 ethtool_pse_set_req_set_header_dev_index(struct ethtool_pse_set_req *req,
4689 __u32 dev_index)
4690 {
4691 req->_present.header = 1;
4692 req->header._present.dev_index = 1;
4693 req->header.dev_index = dev_index;
4694 }
4695 static inline void
ethtool_pse_set_req_set_header_dev_name(struct ethtool_pse_set_req * req,const char * dev_name)4696 ethtool_pse_set_req_set_header_dev_name(struct ethtool_pse_set_req *req,
4697 const char *dev_name)
4698 {
4699 free(req->header.dev_name);
4700 req->header._present.dev_name_len = strlen(dev_name);
4701 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4702 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4703 req->header.dev_name[req->header._present.dev_name_len] = 0;
4704 }
4705 static inline void
ethtool_pse_set_req_set_header_flags(struct ethtool_pse_set_req * req,__u32 flags)4706 ethtool_pse_set_req_set_header_flags(struct ethtool_pse_set_req *req,
4707 __u32 flags)
4708 {
4709 req->_present.header = 1;
4710 req->header._present.flags = 1;
4711 req->header.flags = flags;
4712 }
4713 static inline void
ethtool_pse_set_req_set_admin_state(struct ethtool_pse_set_req * req,__u32 admin_state)4714 ethtool_pse_set_req_set_admin_state(struct ethtool_pse_set_req *req,
4715 __u32 admin_state)
4716 {
4717 req->_present.admin_state = 1;
4718 req->admin_state = admin_state;
4719 }
4720 static inline void
ethtool_pse_set_req_set_admin_control(struct ethtool_pse_set_req * req,__u32 admin_control)4721 ethtool_pse_set_req_set_admin_control(struct ethtool_pse_set_req *req,
4722 __u32 admin_control)
4723 {
4724 req->_present.admin_control = 1;
4725 req->admin_control = admin_control;
4726 }
4727 static inline void
ethtool_pse_set_req_set_pw_d_status(struct ethtool_pse_set_req * req,__u32 pw_d_status)4728 ethtool_pse_set_req_set_pw_d_status(struct ethtool_pse_set_req *req,
4729 __u32 pw_d_status)
4730 {
4731 req->_present.pw_d_status = 1;
4732 req->pw_d_status = pw_d_status;
4733 }
4734
4735 /*
4736 * Set Power Sourcing Equipment params.
4737 */
4738 int ethtool_pse_set(struct ynl_sock *ys, struct ethtool_pse_set_req *req);
4739
4740 /* ============== ETHTOOL_MSG_RSS_GET ============== */
4741 /* ETHTOOL_MSG_RSS_GET - do */
4742 struct ethtool_rss_get_req {
4743 struct {
4744 __u32 header:1;
4745 } _present;
4746
4747 struct ethtool_header header;
4748 };
4749
ethtool_rss_get_req_alloc(void)4750 static inline struct ethtool_rss_get_req *ethtool_rss_get_req_alloc(void)
4751 {
4752 return calloc(1, sizeof(struct ethtool_rss_get_req));
4753 }
4754 void ethtool_rss_get_req_free(struct ethtool_rss_get_req *req);
4755
4756 static inline void
ethtool_rss_get_req_set_header_dev_index(struct ethtool_rss_get_req * req,__u32 dev_index)4757 ethtool_rss_get_req_set_header_dev_index(struct ethtool_rss_get_req *req,
4758 __u32 dev_index)
4759 {
4760 req->_present.header = 1;
4761 req->header._present.dev_index = 1;
4762 req->header.dev_index = dev_index;
4763 }
4764 static inline void
ethtool_rss_get_req_set_header_dev_name(struct ethtool_rss_get_req * req,const char * dev_name)4765 ethtool_rss_get_req_set_header_dev_name(struct ethtool_rss_get_req *req,
4766 const char *dev_name)
4767 {
4768 free(req->header.dev_name);
4769 req->header._present.dev_name_len = strlen(dev_name);
4770 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4771 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4772 req->header.dev_name[req->header._present.dev_name_len] = 0;
4773 }
4774 static inline void
ethtool_rss_get_req_set_header_flags(struct ethtool_rss_get_req * req,__u32 flags)4775 ethtool_rss_get_req_set_header_flags(struct ethtool_rss_get_req *req,
4776 __u32 flags)
4777 {
4778 req->_present.header = 1;
4779 req->header._present.flags = 1;
4780 req->header.flags = flags;
4781 }
4782
4783 struct ethtool_rss_get_rsp {
4784 struct {
4785 __u32 header:1;
4786 __u32 context:1;
4787 __u32 hfunc:1;
4788 __u32 indir_len;
4789 __u32 hkey_len;
4790 } _present;
4791
4792 struct ethtool_header header;
4793 __u32 context;
4794 __u32 hfunc;
4795 void *indir;
4796 void *hkey;
4797 };
4798
4799 void ethtool_rss_get_rsp_free(struct ethtool_rss_get_rsp *rsp);
4800
4801 /*
4802 * Get RSS params.
4803 */
4804 struct ethtool_rss_get_rsp *
4805 ethtool_rss_get(struct ynl_sock *ys, struct ethtool_rss_get_req *req);
4806
4807 /* ETHTOOL_MSG_RSS_GET - dump */
4808 struct ethtool_rss_get_req_dump {
4809 struct {
4810 __u32 header:1;
4811 } _present;
4812
4813 struct ethtool_header header;
4814 };
4815
4816 static inline struct ethtool_rss_get_req_dump *
ethtool_rss_get_req_dump_alloc(void)4817 ethtool_rss_get_req_dump_alloc(void)
4818 {
4819 return calloc(1, sizeof(struct ethtool_rss_get_req_dump));
4820 }
4821 void ethtool_rss_get_req_dump_free(struct ethtool_rss_get_req_dump *req);
4822
4823 static inline void
ethtool_rss_get_req_dump_set_header_dev_index(struct ethtool_rss_get_req_dump * req,__u32 dev_index)4824 ethtool_rss_get_req_dump_set_header_dev_index(struct ethtool_rss_get_req_dump *req,
4825 __u32 dev_index)
4826 {
4827 req->_present.header = 1;
4828 req->header._present.dev_index = 1;
4829 req->header.dev_index = dev_index;
4830 }
4831 static inline void
ethtool_rss_get_req_dump_set_header_dev_name(struct ethtool_rss_get_req_dump * req,const char * dev_name)4832 ethtool_rss_get_req_dump_set_header_dev_name(struct ethtool_rss_get_req_dump *req,
4833 const char *dev_name)
4834 {
4835 free(req->header.dev_name);
4836 req->header._present.dev_name_len = strlen(dev_name);
4837 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4838 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4839 req->header.dev_name[req->header._present.dev_name_len] = 0;
4840 }
4841 static inline void
ethtool_rss_get_req_dump_set_header_flags(struct ethtool_rss_get_req_dump * req,__u32 flags)4842 ethtool_rss_get_req_dump_set_header_flags(struct ethtool_rss_get_req_dump *req,
4843 __u32 flags)
4844 {
4845 req->_present.header = 1;
4846 req->header._present.flags = 1;
4847 req->header.flags = flags;
4848 }
4849
4850 struct ethtool_rss_get_list {
4851 struct ethtool_rss_get_list *next;
4852 struct ethtool_rss_get_rsp obj __attribute__ ((aligned (8)));
4853 };
4854
4855 void ethtool_rss_get_list_free(struct ethtool_rss_get_list *rsp);
4856
4857 struct ethtool_rss_get_list *
4858 ethtool_rss_get_dump(struct ynl_sock *ys, struct ethtool_rss_get_req_dump *req);
4859
4860 /* ============== ETHTOOL_MSG_PLCA_GET_CFG ============== */
4861 /* ETHTOOL_MSG_PLCA_GET_CFG - do */
4862 struct ethtool_plca_get_cfg_req {
4863 struct {
4864 __u32 header:1;
4865 } _present;
4866
4867 struct ethtool_header header;
4868 };
4869
4870 static inline struct ethtool_plca_get_cfg_req *
ethtool_plca_get_cfg_req_alloc(void)4871 ethtool_plca_get_cfg_req_alloc(void)
4872 {
4873 return calloc(1, sizeof(struct ethtool_plca_get_cfg_req));
4874 }
4875 void ethtool_plca_get_cfg_req_free(struct ethtool_plca_get_cfg_req *req);
4876
4877 static inline void
ethtool_plca_get_cfg_req_set_header_dev_index(struct ethtool_plca_get_cfg_req * req,__u32 dev_index)4878 ethtool_plca_get_cfg_req_set_header_dev_index(struct ethtool_plca_get_cfg_req *req,
4879 __u32 dev_index)
4880 {
4881 req->_present.header = 1;
4882 req->header._present.dev_index = 1;
4883 req->header.dev_index = dev_index;
4884 }
4885 static inline void
ethtool_plca_get_cfg_req_set_header_dev_name(struct ethtool_plca_get_cfg_req * req,const char * dev_name)4886 ethtool_plca_get_cfg_req_set_header_dev_name(struct ethtool_plca_get_cfg_req *req,
4887 const char *dev_name)
4888 {
4889 free(req->header.dev_name);
4890 req->header._present.dev_name_len = strlen(dev_name);
4891 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4892 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4893 req->header.dev_name[req->header._present.dev_name_len] = 0;
4894 }
4895 static inline void
ethtool_plca_get_cfg_req_set_header_flags(struct ethtool_plca_get_cfg_req * req,__u32 flags)4896 ethtool_plca_get_cfg_req_set_header_flags(struct ethtool_plca_get_cfg_req *req,
4897 __u32 flags)
4898 {
4899 req->_present.header = 1;
4900 req->header._present.flags = 1;
4901 req->header.flags = flags;
4902 }
4903
4904 struct ethtool_plca_get_cfg_rsp {
4905 struct {
4906 __u32 header:1;
4907 __u32 version:1;
4908 __u32 enabled:1;
4909 __u32 status:1;
4910 __u32 node_cnt:1;
4911 __u32 node_id:1;
4912 __u32 to_tmr:1;
4913 __u32 burst_cnt:1;
4914 __u32 burst_tmr:1;
4915 } _present;
4916
4917 struct ethtool_header header;
4918 __u16 version;
4919 __u8 enabled;
4920 __u8 status;
4921 __u32 node_cnt;
4922 __u32 node_id;
4923 __u32 to_tmr;
4924 __u32 burst_cnt;
4925 __u32 burst_tmr;
4926 };
4927
4928 void ethtool_plca_get_cfg_rsp_free(struct ethtool_plca_get_cfg_rsp *rsp);
4929
4930 /*
4931 * Get PLCA params.
4932 */
4933 struct ethtool_plca_get_cfg_rsp *
4934 ethtool_plca_get_cfg(struct ynl_sock *ys, struct ethtool_plca_get_cfg_req *req);
4935
4936 /* ETHTOOL_MSG_PLCA_GET_CFG - dump */
4937 struct ethtool_plca_get_cfg_req_dump {
4938 struct {
4939 __u32 header:1;
4940 } _present;
4941
4942 struct ethtool_header header;
4943 };
4944
4945 static inline struct ethtool_plca_get_cfg_req_dump *
ethtool_plca_get_cfg_req_dump_alloc(void)4946 ethtool_plca_get_cfg_req_dump_alloc(void)
4947 {
4948 return calloc(1, sizeof(struct ethtool_plca_get_cfg_req_dump));
4949 }
4950 void
4951 ethtool_plca_get_cfg_req_dump_free(struct ethtool_plca_get_cfg_req_dump *req);
4952
4953 static inline void
ethtool_plca_get_cfg_req_dump_set_header_dev_index(struct ethtool_plca_get_cfg_req_dump * req,__u32 dev_index)4954 ethtool_plca_get_cfg_req_dump_set_header_dev_index(struct ethtool_plca_get_cfg_req_dump *req,
4955 __u32 dev_index)
4956 {
4957 req->_present.header = 1;
4958 req->header._present.dev_index = 1;
4959 req->header.dev_index = dev_index;
4960 }
4961 static inline void
ethtool_plca_get_cfg_req_dump_set_header_dev_name(struct ethtool_plca_get_cfg_req_dump * req,const char * dev_name)4962 ethtool_plca_get_cfg_req_dump_set_header_dev_name(struct ethtool_plca_get_cfg_req_dump *req,
4963 const char *dev_name)
4964 {
4965 free(req->header.dev_name);
4966 req->header._present.dev_name_len = strlen(dev_name);
4967 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
4968 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
4969 req->header.dev_name[req->header._present.dev_name_len] = 0;
4970 }
4971 static inline void
ethtool_plca_get_cfg_req_dump_set_header_flags(struct ethtool_plca_get_cfg_req_dump * req,__u32 flags)4972 ethtool_plca_get_cfg_req_dump_set_header_flags(struct ethtool_plca_get_cfg_req_dump *req,
4973 __u32 flags)
4974 {
4975 req->_present.header = 1;
4976 req->header._present.flags = 1;
4977 req->header.flags = flags;
4978 }
4979
4980 struct ethtool_plca_get_cfg_list {
4981 struct ethtool_plca_get_cfg_list *next;
4982 struct ethtool_plca_get_cfg_rsp obj __attribute__ ((aligned (8)));
4983 };
4984
4985 void ethtool_plca_get_cfg_list_free(struct ethtool_plca_get_cfg_list *rsp);
4986
4987 struct ethtool_plca_get_cfg_list *
4988 ethtool_plca_get_cfg_dump(struct ynl_sock *ys,
4989 struct ethtool_plca_get_cfg_req_dump *req);
4990
4991 /* ETHTOOL_MSG_PLCA_GET_CFG - notify */
4992 struct ethtool_plca_get_cfg_ntf {
4993 __u16 family;
4994 __u8 cmd;
4995 struct ynl_ntf_base_type *next;
4996 void (*free)(struct ethtool_plca_get_cfg_ntf *ntf);
4997 struct ethtool_plca_get_cfg_rsp obj __attribute__ ((aligned (8)));
4998 };
4999
5000 void ethtool_plca_get_cfg_ntf_free(struct ethtool_plca_get_cfg_ntf *rsp);
5001
5002 /* ============== ETHTOOL_MSG_PLCA_SET_CFG ============== */
5003 /* ETHTOOL_MSG_PLCA_SET_CFG - do */
5004 struct ethtool_plca_set_cfg_req {
5005 struct {
5006 __u32 header:1;
5007 __u32 version:1;
5008 __u32 enabled:1;
5009 __u32 status:1;
5010 __u32 node_cnt:1;
5011 __u32 node_id:1;
5012 __u32 to_tmr:1;
5013 __u32 burst_cnt:1;
5014 __u32 burst_tmr:1;
5015 } _present;
5016
5017 struct ethtool_header header;
5018 __u16 version;
5019 __u8 enabled;
5020 __u8 status;
5021 __u32 node_cnt;
5022 __u32 node_id;
5023 __u32 to_tmr;
5024 __u32 burst_cnt;
5025 __u32 burst_tmr;
5026 };
5027
5028 static inline struct ethtool_plca_set_cfg_req *
ethtool_plca_set_cfg_req_alloc(void)5029 ethtool_plca_set_cfg_req_alloc(void)
5030 {
5031 return calloc(1, sizeof(struct ethtool_plca_set_cfg_req));
5032 }
5033 void ethtool_plca_set_cfg_req_free(struct ethtool_plca_set_cfg_req *req);
5034
5035 static inline void
ethtool_plca_set_cfg_req_set_header_dev_index(struct ethtool_plca_set_cfg_req * req,__u32 dev_index)5036 ethtool_plca_set_cfg_req_set_header_dev_index(struct ethtool_plca_set_cfg_req *req,
5037 __u32 dev_index)
5038 {
5039 req->_present.header = 1;
5040 req->header._present.dev_index = 1;
5041 req->header.dev_index = dev_index;
5042 }
5043 static inline void
ethtool_plca_set_cfg_req_set_header_dev_name(struct ethtool_plca_set_cfg_req * req,const char * dev_name)5044 ethtool_plca_set_cfg_req_set_header_dev_name(struct ethtool_plca_set_cfg_req *req,
5045 const char *dev_name)
5046 {
5047 free(req->header.dev_name);
5048 req->header._present.dev_name_len = strlen(dev_name);
5049 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
5050 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
5051 req->header.dev_name[req->header._present.dev_name_len] = 0;
5052 }
5053 static inline void
ethtool_plca_set_cfg_req_set_header_flags(struct ethtool_plca_set_cfg_req * req,__u32 flags)5054 ethtool_plca_set_cfg_req_set_header_flags(struct ethtool_plca_set_cfg_req *req,
5055 __u32 flags)
5056 {
5057 req->_present.header = 1;
5058 req->header._present.flags = 1;
5059 req->header.flags = flags;
5060 }
5061 static inline void
ethtool_plca_set_cfg_req_set_version(struct ethtool_plca_set_cfg_req * req,__u16 version)5062 ethtool_plca_set_cfg_req_set_version(struct ethtool_plca_set_cfg_req *req,
5063 __u16 version)
5064 {
5065 req->_present.version = 1;
5066 req->version = version;
5067 }
5068 static inline void
ethtool_plca_set_cfg_req_set_enabled(struct ethtool_plca_set_cfg_req * req,__u8 enabled)5069 ethtool_plca_set_cfg_req_set_enabled(struct ethtool_plca_set_cfg_req *req,
5070 __u8 enabled)
5071 {
5072 req->_present.enabled = 1;
5073 req->enabled = enabled;
5074 }
5075 static inline void
ethtool_plca_set_cfg_req_set_status(struct ethtool_plca_set_cfg_req * req,__u8 status)5076 ethtool_plca_set_cfg_req_set_status(struct ethtool_plca_set_cfg_req *req,
5077 __u8 status)
5078 {
5079 req->_present.status = 1;
5080 req->status = status;
5081 }
5082 static inline void
ethtool_plca_set_cfg_req_set_node_cnt(struct ethtool_plca_set_cfg_req * req,__u32 node_cnt)5083 ethtool_plca_set_cfg_req_set_node_cnt(struct ethtool_plca_set_cfg_req *req,
5084 __u32 node_cnt)
5085 {
5086 req->_present.node_cnt = 1;
5087 req->node_cnt = node_cnt;
5088 }
5089 static inline void
ethtool_plca_set_cfg_req_set_node_id(struct ethtool_plca_set_cfg_req * req,__u32 node_id)5090 ethtool_plca_set_cfg_req_set_node_id(struct ethtool_plca_set_cfg_req *req,
5091 __u32 node_id)
5092 {
5093 req->_present.node_id = 1;
5094 req->node_id = node_id;
5095 }
5096 static inline void
ethtool_plca_set_cfg_req_set_to_tmr(struct ethtool_plca_set_cfg_req * req,__u32 to_tmr)5097 ethtool_plca_set_cfg_req_set_to_tmr(struct ethtool_plca_set_cfg_req *req,
5098 __u32 to_tmr)
5099 {
5100 req->_present.to_tmr = 1;
5101 req->to_tmr = to_tmr;
5102 }
5103 static inline void
ethtool_plca_set_cfg_req_set_burst_cnt(struct ethtool_plca_set_cfg_req * req,__u32 burst_cnt)5104 ethtool_plca_set_cfg_req_set_burst_cnt(struct ethtool_plca_set_cfg_req *req,
5105 __u32 burst_cnt)
5106 {
5107 req->_present.burst_cnt = 1;
5108 req->burst_cnt = burst_cnt;
5109 }
5110 static inline void
ethtool_plca_set_cfg_req_set_burst_tmr(struct ethtool_plca_set_cfg_req * req,__u32 burst_tmr)5111 ethtool_plca_set_cfg_req_set_burst_tmr(struct ethtool_plca_set_cfg_req *req,
5112 __u32 burst_tmr)
5113 {
5114 req->_present.burst_tmr = 1;
5115 req->burst_tmr = burst_tmr;
5116 }
5117
5118 /*
5119 * Set PLCA params.
5120 */
5121 int ethtool_plca_set_cfg(struct ynl_sock *ys,
5122 struct ethtool_plca_set_cfg_req *req);
5123
5124 /* ============== ETHTOOL_MSG_PLCA_GET_STATUS ============== */
5125 /* ETHTOOL_MSG_PLCA_GET_STATUS - do */
5126 struct ethtool_plca_get_status_req {
5127 struct {
5128 __u32 header:1;
5129 } _present;
5130
5131 struct ethtool_header header;
5132 };
5133
5134 static inline struct ethtool_plca_get_status_req *
ethtool_plca_get_status_req_alloc(void)5135 ethtool_plca_get_status_req_alloc(void)
5136 {
5137 return calloc(1, sizeof(struct ethtool_plca_get_status_req));
5138 }
5139 void ethtool_plca_get_status_req_free(struct ethtool_plca_get_status_req *req);
5140
5141 static inline void
ethtool_plca_get_status_req_set_header_dev_index(struct ethtool_plca_get_status_req * req,__u32 dev_index)5142 ethtool_plca_get_status_req_set_header_dev_index(struct ethtool_plca_get_status_req *req,
5143 __u32 dev_index)
5144 {
5145 req->_present.header = 1;
5146 req->header._present.dev_index = 1;
5147 req->header.dev_index = dev_index;
5148 }
5149 static inline void
ethtool_plca_get_status_req_set_header_dev_name(struct ethtool_plca_get_status_req * req,const char * dev_name)5150 ethtool_plca_get_status_req_set_header_dev_name(struct ethtool_plca_get_status_req *req,
5151 const char *dev_name)
5152 {
5153 free(req->header.dev_name);
5154 req->header._present.dev_name_len = strlen(dev_name);
5155 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
5156 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
5157 req->header.dev_name[req->header._present.dev_name_len] = 0;
5158 }
5159 static inline void
ethtool_plca_get_status_req_set_header_flags(struct ethtool_plca_get_status_req * req,__u32 flags)5160 ethtool_plca_get_status_req_set_header_flags(struct ethtool_plca_get_status_req *req,
5161 __u32 flags)
5162 {
5163 req->_present.header = 1;
5164 req->header._present.flags = 1;
5165 req->header.flags = flags;
5166 }
5167
5168 struct ethtool_plca_get_status_rsp {
5169 struct {
5170 __u32 header:1;
5171 __u32 version:1;
5172 __u32 enabled:1;
5173 __u32 status:1;
5174 __u32 node_cnt:1;
5175 __u32 node_id:1;
5176 __u32 to_tmr:1;
5177 __u32 burst_cnt:1;
5178 __u32 burst_tmr:1;
5179 } _present;
5180
5181 struct ethtool_header header;
5182 __u16 version;
5183 __u8 enabled;
5184 __u8 status;
5185 __u32 node_cnt;
5186 __u32 node_id;
5187 __u32 to_tmr;
5188 __u32 burst_cnt;
5189 __u32 burst_tmr;
5190 };
5191
5192 void ethtool_plca_get_status_rsp_free(struct ethtool_plca_get_status_rsp *rsp);
5193
5194 /*
5195 * Get PLCA status params.
5196 */
5197 struct ethtool_plca_get_status_rsp *
5198 ethtool_plca_get_status(struct ynl_sock *ys,
5199 struct ethtool_plca_get_status_req *req);
5200
5201 /* ETHTOOL_MSG_PLCA_GET_STATUS - dump */
5202 struct ethtool_plca_get_status_req_dump {
5203 struct {
5204 __u32 header:1;
5205 } _present;
5206
5207 struct ethtool_header header;
5208 };
5209
5210 static inline struct ethtool_plca_get_status_req_dump *
ethtool_plca_get_status_req_dump_alloc(void)5211 ethtool_plca_get_status_req_dump_alloc(void)
5212 {
5213 return calloc(1, sizeof(struct ethtool_plca_get_status_req_dump));
5214 }
5215 void
5216 ethtool_plca_get_status_req_dump_free(struct ethtool_plca_get_status_req_dump *req);
5217
5218 static inline void
ethtool_plca_get_status_req_dump_set_header_dev_index(struct ethtool_plca_get_status_req_dump * req,__u32 dev_index)5219 ethtool_plca_get_status_req_dump_set_header_dev_index(struct ethtool_plca_get_status_req_dump *req,
5220 __u32 dev_index)
5221 {
5222 req->_present.header = 1;
5223 req->header._present.dev_index = 1;
5224 req->header.dev_index = dev_index;
5225 }
5226 static inline void
ethtool_plca_get_status_req_dump_set_header_dev_name(struct ethtool_plca_get_status_req_dump * req,const char * dev_name)5227 ethtool_plca_get_status_req_dump_set_header_dev_name(struct ethtool_plca_get_status_req_dump *req,
5228 const char *dev_name)
5229 {
5230 free(req->header.dev_name);
5231 req->header._present.dev_name_len = strlen(dev_name);
5232 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
5233 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
5234 req->header.dev_name[req->header._present.dev_name_len] = 0;
5235 }
5236 static inline void
ethtool_plca_get_status_req_dump_set_header_flags(struct ethtool_plca_get_status_req_dump * req,__u32 flags)5237 ethtool_plca_get_status_req_dump_set_header_flags(struct ethtool_plca_get_status_req_dump *req,
5238 __u32 flags)
5239 {
5240 req->_present.header = 1;
5241 req->header._present.flags = 1;
5242 req->header.flags = flags;
5243 }
5244
5245 struct ethtool_plca_get_status_list {
5246 struct ethtool_plca_get_status_list *next;
5247 struct ethtool_plca_get_status_rsp obj __attribute__ ((aligned (8)));
5248 };
5249
5250 void
5251 ethtool_plca_get_status_list_free(struct ethtool_plca_get_status_list *rsp);
5252
5253 struct ethtool_plca_get_status_list *
5254 ethtool_plca_get_status_dump(struct ynl_sock *ys,
5255 struct ethtool_plca_get_status_req_dump *req);
5256
5257 /* ============== ETHTOOL_MSG_MM_GET ============== */
5258 /* ETHTOOL_MSG_MM_GET - do */
5259 struct ethtool_mm_get_req {
5260 struct {
5261 __u32 header:1;
5262 } _present;
5263
5264 struct ethtool_header header;
5265 };
5266
ethtool_mm_get_req_alloc(void)5267 static inline struct ethtool_mm_get_req *ethtool_mm_get_req_alloc(void)
5268 {
5269 return calloc(1, sizeof(struct ethtool_mm_get_req));
5270 }
5271 void ethtool_mm_get_req_free(struct ethtool_mm_get_req *req);
5272
5273 static inline void
ethtool_mm_get_req_set_header_dev_index(struct ethtool_mm_get_req * req,__u32 dev_index)5274 ethtool_mm_get_req_set_header_dev_index(struct ethtool_mm_get_req *req,
5275 __u32 dev_index)
5276 {
5277 req->_present.header = 1;
5278 req->header._present.dev_index = 1;
5279 req->header.dev_index = dev_index;
5280 }
5281 static inline void
ethtool_mm_get_req_set_header_dev_name(struct ethtool_mm_get_req * req,const char * dev_name)5282 ethtool_mm_get_req_set_header_dev_name(struct ethtool_mm_get_req *req,
5283 const char *dev_name)
5284 {
5285 free(req->header.dev_name);
5286 req->header._present.dev_name_len = strlen(dev_name);
5287 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
5288 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
5289 req->header.dev_name[req->header._present.dev_name_len] = 0;
5290 }
5291 static inline void
ethtool_mm_get_req_set_header_flags(struct ethtool_mm_get_req * req,__u32 flags)5292 ethtool_mm_get_req_set_header_flags(struct ethtool_mm_get_req *req,
5293 __u32 flags)
5294 {
5295 req->_present.header = 1;
5296 req->header._present.flags = 1;
5297 req->header.flags = flags;
5298 }
5299
5300 struct ethtool_mm_get_rsp {
5301 struct {
5302 __u32 header:1;
5303 __u32 pmac_enabled:1;
5304 __u32 tx_enabled:1;
5305 __u32 tx_active:1;
5306 __u32 tx_min_frag_size:1;
5307 __u32 rx_min_frag_size:1;
5308 __u32 verify_enabled:1;
5309 __u32 verify_time:1;
5310 __u32 max_verify_time:1;
5311 __u32 stats:1;
5312 } _present;
5313
5314 struct ethtool_header header;
5315 __u8 pmac_enabled;
5316 __u8 tx_enabled;
5317 __u8 tx_active;
5318 __u32 tx_min_frag_size;
5319 __u32 rx_min_frag_size;
5320 __u8 verify_enabled;
5321 __u32 verify_time;
5322 __u32 max_verify_time;
5323 struct ethtool_mm_stat stats;
5324 };
5325
5326 void ethtool_mm_get_rsp_free(struct ethtool_mm_get_rsp *rsp);
5327
5328 /*
5329 * Get MAC Merge configuration and state
5330 */
5331 struct ethtool_mm_get_rsp *
5332 ethtool_mm_get(struct ynl_sock *ys, struct ethtool_mm_get_req *req);
5333
5334 /* ETHTOOL_MSG_MM_GET - dump */
5335 struct ethtool_mm_get_req_dump {
5336 struct {
5337 __u32 header:1;
5338 } _present;
5339
5340 struct ethtool_header header;
5341 };
5342
5343 static inline struct ethtool_mm_get_req_dump *
ethtool_mm_get_req_dump_alloc(void)5344 ethtool_mm_get_req_dump_alloc(void)
5345 {
5346 return calloc(1, sizeof(struct ethtool_mm_get_req_dump));
5347 }
5348 void ethtool_mm_get_req_dump_free(struct ethtool_mm_get_req_dump *req);
5349
5350 static inline void
ethtool_mm_get_req_dump_set_header_dev_index(struct ethtool_mm_get_req_dump * req,__u32 dev_index)5351 ethtool_mm_get_req_dump_set_header_dev_index(struct ethtool_mm_get_req_dump *req,
5352 __u32 dev_index)
5353 {
5354 req->_present.header = 1;
5355 req->header._present.dev_index = 1;
5356 req->header.dev_index = dev_index;
5357 }
5358 static inline void
ethtool_mm_get_req_dump_set_header_dev_name(struct ethtool_mm_get_req_dump * req,const char * dev_name)5359 ethtool_mm_get_req_dump_set_header_dev_name(struct ethtool_mm_get_req_dump *req,
5360 const char *dev_name)
5361 {
5362 free(req->header.dev_name);
5363 req->header._present.dev_name_len = strlen(dev_name);
5364 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
5365 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
5366 req->header.dev_name[req->header._present.dev_name_len] = 0;
5367 }
5368 static inline void
ethtool_mm_get_req_dump_set_header_flags(struct ethtool_mm_get_req_dump * req,__u32 flags)5369 ethtool_mm_get_req_dump_set_header_flags(struct ethtool_mm_get_req_dump *req,
5370 __u32 flags)
5371 {
5372 req->_present.header = 1;
5373 req->header._present.flags = 1;
5374 req->header.flags = flags;
5375 }
5376
5377 struct ethtool_mm_get_list {
5378 struct ethtool_mm_get_list *next;
5379 struct ethtool_mm_get_rsp obj __attribute__ ((aligned (8)));
5380 };
5381
5382 void ethtool_mm_get_list_free(struct ethtool_mm_get_list *rsp);
5383
5384 struct ethtool_mm_get_list *
5385 ethtool_mm_get_dump(struct ynl_sock *ys, struct ethtool_mm_get_req_dump *req);
5386
5387 /* ETHTOOL_MSG_MM_GET - notify */
5388 struct ethtool_mm_get_ntf {
5389 __u16 family;
5390 __u8 cmd;
5391 struct ynl_ntf_base_type *next;
5392 void (*free)(struct ethtool_mm_get_ntf *ntf);
5393 struct ethtool_mm_get_rsp obj __attribute__ ((aligned (8)));
5394 };
5395
5396 void ethtool_mm_get_ntf_free(struct ethtool_mm_get_ntf *rsp);
5397
5398 /* ============== ETHTOOL_MSG_MM_SET ============== */
5399 /* ETHTOOL_MSG_MM_SET - do */
5400 struct ethtool_mm_set_req {
5401 struct {
5402 __u32 header:1;
5403 __u32 verify_enabled:1;
5404 __u32 verify_time:1;
5405 __u32 tx_enabled:1;
5406 __u32 pmac_enabled:1;
5407 __u32 tx_min_frag_size:1;
5408 } _present;
5409
5410 struct ethtool_header header;
5411 __u8 verify_enabled;
5412 __u32 verify_time;
5413 __u8 tx_enabled;
5414 __u8 pmac_enabled;
5415 __u32 tx_min_frag_size;
5416 };
5417
ethtool_mm_set_req_alloc(void)5418 static inline struct ethtool_mm_set_req *ethtool_mm_set_req_alloc(void)
5419 {
5420 return calloc(1, sizeof(struct ethtool_mm_set_req));
5421 }
5422 void ethtool_mm_set_req_free(struct ethtool_mm_set_req *req);
5423
5424 static inline void
ethtool_mm_set_req_set_header_dev_index(struct ethtool_mm_set_req * req,__u32 dev_index)5425 ethtool_mm_set_req_set_header_dev_index(struct ethtool_mm_set_req *req,
5426 __u32 dev_index)
5427 {
5428 req->_present.header = 1;
5429 req->header._present.dev_index = 1;
5430 req->header.dev_index = dev_index;
5431 }
5432 static inline void
ethtool_mm_set_req_set_header_dev_name(struct ethtool_mm_set_req * req,const char * dev_name)5433 ethtool_mm_set_req_set_header_dev_name(struct ethtool_mm_set_req *req,
5434 const char *dev_name)
5435 {
5436 free(req->header.dev_name);
5437 req->header._present.dev_name_len = strlen(dev_name);
5438 req->header.dev_name = malloc(req->header._present.dev_name_len + 1);
5439 memcpy(req->header.dev_name, dev_name, req->header._present.dev_name_len);
5440 req->header.dev_name[req->header._present.dev_name_len] = 0;
5441 }
5442 static inline void
ethtool_mm_set_req_set_header_flags(struct ethtool_mm_set_req * req,__u32 flags)5443 ethtool_mm_set_req_set_header_flags(struct ethtool_mm_set_req *req,
5444 __u32 flags)
5445 {
5446 req->_present.header = 1;
5447 req->header._present.flags = 1;
5448 req->header.flags = flags;
5449 }
5450 static inline void
ethtool_mm_set_req_set_verify_enabled(struct ethtool_mm_set_req * req,__u8 verify_enabled)5451 ethtool_mm_set_req_set_verify_enabled(struct ethtool_mm_set_req *req,
5452 __u8 verify_enabled)
5453 {
5454 req->_present.verify_enabled = 1;
5455 req->verify_enabled = verify_enabled;
5456 }
5457 static inline void
ethtool_mm_set_req_set_verify_time(struct ethtool_mm_set_req * req,__u32 verify_time)5458 ethtool_mm_set_req_set_verify_time(struct ethtool_mm_set_req *req,
5459 __u32 verify_time)
5460 {
5461 req->_present.verify_time = 1;
5462 req->verify_time = verify_time;
5463 }
5464 static inline void
ethtool_mm_set_req_set_tx_enabled(struct ethtool_mm_set_req * req,__u8 tx_enabled)5465 ethtool_mm_set_req_set_tx_enabled(struct ethtool_mm_set_req *req,
5466 __u8 tx_enabled)
5467 {
5468 req->_present.tx_enabled = 1;
5469 req->tx_enabled = tx_enabled;
5470 }
5471 static inline void
ethtool_mm_set_req_set_pmac_enabled(struct ethtool_mm_set_req * req,__u8 pmac_enabled)5472 ethtool_mm_set_req_set_pmac_enabled(struct ethtool_mm_set_req *req,
5473 __u8 pmac_enabled)
5474 {
5475 req->_present.pmac_enabled = 1;
5476 req->pmac_enabled = pmac_enabled;
5477 }
5478 static inline void
ethtool_mm_set_req_set_tx_min_frag_size(struct ethtool_mm_set_req * req,__u32 tx_min_frag_size)5479 ethtool_mm_set_req_set_tx_min_frag_size(struct ethtool_mm_set_req *req,
5480 __u32 tx_min_frag_size)
5481 {
5482 req->_present.tx_min_frag_size = 1;
5483 req->tx_min_frag_size = tx_min_frag_size;
5484 }
5485
5486 /*
5487 * Set MAC Merge configuration
5488 */
5489 int ethtool_mm_set(struct ynl_sock *ys, struct ethtool_mm_set_req *req);
5490
5491 /* ETHTOOL_MSG_CABLE_TEST_NTF - event */
5492 struct ethtool_cable_test_ntf_rsp {
5493 struct {
5494 __u32 header:1;
5495 __u32 status:1;
5496 } _present;
5497
5498 struct ethtool_header header;
5499 __u8 status;
5500 };
5501
5502 struct ethtool_cable_test_ntf {
5503 __u16 family;
5504 __u8 cmd;
5505 struct ynl_ntf_base_type *next;
5506 void (*free)(struct ethtool_cable_test_ntf *ntf);
5507 struct ethtool_cable_test_ntf_rsp obj __attribute__ ((aligned (8)));
5508 };
5509
5510 void ethtool_cable_test_ntf_free(struct ethtool_cable_test_ntf *rsp);
5511
5512 /* ETHTOOL_MSG_CABLE_TEST_TDR_NTF - event */
5513 struct ethtool_cable_test_tdr_ntf_rsp {
5514 struct {
5515 __u32 header:1;
5516 __u32 status:1;
5517 __u32 nest:1;
5518 } _present;
5519
5520 struct ethtool_header header;
5521 __u8 status;
5522 struct ethtool_cable_nest nest;
5523 };
5524
5525 struct ethtool_cable_test_tdr_ntf {
5526 __u16 family;
5527 __u8 cmd;
5528 struct ynl_ntf_base_type *next;
5529 void (*free)(struct ethtool_cable_test_tdr_ntf *ntf);
5530 struct ethtool_cable_test_tdr_ntf_rsp obj __attribute__ ((aligned (8)));
5531 };
5532
5533 void ethtool_cable_test_tdr_ntf_free(struct ethtool_cable_test_tdr_ntf *rsp);
5534
5535 #endif /* _LINUX_ETHTOOL_GEN_H */
5536