Skip to content

Commit 82ff7a1

Browse files
pmachatakuba-moo
authored andcommitted
mlxsw: spectrum_fid: Split a helper out of mlxsw_sp_fid_flood_table_mid()
In future patches, for CFF flood mode support, we will need a way to determine a PGT base dynamically, as an op. Therefore, for symmetry, split out a helper, mlxsw_sp_fid_pgt_base_ctl(), that determines a PGT base in the controlled mode as well. Now that the helper is available, use it in mlxsw_sp_fid_flood_table_init() which currently invokes the FID->MID helper to that end. Signed-off-by: Petr Machata <petrm@nvidia.com> Reviewed-by: Amit Cohen <amcohen@nvidia.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://lore.kernel.org/r/fd41c66a1df4df6499d3da34f40e7b9efa15bc3e.1701183892.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent ab68bd7 commit 82ff7a1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,21 @@ mlxsw_sp_fid_family_pgt_size(const struct mlxsw_sp_fid_family *fid_family)
329329
}
330330

331331
static u16
332-
mlxsw_sp_fid_flood_table_mid(const struct mlxsw_sp_fid_family *fid_family,
333-
const struct mlxsw_sp_flood_table *flood_table,
334-
u16 fid_offset)
332+
mlxsw_sp_fid_pgt_base_ctl(const struct mlxsw_sp_fid_family *fid_family,
333+
const struct mlxsw_sp_flood_table *flood_table)
335334
{
336335
u16 num_fids;
337336

338337
num_fids = mlxsw_sp_fid_family_num_fids(fid_family);
339-
return fid_family->pgt_base + num_fids * flood_table->table_index +
338+
return fid_family->pgt_base + num_fids * flood_table->table_index;
339+
}
340+
341+
static u16
342+
mlxsw_sp_fid_flood_table_mid(const struct mlxsw_sp_fid_family *fid_family,
343+
const struct mlxsw_sp_flood_table *flood_table,
344+
u16 fid_offset)
345+
{
346+
return mlxsw_sp_fid_pgt_base_ctl(fid_family, flood_table) +
340347
fid_offset;
341348
}
342349

@@ -1671,7 +1678,7 @@ mlxsw_sp_fid_flood_table_init(struct mlxsw_sp_fid_family *fid_family,
16711678
u16 mid_base;
16721679
int err, i;
16731680

1674-
mid_base = mlxsw_sp_fid_flood_table_mid(fid_family, flood_table, 0);
1681+
mid_base = mlxsw_sp_fid_pgt_base_ctl(fid_family, flood_table);
16751682

16761683
sfgc_packet_types = mlxsw_sp_packet_type_sfgc_types[packet_type];
16771684
for (i = 0; i < MLXSW_REG_SFGC_TYPE_MAX; i++) {

0 commit comments

Comments
 (0)