patches for DPDK stable branches
 help / color / Atom feed
From: Dekel Peled <dekelp@mellanox.com>
To: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 19.11] net/mlx5: fix RSS key copy to TIR context
Date: Sun, 31 May 2020 17:23:18 +0300
Message-ID: <a55dcf3fd623a349c469c760c7398fa1479d666b.1590934814.git.dekelp@mellanox.com> (raw)

[ upstream commit a4e6ea97a5212f5b59cc65a1293ad23e67ade8fc ]

In function mlx5_devx_cmd_create_tir(), the 40 bytes of RSS key are
copied in 10 iterations, 4 bytes each time using the MLX5_SET macro.
As result the RSS key is copied into TIR context in swapped byte order.
This patch fixes the issue, using memcpy() to copy the RSS key as is.
The struct member mlx5_devx_tir_attr.rx_hash_toeplitz_key is updated
to byte array type.

Fixes: c3aea272eed8 ("net/mlx5: create advanced Rx object via DevX")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5.h           | 2 +-
 drivers/net/mlx5/mlx5_devx_cmds.c | 9 +++------
 drivers/net/mlx5/mlx5_rxq.c       | 3 ++-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index bbf6ecd..e4af5d4 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -370,7 +370,7 @@ struct mlx5_devx_tir_attr {
 	uint32_t rx_hash_fn:4;
 	uint32_t self_lb_block:2;
 	uint32_t transport_domain:24;
-	uint32_t rx_hash_toeplitz_key[10];
+	uint8_t rx_hash_toeplitz_key[MLX5_RSS_HASH_KEY_LEN];
 	struct mlx5_rx_hash_field_select rx_hash_field_selector_outer;
 	struct mlx5_rx_hash_field_select rx_hash_field_selector_inner;
 };
diff --git a/drivers/net/mlx5/mlx5_devx_cmds.c b/drivers/net/mlx5/mlx5_devx_cmds.c
index e3b02bd..e223ee9 100644
--- a/drivers/net/mlx5/mlx5_devx_cmds.c
+++ b/drivers/net/mlx5/mlx5_devx_cmds.c
@@ -635,9 +635,8 @@ struct mlx5_devx_obj *
 {
 	uint32_t in[MLX5_ST_SZ_DW(create_tir_in)] = {0};
 	uint32_t out[MLX5_ST_SZ_DW(create_tir_out)] = {0};
-	void *tir_ctx, *outer, *inner;
+	void *tir_ctx, *outer, *inner, *rss_key;
 	struct mlx5_devx_obj *tir = NULL;
-	int i;
 
 	tir = rte_calloc(__func__, 1, sizeof(*tir), 0);
 	if (!tir) {
@@ -660,10 +659,8 @@ struct mlx5_devx_obj *
 	MLX5_SET(tirc, tir_ctx, rx_hash_fn, tir_attr->rx_hash_fn);
 	MLX5_SET(tirc, tir_ctx, self_lb_block, tir_attr->self_lb_block);
 	MLX5_SET(tirc, tir_ctx, transport_domain, tir_attr->transport_domain);
-	for (i = 0; i < 10; i++) {
-		MLX5_SET(tirc, tir_ctx, rx_hash_toeplitz_key[i],
-			 tir_attr->rx_hash_toeplitz_key[i]);
-	}
+	rss_key = MLX5_ADDR_OF(tirc, tir_ctx, rx_hash_toeplitz_key);
+	memcpy(rss_key, tir_attr->rx_hash_toeplitz_key, MLX5_RSS_HASH_KEY_LEN);
 	outer = MLX5_ADDR_OF(tirc, tir_ctx, rx_hash_field_selector_outer);
 	MLX5_SET(rx_hash_field_select, outer, l3_prot_type,
 		 tir_attr->rx_hash_field_selector_outer.l3_prot_type);
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index c687752..2b6ab21 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -2516,7 +2516,8 @@ struct mlx5_hrxq *
 			tir_attr.transport_domain = priv->sh->td->id;
 		else
 			tir_attr.transport_domain = priv->sh->tdn;
-		memcpy(tir_attr.rx_hash_toeplitz_key, rss_key, rss_key_len);
+		memcpy(tir_attr.rx_hash_toeplitz_key, rss_key,
+		       MLX5_RSS_HASH_KEY_LEN);
 		tir_attr.indirect_table = ind_tbl->rqt->id;
 		if (dev->data->dev_conf.lpbk_mode)
 			tir_attr.self_lb_block =
-- 
1.8.3.1


             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31 14:23 Dekel Peled [this message]
2020-06-01 10:08 ` Luca Boccassi

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a55dcf3fd623a349c469c760c7398fa1479d666b.1590934814.git.dekelp@mellanox.com \
    --to=dekelp@mellanox.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox