summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorPetr Machata <petrm@nvidia.com>2023-11-28 16:50:36 +0100
committerJakub Kicinski <kuba@kernel.org>2023-11-29 20:03:23 -0800
commit82ff7a196d76a04cf437ac0469ac9e9b84110b13 (patch)
tree7669ee5d3f9e00a396d490df20ca8e453b2da059 /drivers/net/ethernet
parentab68bd743af8d4e9efd21c570acb7bee65bb47ce (diff)
downloadlinux-82ff7a196d76a04cf437ac0469ac9e9b84110b13.tar.gz
linux-82ff7a196d76a04cf437ac0469ac9e9b84110b13.tar.bz2
linux-82ff7a196d76a04cf437ac0469ac9e9b84110b13.zip
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>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
index d92c44c6ffbf..96cedc241bf2 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c
@@ -329,14 +329,21 @@ mlxsw_sp_fid_family_pgt_size(const struct mlxsw_sp_fid_family *fid_family)
}
static u16
-mlxsw_sp_fid_flood_table_mid(const struct mlxsw_sp_fid_family *fid_family,
- const struct mlxsw_sp_flood_table *flood_table,
- u16 fid_offset)
+mlxsw_sp_fid_pgt_base_ctl(const struct mlxsw_sp_fid_family *fid_family,
+ const struct mlxsw_sp_flood_table *flood_table)
{
u16 num_fids;
num_fids = mlxsw_sp_fid_family_num_fids(fid_family);
- return fid_family->pgt_base + num_fids * flood_table->table_index +
+ return fid_family->pgt_base + num_fids * flood_table->table_index;
+}
+
+static u16
+mlxsw_sp_fid_flood_table_mid(const struct mlxsw_sp_fid_family *fid_family,
+ const struct mlxsw_sp_flood_table *flood_table,
+ u16 fid_offset)
+{
+ return mlxsw_sp_fid_pgt_base_ctl(fid_family, flood_table) +
fid_offset;
}
@@ -1671,7 +1678,7 @@ mlxsw_sp_fid_flood_table_init(struct mlxsw_sp_fid_family *fid_family,
u16 mid_base;
int err, i;
- mid_base = mlxsw_sp_fid_flood_table_mid(fid_family, flood_table, 0);
+ mid_base = mlxsw_sp_fid_pgt_base_ctl(fid_family, flood_table);
sfgc_packet_types = mlxsw_sp_packet_type_sfgc_types[packet_type];
for (i = 0; i < MLXSW_REG_SFGC_TYPE_MAX; i++) {