ethtool: move firmware flashing flag to struct ethtool_netdev_state
Subsystems (3)
PATCH 1/1 ethtool: move firmware flashing flag to struct ethtool_netdev_state
From: Edward Cree <[email protected]>
Commit 31e0aa99dc02 ("ethtool: Veto some operations during firmware flashing process")
added a flag module_fw_flash_in_progress to struct net_device. As
this is ethtool related state, move it to the recently created
struct ethtool_netdev_state, accessed via the 'ethtool' member of struct net_device.
---
Build tested only.
include/linux/ethtool.h | 2 ++ include/linux/netdevice.h | 3 --- net/ethtool/eeprom.c | 2 +- net/ethtool/ioctl.c | 8 ++++---- net/ethtool/module.c | 10 +++++----- net/ethtool/netlink.c | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-)
include/linux/ethtool.h +2 -0
@@ -1107,11 +1107,13 @@ int ethtool_virtdev_set_link_ksettings(struct net_device *dev,* @rss_lock: Protects entries in @rss_ctx. May be taken from * within RTNL. * @wol_enabled: Wake-on-LAN is enabled +* @module_fw_flash_in_progress: Module firmware flashing is in progress. */ struct ethtool_netdev_state {struct xarray rss_ctx;struct mutex rss_lock;unsigned wol_enabled:1 ; +unsigned module_fw_flash_in_progress:1 ; };struct phy_device ;
include/linux/netdevice.h +0 -3
@@ -1989,8 +1989,6 @@ 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.
@@ -2376,7 +2374,6 @@ struct net_device {bool proto_down;bool threaded; - unsigned module_fw_flash_in_progress:1;struct list_head net_notifier_list;#if IS_ENABLED (CONFIG_MACSEC )
net/ethtool/eeprom.c +1 -1
@@ -91,7 +91,7 @@ static int get_module_eeprom_by_page(struct net_device *dev, {const struct ethtool_ops *ops = dev->ethtool_ops; -if (dev->module_fw_flash_in_progress) { +if (dev->ethtool->module_fw_flash_in_progress) {NL_SET_ERR_MSG (extack,"Module firmware flashing is in progress" );return -EBUSY ;
net/ethtool/ioctl.c +4 -4
@@ -658,7 +658,7 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr)if (!dev->ethtool_ops->get_link_ksettings)return -EOPNOTSUPP ; -if (dev->module_fw_flash_in_progress) +if (dev->ethtool->module_fw_flash_in_progress)return -EBUSY ;memset (&link_ksettings,0 ,sizeof (link_ksettings));
@@ -1572,7 +1572,7 @@ static int ethtool_reset(struct net_device *dev, char __user *useraddr)if (!dev->ethtool_ops->reset)return -EOPNOTSUPP ; -if (dev->module_fw_flash_in_progress) +if (dev->ethtool->module_fw_flash_in_progress)return -EBUSY ;if (copy_from_user (&reset, useraddr,sizeof (reset)))
@@ -2588,7 +2588,7 @@ int ethtool_get_module_info_call(struct net_device *dev,const struct ethtool_ops *ops = dev->ethtool_ops;struct phy_device *phydev = dev->phydev; -if (dev->module_fw_flash_in_progress) +if (dev->ethtool->module_fw_flash_in_progress)return -EBUSY ;if (dev->sfp_bus)
@@ -2628,7 +2628,7 @@ int ethtool_get_module_eeprom_call(struct net_device *dev,const struct ethtool_ops *ops = dev->ethtool_ops;struct phy_device *phydev = dev->phydev; -if (dev->module_fw_flash_in_progress) +if (dev->ethtool->module_fw_flash_in_progress)return -EBUSY ;if (dev->sfp_bus)
net/ethtool/module.c +5 -5
@@ -37,7 +37,7 @@ static int module_get_power_mode(struct net_device *dev,if (!ops->get_module_power_mode)return 0 ; -if (dev->module_fw_flash_in_progress) { +if (dev->ethtool->module_fw_flash_in_progress) {NL_SET_ERR_MSG (extack,"Module firmware flashing is in progress" );return -EBUSY ;
@@ -119,7 +119,7 @@ ethnl_set_module_validate(struct ethnl_req_info *req_info,if (!tb[ETHTOOL_A_MODULE_POWER_MODE_POLICY ])return 0 ; -if (req_info->dev->module_fw_flash_in_progress) { +if (req_info->dev->ethtool->module_fw_flash_in_progress) {NL_SET_ERR_MSG (info->extack,"Module firmware flashing is in progress" );return -EBUSY ;
@@ -226,7 +226,7 @@ static void module_flash_fw_work(struct work_struct *work)ethtool_cmis_fw_update (&module_fw->fw_update);module_flash_fw_work_list_del (&module_fw->list); - module_fw->fw_update.dev->module_fw_flash_in_progress = false; + module_fw->fw_update.dev->ethtool->module_fw_flash_in_progress = false;netdev_put (module_fw->fw_update.dev, &module_fw->dev_tracker);release_firmware (module_fw->fw_update.fw);kfree (module_fw);
@@ -318,7 +318,7 @@ module_flash_fw_schedule(struct net_device *dev, const char *file_name,if (err <0 ) goto err_release_firmware; - dev->module_fw_flash_in_progress = true; + dev->ethtool->module_fw_flash_in_progress = true;netdev_hold (dev, &module_fw->dev_tracker,GFP_KERNEL ); fw_update->dev = dev; fw_update->ntf_params.portid = info->snd_portid;
@@ -385,7 +385,7 @@ static int ethnl_module_fw_flash_validate(struct net_device *dev,return -EOPNOTSUPP ; } -if (dev->module_fw_flash_in_progress) { +if (dev->ethtool->module_fw_flash_in_progress) {NL_SET_ERR_MSG (extack,"Module firmware flashing already in progress" );return -EBUSY ; }
net/ethtool/netlink.c +1 -1
@@ -807,7 +807,7 @@ static int ethnl_netdev_event(struct notifier_block *this, unsigned long event,ethnl_notify_features (ptr);break ;case NETDEV_PRE_UP : -if (dev->module_fw_flash_in_progress) { +if (dev->ethtool->module_fw_flash_in_progress) {NL_SET_ERR_MSG (extack,"Can't set port up while flashing module firmware" );return NOTIFY_BAD ; }
Quoted 4 lines · On Wed, Jul 03, 2024 at 01:18:49PM +0100, [email protected] wrote:
From: Edward Cree <[email protected]>
Commit
31e0aa99dc02("ethtool: Veto some operations during firmware flashing process")
added a flagmodule_fw_flash_in_progressto structnet_device. As
Nitpick: unnecessary space
Quoted 3 lines
this is ethtool related state, move it to the recently created struct
ethtool_netdev_state, accessed via the 'ethtool' member of structnet_device.
Nitpick: wrong indentation in the commit message
Quoted 5 lines
Suggested-by Jakub Kicinski <[email protected]>Signed-off-by Edward Cree <[email protected]>---
Build tested only.
The code changes look OK. Just the commit message formatting needs to be polished a little bit.
Quoted 10 lines · On Wed, Jul 03, 2024 at 01:18:49PM +0100, [email protected] wrote:
From: Edward Cree <[email protected]>
Commit
31e0aa99dc02("ethtool: Veto some operations during firmware flashing process")
added a flagmodule_fw_flash_in_progressto structnet_device. As
this is ethtool related state, move it to the recently created
structethtool_netdev_state, accessed via the 'ethtool' member of structnet_device.Suggested-by Jakub Kicinski <[email protected]>Signed-off-by Edward Cree <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 3 Jul 2024 13:18:49 +0100 you wrote:
From: Edward Cree <[email protected]>
Commit
31e0aa99dc02("ethtool: Veto some operations during firmware flashing process")
added a flagmodule_fw_flash_in_progressto structnet_device. As
this is ethtool related state, move it to the recently created
structethtool_netdev_state, accessed via the 'ethtool' member of structnet_device.[...]
Here is the summary with links:
- [net-next] ethtool: move firmware flashing flag to struct ethtool_netdev_state
https://git.kernel.org/netdev/net-next/c/caa93b7c2594
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html