dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
To: Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Yongseok Koh <yskoh@mellanox.com>,
	Allain Legacy <allain.legacy@windriver.com>
Cc: Dahir Osman <dahir.osman@windriver.com>,
	dev@dpdk.org, matt.peters@windriver.com
Subject: Re: [PATCH v2] net/mlx5: setup RSS regardless of queue count
Date: Wed, 21 Mar 2018 13:54:36 +0100	[thread overview]
Message-ID: <20180321125436.mfuxtxws4qjmwzd5@laranjeiro-vm.dev.6wind.com> (raw)
In-Reply-To: <3635d2d4c01011fa599d599bfbf16d30fba7e722.1521636364.git.nelio.laranjeiro@6wind.com>

On Wed, Mar 21, 2018 at 01:47:51PM +0100, Nelio Laranjeiro wrote:
> From: Dahir Osman <dahir.osman@windriver.com>
> 
> In some environments it is desirable to have the NIC perform RSS
> normally on the packet regardless of the number of queues configured.
> The RSS hash result that is stored in the mbuf can then be used by
> the application to make decisions about how to distribute workloads
> to threads, secondary processes, or even virtual machines if the
> application is a virtual switch.  This change to the mlx5 driver
> aligns with how other drivers in the Intel family work.
> 
> Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c |  2 +-
>  drivers/net/mlx5/mlx5_rss.c  | 10 ++++++++++
>  drivers/net/mlx5/mlx5_rxq.c  |  3 ++-
>  3 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 3eecdc604..49600e174 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -909,7 +909,7 @@ mlx5_flow_convert_finalise(struct mlx5_flow_parse *parser)
>  	unsigned int i;
>  
>  	/* Remove any other flow not matching the pattern. */
> -	if (parser->queues_n == 1) {
> +	if (parser->queues_n == 1 && !parser->rss_conf.rss_hf) {
>  		for (i = 0; i != hash_rxq_init_n; ++i) {
>  			if (i == HASH_RXQ_ETH)
>  				continue;
> diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
> index 5ac650163..c490854e1 100644
> --- a/drivers/net/mlx5/mlx5_rss.c
> +++ b/drivers/net/mlx5/mlx5_rss.c
> @@ -42,6 +42,8 @@ mlx5_rss_hash_update(struct rte_eth_dev *dev,
>  		     struct rte_eth_rss_conf *rss_conf)
>  {
>  	struct priv *priv = dev->data->dev_private;
> +	unsigned int i;
> +	unsigned int idx;
>  
>  	if (rss_conf->rss_hf & MLX5_RSS_HF_MASK) {
>  		rte_errno = EINVAL;
> @@ -59,6 +61,14 @@ mlx5_rss_hash_update(struct rte_eth_dev *dev,
>  		priv->rss_conf.rss_key_len = rss_conf->rss_key_len;
>  	}
>  	priv->rss_conf.rss_hf = rss_conf->rss_hf;
> +	/* Enable the RSS hash in all Rx queues. */
> +	for (i = 0, idx = 0; idx != priv->rxqs_n; ++i) {
> +		if (!(*priv->rxqs)[i])
> +			continue;
> +		(*priv->rxqs)[i]->rss_hash = !!rss_conf->rss_hf &&
> +			!!(dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS);
> +		++idx;
> +	}
>  	return 0;
>  }
>  
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index 56b2d19f2..1b4570586 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -1070,7 +1070,8 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
>  		tmpl->rxq.crc_present ? "disabled" : "enabled",
>  		tmpl->rxq.crc_present << 2);
>  	/* Save port ID. */
> -	tmpl->rxq.rss_hash = priv->rxqs_n > 1;
> +	tmpl->rxq.rss_hash = !!priv->rss_conf.rss_hf &&
> +		(!!(dev->data->dev_conf.rxmode.mq_mode & ETH_MQ_RX_RSS));
>  	tmpl->rxq.port_id = dev->data->port_id;
>  	tmpl->priv = priv;
>  	tmpl->rxq.mp = mp;
> -- 
> 2.11.0

I forgot to say that this patch applies on top of [1] and [2].

Regards,

[1] https://dpdk.org/browse/next/dpdk-next-net-mlx
[2] https://dpdk.org/dev/patchwork/patch/36066/

-- 
Nélio Laranjeiro
6WIND

  reply	other threads:[~2018-03-21 12:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 16:30 [PATCH] net/mlx5: setup RSS regardless of queue count Allain Legacy
2018-03-20 12:26 ` Nélio Laranjeiro
2018-03-20 13:10   ` Legacy, Allain
2018-03-20 23:07   ` Yongseok Koh
2018-03-21  8:33     ` Nélio Laranjeiro
2018-03-21 12:43       ` Legacy, Allain
2018-03-21 12:47 ` [PATCH v2] " Nelio Laranjeiro
2018-03-21 12:54   ` Nélio Laranjeiro [this message]
2018-03-22 23:37   ` Yongseok Koh
2018-03-23 12:15     ` Legacy, Allain
2018-03-26 18:09     ` Legacy, Allain
2018-03-27 16:53       ` Shahaf Shuler

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=20180321125436.mfuxtxws4qjmwzd5@laranjeiro-vm.dev.6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=allain.legacy@windriver.com \
    --cc=dahir.osman@windriver.com \
    --cc=dev@dpdk.org \
    --cc=matt.peters@windriver.com \
    --cc=yskoh@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).