Skip to content

Commit 6502be9

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum_switchdev: Do not set field when it is reserved
When configuring an FDB entry pointing to a LAG netdev (or its upper), the driver should only set the 'lag_vid' field when the FID (filtering identifier) is of 802.1D type. Extend the 802.1D FID family with an attribute indicating whether this field should be set and based on its value set the field or leave it blank. Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Petr Machata <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4e3c7c0 commit 6502be9

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ int mlxsw_sp_setup_tc_prio(struct mlxsw_sp_port *mlxsw_sp_port,
721721
struct tc_prio_qopt_offload *p);
722722

723723
/* spectrum_fid.c */
724+
bool mlxsw_sp_fid_lag_vid_valid(const struct mlxsw_sp_fid *fid);
724725
struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_index(struct mlxsw_sp *mlxsw_sp,
725726
u16 fid_index);
726727
int mlxsw_sp_fid_nve_ifindex(const struct mlxsw_sp_fid *fid, int *nve_ifindex);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ struct mlxsw_sp_fid_family {
9898
enum mlxsw_sp_rif_type rif_type;
9999
const struct mlxsw_sp_fid_ops *ops;
100100
struct mlxsw_sp *mlxsw_sp;
101+
u8 lag_vid_valid:1;
101102
};
102103

103104
static const int mlxsw_sp_sfgc_uc_packet_types[MLXSW_REG_SFGC_TYPE_MAX] = {
@@ -122,6 +123,11 @@ static const int *mlxsw_sp_packet_type_sfgc_types[] = {
122123
[MLXSW_SP_FLOOD_TYPE_MC] = mlxsw_sp_sfgc_mc_packet_types,
123124
};
124125

126+
bool mlxsw_sp_fid_lag_vid_valid(const struct mlxsw_sp_fid *fid)
127+
{
128+
return fid->fid_family->lag_vid_valid;
129+
}
130+
125131
struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_index(struct mlxsw_sp *mlxsw_sp,
126132
u16 fid_index)
127133
{
@@ -792,6 +798,7 @@ static const struct mlxsw_sp_fid_family mlxsw_sp_fid_8021d_family = {
792798
.nr_flood_tables = ARRAY_SIZE(mlxsw_sp_fid_8021d_flood_tables),
793799
.rif_type = MLXSW_SP_RIF_TYPE_FID,
794800
.ops = &mlxsw_sp_fid_8021d_ops,
801+
.lag_vid_valid = 1,
795802
};
796803

797804
static int mlxsw_sp_fid_rfid_configure(struct mlxsw_sp_fid *fid)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2482,7 +2482,8 @@ static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp,
24822482

24832483
bridge_device = bridge_port->bridge_device;
24842484
vid = bridge_device->vlan_enabled ? mlxsw_sp_port_vlan->vid : 0;
2485-
lag_vid = mlxsw_sp_port_vlan->vid;
2485+
lag_vid = mlxsw_sp_fid_lag_vid_valid(mlxsw_sp_port_vlan->fid) ?
2486+
mlxsw_sp_port_vlan->vid : 0;
24862487

24872488
do_fdb_op:
24882489
err = mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, lag_id, mac, fid, lag_vid,

0 commit comments

Comments
 (0)