ethtool: Add ability to flash transceiver modules' firmware

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>
This commit is contained in:
Danielle Ratson
2024-06-27 17:08:56 +03:00
committed by David S. Miller
parent c4f78134d4
commit 32b4c8b53e
4 changed files with 334 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
/* 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
@@ -54,6 +55,8 @@ struct ethtool_module_fw_flash {
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,