Skip to content

Commit

Permalink
mlxsw: spectrum_acl_bloom_filter: Reorder functions to make the code …
Browse files Browse the repository at this point in the history
…more aesthetic

Currently, mlxsw_sp_acl_bf_rule_count_index_get() is implemented before
mlxsw_sp_acl_bf_index_get() but is used after it.

Adding a new function for Spectrum-4 would make them further apart still.
Fix by moving them around.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Amit Cohen authored and Jakub Kicinski committed Jan 7, 2022
1 parent 07ff135 commit 4711671
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ mlxsw_sp_acl_bf_key_encode(struct mlxsw_sp_acl_atcam_region *aregion,
*len = chunk_count * MLXSW_BLOOM_KEY_CHUNK_BYTES;
}

static unsigned int
mlxsw_sp_acl_bf_rule_count_index_get(struct mlxsw_sp_acl_bf *bf,
unsigned int erp_bank,
unsigned int bf_index)
{
return erp_bank * bf->bank_size + bf_index;
}

static unsigned int
mlxsw_sp_acl_bf_index_get(struct mlxsw_sp_acl_bf *bf,
struct mlxsw_sp_acl_atcam_region *aregion,
Expand All @@ -162,6 +154,14 @@ mlxsw_sp_acl_bf_index_get(struct mlxsw_sp_acl_bf *bf,
return mlxsw_sp_acl_bf_crc(bf_key, bf_size);
}

static unsigned int
mlxsw_sp_acl_bf_rule_count_index_get(struct mlxsw_sp_acl_bf *bf,
unsigned int erp_bank,
unsigned int bf_index)
{
return erp_bank * bf->bank_size + bf_index;
}

int
mlxsw_sp_acl_bf_entry_add(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_bf *bf,
Expand Down

0 comments on commit 4711671

Please sign in to comment.