Skip to contentSkip to conversation

mlxsw: couple of fixes

PATCH In review Jiri Pirko 2 participants 4 messages May 18, 2017

Subsystems (3)
lore
Share & tools
lore
author
#2 lore raw

PATCH 2/2 mlxsw: spectrum_router: Fix rif counter freeing routine

In reply to Jiri Pirko

From: Arkadi Sharshevsky <[email protected]>

During rif counter freeing the counter index can be invalid. Add check of validity before freeing the counter.

Fixes e0c0afd8aa4e ("mlxsw: spectrum: Support for counters on router interfaces")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +3 -0
index 33cec1c..9f89c41 100644
@@ -206,6 +206,9 @@ void mlxsw_sp_rif_counter_free(struct mlxsw_sp *mlxsw_sp,
 {
 	unsigned int *p_counter_index;
 
+	if (!mlxsw_sp_rif_counter_valid_get(rif, dir))
+		return;
+
 	p_counter_index = mlxsw_sp_rif_p_counter_get(rif, dir);
 	if (WARN_ON(!p_counter_index))
 		return;
Signature · 1 line
2.9.3

Jiri Pirko

author
#0 lore raw

cover mlxsw: couple of fixes

From: Jiri Pirko <[email protected]>

Cuple of fixes from Arkadi

Arkadi Sharshevsky (2):
mlxsw: spectrum_dpipe: Fix incorrect entry index
mlxsw: spectrum_router: Fix rif counter freeing routine

 drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c  | 3 ++-
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.9.3
author
#1 lore raw

PATCH 1/2 mlxsw: spectrum_dpipe: Fix incorrect entry index

From: Arkadi Sharshevsky <[email protected]>

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")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c +2 -1
index ea56f6a..5f0a7bc 100644
@@ -199,10 +199,11 @@ static int mlxsw_sp_erif_entry_get(struct mlxsw_sp *mlxsw_sp,
 
 	entry->counter_valid = false;
 	entry->counter = 0;
+	entry->index = mlxsw_sp_rif_index(rif);
+
 	if (!counters_enabled)
 		return 0;
 
-	entry->index = mlxsw_sp_rif_index(rif);
 	err = mlxsw_sp_rif_counter_value_get(mlxsw_sp, rif,
 					     MLXSW_SP_RIF_COUNTER_EGRESS,
 					     &cnt);
Signature · 1 line
2.9.3