mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
32b4c8b53e
Add the ability to flash the modules' firmware by implementing the interface between the user space and the kernel. Example from a succeeding implementation: # ethtool --flash-module-firmware swp40 file test.bin Transceiver module firmware flashing started for device swp40 Transceiver module firmware flashing in progress for device swp40 Progress: 99% Transceiver module firmware flashing completed for device swp40 In addition, add infrastructure that allows modules to set socket-specific private data. This ensures that when a socket is closed from user space during the flashing process, the right socket halts sending notifications to user space until the work item is completed. Signed-off-by: Danielle Ratson <danieller@nvidia.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
76 lines
2.3 KiB
C
76 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#include <uapi/linux/ethtool.h>
|
|
#include "netlink.h"
|
|
|
|
/**
|
|
* struct ethnl_module_fw_flash_ntf_params - module firmware flashing
|
|
* notifications parameters
|
|
* @portid: Netlink portid of sender.
|
|
* @seq: Sequence number of sender.
|
|
* @closed_sock: Indicates whether the socket was closed from user space.
|
|
*/
|
|
struct ethnl_module_fw_flash_ntf_params {
|
|
u32 portid;
|
|
u32 seq;
|
|
bool closed_sock;
|
|
};
|
|
|
|
/**
|
|
* struct ethtool_module_fw_flash_params - module firmware flashing parameters
|
|
* @password: Module password. Only valid when @pass_valid is set.
|
|
* @password_valid: Whether the module password is valid or not.
|
|
*/
|
|
struct ethtool_module_fw_flash_params {
|
|
__be32 password;
|
|
u8 password_valid:1;
|
|
};
|
|
|
|
/**
|
|
* struct ethtool_cmis_fw_update_params - CMIS firmware update specific
|
|
* parameters
|
|
* @dev: Pointer to the net_device to be flashed.
|
|
* @params: Module firmware flashing parameters.
|
|
* @ntf_params: Module firmware flashing notification parameters.
|
|
* @fw: Firmware to flash.
|
|
*/
|
|
struct ethtool_cmis_fw_update_params {
|
|
struct net_device *dev;
|
|
struct ethtool_module_fw_flash_params params;
|
|
struct ethnl_module_fw_flash_ntf_params ntf_params;
|
|
const struct firmware *fw;
|
|
};
|
|
|
|
/**
|
|
* struct ethtool_module_fw_flash - module firmware flashing
|
|
* @list: List node for &module_fw_flash_work_list.
|
|
* @dev_tracker: Refcount tracker for @dev.
|
|
* @work: The flashing firmware work.
|
|
* @fw_update: CMIS firmware update specific parameters.
|
|
*/
|
|
struct ethtool_module_fw_flash {
|
|
struct list_head list;
|
|
netdevice_tracker dev_tracker;
|
|
struct work_struct work;
|
|
struct ethtool_cmis_fw_update_params fw_update;
|
|
};
|
|
|
|
void ethnl_module_fw_flash_sock_destroy(struct ethnl_sock_priv *sk_priv);
|
|
|
|
void
|
|
ethnl_module_fw_flash_ntf_err(struct net_device *dev,
|
|
struct ethnl_module_fw_flash_ntf_params *params,
|
|
char *err_msg, char *sub_err_msg);
|
|
void
|
|
ethnl_module_fw_flash_ntf_start(struct net_device *dev,
|
|
struct ethnl_module_fw_flash_ntf_params *params);
|
|
void
|
|
ethnl_module_fw_flash_ntf_complete(struct net_device *dev,
|
|
struct ethnl_module_fw_flash_ntf_params *params);
|
|
void
|
|
ethnl_module_fw_flash_ntf_in_progress(struct net_device *dev,
|
|
struct ethnl_module_fw_flash_ntf_params *params,
|
|
u64 done, u64 total);
|
|
|
|
void ethtool_cmis_fw_update(struct ethtool_cmis_fw_update_params *params);
|