Skip to contentSkip to conversation

mlxsw: Two small updates

PATCH In review Ido Schimmel 2 participants 4 messages Jul 23, 2019 – Jul 25, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover mlxsw: Two small updates

From: Ido Schimmel <[email protected]>

Patch #1, from Amit, exposes the size of the key-value database (KVD) where different entries (e.g., routes, neighbours) are stored in the device. This allows users to understand how many entries can be offloaded and is also useful for writing scale tests.

Patch #2 increases the number of IPv6 nexthop groups mlxsw can offload. The problem and solution are explained in detail in the commit message.

Amit Cohen (1):
mlxsw: spectrum: Expose KVD size for Spectrum-2

Ido Schimmel (1):
mlxsw: spectrum_router: Increase scale of IPv6 nexthop groups

 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 22 ++++++++++++++++++-
 .../ethernet/mellanox/mlxsw/spectrum_router.c |  4 ++--
 2 files changed, 23 insertions(+), 3 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/2 mlxsw: spectrum: Expose KVD size for Spectrum-2

From: Amit Cohen <[email protected]>

Unlike Spectrum-1, the KVD (Key-value database) of Spectrum-2 is not partitioned, so only expose the entire KVD size. This enables users to query the total size of the KVD.

---
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +21 -1
index 650638152bbc..7e8a54068d92 100644
@@ -5026,6 +5026,26 @@ static int mlxsw_sp1_resources_kvd_register(struct mlxsw_core *mlxsw_core)
 	return 0;
 }
 
+static int mlxsw_sp2_resources_kvd_register(struct mlxsw_core *mlxsw_core)
+{
+	struct devlink *devlink = priv_to_devlink(mlxsw_core);
+	struct devlink_resource_size_params kvd_size_params;
+	u32 kvd_size;
+
+	if (!MLXSW_CORE_RES_VALID(mlxsw_core, KVD_SIZE))
+		return -EIO;
+
+	kvd_size = MLXSW_CORE_RES_GET(mlxsw_core, KVD_SIZE);
+	devlink_resource_size_params_init(&kvd_size_params, kvd_size, kvd_size,
+					  MLXSW_SP_KVD_GRANULARITY,
+					  DEVLINK_RESOURCE_UNIT_ENTRY);
+
+	return devlink_resource_register(devlink, MLXSW_SP_RESOURCE_NAME_KVD,
+					 kvd_size, MLXSW_SP_RESOURCE_KVD,
+					 DEVLINK_RESOURCE_ID_PARENT_TOP,
+					 &kvd_size_params);
+}
+
 static int mlxsw_sp1_resources_register(struct mlxsw_core *mlxsw_core)
 {
 	return mlxsw_sp1_resources_kvd_register(mlxsw_core);
@@ -5033,7 +5053,7 @@ static int mlxsw_sp1_resources_register(struct mlxsw_core *mlxsw_core)
 
 static int mlxsw_sp2_resources_register(struct mlxsw_core *mlxsw_core)
 {
-	return 0;
+	return mlxsw_sp2_resources_kvd_register(mlxsw_core);
 }
 
 static int mlxsw_sp_kvd_sizes_get(struct mlxsw_core *mlxsw_core,
Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/2 mlxsw: spectrum_router: Increase scale of IPv6 nexthop groups

In reply to Ido Schimmel

From: Ido Schimmel <[email protected]>

Unlike IPv4, the kernel does not consolidate IPv6 nexthop groups. To avoid exhausting the device's adjacency table - where nexthops are stored - the driver does this consolidation instead.

Each nexthop group is hashed by XOR-ing the interface indexes of all the member nexthop devices. However, the ifindex itself is not hashed, which can result in identical keys used for different groups and finally an -EBUSY error from rhashtable due to too long objects list.

Improve the situation by hashing the ifindex itself.

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +2 -2
index e618be7ce6c6..a330b369e899 100644
@@ -2943,7 +2943,7 @@ static u32 mlxsw_sp_nexthop_group_hash_obj(const void *data, u32 len, u32 seed)
 		val = nh_grp->count;
 		for (i = 0; i < nh_grp->count; i++) {
 			nh = &nh_grp->nexthops[i];
-			val ^= nh->ifindex;
+			val ^= jhash(&nh->ifindex, sizeof(nh->ifindex), seed);
 		}
 		return jhash(&val, sizeof(val), seed);
 	default:
@@ -2961,7 +2961,7 @@ mlxsw_sp_nexthop6_group_hash(struct mlxsw_sp_fib6_entry *fib6_entry, u32 seed)
 
 	list_for_each_entry(mlxsw_sp_rt6, &fib6_entry->rt6_list, list) {
 		dev = mlxsw_sp_rt6->rt->fib6_nh->fib_nh_dev;
-		val ^= dev->ifindex;
+		val ^= jhash(&dev->ifindex, sizeof(dev->ifindex), seed);
 	}
 
 	return jhash(&val, sizeof(val), seed);
Signature · 1 line
2.21.0
maintainer
#3 lore raw
In reply to Ido Schimmel

From: Ido Schimmel <[email protected]>
Date: Tue, 23 Jul 2019 10:57:40 +0300

Quoted 9 lines

From: Ido Schimmel <[email protected]>

Patch #1, from Amit, exposes the size of the key-value database (KVD) where different entries (e.g., routes, neighbours) are stored in the device. This allows users to understand how many entries can be offloaded and is also useful for writing scale tests.

Patch #2 increases the number of IPv6 nexthop groups mlxsw can offload. The problem and solution are explained in detail in the commit message.

Series applied.