netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx5e: parameter to disable symmetric hash
@ 2022-12-14 14:35 Alexandra Kossovsky
  2022-12-14 17:01 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandra Kossovsky @ 2022-12-14 14:35 UTC (permalink / raw)
  To: Saeed Mahameed, Leon Romanovsky, Maxim Mikityanskiy, netdev

Some AF_XDP applications assume standard Topelitz hash when spreading
traffic accross queues via RSS.  MLX5 driver always set "symmetric"
bit, which results in unexpected queues for any particular connection.

With this patch is is possible to disable that symmetric bit via
use_symmetric_hash module parameter, and use the standard Toeplitz hash
with well-known predictable result, same as for other NICs.

Signed-off-by: Alexandra N. Kossovsky <alexandra.kossovsky@oktetlabs.ru>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tir.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
index d4239e3b3c88..63fb2608c0b0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tir.c
@@ -5,6 +5,10 @@
 #include "params.h"
 #include <linux/mlx5/transobj.h>
 
+static bool use_symmetric_hash = true;
+module_param_named(use_symmetric_hash, use_symmetric_hash, bool, 0644);
+MODULE_PARM_DESC(use_symmetric_hash, "Use symmetric Toeplitz hash for RSS.");
+
 #define MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ (64 * 1024)
 
 /* max() doesn't work inside square brackets. */
@@ -121,7 +125,8 @@ void mlx5e_tir_builder_build_rss(struct mlx5e_tir_builder *builder,
 		const size_t len = MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key);
 		void *rss_key = MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key);
 
-		MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
+		if (use_symmetric_hash)
+			MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
 		memcpy(rss_key, rss_hash->toeplitz_hash_key, len);
 	}
 
-- 
2.30.2


-- 
Alexandra N. Kossovsky
OKTET Labs (http://www.oktetlabs.ru/)

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

* Re: [PATCH] net/mlx5e: parameter to disable symmetric hash
  2022-12-14 14:35 [PATCH] net/mlx5e: parameter to disable symmetric hash Alexandra Kossovsky
@ 2022-12-14 17:01 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2022-12-14 17:01 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Alexandra Kossovsky, Saeed Mahameed, Maxim Mikityanskiy, netdev

On Wed, 14 Dec 2022 17:35:42 +0300 Alexandra Kossovsky wrote:
> Some AF_XDP applications assume standard Topelitz hash when spreading
> traffic accross queues via RSS.  MLX5 driver always set "symmetric"
> bit, which results in unexpected queues for any particular connection.
> 
> With this patch is is possible to disable that symmetric bit via
> use_symmetric_hash module parameter, and use the standard Toeplitz hash
> with well-known predictable result, same as for other NICs.

This module param, OTOH, not okay..

[ https://lore.kernel.org/all/20221214085106.42a88df1@kernel.org/ ]

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

end of thread, other threads:[~2022-12-14 17:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-14 14:35 [PATCH] net/mlx5e: parameter to disable symmetric hash Alexandra Kossovsky
2022-12-14 17:01 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).