1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
2 /* Do not edit directly, auto-generated from: */
3 /*	Documentation/netlink/specs/netdev.yaml */
4 /* YNL-GEN user header */
5 
6 #ifndef _LINUX_NETDEV_GEN_H
7 #define _LINUX_NETDEV_GEN_H
8 
9 #include <stdlib.h>
10 #include <string.h>
11 #include <linux/types.h>
12 #include <linux/netdev.h>
13 
14 struct ynl_sock;
15 
16 extern const struct ynl_family ynl_netdev_family;
17 
18 /* Enums */
19 const char *netdev_op_str(int op);
20 const char *netdev_xdp_act_str(enum netdev_xdp_act value);
21 
22 /* Common nested types */
23 /* ============== NETDEV_CMD_DEV_GET ============== */
24 /* NETDEV_CMD_DEV_GET - do */
25 struct netdev_dev_get_req {
26 	struct {
27 		__u32 ifindex:1;
28 	} _present;
29 
30 	__u32 ifindex;
31 };
32 
netdev_dev_get_req_alloc(void)33 static inline struct netdev_dev_get_req *netdev_dev_get_req_alloc(void)
34 {
35 	return calloc(1, sizeof(struct netdev_dev_get_req));
36 }
37 void netdev_dev_get_req_free(struct netdev_dev_get_req *req);
38 
39 static inline void
netdev_dev_get_req_set_ifindex(struct netdev_dev_get_req * req,__u32 ifindex)40 netdev_dev_get_req_set_ifindex(struct netdev_dev_get_req *req, __u32 ifindex)
41 {
42 	req->_present.ifindex = 1;
43 	req->ifindex = ifindex;
44 }
45 
46 struct netdev_dev_get_rsp {
47 	struct {
48 		__u32 ifindex:1;
49 		__u32 xdp_features:1;
50 		__u32 xdp_zc_max_segs:1;
51 	} _present;
52 
53 	__u32 ifindex;
54 	__u64 xdp_features;
55 	__u32 xdp_zc_max_segs;
56 };
57 
58 void netdev_dev_get_rsp_free(struct netdev_dev_get_rsp *rsp);
59 
60 /*
61  * Get / dump information about a netdev.
62  */
63 struct netdev_dev_get_rsp *
64 netdev_dev_get(struct ynl_sock *ys, struct netdev_dev_get_req *req);
65 
66 /* NETDEV_CMD_DEV_GET - dump */
67 struct netdev_dev_get_list {
68 	struct netdev_dev_get_list *next;
69 	struct netdev_dev_get_rsp obj __attribute__ ((aligned (8)));
70 };
71 
72 void netdev_dev_get_list_free(struct netdev_dev_get_list *rsp);
73 
74 struct netdev_dev_get_list *netdev_dev_get_dump(struct ynl_sock *ys);
75 
76 /* NETDEV_CMD_DEV_GET - notify */
77 struct netdev_dev_get_ntf {
78 	__u16 family;
79 	__u8 cmd;
80 	struct ynl_ntf_base_type *next;
81 	void (*free)(struct netdev_dev_get_ntf *ntf);
82 	struct netdev_dev_get_rsp obj __attribute__ ((aligned (8)));
83 };
84 
85 void netdev_dev_get_ntf_free(struct netdev_dev_get_ntf *rsp);
86 
87 #endif /* _LINUX_NETDEV_GEN_H */
88