* [patch net] mlxsw: spectrum: Do not try to create non-existing ports during unsplit
@ 2017-11-21 8:42 Jiri Pirko
2017-11-21 11:15 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Pirko @ 2017-11-21 8:42 UTC (permalink / raw)
To: netdev; +Cc: davem, idosch, mlxsw
From: Ido Schimmel <idosch@mellanox.com>
On some systems, when we unsplit a port we need to re-create two ports
instead. On other systems, only one needs to be re-created.
Do not try to create a port if during driver initialization it was
assigned a negative module number, which is invalid.
This avoids the following error during unsplit:
[ 941.012478] mlxsw_spectrum 0000:01:00.0: Port 43: Failed to map module
The error is harmless and caused by the fact that a local port is
already mapped to module 0.
Fixes: be94535f9531 ("mlxsw: spectrum: Make split flow match firmware requirements")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 8 +++++++-
drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 2d46ec8..2d0897b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -3142,13 +3142,17 @@ static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
if (!mlxsw_sp->ports)
return -ENOMEM;
- mlxsw_sp->port_to_module = kcalloc(max_ports, sizeof(u8), GFP_KERNEL);
+ mlxsw_sp->port_to_module = kmalloc_array(max_ports, sizeof(int),
+ GFP_KERNEL);
if (!mlxsw_sp->port_to_module) {
err = -ENOMEM;
goto err_port_to_module_alloc;
}
for (i = 1; i < max_ports; i++) {
+ /* Mark as invalid */
+ mlxsw_sp->port_to_module[i] = -1;
+
err = mlxsw_sp_port_module_info_get(mlxsw_sp, i, &module,
&width, &lane);
if (err)
@@ -3216,6 +3220,8 @@ static void mlxsw_sp_port_unsplit_create(struct mlxsw_sp *mlxsw_sp,
for (i = 0; i < count; i++) {
local_port = base_port + i * 2;
+ if (mlxsw_sp->port_to_module[local_port] < 0)
+ continue;
module = mlxsw_sp->port_to_module[local_port];
mlxsw_sp_port_create(mlxsw_sp, local_port, false, module,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
index 58cf222..432ab9b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -152,7 +152,7 @@ struct mlxsw_sp {
const struct mlxsw_bus_info *bus_info;
unsigned char base_mac[ETH_ALEN];
struct mlxsw_sp_upper *lags;
- u8 *port_to_module;
+ int *port_to_module;
struct mlxsw_sp_sb *sb;
struct mlxsw_sp_bridge *bridge;
struct mlxsw_sp_router *router;
--
2.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch net] mlxsw: spectrum: Do not try to create non-existing ports during unsplit
2017-11-21 8:42 [patch net] mlxsw: spectrum: Do not try to create non-existing ports during unsplit Jiri Pirko
@ 2017-11-21 11:15 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-11-21 11:15 UTC (permalink / raw)
To: jiri; +Cc: netdev, idosch, mlxsw
From: Jiri Pirko <jiri@resnulli.us>
Date: Tue, 21 Nov 2017 09:42:21 +0100
> From: Ido Schimmel <idosch@mellanox.com>
>
> On some systems, when we unsplit a port we need to re-create two ports
> instead. On other systems, only one needs to be re-created.
>
> Do not try to create a port if during driver initialization it was
> assigned a negative module number, which is invalid.
>
> This avoids the following error during unsplit:
> [ 941.012478] mlxsw_spectrum 0000:01:00.0: Port 43: Failed to map module
>
> The error is harmless and caused by the fact that a local port is
> already mapped to module 0.
>
> Fixes: be94535f9531 ("mlxsw: spectrum: Make split flow match firmware requirements")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reviewed-by: Arkadi Sharshevsky <arkadis@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-21 11:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21 8:42 [patch net] mlxsw: spectrum: Do not try to create non-existing ports during unsplit Jiri Pirko
2017-11-21 11:15 ` David Miller
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).