netlink.h 21 KB

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