From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com,
yotamg@mellanox.com, nogahf@mellanox.com, ogerlitz@mellanox.com,
ilant@mellanox.com
Subject: [patch net v2 04/10] mlxsw: spectrum: Mark port as active before registering it
Date: Wed, 17 Aug 2016 16:39:31 +0200 [thread overview]
Message-ID: <1471444777-3412-5-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1471444777-3412-1-git-send-email-jiri@resnulli.us>
From: Ido Schimmel <idosch@mellanox.com>
Commit bbf2a4757b30 ("mlxsw: spectrum: Initialize ports at the end of
init sequence") moved ports initialization to the end of the init
sequence, which means ports are the first to be removed during fini.
Since the FDB delayed work is still active when ports are removed it's
possible for it to process FDB notifications of inactive ports,
resulting in a warning message.
Fix that by marking ports as inactive only after unregistering them. The
NETDEV_UNREGISTER event will invoke bridge's driver port removal
sequence that will cause the FDB (and FDB notifications) to be flushed.
Fixes: bbf2a4757b30 ("mlxsw: spectrum: Initialize ports at the end of init sequence")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 0677f3f..12681db 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -2183,6 +2183,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
}
mlxsw_sp_port_switchdev_init(mlxsw_sp_port);
+ mlxsw_sp->ports[local_port] = mlxsw_sp_port;
err = register_netdev(dev);
if (err) {
dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to register netdev\n",
@@ -2199,12 +2200,12 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
goto err_core_port_init;
}
- mlxsw_sp->ports[local_port] = mlxsw_sp_port;
return 0;
err_core_port_init:
unregister_netdev(dev);
err_register_netdev:
+ mlxsw_sp->ports[local_port] = NULL;
mlxsw_sp_port_pvid_vport_destroy(mlxsw_sp_port);
err_port_pvid_vport_create:
mlxsw_sp_port_dcb_fini(mlxsw_sp_port);
@@ -2233,9 +2234,9 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port)
if (!mlxsw_sp_port)
return;
- mlxsw_sp->ports[local_port] = NULL;
mlxsw_core_port_fini(&mlxsw_sp_port->core_port);
unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */
+ mlxsw_sp->ports[local_port] = NULL;
mlxsw_sp_port_pvid_vport_destroy(mlxsw_sp_port);
mlxsw_sp_port_dcb_fini(mlxsw_sp_port);
mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
--
2.5.5
next prev parent reply other threads:[~2016-08-17 14:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 14:39 [patch net v2 00/10] mlxsw: IPv4 UC router fixes Jiri Pirko
2016-08-17 14:39 ` [patch net v2 01/10] mlxsw: spectrum: Don't return upon error in removal path Jiri Pirko
2016-08-17 14:39 ` [patch net v2 02/10] mlxsw: spectrum: Remove redundant errors from the code Jiri Pirko
2016-08-17 14:39 ` [patch net v2 03/10] mlxsw: spectrum: Create PVID vPort before registering netdevice Jiri Pirko
2016-08-17 14:39 ` Jiri Pirko [this message]
2016-08-17 14:39 ` [patch net v2 05/10] mlxsw: spectrum: Add missing packet traps Jiri Pirko
2016-08-17 14:39 ` [patch net v2 06/10] mlxsw: spectrum: Trap loop-backed packets Jiri Pirko
2016-08-17 14:39 ` [patch net v2 07/10] mlxsw: reg: Fix missing op field fill-up Jiri Pirko
2016-08-17 14:39 ` [patch net v2 08/10] mlxsw: spectrum: Add missing rollbacks in error path Jiri Pirko
2016-08-17 14:39 ` [patch net v2 09/10] mlxsw: spectrum: Unmap 802.1Q FID before destroying it Jiri Pirko
2016-08-17 14:39 ` [patch net v2 10/10] mlxsw: spectrum: Allow packets to be trapped from any PG Jiri Pirko
2016-08-17 23:19 ` [patch net v2 00/10] mlxsw: IPv4 UC router fixes 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=1471444777-3412-5-git-send-email-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=davem@davemloft.net \
--cc=eladr@mellanox.com \
--cc=idosch@mellanox.com \
--cc=ilant@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=nogahf@mellanox.com \
--cc=ogerlitz@mellanox.com \
--cc=yotamg@mellanox.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).