Skip to content

Commit 798661c

Browse files
committed
Merge branch 'mlxsw-unified-bridge-conversion-part-6'
Ido Schimmel says: ==================== mlxsw: Unified bridge conversion - part 6/6 This is the sixth and final part of the conversion of mlxsw to the unified bridge model. It transitions the last bits of functionality that were under firmware's responsibility in the legacy model to the driver. The last patches flip the driver to the unified bridge model and clean up code that was used to make the conversion easier to review. Patchset overview: Patch #1 sets the egress VID for known unicast packets. For multicast packets, the egress VID is configured using the MPE table. See commit 8c2da08 ("mlxsw: spectrum_fid: Configure egress VID classification for multicast"). Patch #2 configures the VNI to FID classification that is used during decapsulation. Patch #3 configures ingress router interface (RIF) in FID classification records, so that when a packet reaches the router block, its ingress RIF is known. Care is taken to configure this in all the different flows (e.g., RIF set on a FID, {Port, VID} joins a FID that already has a RIF etc.). Patch #4 configures the egress VID for routed packets. For such packets, the egress VID is not set by the MPE table or by an FDB record at the egress bridge, but instead by a dedicated table that maps {Egress RIF, Egress port} to a VID. Patch #5 removes VID configuration from RIF creation as in the unified bridge model firmware no longer needs it. Patch #6 sets the egress FID to use in RIF configuration so that the device knows using which FID to bridge the packet after routing. Patches #7-#9 add a new 802.1Q family and associated VLAN RIFs. In the unified bridge model, we no longer need to emulate 802.1Q FIDs using 802.1D FIDs as VNI can be associated with both. Patches #10-#11 finally flip the driver to the unified bridge model. Patches #12-#13 clean up code that was used to make the conversion easier to review. v2: * Fix build failure [1] in patch #1. [1] https://lore.kernel.org/netdev/[email protected]/ ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents d0bf1fe + 88840d6 commit 798661c

File tree

11 files changed

+829
-235
lines changed

11 files changed

