diff options
author | Arkadi Sharshevsky <arkadis@mellanox.com> | 2017-05-18 03:18:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-18 11:03:59 -0400 |
commit | 6dd4aba36f2dca00c3b6976a0d59c5cee16ad545 (patch) | |
tree | a770e80dddf42bad8858d6efd5288833d9552332 | |
parent | 1ac91bff9c65d4a5e0da244495ea6275fd514c5a (diff) |
mlxsw: spectrum_dpipe: Fix incorrect entry index
In case of disabled counters the entry index will be incorrect. Fix this
by moving the entry index set before the counter status check.
Fixes: 2ba5999f009d ("mlxsw: spectrum: Add Support for erif table entries access")
Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c index ea56f6ade6b4..5f0a7bc692a4 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | |||
@@ -199,10 +199,11 @@ static int mlxsw_sp_erif_entry_get(struct mlxsw_sp *mlxsw_sp, | |||
199 | 199 | ||
200 | entry->counter_valid = false; | 200 | entry->counter_valid = false; |
201 | entry->counter = 0; | 201 | entry->counter = 0; |
202 | entry->index = mlxsw_sp_rif_index(rif); | ||
203 | |||
202 | if (!counters_enabled) | 204 | if (!counters_enabled) |
203 | return 0; | 205 | return 0; |
204 | 206 | ||
205 | entry->index = mlxsw_sp_rif_index(rif); | ||
206 | err = mlxsw_sp_rif_counter_value_get(mlxsw_sp, rif, | 207 | err = mlxsw_sp_rif_counter_value_get(mlxsw_sp, rif, |
207 | MLXSW_SP_RIF_COUNTER_EGRESS, | 208 | MLXSW_SP_RIF_COUNTER_EGRESS, |
208 | &cnt); | 209 | &cnt); |