mlxsw: spectrum: Mark unused ports using NULL
authorIdo Schimmel <idosch@mellanox.com>
Fri, 26 Feb 2016 16:32:30 +0000 (17:32 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Mar 2016 21:07:30 +0000 (16:07 -0500)
When splitting and unsplitting we'll destroy usable ports on the fly, so
mark them using a NULL pointer to indicate that their local port number
is free and can be re-used.

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>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c

index 240881c..926019e 100644 (file)
@@ -1518,6 +1518,7 @@ 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;
        devlink_port = &mlxsw_sp_port->devlink_port;
        devlink_port_type_clear(devlink_port);
        unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */