aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2016-02-26 11:32:28 -0500
committerDavid S. Miller <davem@davemloft.net>2016-03-01 16:07:30 -0500
commit3e9b27b8fc8b00c9edaaa5fd64636e6f2b331f43 (patch)
tree451afc881ced4339822b4aa72ba5242436e4216e
parent284ef8035708334df99d038da1d3c7ddf77ec1bd (diff)
mlxsw: spectrum: Unmap local port from module during teardown
When splitting a port we replace it with 2 or 4 other ports. To be able to do that we need to remove the original port netdev and unmap it from its module. However, we first mark it as disabled, as active ports cannot be unmapped. Signed-off-by: Ido Schimmel <idosch@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.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 20e67835aae7..0dd72f85791e 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -320,6 +320,15 @@ static int mlxsw_sp_port_module_check(struct mlxsw_sp_port *mlxsw_sp_port,
320 return 0; 320 return 0;
321} 321}
322 322
323static int mlxsw_sp_port_module_unmap(struct mlxsw_sp *mlxsw_sp, u8 local_port)
324{
325 char pmlp_pl[MLXSW_REG_PMLP_LEN];
326
327 mlxsw_reg_pmlp_pack(pmlp_pl, local_port);
328 mlxsw_reg_pmlp_width_set(pmlp_pl, 0);
329 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pmlp), pmlp_pl);
330}
331
323static int mlxsw_sp_port_open(struct net_device *dev) 332static int mlxsw_sp_port_open(struct net_device *dev)
324{ 333{
325 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); 334 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
@@ -1530,6 +1539,8 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port)
1530 devlink_port_unregister(devlink_port); 1539 devlink_port_unregister(devlink_port);
1531 mlxsw_sp_port_vports_fini(mlxsw_sp_port); 1540 mlxsw_sp_port_vports_fini(mlxsw_sp_port);
1532 mlxsw_sp_port_switchdev_fini(mlxsw_sp_port); 1541 mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
1542 mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT);
1543 mlxsw_sp_port_module_unmap(mlxsw_sp, mlxsw_sp_port->local_port);
1533 free_percpu(mlxsw_sp_port->pcpu_stats); 1544 free_percpu(mlxsw_sp_port->pcpu_stats);
1534 kfree(mlxsw_sp_port->untagged_vlans); 1545 kfree(mlxsw_sp_port->untagged_vlans);
1535 kfree(mlxsw_sp_port->active_vlans); 1546 kfree(mlxsw_sp_port->active_vlans);