lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5nfPjloqVqmWPyn@gondor.oktetlabs.ru>
Date:   Wed, 14 Dec 2022 17:35:42 +0300
From:   Alexandra Kossovsky <Alexandra.Kossovsky@...etlabs.ru>
To:     Saeed Mahameed <saeedm@...dia.com>,
        Leon Romanovsky <leon@...nel.org>,
        Maxim Mikityanskiy <maximmi@...dia.com>, netdev@...r.kernel.org
Subject: [PATCH] net/mlx5e: parameter to disable symmetric hash

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@...etlabs.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/)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