ethtool: Veto some operations during firmware flashing process

Some operations cannot be performed during the firmware flashing
process.

For example:

- Port must be down during the whole flashing process to avoid packet loss
  while committing reset for example.

- Writing to EEPROM interrupts the flashing process, so operations like
  ethtool dump, module reset, get and set power mode should be vetoed.

- Split port firmware flashing should be vetoed.

In order to veto those scenarios, add a flag in 'struct net_device' that
indicates when a firmware flash is taking place on the module and use it
to prevent interruptions during the process.

Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Danielle Ratson
2024-06-27 17:08:52 +03:00
committed by David S. Miller
parent d7d4cfc4c9
commit 31e0aa99dc
4 changed files with 33 additions and 1 deletions

View File

@@ -1990,6 +1990,8 @@ enum netdev_reg_state {
*
* @threaded: napi threaded mode is enabled
*
* @module_fw_flash_in_progress: Module firmware flashing is in progress.
*
* @net_notifier_list: List of per-net netdev notifier block
* that follow this device when it is moved
* to another network namespace.
@@ -2374,7 +2376,7 @@ struct net_device {
bool proto_down;
bool threaded;
unsigned wol_enabled:1;
unsigned module_fw_flash_in_progress:1;
struct list_head net_notifier_list;
#if IS_ENABLED(CONFIG_MACSEC)