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 /* NETDEV_CMD_QSTATS_GET - dump */ 72 static const struct nla_policy netdev_qstats_get_nl_policy[NETDEV_A_QSTATS_SCOPE + 1] = { 73 [NETDEV_A_QSTATS_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1), 74 [NETDEV_A_QSTATS_SCOPE] = NLA_POLICY_MASK(NLA_UINT, 0x1), 75 }; 76 77 /* Ops table for netdev */ 78 static const struct genl_split_ops netdev_nl_ops[] = { 79 { 80 .cmd = NETDEV_CMD_DEV_GET, 81 .doit = netdev_nl_dev_get_doit, 82 .policy = netdev_dev_get_nl_policy, 83 .maxattr = NETDEV_A_DEV_IFINDEX, 84 .flags = GENL_CMD_CAP_DO, 85 }, 86 { 87 .cmd = NETDEV_CMD_DEV_GET, 88 .dumpit = netdev_nl_dev_get_dumpit, 89 .flags = GENL_CMD_CAP_DUMP, 90 }, 91 #ifdef CONFIG_PAGE_POOL 92 { 93 .cmd = NETDEV_CMD_PAGE_POOL_GET, 94 .doit = netdev_nl_page_pool_get_doit, 95 .policy = netdev_page_pool_get_nl_policy, 96 .maxattr = NETDEV_A_PAGE_POOL_ID, 97 .flags = GENL_CMD_CAP_DO, 98 }, 99 { 100 .cmd = NETDEV_CMD_PAGE_POOL_GET, 101 .dumpit = netdev_nl_page_pool_get_dumpit, 102 .flags = GENL_CMD_CAP_DUMP, 103 }, 104 #endif /* CONFIG_PAGE_POOL */ 105 #ifdef CONFIG_PAGE_POOL_STATS 106 { 107 .cmd = NETDEV_CMD_PAGE_POOL_STATS_GET, 108 .doit = netdev_nl_page_pool_stats_get_doit, 109 .policy = netdev_page_pool_stats_get_nl_policy, 110 .maxattr = NETDEV_A_PAGE_POOL_STATS_INFO, 111 .flags = GENL_CMD_CAP_DO, 112 }, 113 { 114 .cmd = NETDEV_CMD_PAGE_POOL_STATS_GET, 115 .dumpit = netdev_nl_page_pool_stats_get_dumpit, 116 .flags = GENL_CMD_CAP_DUMP, 117 }, 118 #endif /* CONFIG_PAGE_POOL_STATS */ 119 { 120 .cmd = NETDEV_CMD_QUEUE_GET, 121 .doit = netdev_nl_queue_get_doit, 122 .policy = netdev_queue_get_do_nl_policy, 123 .maxattr = NETDEV_A_QUEUE_TYPE, 124 .flags = GENL_CMD_CAP_DO, 125 }, 126 { 127 .cmd = NETDEV_CMD_QUEUE_GET, 128 .dumpit = netdev_nl_queue_get_dumpit, 129 .policy = netdev_queue_get_dump_nl_policy, 130 .maxattr = NETDEV_A_QUEUE_IFINDEX, 131 .flags = GENL_CMD_CAP_DUMP, 132 }, 133 { 134 .cmd = NETDEV_CMD_NAPI_GET, 135 .doit = netdev_nl_napi_get_doit, 136 .policy = netdev_napi_get_do_nl_policy, 137 .maxattr = NETDEV_A_NAPI_ID, 138 .flags = GENL_CMD_CAP_DO, 139 }, 140 { 141 .cmd = NETDEV_CMD_NAPI_GET, 142 .dumpit = netdev_nl_napi_get_dumpit, 143 .policy = netdev_napi_get_dump_nl_policy, 144 .maxattr = NETDEV_A_NAPI_IFINDEX, 145 .flags = GENL_CMD_CAP_DUMP, 146 }, 147 { 148 .cmd = NETDEV_CMD_QSTATS_GET, 149 .dumpit = netdev_nl_qstats_get_dumpit, 150 .policy = netdev_qstats_get_nl_policy, 151 .maxattr = NETDEV_A_QSTATS_SCOPE, 152 .flags = GENL_CMD_CAP_DUMP, 153 }, 154 }; 155 156 static const struct genl_multicast_group netdev_nl_mcgrps[] = { 157 [NETDEV_NLGRP_MGMT] = { "mgmt", }, 158 [NETDEV_NLGRP_PAGE_POOL] = { "page-pool", }, 159 }; 160 161 struct genl_family netdev_nl_family __ro_after_init = { 162 .name = NETDEV_FAMILY_NAME, 163 .version = NETDEV_FAMILY_VERSION, 164 .netnsok = true, 165 .parallel_ops = true, 166 .module = THIS_MODULE, 167 .split_ops = netdev_nl_ops, 168 .n_split_ops = ARRAY_SIZE(netdev_nl_ops), 169 .mcgrps = netdev_nl_mcgrps, 170 .n_mcgrps = ARRAY_SIZE(netdev_nl_mcgrps), 171 }; 172