Skip to content

Commit e917a78

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_fid: Add an op to get PGT address of a FID
In the CFF flood mode, the way to determine a PGT address where a given FID / flood table resides is different from the controlled flood mode, which mlxsw currently uses. Furthermore, this will differ between rFID family and bridge families. The operation therefore needs to be dynamically dispatched. To that end, add an op to FID-family ops. Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Amit Cohen <amcohen@nvidia.com> Link: https://lore.kernel.org/r/00e8f6ad79009a9a77a5c95d596ea9574776dc95.1701183892.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 1686b8d commit e917a78

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ struct mlxsw_sp_fid_ops {
9999
const struct mlxsw_sp_flood_table *flood_table);
100100
int (*pgt_size)(const struct mlxsw_sp_fid_family *fid_family,
101101
u16 *p_pgt_size);
102+
u16 (*fid_mid)(const struct mlxsw_sp_fid *fid,
103+
const struct mlxsw_sp_flood_table *flood_table);
102104
};
103105

104106
struct mlxsw_sp_fid_family {
@@ -345,12 +347,11 @@ mlxsw_sp_fid_pgt_base_ctl(const struct mlxsw_sp_fid_family *fid_family,
345347
}
346348

347349
static u16
348-
mlxsw_sp_fid_flood_table_mid(const struct mlxsw_sp_fid_family *fid_family,
349-
const struct mlxsw_sp_flood_table *flood_table,
350-
u16 fid_offset)
350+
mlxsw_sp_fid_fid_mid_ctl(const struct mlxsw_sp_fid *fid,
351+
const struct mlxsw_sp_flood_table *flood_table)
351352
{
352-
return mlxsw_sp_fid_pgt_base_ctl(fid_family, flood_table) +
353-
fid_offset;
353+
return mlxsw_sp_fid_pgt_base_ctl(fid->fid_family, flood_table) +
354+
fid->fid_offset;
354355
}
355356

356357
int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid,
@@ -368,8 +369,7 @@ int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid,
368369
if (!flood_table)
369370
return -ESRCH;
370371

371-
mid_index = mlxsw_sp_fid_flood_table_mid(fid_family, flood_table,
372-
fid->fid_offset);
372+
mid_index = fid_family->ops->fid_mid(fid, flood_table);
373373
return mlxsw_sp_pgt_entry_port_set(fid_family->mlxsw_sp, mid_index,
374374
fid->fid_index, local_port, member);
375375
}
@@ -1129,6 +1129,7 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021d_ops_ctl = {
11291129
.vid_to_fid_rif_update = mlxsw_sp_fid_8021d_vid_to_fid_rif_update,
11301130
.flood_table_init = mlxsw_sp_fid_flood_table_init_ctl,
11311131
.pgt_size = mlxsw_sp_fid_8021d_pgt_size,
1132+
.fid_mid = mlxsw_sp_fid_fid_mid_ctl,
11321133
};
11331134

11341135
#define MLXSW_SP_FID_8021Q_MAX (VLAN_N_VID - 2)
@@ -1472,6 +1473,7 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021q_ops_ctl = {
14721473
.vid_to_fid_rif_update = mlxsw_sp_fid_8021q_vid_to_fid_rif_update,
14731474
.flood_table_init = mlxsw_sp_fid_flood_table_init_ctl,
14741475
.pgt_size = mlxsw_sp_fid_8021d_pgt_size,
1476+
.fid_mid = mlxsw_sp_fid_fid_mid_ctl,
14751477
};
14761478

14771479
/* There are 4K-2 802.1Q FIDs */

0 commit comments

Comments
 (0)