From: Michal Kubecek <mkubecek@suse.cz>
To: netdev@vger.kernel.org
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>,
davem@davemloft.net, jiri@resnulli.us, oss-drivers@netronome.com,
andrew@lunn.ch
Subject: Re: [PATCH net-next 3/3] nfp: devlink: allow flashing the device via devlink
Date: Fri, 15 Feb 2019 11:26:32 +0100 [thread overview]
Message-ID: <20190215102632.GM25518@unicorn.suse.cz> (raw)
In-Reply-To: <20190214214046.19182-4-jakub.kicinski@netronome.com>
On Thu, Feb 14, 2019 at 01:40:46PM -0800, Jakub Kicinski wrote:
> Devlink now allows updating device flash. Implement this
> callback.
>
> Compared to ethtool update we no longer have to release
> the networking locks - devlink doesn't take them.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> ---
...
> diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
> index cb9c512abc76..8f189149efc5 100644
> --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
> +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
> @@ -1237,11 +1237,8 @@ static int nfp_net_set_channels(struct net_device *netdev,
> static int
> nfp_net_flash_device(struct net_device *netdev, struct ethtool_flash *flash)
> {
> - const struct firmware *fw;
> struct nfp_app *app;
> - struct nfp_nsp *nsp;
> - struct device *dev;
> - int err;
> + int ret;
>
> if (flash->region != ETHTOOL_FLASH_ALL_REGIONS)
> return -EOPNOTSUPP;
> @@ -1250,39 +1247,13 @@ nfp_net_flash_device(struct net_device *netdev, struct ethtool_flash *flash)
> if (!app)
> return -EOPNOTSUPP;
>
> - dev = &app->pdev->dev;
> -
> - nsp = nfp_nsp_open(app->cpp);
> - if (IS_ERR(nsp)) {
> - err = PTR_ERR(nsp);
> - dev_err(dev, "Failed to access the NSP: %d\n", err);
> - return err;
> - }
> -
> - err = request_firmware_direct(&fw, flash->data, dev);
> - if (err)
> - goto exit_close_nsp;
> -
> - dev_info(dev, "Please be patient while writing flash image: %s\n",
> - flash->data);
> dev_hold(netdev);
> rtnl_unlock();
> -
> - err = nfp_nsp_write_flash(nsp, fw);
> - if (err < 0) {
> - dev_err(dev, "Flash write failed: %d\n", err);
> - goto exit_rtnl_lock;
> - }
> - dev_info(dev, "Finished writing flash image\n");
> -
> -exit_rtnl_lock:
> + ret = nfp_flash_update_common(app->pf, flash->data, NULL);
> rtnl_lock();
> dev_put(netdev);
> - release_firmware(fw);
>
> -exit_close_nsp:
> - nfp_nsp_close(nsp);
> - return err;
> + return ret;
> }
>
> static const struct ethtool_ops nfp_net_ethtool_ops = {
Out of curiosity: why don't you drop the ethtool_ops callback and let
the fallback introduced in patch 2/3 do the fallback? Is it to preserve
the check of flash->region or to avoid the lookup? My understanding of
the previous patch was that it would allow new drivers providing the
devlink callback to get rid of ethtool_ops one.
Michal Kubecek
next prev parent reply other threads:[~2019-02-15 10:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 21:40 [PATCH net-next 0/3] devlink: add the ability to update device flash Jakub Kicinski
2019-02-14 21:40 ` [PATCH net-next 1/3] devlink: add flash update command Jakub Kicinski
2019-02-15 10:10 ` Jiri Pirko
2019-02-14 21:40 ` [PATCH net-next 2/3] ethtool: add compat for flash update Jakub Kicinski
2019-02-15 8:53 ` Michal Kubecek
2019-02-15 10:17 ` Jiri Pirko
2019-02-15 15:51 ` Jakub Kicinski
2019-02-15 10:12 ` Jiri Pirko
2019-02-14 21:40 ` [PATCH net-next 3/3] nfp: devlink: allow flashing the device via devlink Jakub Kicinski
2019-02-15 10:15 ` Jiri Pirko
2019-02-15 15:44 ` Jakub Kicinski
2019-02-19 9:19 ` Jiri Pirko
2019-02-20 0:49 ` Jakub Kicinski
2019-02-20 8:37 ` Jiri Pirko
2019-02-21 2:59 ` Florian Fainelli
2019-02-21 3:20 ` Jakub Kicinski
2019-02-21 7:00 ` Jiri Pirko
2019-02-21 7:17 ` Michal Kubecek
2019-02-15 10:26 ` Michal Kubecek [this message]
2019-02-17 23:28 ` [PATCH net-next 0/3] devlink: add the ability to update device flash David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190215102632.GM25518@unicorn.suse.cz \
--to=mkubecek@suse.cz \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).