netlink.h 22 KB

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