From: Jakub Kicinski <kuba@kernel.org>
To: Jiri Pirko <jiri@resnulli.us>
Cc: netdev@vger.kernel.org, davem@davemloft.net, pabeni@redhat.com,
edumazet@google.com, tariqt@nvidia.com, moshe@nvidia.com,
saeedm@nvidia.com, linux-rdma@vger.kernel.org
Subject: Re: [patch net-next v3 05/13] net: devlink: track netdev with devlink_port assigned
Date: Tue, 1 Nov 2022 09:25:42 -0700 [thread overview]
Message-ID: <20221101092542.26c66235@kernel.org> (raw)
In-Reply-To: <20221031124248.484405-6-jiri@resnulli.us>
On Mon, 31 Oct 2022 13:42:40 +0100 Jiri Pirko wrote:
> +/*
> + * Driver should use this to assign devlink port instance to a netdevice
> + * before it registers the netdevice. Therefore devlink_port is static
> + * during the netdev lifetime after it is registered.
> + */
> +#define SET_NETDEV_DEVLINK_PORT(dev, _devlink_port) \
> +({ \
> + WARN_ON(dev->reg_state != NETREG_UNINITIALIZED); \
> + ((dev)->devlink_port = (_devlink_port)); \
> +})
The argument wrapping is inconsistent here - dev is in brackets
on the second line but not on the first. _devlink_port is prefixed
with underscore and dev is not. Let's make this properly secure
and define a local var for dev.
> @@ -10107,6 +10107,7 @@ int register_netdevice(struct net_device *dev)
> return ret;
>
> err_uninit:
> + call_netdevice_notifiers(NETDEV_PRE_UNINIT, dev);
I think we should make this symmetric with POST_INIT.
IOW PRE_UNINIT should only be called if POST_INIT was called.
next prev parent reply other threads:[~2022-11-01 16:25 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 12:42 [patch net-next v3 00/13] net: fix netdev to devlink_port linkage and expose to user Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 01/13] net: devlink: convert devlink port type-specific pointers to union Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 02/13] net: devlink: move port_type_warn_schedule() call to __devlink_port_type_set() Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 03/13] net: devlink: move port_type_netdev_checks() " Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 04/13] net: devlink: take RTNL in port_fill() function only if it is not held Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 05/13] net: devlink: track netdev with devlink_port assigned Jiri Pirko
2022-11-01 16:25 ` Jakub Kicinski [this message]
2022-11-02 9:32 ` Jiri Pirko
2022-11-02 11:13 ` Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 06/13] net: make drivers to use SET_NETDEV_DEVLINK_PORT to set devlink_port Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 07/13] net: devlink: remove netdev arg from devlink_port_type_eth_set() Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 08/13] net: devlink: remove net namespace check from devlink_nl_port_fill() Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 09/13] net: devlink: store copy netdevice ifindex and ifname to allow port_fill() without RTNL held Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 10/13] net: devlink: add not cleared type warning to port unregister Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 11/13] net: devlink: use devlink_port pointer instead of ndo_get_devlink_port Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 12/13] net: remove unused ndo_get_devlink_port Jiri Pirko
2022-10-31 12:42 ` [patch net-next v3 13/13] net: expose devlink port over rtnetlink Jiri Pirko
2022-11-01 16:18 ` Jakub Kicinski
2022-11-02 11:22 ` Jiri Pirko
2022-11-02 15:10 ` Jakub Kicinski
2022-11-02 15:13 ` Jakub Kicinski
2022-11-02 15:37 ` Jiri Pirko
2022-11-02 15:52 ` Jakub Kicinski
2022-11-02 15:59 ` Jiri Pirko
2022-11-02 16:28 ` Jakub Kicinski
2022-11-01 17:29 ` [patch net-next v3 00/13] net: fix netdev to devlink_port linkage and expose to user Jakub Kicinski
2022-11-02 9:33 ` Jiri Pirko
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=20221101092542.26c66235@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jiri@resnulli.us \
--cc=linux-rdma@vger.kernel.org \
--cc=moshe@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.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).