f2c780
From e7cb8ce7cfe1a4afcb9b684894c7755bd4f84f8e Mon Sep 17 00:00:00 2001
f2c780
From: Petr Machata <petrm@nvidia.com>
f2c780
Date: Mon, 13 Jun 2022 15:50:17 +0300
f2c780
Subject: [PATCH 20/32] mlxsw: spectrum_cnt: Reorder counter pools
f2c780
Git-commit: 4b7a632ac4e7101ceefee8484d5c2ca505d347b3
f2c780
References: git-fixes
f2c780
Patch-mainline: v5.19-rc3
f2c780
f2c780
Both RIF and ACL flow counters use a 24-bit SW-managed counter address to
f2c780
communicate which counter they want to bind.
f2c780
f2c780
In a number of Spectrum FW releases, binding a RIF counter is broken and
f2c780
slices the counter index to 16 bits. As a result, on Spectrum-2 and above,
f2c780
no more than about 410 RIF counters can be effectively used. This
f2c780
translates to 205 netdevices for which L3 HW stats can be enabled. (This
f2c780
does not happen on Spectrum-1, because there are fewer counters available
f2c780
overall and the counter index never exceeds 16 bits.)
f2c780
f2c780
Binding counters to ACLs does not have this issue. Therefore reorder the
f2c780
counter allocation scheme so that RIF counters come first and therefore get
f2c780
lower indices that are below the 16-bit barrier.
f2c780
f2c780
Fixes: 98e60dce4da1 ("Merge branch 'mlxsw-Introduce-initial-Spectrum-2-support'")
f2c780
Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
f2c780
Signed-off-by: Petr Machata <petrm@nvidia.com>
f2c780
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
f2c780
Link: https://lore.kernel.org/r/20220613125017.2018162-1-idosch@nvidia.com
f2c780
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
f2c780
Signed-off-by: Denis Kirjanov <denis.kirjanov@suse.com>
f2c780
---
f2c780
 drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h | 2 +-
f2c780
 1 file changed, 1 insertion(+), 1 deletion(-)
f2c780
f2c780
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h
f2c780
index a68d931090dd..15c8d4de8350 100644
f2c780
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h
f2c780
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h
f2c780
@@ -8,8 +8,8 @@
f2c780
 #include "spectrum.h"
f2c780
 
f2c780
 enum mlxsw_sp_counter_sub_pool_id {
f2c780
-	MLXSW_SP_COUNTER_SUB_POOL_FLOW,
f2c780
 	MLXSW_SP_COUNTER_SUB_POOL_RIF,
f2c780
+	MLXSW_SP_COUNTER_SUB_POOL_FLOW,
f2c780
 };
f2c780
 
f2c780
 int mlxsw_sp_counter_alloc(struct mlxsw_sp *mlxsw_sp,
f2c780
-- 
f2c780
2.16.4
f2c780