Michal Kubecek | 2b4a899 | 2019-12-27 15:55:18 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #ifndef _NET_ETHTOOL_NETLINK_H |
| 4 | #define _NET_ETHTOOL_NETLINK_H |
| 5 | |
| 6 | #include <linux/ethtool_netlink.h> |
| 7 | #include <linux/netdevice.h> |
| 8 | #include <net/genetlink.h> |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 9 | #include <net/sock.h> |
| 10 | |
| 11 | struct ethnl_req_info; |
| 12 | |
Michal Kubecek | 9813054 | 2020-03-12 21:07:38 +0100 | [diff] [blame] | 13 | int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info, |
| 14 | const struct nlattr *nest, struct net *net, |
| 15 | struct netlink_ext_ack *extack, |
| 16 | bool require_dev); |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 17 | int ethnl_fill_reply_header(struct sk_buff *skb, struct net_device *dev, |
| 18 | u16 attrtype); |
| 19 | struct sk_buff *ethnl_reply_init(size_t payload, struct net_device *dev, u8 cmd, |
| 20 | u16 hdr_attrtype, struct genl_info *info, |
| 21 | void **ehdrp); |
Jakub Kicinski | c7d759e | 2020-07-09 17:42:47 -0700 | [diff] [blame] | 22 | void *ethnl_dump_put(struct sk_buff *skb, struct netlink_callback *cb, u8 cmd); |
Andrew Lunn | 0df960f | 2020-05-10 21:12:35 +0200 | [diff] [blame] | 23 | void *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd); |
| 24 | int ethnl_multicast(struct sk_buff *skb, struct net_device *dev); |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * ethnl_strz_size() - calculate attribute length for fixed size string |
| 28 | * @s: ETH_GSTRING_LEN sized string (may not be null terminated) |
| 29 | * |
| 30 | * Return: total length of an attribute with null terminated string from @s |
| 31 | */ |
| 32 | static inline int ethnl_strz_size(const char *s) |
| 33 | { |
| 34 | return nla_total_size(strnlen(s, ETH_GSTRING_LEN) + 1); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * ethnl_put_strz() - put string attribute with fixed size string |
Jakub Kicinski | f33b0e1 | 2021-04-12 11:47:07 -0700 | [diff] [blame] | 39 | * @skb: skb with the message |
| 40 | * @attrtype: attribute type |
| 41 | * @s: ETH_GSTRING_LEN sized string (may not be null terminated) |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 42 | * |
| 43 | * Puts an attribute with null terminated string from @s into the message. |
| 44 | * |
| 45 | * Return: 0 on success, negative error code on failure |
| 46 | */ |
| 47 | static inline int ethnl_put_strz(struct sk_buff *skb, u16 attrtype, |
| 48 | const char *s) |
| 49 | { |
| 50 | unsigned int len = strnlen(s, ETH_GSTRING_LEN); |
| 51 | struct nlattr *attr; |
| 52 | |
| 53 | attr = nla_reserve(skb, attrtype, len + 1); |
| 54 | if (!attr) |
| 55 | return -EMSGSIZE; |
| 56 | |
| 57 | memcpy(nla_data(attr), s, len); |
| 58 | ((char *)nla_data(attr))[len] = '\0'; |
| 59 | return 0; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * ethnl_update_u32() - update u32 value from NLA_U32 attribute |
| 64 | * @dst: value to update |
| 65 | * @attr: netlink attribute with new value or null |
| 66 | * @mod: pointer to bool for modification tracking |
| 67 | * |
| 68 | * Copy the u32 value from NLA_U32 netlink attribute @attr into variable |
| 69 | * pointed to by @dst; do nothing if @attr is null. Bool pointed to by @mod |
| 70 | * is set to true if this function changed the value of *dst, otherwise it |
| 71 | * is left as is. |
| 72 | */ |
| 73 | static inline void ethnl_update_u32(u32 *dst, const struct nlattr *attr, |
| 74 | bool *mod) |
| 75 | { |
| 76 | u32 val; |
| 77 | |
| 78 | if (!attr) |
| 79 | return; |
| 80 | val = nla_get_u32(attr); |
| 81 | if (*dst == val) |
| 82 | return; |
| 83 | |
| 84 | *dst = val; |
| 85 | *mod = true; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * ethnl_update_u8() - update u8 value from NLA_U8 attribute |
| 90 | * @dst: value to update |
| 91 | * @attr: netlink attribute with new value or null |
| 92 | * @mod: pointer to bool for modification tracking |
| 93 | * |
| 94 | * Copy the u8 value from NLA_U8 netlink attribute @attr into variable |
| 95 | * pointed to by @dst; do nothing if @attr is null. Bool pointed to by @mod |
| 96 | * is set to true if this function changed the value of *dst, otherwise it |
| 97 | * is left as is. |
| 98 | */ |
| 99 | static inline void ethnl_update_u8(u8 *dst, const struct nlattr *attr, |
| 100 | bool *mod) |
| 101 | { |
| 102 | u8 val; |
| 103 | |
| 104 | if (!attr) |
| 105 | return; |
| 106 | val = nla_get_u8(attr); |
| 107 | if (*dst == val) |
| 108 | return; |
| 109 | |
| 110 | *dst = val; |
| 111 | *mod = true; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * ethnl_update_bool32() - update u32 used as bool from NLA_U8 attribute |
| 116 | * @dst: value to update |
| 117 | * @attr: netlink attribute with new value or null |
| 118 | * @mod: pointer to bool for modification tracking |
| 119 | * |
| 120 | * Use the u8 value from NLA_U8 netlink attribute @attr to set u32 variable |
| 121 | * pointed to by @dst to 0 (if zero) or 1 (if not); do nothing if @attr is |
| 122 | * null. Bool pointed to by @mod is set to true if this function changed the |
| 123 | * logical value of *dst, otherwise it is left as is. |
| 124 | */ |
| 125 | static inline void ethnl_update_bool32(u32 *dst, const struct nlattr *attr, |
| 126 | bool *mod) |
| 127 | { |
| 128 | u8 val; |
| 129 | |
| 130 | if (!attr) |
| 131 | return; |
| 132 | val = !!nla_get_u8(attr); |
| 133 | if (!!*dst == val) |
| 134 | return; |
| 135 | |
| 136 | *dst = val; |
| 137 | *mod = true; |
| 138 | } |
| 139 | |
| 140 | /** |
Zheng Yongjun | b676c7f | 2021-06-02 14:54:28 +0800 | [diff] [blame] | 141 | * ethnl_update_binary() - update binary data from NLA_BINARY attribute |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 142 | * @dst: value to update |
| 143 | * @len: destination buffer length |
| 144 | * @attr: netlink attribute with new value or null |
| 145 | * @mod: pointer to bool for modification tracking |
| 146 | * |
| 147 | * Use the u8 value from NLA_U8 netlink attribute @attr to rewrite data block |
| 148 | * of length @len at @dst by attribute payload; do nothing if @attr is null. |
| 149 | * Bool pointed to by @mod is set to true if this function changed the logical |
| 150 | * value of *dst, otherwise it is left as is. |
| 151 | */ |
| 152 | static inline void ethnl_update_binary(void *dst, unsigned int len, |
| 153 | const struct nlattr *attr, bool *mod) |
| 154 | { |
| 155 | if (!attr) |
| 156 | return; |
| 157 | if (nla_len(attr) < len) |
| 158 | len = nla_len(attr); |
| 159 | if (!memcmp(dst, nla_data(attr), len)) |
| 160 | return; |
| 161 | |
| 162 | memcpy(dst, nla_data(attr), len); |
| 163 | *mod = true; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * ethnl_update_bitfield32() - update u32 value from NLA_BITFIELD32 attribute |
| 168 | * @dst: value to update |
| 169 | * @attr: netlink attribute with new value or null |
| 170 | * @mod: pointer to bool for modification tracking |
| 171 | * |
| 172 | * Update bits in u32 value which are set in attribute's mask to values from |
| 173 | * attribute's value. Do nothing if @attr is null or the value wouldn't change; |
| 174 | * otherwise, set bool pointed to by @mod to true. |
| 175 | */ |
| 176 | static inline void ethnl_update_bitfield32(u32 *dst, const struct nlattr *attr, |
| 177 | bool *mod) |
| 178 | { |
| 179 | struct nla_bitfield32 change; |
| 180 | u32 newval; |
| 181 | |
| 182 | if (!attr) |
| 183 | return; |
| 184 | change = nla_get_bitfield32(attr); |
| 185 | newval = (*dst & ~change.selector) | (change.value & change.selector); |
| 186 | if (*dst == newval) |
| 187 | return; |
| 188 | |
| 189 | *dst = newval; |
| 190 | *mod = true; |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * ethnl_reply_header_size() - total size of reply header |
| 195 | * |
| 196 | * This is an upper estimate so that we do not need to hold RTNL lock longer |
| 197 | * than necessary (to prevent rename between size estimate and composing the |
| 198 | * message). Accounts only for device ifindex and name as those are the only |
| 199 | * attributes ethnl_fill_reply_header() puts into the reply header. |
| 200 | */ |
| 201 | static inline unsigned int ethnl_reply_header_size(void) |
| 202 | { |
| 203 | return nla_total_size(nla_total_size(sizeof(u32)) + |
| 204 | nla_total_size(IFNAMSIZ)); |
| 205 | } |
| 206 | |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 207 | /* GET request handling */ |
| 208 | |
| 209 | /* Unified processing of GET requests uses two data structures: request info |
| 210 | * and reply data. Request info holds information parsed from client request |
| 211 | * and its stays constant through all request processing. Reply data holds data |
| 212 | * retrieved from ethtool_ops callbacks or other internal sources which is used |
| 213 | * to compose the reply. When processing a dump request, request info is filled |
| 214 | * only once (when the request message is parsed) but reply data is filled for |
| 215 | * each reply message. |
| 216 | * |
| 217 | * Both structures consist of part common for all request types (struct |
| 218 | * ethnl_req_info and struct ethnl_reply_data defined below) and optional |
| 219 | * parts specific for each request type. Common part always starts at offset 0. |
| 220 | */ |
| 221 | |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 222 | /** |
| 223 | * struct ethnl_req_info - base type of request information for GET requests |
| 224 | * @dev: network device the request is for (may be null) |
Eric Dumazet | e4b8954 | 2021-12-06 17:30:37 -0800 | [diff] [blame] | 225 | * @dev_tracker: refcount tracker for @dev reference |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 226 | * @flags: request flags common for all request types |
| 227 | * |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 228 | * This is a common base for request specific structures holding data from |
| 229 | * parsed userspace request. These always embed struct ethnl_req_info at |
| 230 | * zero offset. |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 231 | */ |
| 232 | struct ethnl_req_info { |
| 233 | struct net_device *dev; |
Eric Dumazet | e4b8954 | 2021-12-06 17:30:37 -0800 | [diff] [blame] | 234 | netdevice_tracker dev_tracker; |
Michal Kubecek | 041b1c5 | 2019-12-27 15:55:23 +0100 | [diff] [blame] | 235 | u32 flags; |
| 236 | }; |
Michal Kubecek | 2b4a899 | 2019-12-27 15:55:18 +0100 | [diff] [blame] | 237 | |
Eric Dumazet | 34ac17e | 2021-12-14 00:42:30 -0800 | [diff] [blame] | 238 | static inline void ethnl_parse_header_dev_put(struct ethnl_req_info *req_info) |
| 239 | { |
| 240 | dev_put_track(req_info->dev, &req_info->dev_tracker); |
| 241 | } |
| 242 | |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 243 | /** |
| 244 | * struct ethnl_reply_data - base type of reply data for GET requests |
| 245 | * @dev: device for current reply message; in single shot requests it is |
| 246 | * equal to ðnl_req_info.dev; in dumps it's different for each |
| 247 | * reply message |
| 248 | * |
| 249 | * This is a common base for request specific structures holding data for |
| 250 | * kernel reply message. These always embed struct ethnl_reply_data at zero |
| 251 | * offset. |
| 252 | */ |
| 253 | struct ethnl_reply_data { |
| 254 | struct net_device *dev; |
| 255 | }; |
| 256 | |
Heiner Kallweit | c5ab51d | 2021-08-01 12:37:39 +0200 | [diff] [blame] | 257 | int ethnl_ops_begin(struct net_device *dev); |
| 258 | void ethnl_ops_complete(struct net_device *dev); |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 259 | |
| 260 | /** |
| 261 | * struct ethnl_request_ops - unified handling of GET requests |
| 262 | * @request_cmd: command id for request (GET) |
| 263 | * @reply_cmd: command id for reply (GET_REPLY) |
| 264 | * @hdr_attr: attribute type for request header |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 265 | * @req_info_size: size of request info |
| 266 | * @reply_data_size: size of reply data |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 267 | * @allow_nodev_do: allow non-dump request with no device identification |
| 268 | * @parse_request: |
| 269 | * Parse request except common header (struct ethnl_req_info). Common |
| 270 | * header is already filled on entry, the rest up to @repdata_offset |
| 271 | * is zero initialized. This callback should only modify type specific |
| 272 | * request info by parsed attributes from request message. |
| 273 | * @prepare_data: |
| 274 | * Retrieve and prepare data needed to compose a reply message. Calls to |
| 275 | * ethtool_ops handlers are limited to this callback. Common reply data |
| 276 | * (struct ethnl_reply_data) is filled on entry, type specific part after |
| 277 | * it is zero initialized. This callback should only modify the type |
| 278 | * specific part of reply data. Device identification from struct |
| 279 | * ethnl_reply_data is to be used as for dump requests, it iterates |
| 280 | * through network devices while dev member of struct ethnl_req_info |
| 281 | * points to the device from client request. |
| 282 | * @reply_size: |
| 283 | * Estimate reply message size. Returned value must be sufficient for |
| 284 | * message payload without common reply header. The callback may returned |
| 285 | * estimate higher than actual message size if exact calculation would |
| 286 | * not be worth the saved memory space. |
| 287 | * @fill_reply: |
| 288 | * Fill reply message payload (except for common header) from reply data. |
| 289 | * The callback must not generate more payload than previously called |
| 290 | * ->reply_size() estimated. |
| 291 | * @cleanup_data: |
| 292 | * Optional cleanup called when reply data is no longer needed. Can be |
| 293 | * used e.g. to free any additional data structures outside the main |
| 294 | * structure which were allocated by ->prepare_data(). When processing |
| 295 | * dump requests, ->cleanup() is called for each message. |
| 296 | * |
| 297 | * Description of variable parts of GET request handling when using the |
| 298 | * unified infrastructure. When used, a pointer to an instance of this |
| 299 | * structure is to be added to ðnl_default_requests array and generic |
| 300 | * handlers ethnl_default_doit(), ethnl_default_dumpit(), |
Michal Kubecek | 5cf2a54 | 2019-12-27 15:55:58 +0100 | [diff] [blame] | 301 | * ethnl_default_start() and ethnl_default_done() used in @ethtool_genl_ops; |
| 302 | * ethnl_default_notify() can be used in @ethnl_notify_handlers to send |
| 303 | * notifications of the corresponding type. |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 304 | */ |
| 305 | struct ethnl_request_ops { |
| 306 | u8 request_cmd; |
| 307 | u8 reply_cmd; |
| 308 | u16 hdr_attr; |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 309 | unsigned int req_info_size; |
| 310 | unsigned int reply_data_size; |
Michal Kubecek | 728480f | 2019-12-27 15:55:38 +0100 | [diff] [blame] | 311 | bool allow_nodev_do; |
| 312 | |
| 313 | int (*parse_request)(struct ethnl_req_info *req_info, |
| 314 | struct nlattr **tb, |
| 315 | struct netlink_ext_ack *extack); |
| 316 | int (*prepare_data)(const struct ethnl_req_info *req_info, |
| 317 | struct ethnl_reply_data *reply_data, |
| 318 | struct genl_info *info); |
| 319 | int (*reply_size)(const struct ethnl_req_info *req_info, |
| 320 | const struct ethnl_reply_data *reply_data); |
| 321 | int (*fill_reply)(struct sk_buff *skb, |
| 322 | const struct ethnl_req_info *req_info, |
| 323 | const struct ethnl_reply_data *reply_data); |
| 324 | void (*cleanup_data)(struct ethnl_reply_data *reply_data); |
| 325 | }; |
| 326 | |
Michal Kubecek | 7192169 | 2019-12-27 15:55:43 +0100 | [diff] [blame] | 327 | /* request handlers */ |
| 328 | |
| 329 | extern const struct ethnl_request_ops ethnl_strset_request_ops; |
Michal Kubecek | 459e0b8 | 2019-12-27 15:55:48 +0100 | [diff] [blame] | 330 | extern const struct ethnl_request_ops ethnl_linkinfo_request_ops; |
Michal Kubecek | f625aa9 | 2019-12-27 15:56:08 +0100 | [diff] [blame] | 331 | extern const struct ethnl_request_ops ethnl_linkmodes_request_ops; |
Michal Kubecek | 3d2b847 | 2019-12-27 15:56:23 +0100 | [diff] [blame] | 332 | extern const struct ethnl_request_ops ethnl_linkstate_request_ops; |
Michal Kubecek | 6a94b8c | 2020-01-26 23:11:04 +0100 | [diff] [blame] | 333 | extern const struct ethnl_request_ops ethnl_debug_request_ops; |
Michal Kubecek | 51ea22b | 2020-01-26 23:11:13 +0100 | [diff] [blame] | 334 | extern const struct ethnl_request_ops ethnl_wol_request_ops; |
Michal Kubecek | 0524399 | 2020-03-12 21:07:48 +0100 | [diff] [blame] | 335 | extern const struct ethnl_request_ops ethnl_features_request_ops; |
Michal Kubecek | e16c338 | 2020-03-12 21:08:08 +0100 | [diff] [blame] | 336 | extern const struct ethnl_request_ops ethnl_privflags_request_ops; |
Michal Kubecek | e4a1717 | 2020-03-12 21:08:23 +0100 | [diff] [blame] | 337 | extern const struct ethnl_request_ops ethnl_rings_request_ops; |
Michal Kubecek | 0c84979 | 2020-03-12 21:08:38 +0100 | [diff] [blame] | 338 | extern const struct ethnl_request_ops ethnl_channels_request_ops; |
Michal Kubecek | 2172754 | 2020-03-28 00:01:08 +0100 | [diff] [blame] | 339 | extern const struct ethnl_request_ops ethnl_coalesce_request_ops; |
Michal Kubecek | 7f59fb3 | 2020-03-28 00:01:23 +0100 | [diff] [blame] | 340 | extern const struct ethnl_request_ops ethnl_pause_request_ops; |
Michal Kubecek | b7eeefe | 2020-03-28 00:01:38 +0100 | [diff] [blame] | 341 | extern const struct ethnl_request_ops ethnl_eee_request_ops; |
Michal Kubecek | 5b071c5 | 2020-03-28 00:01:58 +0100 | [diff] [blame] | 342 | extern const struct ethnl_request_ops ethnl_tsinfo_request_ops; |
Jakub Kicinski | 1e5d1f6 | 2021-03-29 20:59:52 -0700 | [diff] [blame] | 343 | extern const struct ethnl_request_ops ethnl_fec_request_ops; |
Vladyslav Tarasiuk | c781ff1 | 2021-04-09 11:06:34 +0300 | [diff] [blame] | 344 | extern const struct ethnl_request_ops ethnl_module_eeprom_request_ops; |
Jakub Kicinski | f09ea6f | 2021-04-16 12:27:39 -0700 | [diff] [blame] | 345 | extern const struct ethnl_request_ops ethnl_stats_request_ops; |
Yangbo Lu | c156174a | 2021-06-30 16:11:56 +0800 | [diff] [blame] | 346 | extern const struct ethnl_request_ops ethnl_phc_vclocks_request_ops; |
Ido Schimmel | 353407d | 2021-10-06 13:46:42 +0300 | [diff] [blame] | 347 | extern const struct ethnl_request_ops ethnl_module_request_ops; |
Michal Kubecek | 7192169 | 2019-12-27 15:55:43 +0100 | [diff] [blame] | 348 | |
Jakub Kicinski | 329d9c3 | 2020-10-05 15:07:36 -0700 | [diff] [blame] | 349 | extern const struct nla_policy ethnl_header_policy[ETHTOOL_A_HEADER_FLAGS + 1]; |
Jakub Kicinski | a0de1cd | 2020-10-05 15:07:39 -0700 | [diff] [blame] | 350 | extern const struct nla_policy ethnl_header_policy_stats[ETHTOOL_A_HEADER_FLAGS + 1]; |
Johannes Berg | db972e5 | 2020-10-07 12:53:50 +0200 | [diff] [blame] | 351 | extern const struct nla_policy ethnl_strset_get_policy[ETHTOOL_A_STRSET_COUNTS_ONLY + 1]; |
Jakub Kicinski | ff419af | 2020-10-05 15:07:35 -0700 | [diff] [blame] | 352 | extern const struct nla_policy ethnl_linkinfo_get_policy[ETHTOOL_A_LINKINFO_HEADER + 1]; |
| 353 | extern const struct nla_policy ethnl_linkinfo_set_policy[ETHTOOL_A_LINKINFO_TP_MDIX_CTRL + 1]; |
| 354 | extern const struct nla_policy ethnl_linkmodes_get_policy[ETHTOOL_A_LINKMODES_HEADER + 1]; |
Danielle Ratson | 012ce4d | 2021-02-02 20:06:06 +0200 | [diff] [blame] | 355 | extern const struct nla_policy ethnl_linkmodes_set_policy[ETHTOOL_A_LINKMODES_LANES + 1]; |
Jakub Kicinski | ff419af | 2020-10-05 15:07:35 -0700 | [diff] [blame] | 356 | extern const struct nla_policy ethnl_linkstate_get_policy[ETHTOOL_A_LINKSTATE_HEADER + 1]; |
| 357 | extern const struct nla_policy ethnl_debug_get_policy[ETHTOOL_A_DEBUG_HEADER + 1]; |
| 358 | extern const struct nla_policy ethnl_debug_set_policy[ETHTOOL_A_DEBUG_MSGMASK + 1]; |
| 359 | extern const struct nla_policy ethnl_wol_get_policy[ETHTOOL_A_WOL_HEADER + 1]; |
| 360 | extern const struct nla_policy ethnl_wol_set_policy[ETHTOOL_A_WOL_SOPASS + 1]; |
| 361 | extern const struct nla_policy ethnl_features_get_policy[ETHTOOL_A_FEATURES_HEADER + 1]; |
| 362 | extern const struct nla_policy ethnl_features_set_policy[ETHTOOL_A_FEATURES_WANTED + 1]; |
| 363 | extern const struct nla_policy ethnl_privflags_get_policy[ETHTOOL_A_PRIVFLAGS_HEADER + 1]; |
| 364 | extern const struct nla_policy ethnl_privflags_set_policy[ETHTOOL_A_PRIVFLAGS_FLAGS + 1]; |
| 365 | extern const struct nla_policy ethnl_rings_get_policy[ETHTOOL_A_RINGS_HEADER + 1]; |
Hao Chen | 0b70c25 | 2021-11-18 20:12:42 +0800 | [diff] [blame] | 366 | extern const struct nla_policy ethnl_rings_set_policy[ETHTOOL_A_RINGS_RX_BUF_LEN + 1]; |
Jakub Kicinski | ff419af | 2020-10-05 15:07:35 -0700 | [diff] [blame] | 367 | extern const struct nla_policy ethnl_channels_get_policy[ETHTOOL_A_CHANNELS_HEADER + 1]; |
| 368 | extern const struct nla_policy ethnl_channels_set_policy[ETHTOOL_A_CHANNELS_COMBINED_COUNT + 1]; |
| 369 | extern const struct nla_policy ethnl_coalesce_get_policy[ETHTOOL_A_COALESCE_HEADER + 1]; |
Yufeng Mo | 029ee6b | 2021-08-20 15:35:17 +0800 | [diff] [blame] | 370 | extern const struct nla_policy ethnl_coalesce_set_policy[ETHTOOL_A_COALESCE_MAX + 1]; |
Jakub Kicinski | ff419af | 2020-10-05 15:07:35 -0700 | [diff] [blame] | 371 | extern const struct nla_policy ethnl_pause_get_policy[ETHTOOL_A_PAUSE_HEADER + 1]; |
| 372 | extern const struct nla_policy ethnl_pause_set_policy[ETHTOOL_A_PAUSE_TX + 1]; |
| 373 | extern const struct nla_policy ethnl_eee_get_policy[ETHTOOL_A_EEE_HEADER + 1]; |
| 374 | extern const struct nla_policy ethnl_eee_set_policy[ETHTOOL_A_EEE_TX_LPI_TIMER + 1]; |
| 375 | extern const struct nla_policy ethnl_tsinfo_get_policy[ETHTOOL_A_TSINFO_HEADER + 1]; |
| 376 | extern const struct nla_policy ethnl_cable_test_act_policy[ETHTOOL_A_CABLE_TEST_HEADER + 1]; |
| 377 | extern const struct nla_policy ethnl_cable_test_tdr_act_policy[ETHTOOL_A_CABLE_TEST_TDR_CFG + 1]; |
| 378 | extern const struct nla_policy ethnl_tunnel_info_get_policy[ETHTOOL_A_TUNNEL_INFO_HEADER + 1]; |
Jakub Kicinski | 1e5d1f6 | 2021-03-29 20:59:52 -0700 | [diff] [blame] | 379 | extern const struct nla_policy ethnl_fec_get_policy[ETHTOOL_A_FEC_HEADER + 1]; |
| 380 | extern const struct nla_policy ethnl_fec_set_policy[ETHTOOL_A_FEC_AUTO + 1]; |
Ido Schimmel | f5fe211 | 2021-06-22 09:50:48 +0300 | [diff] [blame] | 381 | extern const struct nla_policy ethnl_module_eeprom_get_policy[ETHTOOL_A_MODULE_EEPROM_I2C_ADDRESS + 1]; |
Jakub Kicinski | f09ea6f | 2021-04-16 12:27:39 -0700 | [diff] [blame] | 382 | extern const struct nla_policy ethnl_stats_get_policy[ETHTOOL_A_STATS_GROUPS + 1]; |
Yangbo Lu | c156174a | 2021-06-30 16:11:56 +0800 | [diff] [blame] | 383 | extern const struct nla_policy ethnl_phc_vclocks_get_policy[ETHTOOL_A_PHC_VCLOCKS_HEADER + 1]; |
Ido Schimmel | 353407d | 2021-10-06 13:46:42 +0300 | [diff] [blame] | 384 | extern const struct nla_policy ethnl_module_get_policy[ETHTOOL_A_MODULE_HEADER + 1]; |
| 385 | extern const struct nla_policy ethnl_module_set_policy[ETHTOOL_A_MODULE_POWER_MODE_POLICY + 1]; |
Jakub Kicinski | 4f30974 | 2020-10-05 15:07:33 -0700 | [diff] [blame] | 386 | |
Michal Kubecek | a53f3d4 | 2019-12-27 15:55:53 +0100 | [diff] [blame] | 387 | int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | bfbcfe2 | 2019-12-27 15:56:13 +0100 | [diff] [blame] | 388 | int ethnl_set_linkmodes(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | e54d04e | 2020-01-26 23:11:07 +0100 | [diff] [blame] | 389 | int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | 8d425b1 | 2020-01-26 23:11:16 +0100 | [diff] [blame] | 390 | int ethnl_set_wol(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | 0980bfc | 2020-03-12 21:07:58 +0100 | [diff] [blame] | 391 | int ethnl_set_features(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | f265d79 | 2020-03-12 21:08:13 +0100 | [diff] [blame] | 392 | int ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | 2fc2929 | 2020-03-12 21:08:28 +0100 | [diff] [blame] | 393 | int ethnl_set_rings(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | e19c591 | 2020-03-12 21:08:43 +0100 | [diff] [blame] | 394 | int ethnl_set_channels(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | 9881418 | 2020-03-28 00:01:13 +0100 | [diff] [blame] | 395 | int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | 3ab8799 | 2020-03-28 00:01:28 +0100 | [diff] [blame] | 396 | int ethnl_set_pause(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | fd77be7 | 2020-03-28 00:01:43 +0100 | [diff] [blame] | 397 | int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info); |
Andrew Lunn | 11ca3c42 | 2020-05-10 21:12:33 +0200 | [diff] [blame] | 398 | int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info); |
Andrew Lunn | 1a644de | 2020-05-27 00:21:38 +0200 | [diff] [blame] | 399 | int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info); |
Jakub Kicinski | c7d759e | 2020-07-09 17:42:47 -0700 | [diff] [blame] | 400 | int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info); |
| 401 | int ethnl_tunnel_info_start(struct netlink_callback *cb); |
| 402 | int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb); |
Jakub Kicinski | 1e5d1f6 | 2021-03-29 20:59:52 -0700 | [diff] [blame] | 403 | int ethnl_set_fec(struct sk_buff *skb, struct genl_info *info); |
Ido Schimmel | 353407d | 2021-10-06 13:46:42 +0300 | [diff] [blame] | 404 | int ethnl_set_module(struct sk_buff *skb, struct genl_info *info); |
Michal Kubecek | a53f3d4 | 2019-12-27 15:55:53 +0100 | [diff] [blame] | 405 | |
Jakub Kicinski | f09ea6f | 2021-04-16 12:27:39 -0700 | [diff] [blame] | 406 | extern const char stats_std_names[__ETHTOOL_STATS_CNT][ETH_GSTRING_LEN]; |
| 407 | extern const char stats_eth_phy_names[__ETHTOOL_A_STATS_ETH_PHY_CNT][ETH_GSTRING_LEN]; |
Jakub Kicinski | ca22445 | 2021-04-16 12:27:40 -0700 | [diff] [blame] | 408 | extern const char stats_eth_mac_names[__ETHTOOL_A_STATS_ETH_MAC_CNT][ETH_GSTRING_LEN]; |
Jakub Kicinski | bfad2b9 | 2021-04-16 12:27:41 -0700 | [diff] [blame] | 409 | extern const char stats_eth_ctrl_names[__ETHTOOL_A_STATS_ETH_CTRL_CNT][ETH_GSTRING_LEN]; |
Jakub Kicinski | a8b06e9 | 2021-04-16 12:27:42 -0700 | [diff] [blame] | 410 | extern const char stats_rmon_names[__ETHTOOL_A_STATS_RMON_CNT][ETH_GSTRING_LEN]; |
Jakub Kicinski | f09ea6f | 2021-04-16 12:27:39 -0700 | [diff] [blame] | 411 | |
Michal Kubecek | 2b4a899 | 2019-12-27 15:55:18 +0100 | [diff] [blame] | 412 | #endif /* _NET_ETHTOOL_NETLINK_H */ |