Skip to content

Commit 14d3946

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Use per-FID struct for the VLAN-aware bridge
In a very similar way to the vFIDs, make the first 4K FIDs - used in the VLAN-aware bridge - use the new FID struct. Upon first use of the FID by any of the ports do the following: 1) Create the FID 2) Setup a matching flooding entry 3) Create a mapping for the FID Unlike vFIDs, upon creation of a FID we always create a global VID-to-FID mapping, so that ports without upper vPorts can use it instead of creating an explicit {Port, VID} to FID mapping. When a port leaves a FID the reverse is performed. Whenever the FID's reference count reaches zero the FID is deleted along with the global mapping. The per-FID struct will later allow us to configure L3 interfaces on top of the VLAN-aware bridge. 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 37286d2 commit 14d3946

File tree

3 files changed

+195
-125
lines changed

3 files changed

+195
-125
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,7 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core,
23962396

23972397
mlxsw_sp->core = mlxsw_core;
23982398
mlxsw_sp->bus_info = mlxsw_bus_info;
2399+
INIT_LIST_HEAD(&mlxsw_sp->fids);
23992400
INIT_LIST_HEAD(&mlxsw_sp->port_vfids.list);
24002401
INIT_LIST_HEAD(&mlxsw_sp->br_vfids.list);
24012402
INIT_LIST_HEAD(&mlxsw_sp->br_mids.list);
@@ -2472,6 +2473,7 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core)
24722473
mlxsw_sp_traps_fini(mlxsw_sp);
24732474
mlxsw_sp_event_unregister(mlxsw_sp, MLXSW_TRAP_ID_PUDE);
24742475
mlxsw_sp_ports_remove(mlxsw_sp);
2476+
WARN_ON(!list_empty(&mlxsw_sp->fids));
24752477
}
24762478

24772479
static struct mlxsw_config_profile mlxsw_sp_config_profile = {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ struct mlxsw_sp {
165165
struct list_head list;
166166
DECLARE_BITMAP(mapped, MLXSW_SP_MID_MAX);
167167
} br_mids;
168-
DECLARE_BITMAP(active_fids, VLAN_N_VID);
168+
struct list_head fids; /* VLAN-aware bridge FIDs */
169169
struct mlxsw_sp_port **ports;
170170
struct mlxsw_core *core;
171171
const struct mlxsw_bus_info *bus_info;

0 commit comments

Comments
 (0)