From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id BD49456A1 for ; Wed, 21 Mar 2018 13:48:52 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id l9so9512778wmh.2 for ; Wed, 21 Mar 2018 05:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=40CGiaT9/K4V0vG1YkK7LmwlhHfhmwxjB6uYMdtjeOc=; b=f2zdiV0PJG3NQIAWlKUJwGIeuaNMnZmLlTKQR7VcuwJ+ifCkV9R9mPL4dguZiEKFyM 2AO3rzp5EeWlS8jN4QnDQjl1TzbZcq4V34Vdet4xxSAyPZRXZqcP2H85H5lPYog+xjCt RFsUKf5gbJ4IbcHo6lIjXVJozY2v3YG/383g1w5NaklIc8kgvxsURnWhtHYm3o4dTMdM MTpSbEiVGEtUiN9J+9Lh07x+mfBPMam34Ola3FbbCrpzyetXsMnx/UecB1XBu2UqPwje 32iYraowl7fOvZMIVXA5ueJJgjUEABgyPeyoJ1jq5WGU8OzRY6izHUI3RQgtU+qVkKqr ChCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=40CGiaT9/K4V0vG1YkK7LmwlhHfhmwxjB6uYMdtjeOc=; b=ZUuv4YObTFuAuCO9wjRm/k0xkeMtolW7fAQ8ngLd18jyYebOlhFPiAvj47oYJmY4/I +52t25kTof7SbKADqzLcS6uKErqbybgcTuqNn/zhAwq5oTxkmb8hK4h8HkXI7VyXFqjs plZmuA9orDyi8mMZedSfMsnHO4d0/zgxocrV54QoMuqVkN9kOxu8IXi6+9Zv8SpSOWmk Z9cOgA0ELP8nBTcFi7jpX7BGGGe9yqL4kVSl/5YI6ZkEERT2WQkJHO3+NxwKLsX/400w UwWutxivnwyRcHEVhw6acq5LD+7vYCLT2UJJwcvzPIsXuHchaAKrV+o4dEmjyVgzKow5 W0bQ== X-Gm-Message-State: AElRT7FrIPP7r1ClcgY+VWllNO1iuIP7ZMYNRpTARv6o5v6+ESD0cbU0 MZ/MJ5raC75ai+KNsFKiub/vdYrTCw== X-Google-Smtp-Source: AG47ELtRdogK7OqLhzpT10AXdpkta4m01I9H/h/p4ogeRx5JZykOi7jXlLJkRnpcaWGBYXzyT317QA== X-Received: by 10.28.229.210 with SMTP id c201mr2717079wmh.154.1521636532248; Wed, 21 Mar 2018 05:48:52 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id v23sm3305400wmh.30.2018.03.21.05.48.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 05:48:51 -0700 (PDT) From: Nelio Laranjeiro To: Adrien Mazarguil , Yongseok Koh , Allain Legacy Cc: Dahir Osman , dev@dpdk.org, matt.peters@windriver.com Date: Wed, 21 Mar 2018 13:47:51 +0100 Message-Id: <3635d2d4c01011fa599d599bfbf16d30fba7e722.1521636364.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180319163007.11516-1-allain.legacy@windriver.com> References: <20180319163007.11516-1-allain.legacy@windriver.com> Subject: [dpdk-dev] [PATCH v2] net/mlx5: setup RSS regardless of queue count X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 12:48:52 -0000 From: Dahir Osman 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 Signed-off-by: Nelio Laranjeiro --- 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