xref: /linux/net/ethtool/module_fw.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <uapi/linux/ethtool.h>
4 #include "netlink.h"
5 
6 /**
7  * struct ethnl_module_fw_flash_ntf_params - module firmware flashing
8  *						notifications parameters
9  * @portid: Netlink portid of sender.
10  * @seq: Sequence number of sender.
11  * @closed_sock: Indicates whether the socket was closed from user space.
12  */
13 struct ethnl_module_fw_flash_ntf_params {
14 	u32 portid;
15 	u32 seq;
16 	bool closed_sock;
17 };
18 
19 /**
20  * struct ethtool_module_fw_flash_params - module firmware flashing parameters
21  * @password: Module password. Only valid when @pass_valid is set.
22  * @password_valid: Whether the module password is valid or not.
23  */
24 struct ethtool_module_fw_flash_params {
25 	__be32 password;
26 	u8 password_valid:1;
27 };
28 
29 /**
30  * struct ethtool_cmis_fw_update_params - CMIS firmware update specific
31  *						parameters
32  * @dev: Pointer to the net_device to be flashed.
33  * @params: Module firmware flashing parameters.
34  * @ntf_params: Module firmware flashing notification parameters.
35  * @fw: Firmware to flash.
36  */
37 struct ethtool_cmis_fw_update_params {
38 	struct net_device *dev;
39 	struct ethtool_module_fw_flash_params params;
40 	struct ethnl_module_fw_flash_ntf_params ntf_params;
41 	const struct firmware *fw;
42 };
43 
44 /**
45  * struct ethtool_module_fw_flash - module firmware flashing
46  * @list: List node for &module_fw_flash_work_list.
47  * @dev_tracker: Refcount tracker for @dev.
48  * @work: The flashing firmware work.
49  * @fw_update: CMIS firmware update specific parameters.
50  */
51 struct ethtool_module_fw_flash {
52 	struct list_head list;
53 	netdevice_tracker dev_tracker;
54 	struct work_struct work;
55 	struct ethtool_cmis_fw_update_params fw_update;
56 };
57 
58 void ethnl_module_fw_flash_sock_destroy(struct ethnl_sock_priv *sk_priv);
59 
60 void
61 ethnl_module_fw_flash_ntf_err(struct net_device *dev,
62 			      struct ethnl_module_fw_flash_ntf_params *params,
63 			      char *err_msg, char *sub_err_msg);
64 void
65 ethnl_module_fw_flash_ntf_start(struct net_device *dev,
66 				struct ethnl_module_fw_flash_ntf_params *params);
67 void
68 ethnl_module_fw_flash_ntf_complete(struct net_device *dev,
69 				   struct ethnl_module_fw_flash_ntf_params *params);
70 void
71 ethnl_module_fw_flash_ntf_in_progress(struct net_device *dev,
72 				      struct ethnl_module_fw_flash_ntf_params *params,
73 				      u64 done, u64 total);
74 
75 void ethtool_cmis_fw_update(struct ethtool_cmis_fw_update_params *params);
76