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 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 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 } _present; 51 52 __u32 ifindex; 53 __u64 xdp_features; 54 }; 55 56 void netdev_dev_get_rsp_free(struct netdev_dev_get_rsp *rsp); 57 58 /* 59 * Get / dump information about a netdev. 60 */ 61 struct netdev_dev_get_rsp * 62 netdev_dev_get(struct ynl_sock *ys, struct netdev_dev_get_req *req); 63 64 /* NETDEV_CMD_DEV_GET - dump */ 65 struct netdev_dev_get_list { 66 struct netdev_dev_get_list *next; 67 struct netdev_dev_get_rsp obj __attribute__ ((aligned (8))); 68 }; 69 70 void netdev_dev_get_list_free(struct netdev_dev_get_list *rsp); 71 72 struct netdev_dev_get_list *netdev_dev_get_dump(struct ynl_sock *ys); 73 74 /* NETDEV_CMD_DEV_GET - notify */ 75 struct netdev_dev_get_ntf { 76 __u16 family; 77 __u8 cmd; 78 struct ynl_ntf_base_type *next; 79 void (*free)(struct netdev_dev_get_ntf *ntf); 80 struct netdev_dev_get_rsp obj __attribute__ ((aligned (8))); 81 }; 82 83 void netdev_dev_get_ntf_free(struct netdev_dev_get_ntf *rsp); 84 85 #endif /* _LINUX_NETDEV_GEN_H */ 86