From: Florian Fainelli <f.fainelli@gmail.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>,
davem@davemloft.net, jiri@resnulli.us
Cc: mkubecek@suse.cz, andrew@lunn.ch, netdev@vger.kernel.org,
oss-drivers@netronome.com
Subject: Re: [PATCH net-next v2 3/5] devlink: create a special NDO for getting the devlink instance
Date: Fri, 22 Feb 2019 12:04:07 -0800 [thread overview]
Message-ID: <4ae4a622-f45f-36a4-2ff5-b0553a40dc22@gmail.com> (raw)
In-Reply-To: <20190222195410.9494-4-jakub.kicinski@netronome.com>
On 2/22/19 11:54 AM, Jakub Kicinski wrote:
> Instead of iterating over all devlink ports add a NDO which
> will return the devlink instance from the driver.
>
> v2: add the netdev_to_devlink() helper (Michal)
>
> Suggested-by: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> ---
[snip]
> - mutex_unlock(&devlink_mutex);
> + devlink = netdev_to_devlink(dev);
> + if (!devlink || !devlink->ops->info_get)
> + return;
AFAICT devlink_create() allows one to specify a NULL ops argument (not
that this makes sense), so probably need to add a check against
devlink->ops here as well, unless we want to change devlink_create() to
refuse a NULL ops pointer.
Other than that:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> +
> + mutex_lock(&devlink->lock);
> + __devlink_compat_running_version(devlink, buf, len);
> + mutex_unlock(&devlink->lock);
> }
>
> int devlink_compat_flash_update(struct net_device *dev, const char *file_name)
> {
> - struct devlink_port *devlink_port;
> struct devlink *devlink;
> + int ret;
>
> - mutex_lock(&devlink_mutex);
> - list_for_each_entry(devlink, &devlink_list, list) {
> - mutex_lock(&devlink->lock);
> - list_for_each_entry(devlink_port, &devlink->port_list, list) {
> - int ret = -EOPNOTSUPP;
> -
> - if (devlink_port->type != DEVLINK_PORT_TYPE_ETH ||
> - devlink_port->type_dev != dev)
> - continue;
> -
> - mutex_unlock(&devlink_mutex);
> - if (devlink->ops->flash_update)
> - ret = devlink->ops->flash_update(devlink,
> - file_name,
> - NULL, NULL);
> - mutex_unlock(&devlink->lock);
> - return ret;
> - }
> - mutex_unlock(&devlink->lock);
> - }
> - mutex_unlock(&devlink_mutex);
> + devlink = netdev_to_devlink(dev);
> + if (!devlink || !devlink->ops->flash_update)
> + return -EOPNOTSUPP;
>
And same here.
--
Florian
next prev parent reply other threads:[~2019-02-22 20:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-22 19:54 [PATCH net-next v2 0/5] devlink: make ethtool compat reliable Jakub Kicinski
2019-02-22 19:54 ` [PATCH net-next v2 1/5] net: devlink: turn devlink into a built-in Jakub Kicinski
2019-02-22 20:07 ` Florian Fainelli
2019-02-22 19:54 ` [PATCH net-next v2 2/5] ethtool: hold a reference to the netdevice around devlink compat Jakub Kicinski
2019-02-22 20:09 ` Florian Fainelli
2019-02-22 21:20 ` Jakub Kicinski
2019-02-22 19:54 ` [PATCH net-next v2 3/5] devlink: create a special NDO for getting the devlink instance Jakub Kicinski
2019-02-22 20:04 ` Florian Fainelli [this message]
2019-02-22 20:09 ` Jakub Kicinski
2019-02-22 19:54 ` [PATCH net-next v2 4/5] nfp: add .ndo_get_devlink Jakub Kicinski
2019-02-22 19:54 ` [PATCH net-next v2 5/5] nfp: remove ethtool flashing fallback Jakub Kicinski
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=4ae4a622-f45f-36a4-2ff5-b0553a40dc22@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=jiri@resnulli.us \
--cc=mkubecek@suse.cz \
--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