[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240124090620.69af41a6@kernel.org>
Date: Wed, 24 Jan 2024 09:06:20 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Danielle Ratson <danieller@...dia.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "davem@...emloft.net"
<davem@...emloft.net>, "edumazet@...gle.com" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>, "corbet@....net" <corbet@....net>,
"linux@...linux.org.uk" <linux@...linux.org.uk>, "sdf@...gle.com"
<sdf@...gle.com>, "kory.maincent@...tlin.com" <kory.maincent@...tlin.com>,
"maxime.chevallier@...tlin.com" <maxime.chevallier@...tlin.com>,
"vladimir.oltean@....com" <vladimir.oltean@....com>,
"przemyslaw.kitszel@...el.com" <przemyslaw.kitszel@...el.com>,
"ahmed.zaki@...el.com" <ahmed.zaki@...el.com>, "richardcochran@...il.com"
<richardcochran@...il.com>, "shayagr@...zon.com" <shayagr@...zon.com>,
"paul.greenwalt@...el.com" <paul.greenwalt@...el.com>, "jiri@...nulli.us"
<jiri@...nulli.us>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, mlxsw <mlxsw@...dia.com>, Petr Machata
<petrm@...dia.com>, Ido Schimmel <idosch@...dia.com>
Subject: Re: [RFC PATCH net-next 9/9] ethtool: Add ability to flash
transceiver modules' firmware
On Wed, 24 Jan 2024 15:46:55 +0000 Danielle Ratson wrote:
> > > The file_name parameter is not really needed inside the work. Once we
> > > called request_firmware_direct(), we have all that we need in
> > > module_fw->fw. Do we still need to avoid that situation? If so, can
> > > you please suggest how?
> >
> > I'd pass it to module_flash_fw_schedule() as a separate argument, if it doesn't
> > have to be saved.
>
> It doesn’t make the module_fw->file_name attribute redundant?
This is what I mean:
diff --git a/net/ethtool/module.c b/net/ethtool/module.c
index 69cedb3ede6d..ea048a7089d9 100644
--- a/net/ethtool/module.c
+++ b/net/ethtool/module.c
@@ -229,7 +229,7 @@ static int module_flash_fw_work_init(struct ethtool_module_fw_flash *module_fw,
}
static int
-module_flash_fw_schedule(struct net_device *dev,
+module_flash_fw_schedule(struct net_device *dev, const char *file_name,
struct ethtool_module_fw_flash_params *params,
struct netlink_ext_ack *extack)
{
@@ -254,8 +254,7 @@ module_flash_fw_schedule(struct net_device *dev,
return -ENOMEM;
module_fw->params = *params;
- err = request_firmware(&module_fw->fw, module_fw->params.file_name,
- &dev->dev);
+ err = request_firmware(&module_fw->fw, file_name, &dev->dev);
if (err) {
NL_SET_ERR_MSG(extack,
"Failed to request module firmware image");
@@ -288,6 +287,7 @@ static int module_flash_fw(struct net_device *dev, struct nlattr **tb,
struct netlink_ext_ack *extack)
{
struct ethtool_module_fw_flash_params params = {};
+ const char *file_name;
struct nlattr *attr;
if (!tb[ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME]) {
@@ -297,8 +297,7 @@ static int module_flash_fw(struct net_device *dev, struct nlattr **tb,
return -EINVAL;
}
- params.file_name =
- nla_data(tb[ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME]);
+ file_name = nla_data(tb[ETHTOOL_A_MODULE_FW_FLASH_FILE_NAME]);
attr = tb[ETHTOOL_A_MODULE_FW_FLASH_PASSWORD];
if (attr) {
@@ -306,7 +305,7 @@ static int module_flash_fw(struct net_device *dev, struct nlattr **tb,
params.password_valid = true;
}
- return module_flash_fw_schedule(dev, ¶ms, extack);
+ return module_flash_fw_schedule(dev, file_name, ¶ms, extack);
}
int ethnl_act_module_fw_flash(struct sk_buff *skb, struct genl_info *info)
diff --git a/net/ethtool/module_fw.h b/net/ethtool/module_fw.h
index 969de116f995..888f082f8daf 100644
--- a/net/ethtool/module_fw.h
+++ b/net/ethtool/module_fw.h
@@ -13,12 +13,10 @@ void ethtool_cmis_fw_update(struct work_struct *work);
/**
* struct ethtool_module_fw_flash_params - module firmware flashing parameters
- * @file_name: Firmware image file name.
* @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 {
- const char *file_name;
u32 password;
u8 password_valid:1;
};
Powered by blists - more mailing lists