1 // SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 2 /* Do not edit directly, auto-generated from: */ 3 /* Documentation/netlink/specs/netdev.yaml */ 4 /* YNL-GEN kernel source */ 5 6 #include <net/netlink.h> 7 #include <net/genetlink.h> 8 9 #include "netdev-genl-gen.h" 10 11 #include <uapi/linux/netdev.h> 12 13 /* Integer value ranges */ 14 static const struct netlink_range_validation netdev_a_page_pool_id_range = { 15 .min = 1ULL, 16 .max = 4294967295ULL, 17 }; 18 19 static const struct netlink_range_validation netdev_a_page_pool_ifindex_range = { 20 .min = 1ULL, 21 .max = 2147483647ULL, 22 }; 23 24 /* Common nested types */ 25 const struct nla_policy netdev_page_pool_info_nl_policy[NETDEV_A_PAGE_POOL_IFINDEX + 1] = { 26 [NETDEV_A_PAGE_POOL_ID] = NLA_POLICY_FULL_RANGE(NLA_UINT, &netdev_a_page_pool_id_range), 27 [NETDEV_A_PAGE_POOL_IFINDEX] = NLA_POLICY_FULL_RANGE(NLA_U32, &netdev_a_page_pool_ifindex_range), 28 }; 29 30 /* NETDEV_CMD_DEV_GET - do */ 31 static const struct nla_policy netdev_dev_get_nl_policy[NETDEV_A_DEV_IFINDEX + 1] = { 32 [NETDEV_A_DEV_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1), 33 }; 34 35 /* NETDEV_CMD_PAGE_POOL_GET - do */ 36 #ifdef CONFIG_PAGE_POOL 37 static const struct nla_policy netdev_page_pool_get_nl_policy[NETDEV_A_PAGE_POOL_ID + 1] = { 38 [NETDEV_A_PAGE_POOL_ID] = NLA_POLICY_FULL_RANGE(NLA_UINT, &netdev_a_page_pool_id_range), 39 }; 40 #endif /* CONFIG_PAGE_POOL */ 41 42 /* NETDEV_CMD_PAGE_POOL_STATS_GET - do */ 43 #ifdef CONFIG_PAGE_POOL_STATS 44 static const struct nla_policy netdev_page_pool_stats_get_nl_policy[NETDEV_A_PAGE_POOL_STATS_INFO + 1] = { 45 [NETDEV_A_PAGE_POOL_STATS_INFO] = NLA_POLICY_NESTED(netdev_page_pool_info_nl_policy), 46 }; 47 #endif /* CONFIG_PAGE_POOL_STATS */ 48 49 /* NETDEV_CMD_QUEUE_GET - do */ 50 static const struct nla_policy netdev_queue_get_do_nl_policy[NETDEV_A_QUEUE_TYPE + 1] = { 51 [NETDEV_A_QUEUE_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1), 52 [NETDEV_A_QUEUE_TYPE] = NLA_POLICY_MAX(NLA_U32, 1), 53 [NETDEV_A_QUEUE_ID] = { .type = NLA_U32, }, 54 }; 55 56 /* NETDEV_CMD_QUEUE_GET - dump */ 57 static const struct nla_policy netdev_queue_get_dump_nl_policy[NETDEV_A_QUEUE_IFINDEX + 1] = { 58 [NETDEV_A_QUEUE_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1), 59 }; 60 61 /* NETDEV_CMD_NAPI_GET - do */ 62 static const struct nla_policy netdev_napi_get_do_nl_policy[NETDEV_A_NAPI_ID + 1] = { 63 [NETDEV_A_NAPI_ID] = { .type = NLA_U32, }, 64 }; 65 66 /* NETDEV_CMD_NAPI_GET - dump */ 67 static const struct nla_policy netdev_napi_get_dump_nl_policy[NETDEV_A_NAPI_IFINDEX + 1] = { 68 [NETDEV_A_NAPI_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1), 69 }; 70 71 /* Ops table for netdev */ 72 static const struct genl_split_ops netdev_nl_ops[] = { 73 { 74 .cmd = NETDEV_CMD_DEV_GET, 75 .doit = netdev_nl_dev_get_doit, 76 .policy = netdev_dev_get_nl_policy, 77 .maxattr = NETDEV_A_DEV_IFINDEX, 78 .flags = GENL_CMD_CAP_DO, 79 }, 80 { 81 .cmd = NETDEV_CMD_DEV_GET, 82 .dumpit = netdev_nl_dev_get_dumpit, 83 .flags = GENL_CMD_CAP_DUMP, 84 }, 85 #ifdef CONFIG_PAGE_POOL 86 { 87 .cmd = NETDEV_CMD_PAGE_POOL_GET, 88 .doit = netdev_nl_page_pool_get_doit, 89 .policy = netdev_page_pool_get_nl_policy, 90 .maxattr = NETDEV_A_PAGE_POOL_ID, 91 .flags = GENL_CMD_CAP_DO, 92 }, 93 { 94 .cmd = NETDEV_CMD_PAGE_POOL_GET, 95 .dumpit = netdev_nl_page_pool_get_dumpit, 96 .flags = GENL_CMD_CAP_DUMP, 97 }, 98 #endif /* CONFIG_PAGE_POOL */ 99 #ifdef CONFIG_PAGE_POOL_STATS 100 { 101 .cmd = NETDEV_CMD_PAGE_POOL_STATS_GET, 102 .doit = netdev_nl_page_pool_stats_get_doit, 103 .policy = netdev_page_pool_stats_get_nl_policy, 104 .maxattr = NETDEV_A_PAGE_POOL_STATS_INFO, 105 .flags = GENL_CMD_CAP_DO, 106 }, 107 { 108 .cmd = NETDEV_CMD_PAGE_POOL_STATS_GET, 109 .dumpit = netdev_nl_page_pool_stats_get_dumpit, 110 .flags = GENL_CMD_CAP_DUMP, 111 }, 112 #endif /* CONFIG_PAGE_POOL_STATS */ 113 { 114 .cmd = NETDEV_CMD_QUEUE_GET, 115 .doit = netdev_nl_queue_get_doit, 116 .policy = netdev_queue_get_do_nl_policy, 117 .maxattr = NETDEV_A_QUEUE_TYPE, 118 .flags = GENL_CMD_CAP_DO, 119 }, 120 { 121 .cmd = NETDEV_CMD_QUEUE_GET, 122 .dumpit = netdev_nl_queue_get_dumpit, 123 .policy = netdev_queue_get_dump_nl_policy, 124 .maxattr = NETDEV_A_QUEUE_IFINDEX, 125 .flags = GENL_CMD_CAP_DUMP, 126 }, 127 { 128 .cmd = NETDEV_CMD_NAPI_GET, 129 .doit = netdev_nl_napi_get_doit, 130 .policy = netdev_napi_get_do_nl_policy, 131 .maxattr = NETDEV_A_NAPI_ID, 132 .flags = GENL_CMD_CAP_DO, 133 }, 134 { 135 .cmd = NETDEV_CMD_NAPI_GET, 136 .dumpit = netdev_nl_napi_get_dumpit, 137 .policy = netdev_napi_get_dump_nl_policy, 138 .maxattr = NETDEV_A_NAPI_IFINDEX, 139 .flags = GENL_CMD_CAP_DUMP, 140 }, 141 }; 142 143 static const struct genl_multicast_group netdev_nl_mcgrps[] = { 144 [NETDEV_NLGRP_MGMT] = { "mgmt", }, 145 [NETDEV_NLGRP_PAGE_POOL] = { "page-pool", }, 146 }; 147 148 struct genl_family netdev_nl_family __ro_after_init = { 149 .name = NETDEV_FAMILY_NAME, 150 .version = NETDEV_FAMILY_VERSION, 151 .netnsok = true, 152 .parallel_ops = true, 153 .module = THIS_MODULE, 154 .split_ops = netdev_nl_ops, 155 .n_split_ops = ARRAY_SIZE(netdev_nl_ops), 156 .mcgrps = netdev_nl_mcgrps, 157 .n_mcgrps = ARRAY_SIZE(netdev_nl_mcgrps), 158 }; 159