All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] mlxsw: Two small updates
@ 2019-07-23  7:57 Ido Schimmel
  2019-07-23  7:57 ` [PATCH net-next 1/2] mlxsw: spectrum: Expose KVD size for Spectrum-2 Ido Schimmel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ido Schimmel @ 2019-07-23  7:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, amitc, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

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(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] mlxsw: spectrum: Expose KVD size for Spectrum-2
  2019-07-23  7:57 [PATCH net-next 0/2] mlxsw: Two small updates Ido Schimmel
@ 2019-07-23  7:57 ` Ido Schimmel
  2019-07-23  7:57 ` [PATCH net-next 2/2] mlxsw: spectrum_router: Increase scale of IPv6 nexthop groups Ido Schimmel
  2019-07-25 18:36 ` [PATCH net-next 0/2] mlxsw: Two small updates David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2019-07-23  7:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, amitc, mlxsw, Ido Schimmel

From: Amit Cohen <amitc@mellanox.com>

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.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
---
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index 650638152bbc..7e8a54068d92 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -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,
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] mlxsw: spectrum_router: Increase scale of IPv6 nexthop groups
  2019-07-23  7:57 [PATCH net-next 0/2] mlxsw: Two small updates Ido Schimmel
  2019-07-23  7:57 ` [PATCH net-next 1/2] mlxsw: spectrum: Expose KVD size for Spectrum-2 Ido Schimmel
@ 2019-07-23  7:57 ` Ido Schimmel
  2019-07-25 18:36 ` [PATCH net-next 0/2] mlxsw: Two small updates David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2019-07-23  7:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, amitc, mlxsw, Ido Schimmel

From: Ido Schimmel <idosch@mellanox.com>

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.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index e618be7ce6c6..a330b369e899 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -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);
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] mlxsw: Two small updates
  2019-07-23  7:57 [PATCH net-next 0/2] mlxsw: Two small updates Ido Schimmel
  2019-07-23  7:57 ` [PATCH net-next 1/2] mlxsw: spectrum: Expose KVD size for Spectrum-2 Ido Schimmel
  2019-07-23  7:57 ` [PATCH net-next 2/2] mlxsw: spectrum_router: Increase scale of IPv6 nexthop groups Ido Schimmel
@ 2019-07-25 18:36 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-07-25 18:36 UTC (permalink / raw)
  To: idosch; +Cc: netdev, jiri, amitc, mlxsw, idosch

From: Ido Schimmel <idosch@idosch.org>
Date: Tue, 23 Jul 2019 10:57:40 +0300

> From: Ido Schimmel <idosch@mellanox.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-25 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23  7:57 [PATCH net-next 0/2] mlxsw: Two small updates Ido Schimmel
2019-07-23  7:57 ` [PATCH net-next 1/2] mlxsw: spectrum: Expose KVD size for Spectrum-2 Ido Schimmel
2019-07-23  7:57 ` [PATCH net-next 2/2] mlxsw: spectrum_router: Increase scale of IPv6 nexthop groups Ido Schimmel
2019-07-25 18:36 ` [PATCH net-next 0/2] mlxsw: Two small updates David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.