[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190222095131.GQ23151@unicorn.suse.cz>
Date: Fri, 22 Feb 2019 10:51:31 +0100
From: Michal Kubecek <mkubecek@...e.cz>
To: Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc: davem@...emloft.net, jiri@...nulli.us, andrew@...n.ch,
f.fainelli@...il.com, netdev@...r.kernel.org,
oss-drivers@...ronome.com
Subject: Re: [PATCH net-next 3/5] devlink: create a special NDO for getting
the devlink instance
On Thu, Feb 21, 2019 at 09:46:18AM -0800, Jakub Kicinski wrote:
> Instead of iterating over all devlink ports add a NDO which
> will return the devlink instance from the driver.
>
> Suggested-by: Jiri Pirko <jiri@...nulli.us>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
> ---
> include/linux/netdevice.h | 6 ++++
> net/core/devlink.c | 62 +++++++++++++--------------------------
> 2 files changed, 26 insertions(+), 42 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index aab4d9f6613d..eebcef6b8191 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -940,6 +940,8 @@ struct dev_ifalias {
> char ifalias[];
> };
>
> +struct devlink;
> +
> /*
> * This structure defines the management hooks for network devices.
> * The following hooks can be defined; unless noted otherwise, they are
> @@ -1248,6 +1250,9 @@ struct dev_ifalias {
> * that got dropped are freed/returned via xdp_return_frame().
> * Returns negative number, means general error invoking ndo, meaning
> * no frames were xmit'ed and core-caller will free all frames.
> + * struct devlink *(*ndo_get_devlink)(struct net_device *dev);
> + * Get devlink instance associated with a given netdev.
> + * Called with a reference on the device only, rtnl_lock is not held.
The formulation is a bit ambiguous. Do I understand correctly that what
it says is that device reference is sufficient and rtnl_lock is not
necessary (but there is no harm if caller holds rtnl_lock)?
Michal
Powered by blists - more mailing lists