+829
-235
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,12 @@ MLXSW_ITEM32(cmd_mbox, config_profile,
633633
*/
634634
MLXSW_ITEM32(cmd_mbox, config_profile, set_ar_sec, 0x0C, 15, 1);
635635

636+
/* cmd_mbox_config_set_ubridge
637+
* Capability bit. Setting a bit to 1 configures the profile
638+
* according to the mailbox contents.
639+
*/
640+
MLXSW_ITEM32(cmd_mbox, config_profile, set_ubridge, 0x0C, 22, 1);
641+
636642
/* cmd_mbox_config_set_kvd_linear_size
637643
* Capability bit. Setting a bit to 1 configures the profile
638644
* according to the mailbox contents.
@@ -792,6 +798,13 @@ MLXSW_ITEM32(cmd_mbox, config_profile, adaptive_routing_group_cap, 0x4C, 0, 16);
792798
*/
793799
MLXSW_ITEM32(cmd_mbox, config_profile, arn, 0x50, 31, 1);
794800

801+
/* cmd_mbox_config_profile_ubridge
802+
* Unified Bridge
803+
* 0 - non unified bridge
804+
* 1 - unified bridge
805+
*/
806+
MLXSW_ITEM32(cmd_mbox, config_profile, ubridge, 0x50, 4, 1);
807+
795808
/* cmd_mbox_config_kvd_linear_size
796809
* KVD Linear Size
797810
* Valid for Spectrum only

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ struct mlxsw_config_profile {
295295
used_max_pkey:1,
296296
used_ar_sec:1,
297297
used_adaptive_routing_group_cap:1,
298+
used_ubridge:1,
298299
used_kvd_sizes:1;
299300
u8 max_vepa_channels;
300301
u16 max_mid;
@@ -314,6 +315,7 @@ struct mlxsw_config_profile {
314315
u8 ar_sec;
315316
u16 adaptive_routing_group_cap;
316317
u8 arn;
318+
u8 ubridge;
317319
u32 kvd_linear_size;
318320
u8 kvd_hash_single_parts;
319321
u8 kvd_hash_double_parts;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,11 @@ static int mlxsw_pci_config_profile(struct mlxsw_pci *mlxsw_pci, char *mbox,
12351235
mlxsw_cmd_mbox_config_profile_adaptive_routing_group_cap_set(
12361236
mbox, profile->adaptive_routing_group_cap);
12371237
}
1238+
if (profile->used_ubridge) {
1239+
mlxsw_cmd_mbox_config_profile_set_ubridge_set(mbox, 1);
1240+
mlxsw_cmd_mbox_config_profile_ubridge_set(mbox,
1241+
profile->ubridge);
1242+
}
12381243
if (profile->used_kvd_sizes && MLXSW_RES_VALID(res, KVD_SIZE)) {
12391244
err = mlxsw_pci_profile_get_kvd_sizes(mlxsw_pci, profile, res);
12401245
if (err)

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

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ static inline void mlxsw_reg_sfd_rec_pack(char *payload, int rec_index,
380380

381381
static inline void mlxsw_reg_sfd_uc_pack(char *payload, int rec_index,
382382
enum mlxsw_reg_sfd_rec_policy policy,
383-
const char *mac, u16 fid_vid,
383+
const char *mac, u16 fid_vid, u16 vid,
384384
enum mlxsw_reg_sfd_rec_action action,
385385
u16 local_port)
386386
{
@@ -389,6 +389,8 @@ static inline void mlxsw_reg_sfd_uc_pack(char *payload, int rec_index,
389389
mlxsw_reg_sfd_rec_policy_set(payload, rec_index, policy);
390390
mlxsw_reg_sfd_uc_sub_port_set(payload, rec_index, 0);
391391
mlxsw_reg_sfd_uc_fid_vid_set(payload, rec_index, fid_vid);
392+
mlxsw_reg_sfd_uc_set_vid_set(payload, rec_index, vid ? true : false);
393+
mlxsw_reg_sfd_uc_vid_set(payload, rec_index, vid);
392394
mlxsw_reg_sfd_uc_system_port_set(payload, rec_index, local_port);
393395
}
394396

@@ -454,6 +456,7 @@ mlxsw_reg_sfd_uc_lag_pack(char *payload, int rec_index,
454456
mlxsw_reg_sfd_rec_policy_set(payload, rec_index, policy);
455457
mlxsw_reg_sfd_uc_lag_sub_port_set(payload, rec_index, 0);
456458
mlxsw_reg_sfd_uc_lag_fid_vid_set(payload, rec_index, fid_vid);
459+
mlxsw_reg_sfd_uc_lag_set_vid_set(payload, rec_index, true);
457460
mlxsw_reg_sfd_uc_lag_lag_vid_set(payload, rec_index, lag_vid);
458461
mlxsw_reg_sfd_uc_lag_lag_id_set(payload, rec_index, lag_id);
459462
}
@@ -1655,40 +1658,43 @@ MLXSW_ITEM32(reg, svfa, irif, 0x14, 0, 16);
16551658

16561659
static inline void __mlxsw_reg_svfa_pack(char *payload,
16571660
enum mlxsw_reg_svfa_mt mt, bool valid,
1658-
u16 fid)
1661+
u16 fid, bool irif_v, u16 irif)
16591662
{
16601663
MLXSW_REG_ZERO(svfa, payload);
16611664
mlxsw_reg_svfa_swid_set(payload, 0);
16621665
mlxsw_reg_svfa_mapping_table_set(payload, mt);
16631666
mlxsw_reg_svfa_v_set(payload, valid);
16641667
mlxsw_reg_svfa_fid_set(payload, fid);
1668+
mlxsw_reg_svfa_irif_v_set(payload, irif_v);
1669+
mlxsw_reg_svfa_irif_set(payload, irif_v ? irif : 0);
16651670
}
16661671

16671672
static inline void mlxsw_reg_svfa_port_vid_pack(char *payload, u16 local_port,
1668-
bool valid, u16 fid, u16 vid)
1673+
bool valid, u16 fid, u16 vid,
1674+
bool irif_v, u16 irif)
16691675
{
16701676
enum mlxsw_reg_svfa_mt mt = MLXSW_REG_SVFA_MT_PORT_VID_TO_FID;
16711677

1672-
__mlxsw_reg_svfa_pack(payload, mt, valid, fid);
1678+
__mlxsw_reg_svfa_pack(payload, mt, valid, fid, irif_v, irif);
16731679
mlxsw_reg_svfa_local_port_set(payload, local_port);
16741680
mlxsw_reg_svfa_vid_set(payload, vid);
16751681
}
16761682

16771683
static inline void mlxsw_reg_svfa_vid_pack(char *payload, bool valid, u16 fid,
1678-
u16 vid)
1684+
u16 vid, bool irif_v, u16 irif)
16791685
{
16801686
enum mlxsw_reg_svfa_mt mt = MLXSW_REG_SVFA_MT_VID_TO_FID;
16811687

1682-
__mlxsw_reg_svfa_pack(payload, mt, valid, fid);
1688+
__mlxsw_reg_svfa_pack(payload, mt, valid, fid, irif_v, irif);
16831689
mlxsw_reg_svfa_vid_set(payload, vid);
16841690
}
16851691

16861692
static inline void mlxsw_reg_svfa_vni_pack(char *payload, bool valid, u16 fid,
1687-
u32 vni)
1693+
u32 vni, bool irif_v, u16 irif)
16881694
{
16891695
enum mlxsw_reg_svfa_mt mt = MLXSW_REG_SVFA_MT_VNI_TO_FID;
16901696

1691-
__mlxsw_reg_svfa_pack(payload, mt, valid, fid);
1697+
__mlxsw_reg_svfa_pack(payload, mt, valid, fid, irif_v, irif);
16921698
mlxsw_reg_svfa_vni_set(payload, vni);
16931699
}
16941700

@@ -1963,7 +1969,8 @@ MLXSW_ITEM32(reg, sfmr, smpe, 0x28, 0, 16);
19631969
static inline void mlxsw_reg_sfmr_pack(char *payload,
19641970
enum mlxsw_reg_sfmr_op op, u16 fid,
19651971
u16 fid_offset, bool flood_rsp,
1966-
enum mlxsw_reg_bridge_type bridge_type)
1972+
enum mlxsw_reg_bridge_type bridge_type,
1973+
bool smpe_valid, u16 smpe)
19671974
{
19681975
MLXSW_REG_ZERO(sfmr, payload);
19691976
mlxsw_reg_sfmr_op_set(payload, op);
@@ -1973,6 +1980,8 @@ static inline void mlxsw_reg_sfmr_pack(char *payload,
19731980
mlxsw_reg_sfmr_vv_set(payload, false);
19741981
mlxsw_reg_sfmr_flood_rsp_set(payload, flood_rsp);
19751982
mlxsw_reg_sfmr_flood_bridge_type_set(payload, bridge_type);
1983+
mlxsw_reg_sfmr_smpe_valid_set(payload, smpe_valid);
1984+
mlxsw_reg_sfmr_smpe_set(payload, smpe);
19761985
}
19771986

19781987
/* SPVMLR - Switch Port VLAN MAC Learning Register
@@ -7107,10 +7116,11 @@ static inline void mlxsw_reg_ritr_rif_pack(char *payload, u16 rif)
71077116
}
71087117

71097118
static inline void mlxsw_reg_ritr_sp_if_pack(char *payload, bool lag,
7110-
u16 system_port, u16 vid)
7119+
u16 system_port, u16 efid, u16 vid)
71117120
{
71127121
mlxsw_reg_ritr_sp_if_lag_set(payload, lag);
71137122
mlxsw_reg_ritr_sp_if_system_port_set(payload, system_port);
7123+
mlxsw_reg_ritr_sp_if_efid_set(payload, efid);
71147124
mlxsw_reg_ritr_sp_if_vid_set(payload, vid);
71157125
}
71167126

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

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3161,7 +3161,6 @@ static int mlxsw_sp_init(struct mlxsw_core *mlxsw_core,
31613161
goto err_ports_create;
31623162
}
31633163

3164-
mlxsw_sp->ubridge = false;
31653164
return 0;
31663165

31673166
err_ports_create:
@@ -3383,24 +3382,15 @@ static void mlxsw_sp_fini(struct mlxsw_core *mlxsw_core)
33833382
mlxsw_sp_parsing_fini(mlxsw_sp);
33843383
}
33853384

3386-
/* Per-FID flood tables are used for both "true" 802.1D FIDs and emulated
3387-
* 802.1Q FIDs
3388-
*/
3389-
#define MLXSW_SP_FID_FLOOD_TABLE_SIZE (MLXSW_SP_FID_8021D_MAX + \
3390-
VLAN_VID_MASK - 1)
3391-
33923385
static const struct mlxsw_config_profile mlxsw_sp1_config_profile = {
3393-
.used_max_mid = 1,
3394-
.max_mid = MLXSW_SP_MID_MAX,
3395-
.used_flood_tables = 1,
3396-
.used_flood_mode = 1,
3397-
.flood_mode = MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_MIXED,
3398-
.max_fid_flood_tables = 3,
3399-
.fid_flood_table_size = MLXSW_SP_FID_FLOOD_TABLE_SIZE,
3386+
.used_flood_mode = 1,
3387+
.flood_mode = MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_CONTROLLED,
34003388
.used_max_ib_mc = 1,
34013389
.max_ib_mc = 0,
34023390
.used_max_pkey = 1,
34033391
.max_pkey = 0,
3392+
.used_ubridge = 1,
3393+
.ubridge = 1,
34043394
.used_kvd_sizes = 1,
34053395
.kvd_hash_single_parts = 59,
34063396
.kvd_hash_double_parts = 41,
@@ -3414,17 +3404,14 @@ static const struct mlxsw_config_profile mlxsw_sp1_config_profile = {
34143404
};
34153405

34163406
static const struct mlxsw_config_profile mlxsw_sp2_config_profile = {
3417-
.used_max_mid = 1,
3418-
.max_mid = MLXSW_SP_MID_MAX,
3419-
.used_flood_tables = 1,
3420-
.used_flood_mode = 1,
3421-
.flood_mode = MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_MIXED,
3422-
.max_fid_flood_tables = 3,
3423-
.fid_flood_table_size = MLXSW_SP_FID_FLOOD_TABLE_SIZE,
3407+
.used_flood_mode = 1,
3408+
.flood_mode = MLXSW_CMD_MBOX_CONFIG_PROFILE_FLOOD_MODE_CONTROLLED,
34243409
.used_max_ib_mc = 1,
34253410
.max_ib_mc = 0,
34263411
.used_max_pkey = 1,
34273412
.max_pkey = 0,
3413+
.used_ubridge = 1,
3414+
.ubridge = 1,
34283415
.swid_config = {
34293416
{
34303417
.used_type = 1,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct mlxsw_sp_upper {
8484

8585
enum mlxsw_sp_rif_type {
8686
MLXSW_SP_RIF_TYPE_SUBPORT,
87-
MLXSW_SP_RIF_TYPE_VLAN_EMU,
87+
MLXSW_SP_RIF_TYPE_VLAN,
8888
MLXSW_SP_RIF_TYPE_FID,
8989
MLXSW_SP_RIF_TYPE_IPIP_LB, /* IP-in-IP loopback. */
9090
MLXSW_SP_RIF_TYPE_MAX,
@@ -208,7 +208,6 @@ struct mlxsw_sp {
208208
u32 lowest_shaper_bs;
209209
struct rhashtable ipv6_addr_ht;
210210
struct mutex ipv6_addr_ht_lock; /* Protects ipv6_addr_ht */
211-
bool ubridge;
212211
struct mlxsw_sp_pgt *pgt;
213212
bool pgt_smpe_index_valid;
214213
};
@@ -737,6 +736,7 @@ union mlxsw_sp_l3addr {
737736
struct in6_addr addr6;
738737
};
739738

739+
u16 mlxsw_sp_rif_index(const struct mlxsw_sp_rif *rif);
740740
int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp,
741741
struct netlink_ext_ack *extack);
742742
void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp);
@@ -1285,7 +1285,8 @@ void mlxsw_sp_fid_port_vid_unmap(struct mlxsw_sp_fid *fid,
12851285
struct mlxsw_sp_port *mlxsw_sp_port, u16 vid);
12861286
u16 mlxsw_sp_fid_index(const struct mlxsw_sp_fid *fid);
12871287
enum mlxsw_sp_fid_type mlxsw_sp_fid_type(const struct mlxsw_sp_fid *fid);
1288-
void mlxsw_sp_fid_rif_set(struct mlxsw_sp_fid *fid, struct mlxsw_sp_rif *rif);
1288+
int mlxsw_sp_fid_rif_set(struct mlxsw_sp_fid *fid, struct mlxsw_sp_rif *rif);
1289+
void mlxsw_sp_fid_rif_unset(struct mlxsw_sp_fid *fid);
12891290
struct mlxsw_sp_rif *mlxsw_sp_fid_rif(const struct mlxsw_sp_fid *fid);
12901291
enum mlxsw_sp_rif_type
12911292
mlxsw_sp_fid_type_rif_type(const struct mlxsw_sp *mlxsw_sp,
@@ -1476,7 +1477,6 @@ void mlxsw_sp_pgt_mid_free_range(struct mlxsw_sp *mlxsw_sp, u16 mid_base,
14761477
u16 count);
14771478
int mlxsw_sp_pgt_entry_port_set(struct mlxsw_sp *mlxsw_sp, u16 mid,
14781479
u16 smpe, u16 local_port, bool member);
1479-
u16 mlxsw_sp_pgt_index_to_mid(const struct mlxsw_sp *mlxsw_sp, u16 pgt_index);
14801480
int mlxsw_sp_pgt_init(struct mlxsw_sp *mlxsw_sp);
14811481
void mlxsw_sp_pgt_fini(struct mlxsw_sp *mlxsw_sp);
14821482

0 commit comments

Comments
 (0)