DPDK patches and discussions
 help / color / mirror / Atom feed
From: Raslan Darawsheh <rasland@mellanox.com>
To: Dekel Peled <dekelp@mellanox.com>,
	Matan Azrad <matan@mellanox.com>,
	Slava Ovsiienko <viacheslavo@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] common/mlx5: fix RSS key copy to TIR context
Date: Mon, 30 Mar 2020 13:22:02 +0000	[thread overview]
Message-ID: <AM0PR05MB670747BCD26D24D0D1954863C2CB0@AM0PR05MB6707.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <47a603b080cf3ede11ae867068a7be81fd755db6.1585472631.git.dekelp@mellanox.com>

Hi,

> -----Original Message-----
> From: Dekel Peled <dekelp@mellanox.com>
> Sent: Sunday, March 29, 2020 12:18 PM
> To: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Raslan Darawsheh <rasland@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] common/mlx5: fix RSS key copy to TIR context
> 
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/common/mlx5/mlx5_devx_cmds.c |  9 +++------
>  drivers/common/mlx5/mlx5_devx_cmds.h |  2 +-
>  drivers/net/mlx5/mlx5_rxq.c          |  3 ++-
>  drivers/vdpa/mlx5/mlx5_vdpa_steer.c  | 14 ++++++++++----
>  4 files changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c
> b/drivers/common/mlx5/mlx5_devx_cmds.c
> index 1157a44..67c8a8c 100644
> --- a/drivers/common/mlx5/mlx5_devx_cmds.c
> +++ b/drivers/common/mlx5/mlx5_devx_cmds.c
> @@ -759,9 +759,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) {
> @@ -784,10 +783,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/common/mlx5/mlx5_devx_cmds.h
> b/drivers/common/mlx5/mlx5_devx_cmds.h
> index 20bb294..f7802e6 100644
> --- a/drivers/common/mlx5/mlx5_devx_cmds.h
> +++ b/drivers/common/mlx5/mlx5_devx_cmds.h
> @@ -183,7 +183,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_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index 8a6b410..97ce206 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -2519,7 +2519,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 =
> diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_steer.c
> b/drivers/vdpa/mlx5/mlx5_vdpa_steer.c
> index 36017f1..9f8af4c 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa_steer.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa_steer.c
> @@ -144,10 +144,16 @@
>  		.transport_domain = priv->td->id,
>  		.indirect_table = priv->steer.rqt->id,
>  		.rx_hash_symmetric = 1,
> -		.rx_hash_toeplitz_key = { 0x2cc681d1, 0x5bdbf4f7,
> 0xfca28319,
> -					  0xdb1a3e94, 0x6b9e38d9,
> 0x2c9c03d1,
> -					  0xad9944a7, 0xd9563d59,
> 0x063c25f3,
> -					  0xfc1fdc2a },
> +		.rx_hash_toeplitz_key = { 0x2c, 0xc6, 0x81, 0xd1,
> +					  0x5b, 0xdb, 0xf4, 0xf7,
> +					  0xfc, 0xa2, 0x83, 0x19,
> +					  0xdb, 0x1a, 0x3e, 0x94,
> +					  0x6b, 0x9e, 0x38, 0xd9,
> +					  0x2c, 0x9c, 0x03, 0xd1,
> +					  0xad, 0x99, 0x44, 0xa7,
> +					  0xd9, 0x56, 0x3d, 0x59,
> +					  0x06, 0x3c, 0x25, 0xf3,
> +					  0xfc, 0x1f, 0xdc, 0x2a },
>  	};
>  	struct {
>  		size_t size;
> --
> 1.8.3.1

Patch applied to next-net-mlx, 

Kindest regards,
Raslan Darawsheh

      reply	other threads:[~2020-03-30 13:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29  9:18 Dekel Peled
2020-03-30 13:22 ` Raslan Darawsheh [this message]

Reply instructions:

You may reply publicly 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=AM0PR05MB670747BCD26D24D0D1954863C2CB0@AM0PR05MB6707.eurprd05.prod.outlook.com \
    --to=rasland@mellanox.com \
    --cc=dekelp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=stable@dpdk.org \
    --cc=viacheslavo@mellanox.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).