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