From patchwork Tue Apr 10 13:34:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xueming Li X-Patchwork-Id: 37797 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 19E9D1BAD9; Tue, 10 Apr 2018 15:35:08 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id B9E1C1BAA0 for ; Tue, 10 Apr 2018 15:34:41 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@mellanox.com) with ESMTPS (AES256-SHA encrypted); 10 Apr 2018 16:35:50 +0300 Received: from dev-r630-06.mtbc.labs.mlnx (dev-r630-06.mtbc.labs.mlnx [10.12.205.180]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w3ADYemP023243; Tue, 10 Apr 2018 16:34:40 +0300 Received: from dev-r630-06.mtbc.labs.mlnx (localhost [127.0.0.1]) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7) with ESMTP id w3ADYe80189993; Tue, 10 Apr 2018 21:34:40 +0800 Received: (from xuemingl@localhost) by dev-r630-06.mtbc.labs.mlnx (8.14.7/8.14.7/Submit) id w3ADYeE4189992; Tue, 10 Apr 2018 21:34:40 +0800 From: Xueming Li To: Nelio Laranjeiro , Shahaf Shuler Cc: Xueming Li , dev@dpdk.org Date: Tue, 10 Apr 2018 21:34:13 +0800 Message-Id: <20180410133415.189905-14-xuemingl@mellanox.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20180410133415.189905-1-xuemingl@mellanox.com> References: <20180410133415.189905-1-xuemingl@mellanox.com> Subject: [dpdk-dev] [PATCH v2 13/15] net/mlx5: setup RSS flow 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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. Signed-off-by: Xueming Li --- drivers/net/mlx5/mlx5_flow.c | 71 +++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 41 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 5784f2ee0..9efe00086 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1252,48 +1252,37 @@ mlx5_flow_convert_rss(struct rte_eth_dev *dev, struct mlx5_flow_parse *parser) parser->queue[i].ibv_attr = NULL; } } - if (parser->rss_conf.types) { - /* Remove impossible flow according to the RSS configuration. */ - for (i = hmin; i != (hmax + 1); ++i) { - if (!parser->queue[i].ibv_attr) - continue; - if (parser->rss_conf.types & - hash_rxq_init[i].dpdk_rss_hf) { - parser->queue[i].hash_fields = - hash_rxq_init[i].hash_fields; - found = 1; - continue; - } - /* L4 flow could be used for L3 RSS. */ - if (i == parser->layer && i < ip && - (hash_rxq_init[ip].dpdk_rss_hf & - parser->rss_conf.types)) { - parser->queue[i].hash_fields = - hash_rxq_init[ip].hash_fields; - found = 1; - continue; - } - /* L3 flow and L4 hash: non-rss L3 flow. */ - if (i == parser->layer && i == ip && found) - /* IP pattern and L4 HF. */ - continue; - rte_free(parser->queue[i].ibv_attr); - parser->queue[i].ibv_attr = NULL; + /* Remove impossible flow according to the RSS configuration. */ + for (i = hmin; i != (hmax + 1); ++i) { + if (!parser->queue[i].ibv_attr) + continue; + if (parser->rss_conf.types & + hash_rxq_init[i].dpdk_rss_hf) { + parser->queue[i].hash_fields = + hash_rxq_init[i].hash_fields; + found = 1; + continue; } - if (!found) - DRV_LOG(WARNING, - "port %u rss hash function doesn't match " - "pattern", dev->data->port_id); - } else { - /* Remove any other flow. */ - for (i = hmin; i != (hmax + 1); ++i) { - if (i == parser->layer || !parser->queue[i].ibv_attr) - continue; - rte_free(parser->queue[i].ibv_attr); - parser->queue[i].ibv_attr = NULL; + /* L4 flow could be used for L3 RSS. */ + if (i == parser->layer && i < ip && + (hash_rxq_init[ip].dpdk_rss_hf & + parser->rss_conf.types)) { + parser->queue[i].hash_fields = + hash_rxq_init[ip].hash_fields; + found = 1; + continue; } - parser->rss_conf.queue_num = 1; + /* L3 flow and L4 hash: non-rss L3 flow. */ + if (i == parser->layer && i == ip && found) + /* IP pattern and L4 HF. */ + continue; + rte_free(parser->queue[i].ibv_attr); + parser->queue[i].ibv_attr = NULL; } + if (!found) + DRV_LOG(WARNING, + "port %u rss hash function doesn't match " + "pattern", dev->data->port_id); return 0; } @@ -2326,8 +2315,8 @@ mlx5_flow_dump(struct rte_eth_dev *dev __rte_unused, (void *)flow->frxq[i].hrxq->ind_table, flow->frxq[i].hash_fields | (flow->tunnel && - flow->rss_conf.rss_level ? (uint32_t)IBV_RX_HASH_INNER : 0), - flow->queues_n, + flow->rss_conf.level ? (uint32_t)IBV_RX_HASH_INNER : 0), + flow->rss_conf.queue_num, flow->frxq[i].ibv_attr->num_of_specs, flow->frxq[i].ibv_attr->size, flow->frxq[i].ibv_attr->priority,