Skip to content

Commit 64771e3

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Enable FDB records for VLAN devices on top of LAG
When adding or removing FDB records of VLAN devices on top of LAG we should set the lag_vid parameter to the VLAN ID of the VLAN device. It is reserved otherwise. Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent afd7f97 commit 64771e3

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp_port *mlxsw_sp_port,
588588
}
589589

590590
static int mlxsw_sp_port_fdb_uc_lag_op(struct mlxsw_sp *mlxsw_sp, u16 lag_id,
591-
const char *mac, u16 fid, bool adding,
592-
bool dynamic)
591+
const char *mac, u16 fid, u16 lag_vid,
592+
bool adding, bool dynamic)
593593
{
594594
char *sfd_pl;
595595
int err;
@@ -600,8 +600,8 @@ static int mlxsw_sp_port_fdb_uc_lag_op(struct mlxsw_sp *mlxsw_sp, u16 lag_id,
600600

601601
mlxsw_reg_sfd_pack(sfd_pl, mlxsw_sp_sfd_op(adding), 0);
602602
mlxsw_reg_sfd_uc_lag_pack(sfd_pl, 0, mlxsw_sp_sfd_rec_policy(dynamic),
603-
mac, fid, MLXSW_REG_SFD_REC_ACTION_NOP, 0,
604-
lag_id);
603+
mac, fid, MLXSW_REG_SFD_REC_ACTION_NOP,
604+
lag_vid, lag_id);
605605
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl);
606606
kfree(sfd_pl);
607607

@@ -614,6 +614,7 @@ mlxsw_sp_port_fdb_static_add(struct mlxsw_sp_port *mlxsw_sp_port,
614614
struct switchdev_trans *trans)
615615
{
616616
u16 fid = fdb->vid;
617+
u16 lag_vid = 0;
617618

618619
if (switchdev_trans_ph_prepare(trans))
619620
return 0;
@@ -622,6 +623,7 @@ mlxsw_sp_port_fdb_static_add(struct mlxsw_sp_port *mlxsw_sp_port,
622623
u16 vfid = mlxsw_sp_vport_vfid_get(mlxsw_sp_port);
623624

624625
fid = mlxsw_sp_vfid_to_fid(vfid);
626+
lag_vid = mlxsw_sp_vport_vid_get(mlxsw_sp_port);
625627
}
626628

627629
if (!fid)
@@ -633,7 +635,8 @@ mlxsw_sp_port_fdb_static_add(struct mlxsw_sp_port *mlxsw_sp_port,
633635
else
634636
return mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp_port->mlxsw_sp,
635637
mlxsw_sp_port->lag_id,
636-
fdb->addr, fid, true, false);
638+
fdb->addr, fid, lag_vid,
639+
true, false);
637640
}
638641

639642
static int mlxsw_sp_port_obj_add(struct net_device *dev,
@@ -756,11 +759,13 @@ mlxsw_sp_port_fdb_static_del(struct mlxsw_sp_port *mlxsw_sp_port,
756759
const struct switchdev_obj_port_fdb *fdb)
757760
{
758761
u16 fid = fdb->vid;
762+
u16 lag_vid = 0;
759763

760764
if (mlxsw_sp_port_is_vport(mlxsw_sp_port)) {
761765
u16 vfid = mlxsw_sp_vport_vfid_get(mlxsw_sp_port);
762766

763767
fid = mlxsw_sp_vfid_to_fid(vfid);
768+
lag_vid = mlxsw_sp_vport_vid_get(mlxsw_sp_port);
764769
}
765770

766771
if (!mlxsw_sp_port->lagged)
@@ -770,7 +775,7 @@ mlxsw_sp_port_fdb_static_del(struct mlxsw_sp_port *mlxsw_sp_port,
770775
else
771776
return mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp_port->mlxsw_sp,
772777
mlxsw_sp_port->lag_id,
773-
fdb->addr, fid,
778+
fdb->addr, fid, lag_vid,
774779
false, false);
775780
}
776781

@@ -1039,6 +1044,7 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp,
10391044
{
10401045
struct mlxsw_sp_port *mlxsw_sp_port;
10411046
char mac[ETH_ALEN];
1047+
u16 lag_vid = 0;
10421048
u16 lag_id;
10431049
u16 vid, fid;
10441050
int err;
@@ -1062,13 +1068,14 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp,
10621068
}
10631069

10641070
vid = mlxsw_sp_vport_vid_get(mlxsw_sp_vport);
1071+
lag_vid = vid;
10651072
/* Override the physical port with the vPort. */
10661073
mlxsw_sp_port = mlxsw_sp_vport;
10671074
} else {
10681075
vid = fid;
10691076
}
10701077

1071-
err = mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, lag_id, mac, fid,
1078+
err = mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, lag_id, mac, fid, lag_vid,
10721079
adding && mlxsw_sp_port->learning,
10731080
true);
10741081
if (err) {

0 commit comments

Comments
 (0)