From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 09DC9A0C51; Tue, 13 Jul 2021 14:55:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E56C3410E6; Tue, 13 Jul 2021 14:55:07 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by mails.dpdk.org (Postfix) with ESMTP id 16235406FF; Tue, 13 Jul 2021 14:55:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lmGeP5m1vwqxu9a4zpOBGwzVpO070eEXNavNcEQYNIJ/1ORuHBhMZC/4enevVb7jbQTPRC28YofL/xXQNkxw8i5oDgknhXO8+Rgy21TwUrUyuvkF052Lqz8gRH2+DP+fCWZZzAtCsJtrU3+rmpkb8MtjeFCVHmg6PTEh7M1aVZeYdlUWdyfLj4GpNbDWfyrcFS/68BGiBDT7bWh06yV//jZN2j26baGglr/9GGpEdrndAhFcy+lvnfT6zS3TIMci1b0OmRSqeM8uqSi3CB6c6STW/dAhr+Aw/NApCwuU+25mc7m5EQF+fz17t4KwU/etKW+eh30IgTzGMzrT5lJMlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6QSfqNtDiT8idSbT21FF4TdS+MX2IFVzO4EsS8tXEsI=; b=jpFKCn+dUTLON0wZg/XTS/jaFE03RY//8bqT2hD3rBJ6kvcMUmrYc43g02/vvizB1SVqhywIFS3Kqubb+QsL9SOfRdPGWQ0Rle/VBhdZGup3UVB1s0xhq1LIYosbbOrrycnqlTwCOtfKq5Ud41d7tZoUQSzzUPCy0ylFxxqPnJihtRM9irjOglmSqgZDpT3Fws2DOdbMiaMT2qHxIn8UDGz2dWtARtV7diMYdeshKtBtg8/qQ4aEOwUtwfCKLyuOGKsVJMHy3dI03CbGtJt/uMHB2MGaJmNZXTJvSLLg2KL/GPRPWpRhMsPkqrhndpPomHORObb2ni/tzCVZdibVxA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6QSfqNtDiT8idSbT21FF4TdS+MX2IFVzO4EsS8tXEsI=; b=Ay14k0sigVUEQ43P9wkrSnLx+6C2oAAVStbB1SfjTA1/wCvTQ5I8nyDNHJNEFZb2A09LSpESZEQhLl0CNL1W/tzJrkPMWC7E2wEBKSOF2cr8VJcW1AeCzCigcnMVt/vaC4bAAQe2dV/Vm+mZG/s2oOUr9VhU0L/2bwQBlVMKje7PoEEHs4de8HXwWaeoTm/fWZTPYAsOlWz//RUzYNORr1AFrWXrW8xAnpaxoWv6Nu/qKmignBKuzK6cZs0VBrcBqV5En35x4+WOniTS4M4ju3AZU81iF1yc7Mdx19WvxlMkPhuJ4+D0GWFDh76AMaAERArsTtVfMviHAAXe6XU5oA== Received: from BN6PR14CA0024.namprd14.prod.outlook.com (2603:10b6:404:79::34) by DM4PR12MB5182.namprd12.prod.outlook.com (2603:10b6:5:395::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.21; Tue, 13 Jul 2021 12:55:04 +0000 Received: from BN8NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:404:79:cafe::ff) by BN6PR14CA0024.outlook.office365.com (2603:10b6:404:79::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 13 Jul 2021 12:55:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT041.mail.protection.outlook.com (10.13.177.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4308.20 via Frontend Transport; Tue, 13 Jul 2021 12:55:04 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Jul 2021 12:55:02 +0000 From: Lior Margalit To: , Matan Azrad CC: Lior Margalit , Date: Tue, 13 Jul 2021 15:54:42 +0300 Message-ID: <20210713125442.1366424-1-lmargalit@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80cdc4f9-726e-46b7-9141-08d945fd6f47 X-MS-TrafficTypeDiagnostic: DM4PR12MB5182: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C9p7XVJJ6DrhjTM4Dj3ujh3n0rtyXo4rbYM5iyOljZS0vkR6UqLxYWCcgCsoR9ggvwABtHI6AxHoHhMwHkDecuflgVoS51XRRKmAhks7MrYLo5OXTkt2VzvHUK40AIoCunUEEI97yqPPZpRh6iLYtThfDRC6bBCStHmKwkFMFyI/3bZ6p7YHMv1UwR319R2pYawZE72oexKA7EgGPAfSiOwmb2W9tHDIi6Ma6eInBVVIHTvggX1RB+vbDjv5fGZPkgZAwyIP4G0Ln5c4P7DPkGTDTw5r2QTYcz+FVdOk3O2git0ZyiAgZ7AIQM+dQZWITYj9VT02IzfqWf7hfu1wYk6rlf8mTVX9sUrDTo5K7Gv7iz42J32NJ3apQKJnTamE+9Xfok508DxNSqxqiPOHpH92WsPbOgwvrIkbtOk+ss9Kl+VXWZdOH8+DVvspBXMbQsmJ9qzDWzkwdlrezyTJongHeICg1wseTAA3+xXjhZfLTzDg8zs1Ktouzr6y6BZrEk+hbPk4mkpyr+NwU6kAJXZtUSmdbeVuLVj54pfmm8zvSKAtCVBvA1WuErMPaeyXp1rghMyqfdXkNj+XJBNUDkIQ2NwSprdC4Gc5AfXy/FwT2oEKrgCh0XbenzCfqlqM1dp7sgT6ZRumuXHDy/CeJfeoMV9rrQ0z4haSNgspD1UdAQOte9TCOrhgGNyH+RgoLbEjURRwnjWo55YVSmaZqs1+8vV2zg7ERejiPzJb0VY= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(39860400002)(346002)(136003)(396003)(46966006)(36840700001)(6286002)(4326008)(70586007)(54906003)(336012)(316002)(36906005)(5660300002)(450100002)(47076005)(82310400003)(2616005)(8676002)(8936002)(110136005)(36756003)(86362001)(16526019)(186003)(2906002)(426003)(6666004)(70206006)(36860700001)(55016002)(7636003)(26005)(6636002)(1076003)(82740400003)(478600001)(34020700004)(356005)(83380400001)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 12:55:04.3870 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80cdc4f9-726e-46b7-9141-08d945fd6f47 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5182 Subject: [dpdk-dev] [PATCH v1] net/mlx5: fix RSS selection flags settings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The L3 protocol of the RSS type may be different than the one defined in the flow. If the RSS type also includes L4 protocol type, the selection flags for the RX hash will be set with SPORT/DPORT without setting SRC/DST IP, but this combination is not supported by the rte API. When using indirect RSS action, the flow creation fails, because it does not match any of the pre-created TIRs. The fix is to prevent setting the hash flags with SPORT/DPORT without setting SRC/DST IP. The hash flags will remain 0, meaning non-RSS processing of the received packets. In case of indirect rss action, it will match the MLX5_RSS_HASH_NONE pre-created TIR. In addition, the queue_num is set to 1 when the hash flags are 0, but it was implemented only when creating a new TIR. Applied the same to the RSS desc before checking if it matches a cached TIR object. Fixes: b1d63d829378 ("net/mlx5: support RSS on src or dst fields only") Fixes: 5a959cbfa68c ("net/mlx5: share Rx hash queue code") Cc: stable@dpdk.org Signed-off-by: Lior Margalit Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 14 +++++++++++--- drivers/net/mlx5/mlx5_flow_verbs.c | 10 ++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 2f4c0eeb5b..99836b1796 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -10506,10 +10506,8 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, dev_flow->hash_fields = 0; #ifdef HAVE_IBV_DEVICE_TUNNEL_SUPPORT - if (rss_desc->level >= 2) { - dev_flow->hash_fields |= IBV_RX_HASH_INNER; + if (rss_desc->level >= 2) rss_inner = 1; - } #endif if ((rss_inner && (items & MLX5_FLOW_LAYER_INNER_L3_IPV4)) || (!rss_inner && (items & MLX5_FLOW_LAYER_OUTER_L3_IPV4))) { @@ -10532,6 +10530,12 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, dev_flow->hash_fields |= MLX5_IPV6_IBV_RX_HASH; } } + if (dev_flow->hash_fields == 0) + /* + * There is no match between the rss types and the + * l3 protocol (IPv4/IPv6) defined in the flow. + */ + return; if ((rss_inner && (items & MLX5_FLOW_LAYER_INNER_L4_UDP)) || (!rss_inner && (items & MLX5_FLOW_LAYER_OUTER_L4_UDP))) { if (rss_types & ETH_RSS_UDP) { @@ -10557,6 +10561,8 @@ flow_dv_hashfields_set(struct mlx5_flow *dev_flow, dev_flow->hash_fields |= MLX5_TCP_IBV_RX_HASH; } } + if (rss_inner) + dev_flow->hash_fields |= IBV_RX_HASH_INNER; } /** @@ -10589,6 +10595,8 @@ flow_dv_hrxq_prepare(struct rte_eth_dev *dev, rss_desc->hash_fields = dev_flow->hash_fields; rss_desc->tunnel = !!(dh->layers & MLX5_FLOW_LAYER_TUNNEL); rss_desc->shared_rss = 0; + if (rss_desc->hash_fields == 0) + rss_desc->queue_num = 1; *hrxq_idx = mlx5_hrxq_get(dev, rss_desc); if (!*hrxq_idx) return NULL; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index fe9673310a..527dcfbf26 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1820,8 +1820,9 @@ flow_verbs_translate(struct rte_eth_dev *dev, flow_verbs_translate_item_tcp(dev_flow, items, item_flags); subpriority = MLX5_PRIORITY_MAP_L4; - dev_flow->hash_fields |= - mlx5_flow_hashfields_adjust + if (dev_flow->hash_fields != 0) + dev_flow->hash_fields |= + mlx5_flow_hashfields_adjust (rss_desc, tunnel, ETH_RSS_TCP, (IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_DST_PORT_TCP)); @@ -1832,8 +1833,9 @@ flow_verbs_translate(struct rte_eth_dev *dev, flow_verbs_translate_item_udp(dev_flow, items, item_flags); subpriority = MLX5_PRIORITY_MAP_L4; - dev_flow->hash_fields |= - mlx5_flow_hashfields_adjust + if (dev_flow->hash_fields != 0) + dev_flow->hash_fields |= + mlx5_flow_hashfields_adjust (rss_desc, tunnel, ETH_RSS_UDP, (IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_DST_PORT_UDP)); -- 2.25.1