aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2017-11-21 03:42:21 -0500
committerDavid S. Miller <davem@davemloft.net>2017-11-21 06:15:22 -0500
commitbf4e9f24a8d9e63c9cbd9cbeb84fc8a9a46ff1a3 (patch)
tree52d00b9e98b3090f34eaf0022feac4fd98c36f4a
parent32a72bbd5da2411eab591bf9bc2e39349106193a (diff)
mlxsw: spectrum: Do not try to create non-existing ports during unsplit
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.h2
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 2d46ec84ebdf..2d0897b7d860 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)
3142 if (!mlxsw_sp->ports) 3142 if (!mlxsw_sp->ports)
3143 return -ENOMEM; 3143 return -ENOMEM;
3144 3144
3145 mlxsw_sp->port_to_module = kcalloc(max_ports, sizeof(u8), GFP_KERNEL); 3145 mlxsw_sp->port_to_module = kmalloc_array(max_ports, sizeof(int),
3146 GFP_KERNEL);
3146 if (!mlxsw_sp->port_to_module) { 3147 if (!mlxsw_sp->port_to_module) {
3147 err = -ENOMEM; 3148 err = -ENOMEM;
3148 goto err_port_to_module_alloc; 3149 goto err_port_to_module_alloc;
3149 } 3150 }
3150 3151
3151 for (i = 1; i < max_ports; i++) { 3152 for (i = 1; i < max_ports; i++) {
3153 /* Mark as invalid */
3154 mlxsw_sp->port_to_module[i] = -1;
3155
3152 err = mlxsw_sp_port_module_info_get(mlxsw_sp, i, &module, 3156 err = mlxsw_sp_port_module_info_get(mlxsw_sp, i, &module,
3153 &width, &lane); 3157 &width, &lane);
3154 if (err) 3158 if (err)
@@ -3216,6 +3220,8 @@ static void mlxsw_sp_port_unsplit_create(struct mlxsw_sp *mlxsw_sp,
3216 3220
3217 for (i = 0; i < count; i++) { 3221 for (i = 0; i < count; i++) {
3218 local_port = base_port + i * 2; 3222 local_port = base_port + i * 2;
3223 if (mlxsw_sp->port_to_module[local_port] < 0)
3224 continue;
3219 module = mlxsw_sp->port_to_module[local_port]; 3225 module = mlxsw_sp->port_to_module[local_port];
3220 3226
3221 mlxsw_sp_port_create(mlxsw_sp, local_port, false, module, 3227 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 58cf222fb985..432ab9b12b7f 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
@@ -152,7 +152,7 @@ struct mlxsw_sp {
152 const struct mlxsw_bus_info *bus_info; 152 const struct mlxsw_bus_info *bus_info;
153 unsigned char base_mac[ETH_ALEN]; 153 unsigned char base_mac[ETH_ALEN];
154 struct mlxsw_sp_upper *lags; 154 struct mlxsw_sp_upper *lags;
155 u8 *port_to_module; 155 int *port_to_module;
156 struct mlxsw_sp_sb *sb; 156 struct mlxsw_sp_sb *sb;
157 struct mlxsw_sp_bridge *bridge; 157 struct mlxsw_sp_bridge *bridge;
158 struct mlxsw_sp_router *router; 158 struct mlxsw_sp_router *router;