18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci#ifndef _NET_ETHTOOL_NETLINK_H 48c2ecf20Sopenharmony_ci#define _NET_ETHTOOL_NETLINK_H 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/ethtool_netlink.h> 78c2ecf20Sopenharmony_ci#include <linux/netdevice.h> 88c2ecf20Sopenharmony_ci#include <net/genetlink.h> 98c2ecf20Sopenharmony_ci#include <net/sock.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistruct ethnl_req_info; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciint ethnl_parse_header_dev_get(struct ethnl_req_info *req_info, 148c2ecf20Sopenharmony_ci const struct nlattr *nest, struct net *net, 158c2ecf20Sopenharmony_ci struct netlink_ext_ack *extack, 168c2ecf20Sopenharmony_ci bool require_dev); 178c2ecf20Sopenharmony_ciint ethnl_fill_reply_header(struct sk_buff *skb, struct net_device *dev, 188c2ecf20Sopenharmony_ci u16 attrtype); 198c2ecf20Sopenharmony_cistruct sk_buff *ethnl_reply_init(size_t payload, struct net_device *dev, u8 cmd, 208c2ecf20Sopenharmony_ci u16 hdr_attrtype, struct genl_info *info, 218c2ecf20Sopenharmony_ci void **ehdrp); 228c2ecf20Sopenharmony_civoid *ethnl_dump_put(struct sk_buff *skb, struct netlink_callback *cb, u8 cmd); 238c2ecf20Sopenharmony_civoid *ethnl_bcastmsg_put(struct sk_buff *skb, u8 cmd); 248c2ecf20Sopenharmony_ciint ethnl_multicast(struct sk_buff *skb, struct net_device *dev); 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/** 278c2ecf20Sopenharmony_ci * ethnl_strz_size() - calculate attribute length for fixed size string 288c2ecf20Sopenharmony_ci * @s: ETH_GSTRING_LEN sized string (may not be null terminated) 298c2ecf20Sopenharmony_ci * 308c2ecf20Sopenharmony_ci * Return: total length of an attribute with null terminated string from @s 318c2ecf20Sopenharmony_ci */ 328c2ecf20Sopenharmony_cistatic inline int ethnl_strz_size(const char *s) 338c2ecf20Sopenharmony_ci{ 348c2ecf20Sopenharmony_ci return nla_total_size(strnlen(s, ETH_GSTRING_LEN) + 1); 358c2ecf20Sopenharmony_ci} 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/** 388c2ecf20Sopenharmony_ci * ethnl_put_strz() - put string attribute with fixed size string 398c2ecf20Sopenharmony_ci * @skb: skb with the message 408c2ecf20Sopenharmony_ci * @attrype: attribute type 418c2ecf20Sopenharmony_ci * @s: ETH_GSTRING_LEN sized string (may not be null terminated) 428c2ecf20Sopenharmony_ci * 438c2ecf20Sopenharmony_ci * Puts an attribute with null terminated string from @s into the message. 448c2ecf20Sopenharmony_ci * 458c2ecf20Sopenharmony_ci * Return: 0 on success, negative error code on failure 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_cistatic inline int ethnl_put_strz(struct sk_buff *skb, u16 attrtype, 488c2ecf20Sopenharmony_ci const char *s) 498c2ecf20Sopenharmony_ci{ 508c2ecf20Sopenharmony_ci unsigned int len = strnlen(s, ETH_GSTRING_LEN); 518c2ecf20Sopenharmony_ci struct nlattr *attr; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci attr = nla_reserve(skb, attrtype, len + 1); 548c2ecf20Sopenharmony_ci if (!attr) 558c2ecf20Sopenharmony_ci return -EMSGSIZE; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci memcpy(nla_data(attr), s, len); 588c2ecf20Sopenharmony_ci ((char *)nla_data(attr))[len] = '\0'; 598c2ecf20Sopenharmony_ci return 0; 608c2ecf20Sopenharmony_ci} 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/** 638c2ecf20Sopenharmony_ci * ethnl_update_u32() - update u32 value from NLA_U32 attribute 648c2ecf20Sopenharmony_ci * @dst: value to update 658c2ecf20Sopenharmony_ci * @attr: netlink attribute with new value or null 668c2ecf20Sopenharmony_ci * @mod: pointer to bool for modification tracking 678c2ecf20Sopenharmony_ci * 688c2ecf20Sopenharmony_ci * Copy the u32 value from NLA_U32 netlink attribute @attr into variable 698c2ecf20Sopenharmony_ci * pointed to by @dst; do nothing if @attr is null. Bool pointed to by @mod 708c2ecf20Sopenharmony_ci * is set to true if this function changed the value of *dst, otherwise it 718c2ecf20Sopenharmony_ci * is left as is. 728c2ecf20Sopenharmony_ci */ 738c2ecf20Sopenharmony_cistatic inline void ethnl_update_u32(u32 *dst, const struct nlattr *attr, 748c2ecf20Sopenharmony_ci bool *mod) 758c2ecf20Sopenharmony_ci{ 768c2ecf20Sopenharmony_ci u32 val; 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci if (!attr) 798c2ecf20Sopenharmony_ci return; 808c2ecf20Sopenharmony_ci val = nla_get_u32(attr); 818c2ecf20Sopenharmony_ci if (*dst == val) 828c2ecf20Sopenharmony_ci return; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci *dst = val; 858c2ecf20Sopenharmony_ci *mod = true; 868c2ecf20Sopenharmony_ci} 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/** 898c2ecf20Sopenharmony_ci * ethnl_update_u8() - update u8 value from NLA_U8 attribute 908c2ecf20Sopenharmony_ci * @dst: value to update 918c2ecf20Sopenharmony_ci * @attr: netlink attribute with new value or null 928c2ecf20Sopenharmony_ci * @mod: pointer to bool for modification tracking 938c2ecf20Sopenharmony_ci * 948c2ecf20Sopenharmony_ci * Copy the u8 value from NLA_U8 netlink attribute @attr into variable 958c2ecf20Sopenharmony_ci * pointed to by @dst; do nothing if @attr is null. Bool pointed to by @mod 968c2ecf20Sopenharmony_ci * is set to true if this function changed the value of *dst, otherwise it 978c2ecf20Sopenharmony_ci * is left as is. 988c2ecf20Sopenharmony_ci */ 998c2ecf20Sopenharmony_cistatic inline void ethnl_update_u8(u8 *dst, const struct nlattr *attr, 1008c2ecf20Sopenharmony_ci bool *mod) 1018c2ecf20Sopenharmony_ci{ 1028c2ecf20Sopenharmony_ci u8 val; 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci if (!attr) 1058c2ecf20Sopenharmony_ci return; 1068c2ecf20Sopenharmony_ci val = nla_get_u8(attr); 1078c2ecf20Sopenharmony_ci if (*dst == val) 1088c2ecf20Sopenharmony_ci return; 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci *dst = val; 1118c2ecf20Sopenharmony_ci *mod = true; 1128c2ecf20Sopenharmony_ci} 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/** 1158c2ecf20Sopenharmony_ci * ethnl_update_bool32() - update u32 used as bool from NLA_U8 attribute 1168c2ecf20Sopenharmony_ci * @dst: value to update 1178c2ecf20Sopenharmony_ci * @attr: netlink attribute with new value or null 1188c2ecf20Sopenharmony_ci * @mod: pointer to bool for modification tracking 1198c2ecf20Sopenharmony_ci * 1208c2ecf20Sopenharmony_ci * Use the u8 value from NLA_U8 netlink attribute @attr to set u32 variable 1218c2ecf20Sopenharmony_ci * pointed to by @dst to 0 (if zero) or 1 (if not); do nothing if @attr is 1228c2ecf20Sopenharmony_ci * null. Bool pointed to by @mod is set to true if this function changed the 1238c2ecf20Sopenharmony_ci * logical value of *dst, otherwise it is left as is. 1248c2ecf20Sopenharmony_ci */ 1258c2ecf20Sopenharmony_cistatic inline void ethnl_update_bool32(u32 *dst, const struct nlattr *attr, 1268c2ecf20Sopenharmony_ci bool *mod) 1278c2ecf20Sopenharmony_ci{ 1288c2ecf20Sopenharmony_ci u8 val; 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci if (!attr) 1318c2ecf20Sopenharmony_ci return; 1328c2ecf20Sopenharmony_ci val = !!nla_get_u8(attr); 1338c2ecf20Sopenharmony_ci if (!!*dst == val) 1348c2ecf20Sopenharmony_ci return; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci *dst = val; 1378c2ecf20Sopenharmony_ci *mod = true; 1388c2ecf20Sopenharmony_ci} 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci/** 1418c2ecf20Sopenharmony_ci * ethnl_update_binary() - update binary data from NLA_BINARY atribute 1428c2ecf20Sopenharmony_ci * @dst: value to update 1438c2ecf20Sopenharmony_ci * @len: destination buffer length 1448c2ecf20Sopenharmony_ci * @attr: netlink attribute with new value or null 1458c2ecf20Sopenharmony_ci * @mod: pointer to bool for modification tracking 1468c2ecf20Sopenharmony_ci * 1478c2ecf20Sopenharmony_ci * Use the u8 value from NLA_U8 netlink attribute @attr to rewrite data block 1488c2ecf20Sopenharmony_ci * of length @len at @dst by attribute payload; do nothing if @attr is null. 1498c2ecf20Sopenharmony_ci * Bool pointed to by @mod is set to true if this function changed the logical 1508c2ecf20Sopenharmony_ci * value of *dst, otherwise it is left as is. 1518c2ecf20Sopenharmony_ci */ 1528c2ecf20Sopenharmony_cistatic inline void ethnl_update_binary(void *dst, unsigned int len, 1538c2ecf20Sopenharmony_ci const struct nlattr *attr, bool *mod) 1548c2ecf20Sopenharmony_ci{ 1558c2ecf20Sopenharmony_ci if (!attr) 1568c2ecf20Sopenharmony_ci return; 1578c2ecf20Sopenharmony_ci if (nla_len(attr) < len) 1588c2ecf20Sopenharmony_ci len = nla_len(attr); 1598c2ecf20Sopenharmony_ci if (!memcmp(dst, nla_data(attr), len)) 1608c2ecf20Sopenharmony_ci return; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci memcpy(dst, nla_data(attr), len); 1638c2ecf20Sopenharmony_ci *mod = true; 1648c2ecf20Sopenharmony_ci} 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci/** 1678c2ecf20Sopenharmony_ci * ethnl_update_bitfield32() - update u32 value from NLA_BITFIELD32 attribute 1688c2ecf20Sopenharmony_ci * @dst: value to update 1698c2ecf20Sopenharmony_ci * @attr: netlink attribute with new value or null 1708c2ecf20Sopenharmony_ci * @mod: pointer to bool for modification tracking 1718c2ecf20Sopenharmony_ci * 1728c2ecf20Sopenharmony_ci * Update bits in u32 value which are set in attribute's mask to values from 1738c2ecf20Sopenharmony_ci * attribute's value. Do nothing if @attr is null or the value wouldn't change; 1748c2ecf20Sopenharmony_ci * otherwise, set bool pointed to by @mod to true. 1758c2ecf20Sopenharmony_ci */ 1768c2ecf20Sopenharmony_cistatic inline void ethnl_update_bitfield32(u32 *dst, const struct nlattr *attr, 1778c2ecf20Sopenharmony_ci bool *mod) 1788c2ecf20Sopenharmony_ci{ 1798c2ecf20Sopenharmony_ci struct nla_bitfield32 change; 1808c2ecf20Sopenharmony_ci u32 newval; 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci if (!attr) 1838c2ecf20Sopenharmony_ci return; 1848c2ecf20Sopenharmony_ci change = nla_get_bitfield32(attr); 1858c2ecf20Sopenharmony_ci newval = (*dst & ~change.selector) | (change.value & change.selector); 1868c2ecf20Sopenharmony_ci if (*dst == newval) 1878c2ecf20Sopenharmony_ci return; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci *dst = newval; 1908c2ecf20Sopenharmony_ci *mod = true; 1918c2ecf20Sopenharmony_ci} 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci/** 1948c2ecf20Sopenharmony_ci * ethnl_reply_header_size() - total size of reply header 1958c2ecf20Sopenharmony_ci * 1968c2ecf20Sopenharmony_ci * This is an upper estimate so that we do not need to hold RTNL lock longer 1978c2ecf20Sopenharmony_ci * than necessary (to prevent rename between size estimate and composing the 1988c2ecf20Sopenharmony_ci * message). Accounts only for device ifindex and name as those are the only 1998c2ecf20Sopenharmony_ci * attributes ethnl_fill_reply_header() puts into the reply header. 2008c2ecf20Sopenharmony_ci */ 2018c2ecf20Sopenharmony_cistatic inline unsigned int ethnl_reply_header_size(void) 2028c2ecf20Sopenharmony_ci{ 2038c2ecf20Sopenharmony_ci return nla_total_size(nla_total_size(sizeof(u32)) + 2048c2ecf20Sopenharmony_ci nla_total_size(IFNAMSIZ)); 2058c2ecf20Sopenharmony_ci} 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci/* GET request handling */ 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci/* Unified processing of GET requests uses two data structures: request info 2108c2ecf20Sopenharmony_ci * and reply data. Request info holds information parsed from client request 2118c2ecf20Sopenharmony_ci * and its stays constant through all request processing. Reply data holds data 2128c2ecf20Sopenharmony_ci * retrieved from ethtool_ops callbacks or other internal sources which is used 2138c2ecf20Sopenharmony_ci * to compose the reply. When processing a dump request, request info is filled 2148c2ecf20Sopenharmony_ci * only once (when the request message is parsed) but reply data is filled for 2158c2ecf20Sopenharmony_ci * each reply message. 2168c2ecf20Sopenharmony_ci * 2178c2ecf20Sopenharmony_ci * Both structures consist of part common for all request types (struct 2188c2ecf20Sopenharmony_ci * ethnl_req_info and struct ethnl_reply_data defined below) and optional 2198c2ecf20Sopenharmony_ci * parts specific for each request type. Common part always starts at offset 0. 2208c2ecf20Sopenharmony_ci */ 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci/** 2238c2ecf20Sopenharmony_ci * struct ethnl_req_info - base type of request information for GET requests 2248c2ecf20Sopenharmony_ci * @dev: network device the request is for (may be null) 2258c2ecf20Sopenharmony_ci * @flags: request flags common for all request types 2268c2ecf20Sopenharmony_ci * 2278c2ecf20Sopenharmony_ci * This is a common base for request specific structures holding data from 2288c2ecf20Sopenharmony_ci * parsed userspace request. These always embed struct ethnl_req_info at 2298c2ecf20Sopenharmony_ci * zero offset. 2308c2ecf20Sopenharmony_ci */ 2318c2ecf20Sopenharmony_cistruct ethnl_req_info { 2328c2ecf20Sopenharmony_ci struct net_device *dev; 2338c2ecf20Sopenharmony_ci u32 flags; 2348c2ecf20Sopenharmony_ci}; 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci/** 2378c2ecf20Sopenharmony_ci * struct ethnl_reply_data - base type of reply data for GET requests 2388c2ecf20Sopenharmony_ci * @dev: device for current reply message; in single shot requests it is 2398c2ecf20Sopenharmony_ci * equal to ðnl_req_info.dev; in dumps it's different for each 2408c2ecf20Sopenharmony_ci * reply message 2418c2ecf20Sopenharmony_ci * 2428c2ecf20Sopenharmony_ci * This is a common base for request specific structures holding data for 2438c2ecf20Sopenharmony_ci * kernel reply message. These always embed struct ethnl_reply_data at zero 2448c2ecf20Sopenharmony_ci * offset. 2458c2ecf20Sopenharmony_ci */ 2468c2ecf20Sopenharmony_cistruct ethnl_reply_data { 2478c2ecf20Sopenharmony_ci struct net_device *dev; 2488c2ecf20Sopenharmony_ci}; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_cistatic inline int ethnl_ops_begin(struct net_device *dev) 2518c2ecf20Sopenharmony_ci{ 2528c2ecf20Sopenharmony_ci if (dev && dev->reg_state == NETREG_UNREGISTERING) 2538c2ecf20Sopenharmony_ci return -ENODEV; 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci if (dev && dev->ethtool_ops->begin) 2568c2ecf20Sopenharmony_ci return dev->ethtool_ops->begin(dev); 2578c2ecf20Sopenharmony_ci else 2588c2ecf20Sopenharmony_ci return 0; 2598c2ecf20Sopenharmony_ci} 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_cistatic inline void ethnl_ops_complete(struct net_device *dev) 2628c2ecf20Sopenharmony_ci{ 2638c2ecf20Sopenharmony_ci if (dev && dev->ethtool_ops->complete) 2648c2ecf20Sopenharmony_ci dev->ethtool_ops->complete(dev); 2658c2ecf20Sopenharmony_ci} 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci/** 2688c2ecf20Sopenharmony_ci * struct ethnl_request_ops - unified handling of GET requests 2698c2ecf20Sopenharmony_ci * @request_cmd: command id for request (GET) 2708c2ecf20Sopenharmony_ci * @reply_cmd: command id for reply (GET_REPLY) 2718c2ecf20Sopenharmony_ci * @hdr_attr: attribute type for request header 2728c2ecf20Sopenharmony_ci * @req_info_size: size of request info 2738c2ecf20Sopenharmony_ci * @reply_data_size: size of reply data 2748c2ecf20Sopenharmony_ci * @allow_nodev_do: allow non-dump request with no device identification 2758c2ecf20Sopenharmony_ci * @parse_request: 2768c2ecf20Sopenharmony_ci * Parse request except common header (struct ethnl_req_info). Common 2778c2ecf20Sopenharmony_ci * header is already filled on entry, the rest up to @repdata_offset 2788c2ecf20Sopenharmony_ci * is zero initialized. This callback should only modify type specific 2798c2ecf20Sopenharmony_ci * request info by parsed attributes from request message. 2808c2ecf20Sopenharmony_ci * @prepare_data: 2818c2ecf20Sopenharmony_ci * Retrieve and prepare data needed to compose a reply message. Calls to 2828c2ecf20Sopenharmony_ci * ethtool_ops handlers are limited to this callback. Common reply data 2838c2ecf20Sopenharmony_ci * (struct ethnl_reply_data) is filled on entry, type specific part after 2848c2ecf20Sopenharmony_ci * it is zero initialized. This callback should only modify the type 2858c2ecf20Sopenharmony_ci * specific part of reply data. Device identification from struct 2868c2ecf20Sopenharmony_ci * ethnl_reply_data is to be used as for dump requests, it iterates 2878c2ecf20Sopenharmony_ci * through network devices while dev member of struct ethnl_req_info 2888c2ecf20Sopenharmony_ci * points to the device from client request. 2898c2ecf20Sopenharmony_ci * @reply_size: 2908c2ecf20Sopenharmony_ci * Estimate reply message size. Returned value must be sufficient for 2918c2ecf20Sopenharmony_ci * message payload without common reply header. The callback may returned 2928c2ecf20Sopenharmony_ci * estimate higher than actual message size if exact calculation would 2938c2ecf20Sopenharmony_ci * not be worth the saved memory space. 2948c2ecf20Sopenharmony_ci * @fill_reply: 2958c2ecf20Sopenharmony_ci * Fill reply message payload (except for common header) from reply data. 2968c2ecf20Sopenharmony_ci * The callback must not generate more payload than previously called 2978c2ecf20Sopenharmony_ci * ->reply_size() estimated. 2988c2ecf20Sopenharmony_ci * @cleanup_data: 2998c2ecf20Sopenharmony_ci * Optional cleanup called when reply data is no longer needed. Can be 3008c2ecf20Sopenharmony_ci * used e.g. to free any additional data structures outside the main 3018c2ecf20Sopenharmony_ci * structure which were allocated by ->prepare_data(). When processing 3028c2ecf20Sopenharmony_ci * dump requests, ->cleanup() is called for each message. 3038c2ecf20Sopenharmony_ci * 3048c2ecf20Sopenharmony_ci * Description of variable parts of GET request handling when using the 3058c2ecf20Sopenharmony_ci * unified infrastructure. When used, a pointer to an instance of this 3068c2ecf20Sopenharmony_ci * structure is to be added to ðnl_default_requests array and generic 3078c2ecf20Sopenharmony_ci * handlers ethnl_default_doit(), ethnl_default_dumpit(), 3088c2ecf20Sopenharmony_ci * ethnl_default_start() and ethnl_default_done() used in @ethtool_genl_ops; 3098c2ecf20Sopenharmony_ci * ethnl_default_notify() can be used in @ethnl_notify_handlers to send 3108c2ecf20Sopenharmony_ci * notifications of the corresponding type. 3118c2ecf20Sopenharmony_ci */ 3128c2ecf20Sopenharmony_cistruct ethnl_request_ops { 3138c2ecf20Sopenharmony_ci u8 request_cmd; 3148c2ecf20Sopenharmony_ci u8 reply_cmd; 3158c2ecf20Sopenharmony_ci u16 hdr_attr; 3168c2ecf20Sopenharmony_ci unsigned int req_info_size; 3178c2ecf20Sopenharmony_ci unsigned int reply_data_size; 3188c2ecf20Sopenharmony_ci bool allow_nodev_do; 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci int (*parse_request)(struct ethnl_req_info *req_info, 3218c2ecf20Sopenharmony_ci struct nlattr **tb, 3228c2ecf20Sopenharmony_ci struct netlink_ext_ack *extack); 3238c2ecf20Sopenharmony_ci int (*prepare_data)(const struct ethnl_req_info *req_info, 3248c2ecf20Sopenharmony_ci struct ethnl_reply_data *reply_data, 3258c2ecf20Sopenharmony_ci struct genl_info *info); 3268c2ecf20Sopenharmony_ci int (*reply_size)(const struct ethnl_req_info *req_info, 3278c2ecf20Sopenharmony_ci const struct ethnl_reply_data *reply_data); 3288c2ecf20Sopenharmony_ci int (*fill_reply)(struct sk_buff *skb, 3298c2ecf20Sopenharmony_ci const struct ethnl_req_info *req_info, 3308c2ecf20Sopenharmony_ci const struct ethnl_reply_data *reply_data); 3318c2ecf20Sopenharmony_ci void (*cleanup_data)(struct ethnl_reply_data *reply_data); 3328c2ecf20Sopenharmony_ci}; 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ci/* request handlers */ 3358c2ecf20Sopenharmony_ci 3368c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_strset_request_ops; 3378c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_linkinfo_request_ops; 3388c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_linkmodes_request_ops; 3398c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_linkstate_request_ops; 3408c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_debug_request_ops; 3418c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_wol_request_ops; 3428c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_features_request_ops; 3438c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_privflags_request_ops; 3448c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_rings_request_ops; 3458c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_channels_request_ops; 3468c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_coalesce_request_ops; 3478c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_pause_request_ops; 3488c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_eee_request_ops; 3498c2ecf20Sopenharmony_ciextern const struct ethnl_request_ops ethnl_tsinfo_request_ops; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_header_policy[ETHTOOL_A_HEADER_FLAGS + 1]; 3528c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_header_policy_stats[ETHTOOL_A_HEADER_FLAGS + 1]; 3538c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_strset_get_policy[ETHTOOL_A_STRSET_COUNTS_ONLY + 1]; 3548c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_linkinfo_get_policy[ETHTOOL_A_LINKINFO_HEADER + 1]; 3558c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_linkinfo_set_policy[ETHTOOL_A_LINKINFO_TP_MDIX_CTRL + 1]; 3568c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_linkmodes_get_policy[ETHTOOL_A_LINKMODES_HEADER + 1]; 3578c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_linkmodes_set_policy[ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG + 1]; 3588c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_linkstate_get_policy[ETHTOOL_A_LINKSTATE_HEADER + 1]; 3598c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_debug_get_policy[ETHTOOL_A_DEBUG_HEADER + 1]; 3608c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_debug_set_policy[ETHTOOL_A_DEBUG_MSGMASK + 1]; 3618c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_wol_get_policy[ETHTOOL_A_WOL_HEADER + 1]; 3628c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_wol_set_policy[ETHTOOL_A_WOL_SOPASS + 1]; 3638c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_features_get_policy[ETHTOOL_A_FEATURES_HEADER + 1]; 3648c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_features_set_policy[ETHTOOL_A_FEATURES_WANTED + 1]; 3658c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_privflags_get_policy[ETHTOOL_A_PRIVFLAGS_HEADER + 1]; 3668c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_privflags_set_policy[ETHTOOL_A_PRIVFLAGS_FLAGS + 1]; 3678c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_rings_get_policy[ETHTOOL_A_RINGS_HEADER + 1]; 3688c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_rings_set_policy[ETHTOOL_A_RINGS_TX + 1]; 3698c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_channels_get_policy[ETHTOOL_A_CHANNELS_HEADER + 1]; 3708c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_channels_set_policy[ETHTOOL_A_CHANNELS_COMBINED_COUNT + 1]; 3718c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_coalesce_get_policy[ETHTOOL_A_COALESCE_HEADER + 1]; 3728c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_coalesce_set_policy[ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL + 1]; 3738c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_pause_get_policy[ETHTOOL_A_PAUSE_HEADER + 1]; 3748c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_pause_set_policy[ETHTOOL_A_PAUSE_TX + 1]; 3758c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_eee_get_policy[ETHTOOL_A_EEE_HEADER + 1]; 3768c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_eee_set_policy[ETHTOOL_A_EEE_TX_LPI_TIMER + 1]; 3778c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_tsinfo_get_policy[ETHTOOL_A_TSINFO_HEADER + 1]; 3788c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_cable_test_act_policy[ETHTOOL_A_CABLE_TEST_HEADER + 1]; 3798c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_cable_test_tdr_act_policy[ETHTOOL_A_CABLE_TEST_TDR_CFG + 1]; 3808c2ecf20Sopenharmony_ciextern const struct nla_policy ethnl_tunnel_info_get_policy[ETHTOOL_A_TUNNEL_INFO_HEADER + 1]; 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ciint ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info); 3838c2ecf20Sopenharmony_ciint ethnl_set_linkmodes(struct sk_buff *skb, struct genl_info *info); 3848c2ecf20Sopenharmony_ciint ethnl_set_debug(struct sk_buff *skb, struct genl_info *info); 3858c2ecf20Sopenharmony_ciint ethnl_set_wol(struct sk_buff *skb, struct genl_info *info); 3868c2ecf20Sopenharmony_ciint ethnl_set_features(struct sk_buff *skb, struct genl_info *info); 3878c2ecf20Sopenharmony_ciint ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info); 3888c2ecf20Sopenharmony_ciint ethnl_set_rings(struct sk_buff *skb, struct genl_info *info); 3898c2ecf20Sopenharmony_ciint ethnl_set_channels(struct sk_buff *skb, struct genl_info *info); 3908c2ecf20Sopenharmony_ciint ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info); 3918c2ecf20Sopenharmony_ciint ethnl_set_pause(struct sk_buff *skb, struct genl_info *info); 3928c2ecf20Sopenharmony_ciint ethnl_set_eee(struct sk_buff *skb, struct genl_info *info); 3938c2ecf20Sopenharmony_ciint ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info); 3948c2ecf20Sopenharmony_ciint ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info); 3958c2ecf20Sopenharmony_ciint ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info); 3968c2ecf20Sopenharmony_ciint ethnl_tunnel_info_start(struct netlink_callback *cb); 3978c2ecf20Sopenharmony_ciint ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb); 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_ci#endif /* _NET_ETHTOOL_NETLINK_H */ 400