Skip to content

Commit d62dd8a

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_fid: Introduce emulated 802.1Q FIDs
The driver uses 802.1Q FIDs when offloading a VLAN-aware bridge. Unfortunately, it is not possible to assign a VNI to such FIDs, which prompts the driver to forbid the enslavement of VxLAN devices to a VLAN-aware bridge. Workaround this hardware limitation by creating a new family of FIDs, emulated 802.1Q FIDs. These FIDs are emulated using 802.1D FIDs, which can be assigned a VNI. The downside of this approach is that multiple {Port, VID}->FID entries are required, whereas only a single VID->FID is required with "true" 802.1Q FIDs. Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Petr Machata <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c4a729 commit d62dd8a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,39 @@ static const struct mlxsw_sp_fid_family mlxsw_sp_fid_8021d_family = {
801801
.lag_vid_valid = 1,
802802
};
803803

804+
static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021q_emu_ops = {
805+
.setup = mlxsw_sp_fid_8021q_setup,
806+
.configure = mlxsw_sp_fid_8021d_configure,
807+
.deconfigure = mlxsw_sp_fid_8021d_deconfigure,
808+
.index_alloc = mlxsw_sp_fid_8021d_index_alloc,
809+
.compare = mlxsw_sp_fid_8021q_compare,
810+
.flood_index = mlxsw_sp_fid_8021d_flood_index,
811+
.port_vid_map = mlxsw_sp_fid_8021d_port_vid_map,
812+
.port_vid_unmap = mlxsw_sp_fid_8021d_port_vid_unmap,
813+
.vni_set = mlxsw_sp_fid_8021d_vni_set,
814+
.vni_clear = mlxsw_sp_fid_8021d_vni_clear,
815+
.nve_flood_index_set = mlxsw_sp_fid_8021d_nve_flood_index_set,
816+
.nve_flood_index_clear = mlxsw_sp_fid_8021d_nve_flood_index_clear,
817+
};
818+
819+
/* There are 4K-2 emulated 802.1Q FIDs, starting right after the 802.1D FIDs */
820+
#define MLXSW_SP_FID_8021Q_EMU_START (VLAN_N_VID + MLXSW_SP_FID_8021D_MAX)
821+
#define MLXSW_SP_FID_8021Q_EMU_END (MLXSW_SP_FID_8021Q_EMU_START + \
822+
VLAN_VID_MASK - 2)
823+
824+
/* Range and flood configuration must match mlxsw_config_profile */
825+
static const struct mlxsw_sp_fid_family mlxsw_sp_fid_8021q_emu_family = {
826+
.type = MLXSW_SP_FID_TYPE_8021Q,
827+
.fid_size = sizeof(struct mlxsw_sp_fid_8021q),
828+
.start_index = MLXSW_SP_FID_8021Q_EMU_START,
829+
.end_index = MLXSW_SP_FID_8021Q_EMU_END,
830+
.flood_tables = mlxsw_sp_fid_8021d_flood_tables,
831+
.nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_8021d_flood_tables),
832+
.rif_type = MLXSW_SP_RIF_TYPE_VLAN,
833+
.ops = &mlxsw_sp_fid_8021q_emu_ops,
834+
.lag_vid_valid = 1,
835+
};
836+
804837
static int mlxsw_sp_fid_rfid_configure(struct mlxsw_sp_fid *fid)
805838
{
806839
/* rFIDs are allocated by the device during init */

0 commit comments

Comments
 (0)