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