Skip to content

Commit 3e9b27b

Browse files
idoschdavem330
authored andcommitted
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>
1 parent 284ef80 commit 3e9b27b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,15 @@ static int mlxsw_sp_port_module_check(struct mlxsw_sp_port *mlxsw_sp_port,
320320
return 0;
321321
}
322322

323+
static 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+
323332
static int mlxsw_sp_port_open(struct net_device *dev)
324333
{
325334
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)
15301539
devlink_port_unregister(devlink_port);
15311540
mlxsw_sp_port_vports_fini(mlxsw_sp_port);
15321541
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);
15331544
free_percpu(mlxsw_sp_port->pcpu_stats);
15341545
kfree(mlxsw_sp_port->untagged_vlans);
15351546
kfree(mlxsw_sp_port->active_vlans);

0 commit comments

Comments
 (0)