Commit 9834e246 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

mlxsw: spectrum_router: Drop mlxsw_sp arg from counter alloc/free functions

The mlxsw_sp reference is carried by the mlxsw_sp_rif object that is passed
to these functions as well. Just deduce the former from the latter,
and drop the explicit mlxsw_sp parameter. Adapt callers.
Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8fe96f58
...@@ -266,10 +266,10 @@ static int mlxsw_sp_dpipe_table_erif_counters_update(void *priv, bool enable) ...@@ -266,10 +266,10 @@ static int mlxsw_sp_dpipe_table_erif_counters_update(void *priv, bool enable)
if (!rif) if (!rif)
continue; continue;
if (enable) if (enable)
mlxsw_sp_rif_counter_alloc(mlxsw_sp, rif, mlxsw_sp_rif_counter_alloc(rif,
MLXSW_SP_RIF_COUNTER_EGRESS); MLXSW_SP_RIF_COUNTER_EGRESS);
else else
mlxsw_sp_rif_counter_free(mlxsw_sp, rif, mlxsw_sp_rif_counter_free(rif,
MLXSW_SP_RIF_COUNTER_EGRESS); MLXSW_SP_RIF_COUNTER_EGRESS);
} }
mutex_unlock(&mlxsw_sp->router->lock); mutex_unlock(&mlxsw_sp->router->lock);
......
...@@ -235,10 +235,10 @@ static int mlxsw_sp_rif_counter_clear(struct mlxsw_sp *mlxsw_sp, ...@@ -235,10 +235,10 @@ static int mlxsw_sp_rif_counter_clear(struct mlxsw_sp *mlxsw_sp,
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ricnt), ricnt_pl); return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ricnt), ricnt_pl);
} }
int mlxsw_sp_rif_counter_alloc(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_rif_counter_alloc(struct mlxsw_sp_rif *rif,
struct mlxsw_sp_rif *rif,
enum mlxsw_sp_rif_counter_dir dir) enum mlxsw_sp_rif_counter_dir dir)
{ {
struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
unsigned int *p_counter_index; unsigned int *p_counter_index;
int err; int err;
...@@ -268,10 +268,10 @@ int mlxsw_sp_rif_counter_alloc(struct mlxsw_sp *mlxsw_sp, ...@@ -268,10 +268,10 @@ int mlxsw_sp_rif_counter_alloc(struct mlxsw_sp *mlxsw_sp,
return err; return err;
} }
void mlxsw_sp_rif_counter_free(struct mlxsw_sp *mlxsw_sp, void mlxsw_sp_rif_counter_free(struct mlxsw_sp_rif *rif,
struct mlxsw_sp_rif *rif,
enum mlxsw_sp_rif_counter_dir dir) enum mlxsw_sp_rif_counter_dir dir)
{ {
struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp;
unsigned int *p_counter_index; unsigned int *p_counter_index;
if (!mlxsw_sp_rif_counter_valid_get(rif, dir)) if (!mlxsw_sp_rif_counter_valid_get(rif, dir))
...@@ -296,14 +296,12 @@ static void mlxsw_sp_rif_counters_alloc(struct mlxsw_sp_rif *rif) ...@@ -296,14 +296,12 @@ static void mlxsw_sp_rif_counters_alloc(struct mlxsw_sp_rif *rif)
if (!devlink_dpipe_table_counter_enabled(devlink, if (!devlink_dpipe_table_counter_enabled(devlink,
MLXSW_SP_DPIPE_TABLE_NAME_ERIF)) MLXSW_SP_DPIPE_TABLE_NAME_ERIF))
return; return;
mlxsw_sp_rif_counter_alloc(mlxsw_sp, rif, MLXSW_SP_RIF_COUNTER_EGRESS); mlxsw_sp_rif_counter_alloc(rif, MLXSW_SP_RIF_COUNTER_EGRESS);
} }
static void mlxsw_sp_rif_counters_free(struct mlxsw_sp_rif *rif) static void mlxsw_sp_rif_counters_free(struct mlxsw_sp_rif *rif)
{ {
struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; mlxsw_sp_rif_counter_free(rif, MLXSW_SP_RIF_COUNTER_EGRESS);
mlxsw_sp_rif_counter_free(mlxsw_sp, rif, MLXSW_SP_RIF_COUNTER_EGRESS);
} }
#define MLXSW_SP_PREFIX_COUNT (sizeof(struct in6_addr) * BITS_PER_BYTE + 1) #define MLXSW_SP_PREFIX_COUNT (sizeof(struct in6_addr) * BITS_PER_BYTE + 1)
......
...@@ -159,11 +159,9 @@ int mlxsw_sp_rif_counter_value_get(struct mlxsw_sp *mlxsw_sp, ...@@ -159,11 +159,9 @@ int mlxsw_sp_rif_counter_value_get(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_rif *rif, struct mlxsw_sp_rif *rif,
enum mlxsw_sp_rif_counter_dir dir, enum mlxsw_sp_rif_counter_dir dir,
u64 *cnt); u64 *cnt);
void mlxsw_sp_rif_counter_free(struct mlxsw_sp *mlxsw_sp, void mlxsw_sp_rif_counter_free(struct mlxsw_sp_rif *rif,
struct mlxsw_sp_rif *rif,
enum mlxsw_sp_rif_counter_dir dir); enum mlxsw_sp_rif_counter_dir dir);
int mlxsw_sp_rif_counter_alloc(struct mlxsw_sp *mlxsw_sp, int mlxsw_sp_rif_counter_alloc(struct mlxsw_sp_rif *rif,
struct mlxsw_sp_rif *rif,
enum mlxsw_sp_rif_counter_dir dir); enum mlxsw_sp_rif_counter_dir dir);
struct mlxsw_sp_neigh_entry * struct mlxsw_sp_neigh_entry *
mlxsw_sp_rif_neigh_next(struct mlxsw_sp_rif *rif, mlxsw_sp_rif_neigh_next(struct mlxsw_sp_rif *rif,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment