From: Shannon Nelson <shnelson@amd.com>
To: Jiri Pirko <jiri@resnulli.us>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, michael.chan@broadcom.com,
ioana.ciornei@nxp.com, dmichail@fungible.com,
jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
tchornyi@marvell.com, tariqt@nvidia.com, saeedm@nvidia.com,
leon@kernel.org, idosch@nvidia.com, petrm@nvidia.com,
vladimir.oltean@nxp.com, claudiu.manoil@nxp.com,
alexandre.belloni@bootlin.com, simon.horman@corigine.com,
shannon.nelson@amd.com, brett.creeley@amd.com
Subject: Re: [patch net-next 1/8] devlink: call devlink_port_register/unregister() on registered instance
Date: Mon, 5 Dec 2022 15:55:32 -0800 [thread overview]
Message-ID: <5e97d5b5-3df4-c9b5-bca4-c82c75d353e8@amd.com> (raw)
In-Reply-To: <20221205152257.454610-2-jiri@resnulli.us>
On 12/5/22 7:22 AM, Jiri Pirko wrote:
>
> From: Jiri Pirko <jiri@nvidia.com>
>
> Change the drivers that use devlink_port_register/unregister() to call
> these functions only in case devlink is registered.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> ---
> RFC->v1:
> - shortened patch subject
> ---
> .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 29 ++++++++++---------
> .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 7 +++--
> .../ethernet/fungible/funeth/funeth_main.c | 17 +++++++----
> drivers/net/ethernet/intel/ice/ice_main.c | 21 ++++++++------
> .../ethernet/marvell/prestera/prestera_main.c | 6 ++--
> drivers/net/ethernet/mscc/ocelot_vsc7514.c | 10 +++----
> .../ethernet/pensando/ionic/ionic_devlink.c | 6 ++--
> drivers/net/ethernet/ti/am65-cpsw-nuss.c | 7 +++--
> 8 files changed, 60 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
> index e6ff757895ab..06670343f90b 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
> @@ -78,16 +78,18 @@ int ionic_devlink_register(struct ionic *ionic)
> struct devlink_port_attrs attrs = {};
> int err;
>
> + devlink_register(dl);
> +
> attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
> devlink_port_attrs_set(&ionic->dl_port, &attrs);
> err = devlink_port_register(dl, &ionic->dl_port, 0);
> if (err) {
> dev_err(ionic->dev, "devlink_port_register failed: %d\n", err);
> + devlink_unregister(dl);
> return err;
> }
>
> SET_NETDEV_DEVLINK_PORT(ionic->lif->netdev, &ionic->dl_port);
> - devlink_register(dl);
> return 0;
> }
>
> @@ -95,6 +97,6 @@ void ionic_devlink_unregister(struct ionic *ionic)
> {
> struct devlink *dl = priv_to_devlink(ionic);
>
> - devlink_unregister(dl);
> devlink_port_unregister(&ionic->dl_port);
> + devlink_unregister(dl);
> }
I don't know about the rest of the drivers, but this seems to be the
exact opposite of what Leon did in this patch over a year ago:
https://lore.kernel.org/netdev/cover.1632565508.git.leonro@nvidia.com/
I haven't kept up on all the discussion about this, but is there no
longer a worry about registering the devlink object before all the
related configuration bits are in place?
Does this open any potential issues with userland programs seeing the
devlink device and trying to access port before they get registered?
sln
next prev parent reply other threads:[~2022-12-05 23:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-05 15:22 [patch net-next 0/8] devlink: make sure devlink port registers/unregisters only for registered instance Jiri Pirko
2022-12-05 15:22 ` [patch net-next 1/8] devlink: call devlink_port_register/unregister() on " Jiri Pirko
2022-12-05 23:55 ` Shannon Nelson [this message]
2022-12-06 7:41 ` Jiri Pirko
2022-12-06 7:56 ` Leon Romanovsky
2022-12-06 17:35 ` Shannon Nelson
2022-12-07 13:27 ` Jiri Pirko
2022-12-07 19:45 ` Shannon Nelson
2022-12-05 15:22 ` [patch net-next 2/8] netdevsim: call devl_port_register/unregister() " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 3/8] mlxsw: " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 4/8] nfp: " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 5/8] mlx4: " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 6/8] mlx5: " Jiri Pirko
2022-12-05 15:22 ` [patch net-next 7/8] devlink: assert if devl_port_register/unregister() is called on unregistered devlink instance Jiri Pirko
2022-12-05 15:22 ` [patch net-next 8/8] devlink: remove port notifications from devlink_register/unregister() Jiri Pirko
2022-12-06 1:08 ` [patch net-next 0/8] devlink: make sure devlink port registers/unregisters only for registered instance Jakub Kicinski
2022-12-06 7:44 ` Jiri Pirko
2022-12-06 20:12 ` Jakub Kicinski
2022-12-07 13:28 ` 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=5e97d5b5-3df4-c9b5-bca4-c82c75d353e8@amd.com \
--to=shnelson@amd.com \
--cc=alexandre.belloni@bootlin.com \
--cc=anthony.l.nguyen@intel.com \
--cc=brett.creeley@amd.com \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=dmichail@fungible.com \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=ioana.ciornei@nxp.com \
--cc=jesse.brandeburg@intel.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=saeedm@nvidia.com \
--cc=shannon.nelson@amd.com \
--cc=simon.horman@corigine.com \
--cc=tariqt@nvidia.com \
--cc=tchornyi@marvell.com \
--cc=vladimir.oltean@nxp.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).