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 <linux/phy.h> 9 #include <net/genetlink.h> 10 #include <net/sock.h> 11 12 struct ethnl_req_info; 13 14 extern char phy_interface_names[PHY_INTERFACE_MODE_MAX][ETH_GSTRING_LEN]; 15 16 int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info, 17 const struct nlattr *nest, struct net *net, 18 struct netlink_ext_ack *extack, 19 bool require_dev); 20 int ethnl_fill_reply_header(struct sk_buff *skb, struct net_device *dev, 21 u16 attrtype); 22 struct sk_buff *ethnl_reply_init(size_t payload, struct net_device *dev, u8 cmd, 23 u16 hdr_attrtype, struct genl_info *info, 24 void **ehdrp); 25 void *ethnl_dump_put(struct sk_buff *skb, struct netlink_callback *cb, u8 cmd); 26 void *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd); 27 void *ethnl_unicast_put(struct sk_buff *skb, u32 portid, u32 seq, u8 cmd); 28 int ethnl_multicast(struct sk_buff *skb, struct net_device *dev); 29 void ethnl_notify(struct net_device *dev, unsigned int cmd, 30 const struct ethnl_req_info *req_info); 31 32 /** 33 * ethnl_strz_size() - calculate attribute length for fixed size string 34 * @s: ETH_GSTRING_LEN sized string (may not be null terminated) 35 * 36 * Return: total length of an attribute with null terminated string from @s 37 */ 38 static inline int ethnl_strz_size(const char *s) 39 { 40 return nla_total_size(strnlen(s, ETH_GSTRING_LEN) + 1); 41 } 42 43 /** 44 * ethnl_put_strz() - put string attribute with fixed size string 45 * @skb: skb with the message 46 * @attrtype: attribute type 47 * @s: ETH_GSTRING_LEN sized string (may not be null terminated) 48 * 49 * Puts an attribute with null terminated string from @s into the message. 50 * 51 * Return: 0 on success, negative error code on failure 52 */ 53 static inline int ethnl_put_strz(struct sk_buff *skb, u16 attrtype, 54 const char *s) 55 { 56 unsigned int len = strnlen(s, ETH_GSTRING_LEN); 57 struct nlattr *attr; 58 59 attr = nla_reserve(skb, attrtype, len + 1); 60 if (!attr) 61 return -EMSGSIZE; 62 63 memcpy(nla_data(attr), s, len); 64 ((char *)nla_data(attr))[len] = '\0'; 65 return 0; 66 } 67 68 /** 69 * ethnl_update_u32() - update u32 value from NLA_U32 attribute 70 * @dst: value to update 71 * @attr: netlink attribute with new value or null 72 * @mod: pointer to bool for modification tracking 73 * 74 * Copy the u32 value from NLA_U32 netlink attribute @attr into variable 75 * pointed to by @dst; do nothing if @attr is null. Bool pointed to by @mod 76 * is set to true if this function changed the value of *dst, otherwise it 77 * is left as is. 78 */ 79 static inline void ethnl_update_u32(u32 *dst, const struct nlattr *attr, 80 bool *mod) 81 { 82 u32 val; 83 84 if (!attr) 85 return; 86 val = nla_get_u32(attr); 87 if (*dst == val) 88 return; 89 90 *dst = val; 91 *mod = true; 92 } 93 94 /** 95 * ethnl_update_u8() - update u8 value from NLA_U8 attribute 96 * @dst: value to update 97 * @attr: netlink attribute with new value or null 98 * @mod: pointer to bool for modification tracking 99 * 100 * Copy the u8 value from NLA_U8 netlink attribute @attr into variable 101 * pointed to by @dst; do nothing if @attr is null. Bool pointed to by @mod 102 * is set to true if this function changed the value of *dst, otherwise it 103 * is left as is. 104 */ 105 static inline void ethnl_update_u8(u8 *dst, const struct nlattr *attr, 106 bool *mod) 107 { 108 u8 val; 109 110 if (!attr) 111 return; 112 val = nla_get_u8(attr); 113 if (*dst == val) 114 return; 115 116 *dst = val; 117 *mod = true; 118 } 119 120 /** 121 * ethnl_update_u8_u32() - update u8 value from an NLA_U32 attribute 122 * @dst: value to update 123 * @attr: netlink attribute with new value or null 124 * @mod: pointer to bool for modification tracking 125 * 126 * Some attributes are NLA_U32 on the wire but are stored in a u8. Read the 127 * full 32-bit value from NLA_U32 netlink attribute @attr and narrow it into 128 * the u8 pointed to by @dst; do nothing if @attr is null. 129 * Bool pointed to by @mod is set to true if this function changed the value 130 * of *dst, otherwise it is left as is. 131 */ 132 static inline void ethnl_update_u8_u32(u8 *dst, const struct nlattr *attr, 133 bool *mod) 134 { 135 u32 val; 136 137 if (!attr) 138 return; 139 val = nla_get_u32(attr); 140 DEBUG_NET_WARN_ON_ONCE(val > U8_MAX); 141 if (*dst == val) 142 return; 143 144 *dst = val; 145 *mod = true; 146 } 147 148 /** 149 * ethnl_update_bool32() - update u32 used as bool from NLA_U8 attribute 150 * @dst: value to update 151 * @attr: netlink attribute with new value or null 152 * @mod: pointer to bool for modification tracking 153 * 154 * Use the u8 value from NLA_U8 netlink attribute @attr to set u32 variable 155 * pointed to by @dst to 0 (if zero) or 1 (if not); do nothing if @attr is 156 * null. Bool pointed to by @mod is set to true if this function changed the 157 * logical value of *dst, otherwise it is left as is. 158 */ 159 static inline void ethnl_update_bool32(u32 *dst, const struct nlattr *attr, 160 bool *mod) 161 { 162 u8 val; 163 164 if (!attr) 165 return; 166 val = !!nla_get_u8(attr); 167 if (!!*dst == val) 168 return; 169 170 *dst = val; 171 *mod = true; 172 } 173 174 /** 175 * ethnl_update_bool() - updateb bool used as bool from NLA_U8 attribute 176 * @dst: value to update 177 * @attr: netlink attribute with new value or null 178 * @mod: pointer to bool for modification tracking 179 * 180 * Use the bool value from NLA_U8 netlink attribute @attr to set bool variable 181 * pointed to by @dst to 0 (if zero) or 1 (if not); do nothing if @attr is 182 * null. Bool pointed to by @mod is set to true if this function changed the 183 * logical value of *dst, otherwise it is left as is. 184 */ 185 static inline void ethnl_update_bool(bool *dst, const struct nlattr *attr, 186 bool *mod) 187 { 188 u8 val; 189 190 if (!attr) 191 return; 192 val = !!nla_get_u8(attr); 193 if (!!*dst == val) 194 return; 195 196 *dst = val; 197 *mod = true; 198 } 199 200 /** 201 * ethnl_update_binary() - update binary data from NLA_BINARY attribute 202 * @dst: value to update 203 * @len: destination buffer length 204 * @attr: netlink attribute with new value or null 205 * @mod: pointer to bool for modification tracking 206 * 207 * Use the u8 value from NLA_U8 netlink attribute @attr to rewrite data block 208 * of length @len at @dst by attribute payload; do nothing if @attr is null. 209 * Bool pointed to by @mod is set to true if this function changed the logical 210 * value of *dst, otherwise it is left as is. 211 */ 212 static inline void ethnl_update_binary(void *dst, unsigned int len, 213 const struct nlattr *attr, bool *mod) 214 { 215 if (!attr) 216 return; 217 if (nla_len(attr) < len) 218 len = nla_len(attr); 219 if (!memcmp(dst, nla_data(attr), len)) 220 return; 221 222 memcpy(dst, nla_data(attr), len); 223 *mod = true; 224 } 225 226 /** 227 * ethnl_update_bitfield32() - update u32 value from NLA_BITFIELD32 attribute 228 * @dst: value to update 229 * @attr: netlink attribute with new value or null 230 * @mod: pointer to bool for modification tracking 231 * 232 * Update bits in u32 value which are set in attribute's mask to values from 233 * attribute's value. Do nothing if @attr is null or the value wouldn't change; 234 * otherwise, set bool pointed to by @mod to true. 235 */ 236 static inline void ethnl_update_bitfield32(u32 *dst, const struct nlattr *attr, 237 bool *mod) 238 { 239 struct nla_bitfield32 change; 240 u32 newval; 241 242 if (!attr) 243 return; 244 change = nla_get_bitfield32(attr); 245 newval = (*dst & ~change.selector) | (change.value & change.selector); 246 if (*dst == newval) 247 return; 248 249 *dst = newval; 250 *mod = true; 251 } 252 253 /** 254 * ethnl_reply_header_size() - total size of reply header 255 * 256 * This is an upper estimate so that we do not need to hold RTNL lock longer 257 * than necessary (to prevent rename between size estimate and composing the 258 * message). Accounts only for device ifindex and name as those are the only 259 * attributes ethnl_fill_reply_header() puts into the reply header. 260 */ 261 static inline unsigned int ethnl_reply_header_size(void) 262 { 263 return nla_total_size(nla_total_size(sizeof(u32)) + 264 nla_total_size(IFNAMSIZ)); 265 } 266 267 /* GET request handling */ 268 269 /* Unified processing of GET requests uses two data structures: request info 270 * and reply data. Request info holds information parsed from client request 271 * and its stays constant through all request processing. Reply data holds data 272 * retrieved from ethtool_ops callbacks or other internal sources which is used 273 * to compose the reply. When processing a dump request, request info is filled 274 * only once (when the request message is parsed) but reply data is filled for 275 * each reply message. 276 * 277 * Both structures consist of part common for all request types (struct 278 * ethnl_req_info and struct ethnl_reply_data defined below) and optional 279 * parts specific for each request type. Common part always starts at offset 0. 280 */ 281 282 /** 283 * struct ethnl_req_info - base type of request information for GET requests 284 * @dev: network device the request is for (may be null) 285 * @dev_tracker: refcount tracker for @dev reference 286 * @flags: request flags common for all request types 287 * @phy_index: phy_device index connected to @dev this request is for. Can be 288 * 0 if the request doesn't target a phy, or if the @dev's attached 289 * phy is targeted. 290 * 291 * This is a common base for request specific structures holding data from 292 * parsed userspace request. These always embed struct ethnl_req_info at 293 * zero offset. 294 */ 295 struct ethnl_req_info { 296 struct net_device *dev; 297 netdevice_tracker dev_tracker; 298 u32 flags; 299 u32 phy_index; 300 }; 301 302 static inline void ethnl_parse_header_dev_put(struct ethnl_req_info *req_info) 303 { 304 netdev_put(req_info->dev, &req_info->dev_tracker); 305 } 306 307 /** 308 * ethnl_req_get_phydev() - Gets the phy_device targeted by this request, 309 * if any. 310 * @req_info: The ethnl request to get the phy from. 311 * @tb: The netlink attributes array, for error reporting. 312 * @header: The netlink header index, used for error reporting. 313 * @extack: The netlink extended ACK, for error reporting. 314 * 315 * If a phy_device is returned the caller must hold rtnl_lock when calling 316 * this function, and until it's done interacting with the returned phy_device. 317 * IOW caller must hold rtnl_lock unless they know netdev has no phy_device. 318 * 319 * Return: A phy_device pointer corresponding either to the passed phy_index 320 * if one is provided. If not, the phy_device attached to the 321 * net_device targeted by this request is returned. If there's no 322 * targeted net_device, or no phy_device is attached, NULL is 323 * returned. If the provided phy_index is invalid, an error pointer 324 * is returned. 325 */ 326 struct phy_device *ethnl_req_get_phydev(const struct ethnl_req_info *req_info, 327 struct nlattr **tb, unsigned int header, 328 struct netlink_ext_ack *extack); 329 330 /** 331 * struct ethnl_reply_data - base type of reply data for GET requests 332 * @dev: device for current reply message; in single shot requests it is 333 * equal to ðnl_req_info.dev; in dumps it's different for each 334 * reply message 335 * 336 * This is a common base for request specific structures holding data for 337 * kernel reply message. These always embed struct ethnl_reply_data at zero 338 * offset. 339 */ 340 struct ethnl_reply_data { 341 struct net_device *dev; 342 }; 343 344 int ethnl_ops_begin(struct net_device *dev); 345 void ethnl_ops_complete(struct net_device *dev); 346 347 enum ethnl_sock_type { 348 ETHTOOL_SOCK_TYPE_MODULE_FW_FLASH, 349 }; 350 351 struct ethnl_sock_priv { 352 struct net *net; 353 u32 portid; 354 enum ethnl_sock_type type; 355 }; 356 357 int ethnl_sock_priv_set(struct sk_buff *skb, struct net *net, u32 portid, 358 enum ethnl_sock_type type); 359 360 /** 361 * struct ethnl_request_ops - unified handling of GET and SET requests 362 * @request_cmd: command id for request (GET) 363 * @reply_cmd: command id for reply (GET_REPLY) 364 * @hdr_attr: attribute type for request header 365 * @req_info_size: size of request info 366 * @reply_data_size: size of reply data 367 * @allow_nodev_do: 368 * Allow non-dump request with no device identification. 369 * Note that locks (rtnl_lock etc.) are only taken if device is set. 370 * @set_ntf_cmd: notification to generate on changes (SET) 371 * @parse_request: 372 * Parse request except common header (struct ethnl_req_info). Common 373 * header is already filled on entry, the rest up to @repdata_offset 374 * is zero initialized. This callback should only modify type specific 375 * request info by parsed attributes from request message. 376 * Called for both GET and SET. Information parsed for SET will 377 * be conveyed to the req_info used during NTF generation. 378 * @prepare_data: 379 * Retrieve and prepare data needed to compose a reply message. Calls to 380 * ethtool_ops handlers are limited to this callback. Common reply data 381 * (struct ethnl_reply_data) is filled on entry, type specific part after 382 * it is zero initialized. This callback should only modify the type 383 * specific part of reply data. Device identification from struct 384 * ethnl_reply_data is to be used as for dump requests, it iterates 385 * through network devices while dev member of struct ethnl_req_info 386 * points to the device from client request. 387 * @reply_size: 388 * Estimate reply message size. Returned value must be sufficient for 389 * message payload without common reply header. The callback may returned 390 * estimate higher than actual message size if exact calculation would 391 * not be worth the saved memory space. 392 * @fill_reply: 393 * Fill reply message payload (except for common header) from reply data. 394 * The callback must not generate more payload than previously called 395 * ->reply_size() estimated. 396 * @cleanup_data: 397 * Optional cleanup called when reply data is no longer needed. Can be 398 * used e.g. to free any additional data structures outside the main 399 * structure which were allocated by ->prepare_data(). When processing 400 * dump requests, ->cleanup() is called for each message. 401 * @set_validate: 402 * Check if set operation is supported for a given device, and perform 403 * extra input checks. Expected return values: 404 * - 0 if the operation is a noop for the device (rare) 405 * - 1 if operation should proceed to calling @set 406 * - negative errno on errors 407 * Called without any locks, just a reference on the netdev. 408 * @set: 409 * Execute the set operation. The implementation should return 410 * - 0 if no configuration has changed 411 * - 1 if configuration changed and notification should be generated 412 * - negative errno on errors 413 * 414 * Description of variable parts of GET request handling when using the 415 * unified infrastructure. When used, a pointer to an instance of this 416 * structure is to be added to ðnl_default_requests array and generic 417 * handlers ethnl_default_doit(), ethnl_default_dumpit(), 418 * ethnl_default_start() and ethnl_default_done() used in @ethtool_genl_ops; 419 * ethnl_default_notify() can be used in @ethnl_notify_handlers to send 420 * notifications of the corresponding type. 421 */ 422 struct ethnl_request_ops { 423 u8 request_cmd; 424 u8 reply_cmd; 425 u16 hdr_attr; 426 unsigned int req_info_size; 427 unsigned int reply_data_size; 428 bool allow_nodev_do; 429 u8 set_ntf_cmd; 430 431 int (*parse_request)(struct ethnl_req_info *req_info, 432 const struct genl_info *info, 433 struct nlattr **tb, 434 struct netlink_ext_ack *extack); 435 int (*prepare_data)(const struct ethnl_req_info *req_info, 436 struct ethnl_reply_data *reply_data, 437 const struct genl_info *info); 438 int (*reply_size)(const struct ethnl_req_info *req_info, 439 const struct ethnl_reply_data *reply_data); 440 int (*fill_reply)(struct sk_buff *skb, 441 const struct ethnl_req_info *req_info, 442 const struct ethnl_reply_data *reply_data); 443 void (*cleanup_data)(struct ethnl_reply_data *reply_data); 444 445 int (*set_validate)(struct ethnl_req_info *req_info, 446 struct genl_info *info); 447 int (*set)(struct ethnl_req_info *req_info, 448 struct genl_info *info); 449 }; 450 451 /* request handlers */ 452 453 extern const struct ethnl_request_ops ethnl_strset_request_ops; 454 extern const struct ethnl_request_ops ethnl_linkinfo_request_ops; 455 extern const struct ethnl_request_ops ethnl_linkmodes_request_ops; 456 extern const struct ethnl_request_ops ethnl_linkstate_request_ops; 457 extern const struct ethnl_request_ops ethnl_debug_request_ops; 458 extern const struct ethnl_request_ops ethnl_wol_request_ops; 459 extern const struct ethnl_request_ops ethnl_features_request_ops; 460 extern const struct ethnl_request_ops ethnl_privflags_request_ops; 461 extern const struct ethnl_request_ops ethnl_rings_request_ops; 462 extern const struct ethnl_request_ops ethnl_channels_request_ops; 463 extern const struct ethnl_request_ops ethnl_coalesce_request_ops; 464 extern const struct ethnl_request_ops ethnl_pause_request_ops; 465 extern const struct ethnl_request_ops ethnl_eee_request_ops; 466 extern const struct ethnl_request_ops ethnl_tsinfo_request_ops; 467 extern const struct ethnl_request_ops ethnl_fec_request_ops; 468 extern const struct ethnl_request_ops ethnl_module_eeprom_request_ops; 469 extern const struct ethnl_request_ops ethnl_stats_request_ops; 470 extern const struct ethnl_request_ops ethnl_phc_vclocks_request_ops; 471 extern const struct ethnl_request_ops ethnl_module_request_ops; 472 extern const struct ethnl_request_ops ethnl_pse_request_ops; 473 extern const struct ethnl_request_ops ethnl_rss_request_ops; 474 extern const struct ethnl_request_ops ethnl_plca_cfg_request_ops; 475 extern const struct ethnl_request_ops ethnl_plca_status_request_ops; 476 extern const struct ethnl_request_ops ethnl_mm_request_ops; 477 extern const struct ethnl_request_ops ethnl_phy_request_ops; 478 extern const struct ethnl_request_ops ethnl_tsconfig_request_ops; 479 extern const struct ethnl_request_ops ethnl_mse_request_ops; 480 extern const struct ethnl_request_ops ethnl_port_request_ops; 481 482 extern const struct nla_policy ethnl_header_policy[ETHTOOL_A_HEADER_FLAGS + 1]; 483 extern const struct nla_policy ethnl_header_policy_stats[ETHTOOL_A_HEADER_FLAGS + 1]; 484 extern const struct nla_policy ethnl_header_policy_phy[ETHTOOL_A_HEADER_PHY_INDEX + 1]; 485 extern const struct nla_policy ethnl_header_policy_phy_stats[ETHTOOL_A_HEADER_PHY_INDEX + 1]; 486 extern const struct nla_policy ethnl_strset_get_policy[ETHTOOL_A_STRSET_COUNTS_ONLY + 1]; 487 extern const struct nla_policy ethnl_linkinfo_get_policy[ETHTOOL_A_LINKINFO_HEADER + 1]; 488 extern const struct nla_policy ethnl_linkinfo_set_policy[ETHTOOL_A_LINKINFO_TP_MDIX_CTRL + 1]; 489 extern const struct nla_policy ethnl_linkmodes_get_policy[ETHTOOL_A_LINKMODES_HEADER + 1]; 490 extern const struct nla_policy ethnl_linkmodes_set_policy[ETHTOOL_A_LINKMODES_LANES + 1]; 491 extern const struct nla_policy ethnl_linkstate_get_policy[ETHTOOL_A_LINKSTATE_HEADER + 1]; 492 extern const struct nla_policy ethnl_debug_get_policy[ETHTOOL_A_DEBUG_HEADER + 1]; 493 extern const struct nla_policy ethnl_debug_set_policy[ETHTOOL_A_DEBUG_MSGMASK + 1]; 494 extern const struct nla_policy ethnl_wol_get_policy[ETHTOOL_A_WOL_HEADER + 1]; 495 extern const struct nla_policy ethnl_wol_set_policy[ETHTOOL_A_WOL_SOPASS + 1]; 496 extern const struct nla_policy ethnl_features_get_policy[ETHTOOL_A_FEATURES_HEADER + 1]; 497 extern const struct nla_policy ethnl_features_set_policy[ETHTOOL_A_FEATURES_WANTED + 1]; 498 extern const struct nla_policy ethnl_privflags_get_policy[ETHTOOL_A_PRIVFLAGS_HEADER + 1]; 499 extern const struct nla_policy ethnl_privflags_set_policy[ETHTOOL_A_PRIVFLAGS_FLAGS + 1]; 500 extern const struct nla_policy ethnl_rings_get_policy[ETHTOOL_A_RINGS_HEADER + 1]; 501 extern const struct nla_policy ethnl_rings_set_policy[ETHTOOL_A_RINGS_HDS_THRESH_MAX + 1]; 502 extern const struct nla_policy ethnl_channels_get_policy[ETHTOOL_A_CHANNELS_HEADER + 1]; 503 extern const struct nla_policy ethnl_channels_set_policy[ETHTOOL_A_CHANNELS_COMBINED_COUNT + 1]; 504 extern const struct nla_policy ethnl_coalesce_get_policy[ETHTOOL_A_COALESCE_HEADER + 1]; 505 extern const struct nla_policy ethnl_coalesce_set_policy[ETHTOOL_A_COALESCE_MAX + 1]; 506 extern const struct nla_policy ethnl_pause_get_policy[ETHTOOL_A_PAUSE_STATS_SRC + 1]; 507 extern const struct nla_policy ethnl_pause_set_policy[ETHTOOL_A_PAUSE_STATS_SRC + 1]; 508 extern const struct nla_policy ethnl_eee_get_policy[ETHTOOL_A_EEE_HEADER + 1]; 509 extern const struct nla_policy ethnl_eee_set_policy[ETHTOOL_A_EEE_TX_LPI_TIMER + 1]; 510 extern const struct nla_policy ethnl_tsinfo_get_policy[ETHTOOL_A_TSINFO_MAX + 1]; 511 extern const struct nla_policy ethnl_cable_test_act_policy[ETHTOOL_A_CABLE_TEST_HEADER + 1]; 512 extern const struct nla_policy ethnl_cable_test_tdr_act_policy[ETHTOOL_A_CABLE_TEST_TDR_CFG + 1]; 513 extern const struct nla_policy ethnl_tunnel_info_get_policy[ETHTOOL_A_TUNNEL_INFO_HEADER + 1]; 514 extern const struct nla_policy ethnl_fec_get_policy[ETHTOOL_A_FEC_HEADER + 1]; 515 extern const struct nla_policy ethnl_fec_set_policy[ETHTOOL_A_FEC_AUTO + 1]; 516 extern const struct nla_policy ethnl_module_eeprom_get_policy[ETHTOOL_A_MODULE_EEPROM_I2C_ADDRESS + 1]; 517 extern const struct nla_policy ethnl_stats_get_policy[ETHTOOL_A_STATS_SRC + 1]; 518 extern const struct nla_policy ethnl_phc_vclocks_get_policy[ETHTOOL_A_PHC_VCLOCKS_HEADER + 1]; 519 extern const struct nla_policy ethnl_module_get_policy[ETHTOOL_A_MODULE_HEADER + 1]; 520 extern const struct nla_policy ethnl_module_set_policy[ETHTOOL_A_MODULE_POWER_MODE_POLICY + 1]; 521 extern const struct nla_policy ethnl_pse_get_policy[ETHTOOL_A_PSE_HEADER + 1]; 522 extern const struct nla_policy ethnl_pse_set_policy[ETHTOOL_A_PSE_MAX + 1]; 523 extern const struct nla_policy ethnl_rss_get_policy[ETHTOOL_A_RSS_START_CONTEXT + 1]; 524 extern const struct nla_policy ethnl_rss_set_policy[ETHTOOL_A_RSS_FLOW_HASH + 1]; 525 extern const struct nla_policy ethnl_rss_create_policy[ETHTOOL_A_RSS_INPUT_XFRM + 1]; 526 extern const struct nla_policy ethnl_rss_delete_policy[ETHTOOL_A_RSS_CONTEXT + 1]; 527 extern const struct nla_policy ethnl_plca_get_cfg_policy[ETHTOOL_A_PLCA_HEADER + 1]; 528 extern const struct nla_policy ethnl_plca_set_cfg_policy[ETHTOOL_A_PLCA_MAX + 1]; 529 extern const struct nla_policy ethnl_plca_get_status_policy[ETHTOOL_A_PLCA_HEADER + 1]; 530 extern const struct nla_policy ethnl_mm_get_policy[ETHTOOL_A_MM_HEADER + 1]; 531 extern const struct nla_policy ethnl_mm_set_policy[ETHTOOL_A_MM_MAX + 1]; 532 extern const struct nla_policy ethnl_module_fw_flash_act_policy[ETHTOOL_A_MODULE_FW_FLASH_PASSWORD + 1]; 533 extern const struct nla_policy ethnl_phy_get_policy[ETHTOOL_A_PHY_HEADER + 1]; 534 extern const struct nla_policy ethnl_tsconfig_get_policy[ETHTOOL_A_TSCONFIG_HEADER + 1]; 535 extern const struct nla_policy ethnl_tsconfig_set_policy[ETHTOOL_A_TSCONFIG_MAX + 1]; 536 extern const struct nla_policy ethnl_mse_get_policy[ETHTOOL_A_MSE_HEADER + 1]; 537 extern const struct nla_policy ethnl_port_get_policy[ETHTOOL_A_PORT_ID + 1]; 538 539 int ethnl_set_features(struct sk_buff *skb, struct genl_info *info); 540 int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info); 541 int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info); 542 int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info); 543 int ethnl_tunnel_info_start(struct netlink_callback *cb); 544 int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb); 545 int ethnl_act_module_fw_flash(struct sk_buff *skb, struct genl_info *info); 546 int ethnl_rss_dump_start(struct netlink_callback *cb); 547 int ethnl_rss_dumpit(struct sk_buff *skb, struct netlink_callback *cb); 548 int ethnl_tsinfo_start(struct netlink_callback *cb); 549 int ethnl_tsinfo_dumpit(struct sk_buff *skb, struct netlink_callback *cb); 550 int ethnl_tsinfo_done(struct netlink_callback *cb); 551 int ethnl_rss_create_doit(struct sk_buff *skb, struct genl_info *info); 552 int ethnl_rss_delete_doit(struct sk_buff *skb, struct genl_info *info); 553 int ethnl_port_dump_start(struct netlink_callback *cb); 554 int ethnl_port_dumpit(struct sk_buff *skb, struct netlink_callback *cb); 555 int ethnl_port_dump_done(struct netlink_callback *cb); 556 557 extern const char stats_std_names[__ETHTOOL_STATS_CNT][ETH_GSTRING_LEN]; 558 extern const char stats_eth_phy_names[__ETHTOOL_A_STATS_ETH_PHY_CNT][ETH_GSTRING_LEN]; 559 extern const char stats_eth_mac_names[__ETHTOOL_A_STATS_ETH_MAC_CNT][ETH_GSTRING_LEN]; 560 extern const char stats_eth_ctrl_names[__ETHTOOL_A_STATS_ETH_CTRL_CNT][ETH_GSTRING_LEN]; 561 extern const char stats_rmon_names[__ETHTOOL_A_STATS_RMON_CNT][ETH_GSTRING_LEN]; 562 extern const char stats_phy_names[__ETHTOOL_A_STATS_PHY_CNT][ETH_GSTRING_LEN]; 563 564 #endif /* _NET_ETHTOOL_NETLINK_H */ 565