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 9A505A0C4D; Tue, 27 Jul 2021 08:46:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58D61410ED; Tue, 27 Jul 2021 08:46:43 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2066.outbound.protection.outlook.com [40.107.243.66]) by mails.dpdk.org (Postfix) with ESMTP id 578BF410EC; Tue, 27 Jul 2021 08:46:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jKrV4MrFEQkoHF4Jagw3iU900HdrWL2cduP/WK2SzWdPe6KKwXhQQW5ZJKAMODwsFzrkho+qLaJsDfesaK0F0e7TLqT9gd14v7jPQJLX1FF9Dpq1DkPow6PAh2a6r7nLZSc0v+30aSpTNKkRFr+f8Ohw9zFc+kek5uZgljVVaL4sd8YUcU2Dn9jvnHsv38oc82Nl8c+h5MZSAmePobtJPQEOqCz4yW5rLZpji9Tov4h4ZVcZL/wD81Vz+avY/gkZKOVvjrGAusESAsxH3TncRliU+TtQKcm08bFS5qVH3XZWyrDxWEM2WjjgQAL9+eUphlbX0daxnbWAwU3BJXUNOw== 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=eN9s4xiauH57x8O/NZXmNNfrpF6P7qaCnicjdBeXPYQ=; b=MLZ1+VZosb68r6MeZyRYcPCC9y9ogHOlDEvvnHeNWkclLkuLFNowGX2dCktdtgGpZpR/WLzj1Y9KitTDn3nP53kZwIfgwl+PUfQ5Oh1yP0RPujbaCNLyZlU7unMpoPmhMaQIE4duRVazZRXU83yY3f0sCz6WInvMzkGH+7OGNMpCfIV4czUPcTfD5xGP+R7AGN7iwLpBesZ6UwerD7Dpbz+4RqO2240AcxuAVU7keriR6IOCb4EghxBnyZk4jwY1e6pljD5VlkSHqLxa8VRikShSyhgd9kB8UJ1cv+2cAX+4C8/qAdXn7lV7lgUh4fY1bz2WFQMm6AgUce8SbLWyuQ== 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=quarantine 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=eN9s4xiauH57x8O/NZXmNNfrpF6P7qaCnicjdBeXPYQ=; b=mv1mu/fZwO9zX8jOL/rfYTFsbvrYDMdOXUCfsf6jCHrG020dtQYseSG1IDT49dEZFNCipATOIGFgsCMyVU9highTKK3fIXT75AI92heV4pTZ5zYUnvGfLJdOfgmK9cSgr/TQ4atWrRBsdiP+dCpn4cQXT9jazZ+x3zXgkvziw5Fr/hWASPwVoLY5uqsu0YiLTMvEANUhgsmkxIRz0jZcV10wZzjFtx7Q8C6vpvgXwh/QdKjghInskkFfep8Fm1dNduteBDMR8hUz4y/Tm+WIk/oKcijmqJ7csSKgzE+UdtgqzmpysU6zI2CqK+YhEdwGMk+wdPcIiqUtcO6iDbM3WQ== Received: from BN9PR03CA0227.namprd03.prod.outlook.com (2603:10b6:408:f8::22) by MWHPR12MB1630.namprd12.prod.outlook.com (2603:10b6:301:c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.29; Tue, 27 Jul 2021 06:46:41 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f8:cafe::f7) by BN9PR03CA0227.outlook.office365.com (2603:10b6:408:f8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25 via Frontend Transport; Tue, 27 Jul 2021 06:46:40 +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 BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4352.24 via Frontend Transport; Tue, 27 Jul 2021 06:46:40 +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, 27 Jul 2021 06:46:38 +0000 From: Lior Margalit To: Matan Azrad CC: Lior Margalit , , Date: Tue, 27 Jul 2021 09:46:19 +0300 Message-ID: <20210727064620.880417-2-lmargalit@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210727064620.880417-1-lmargalit@nvidia.com> References: <20210713125442.1366424-1-lmargalit@nvidia.com> <20210727064620.880417-1-lmargalit@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5a0b34a5-b560-4e82-bee7-08d950ca4a34 X-MS-TrafficTypeDiagnostic: MWHPR12MB1630: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AuzuCfUFwUc3rGNNu3j9Wy7lBYu5yYvjFkoBMH4nPBODG/f/DwlzfF2otYbyT5jPUVIRIoOACr+Pjwx8uNEz6e0Xcb+7dA3UIPqNI5s4/oHZ0rNpauVMTJ71xm4hIRibwF9Sa4Zv/OjVjhCYecY63Phwg5eq6m/Awem7ZmPQs7eSnDA18iqhnqLW0/RsCTsNBnCeRexWWikpEvW6RYNiS8nLzDTbL0EQo+MjXjRPp2pUYWvzxMWb5TjXPzc/V4RIbJ37i5o4nIfIB2gNR6TCaq9YwDHjLTtoYdDG9uuP1fnrD3tJeGqKCdnvCoQLwjqresPBgWDPq5Qd/B4/5vzUOQFsvYIG01XlcEigMlf6zn4G9bHNP0EI13ewrFdFXEdOxQdBXih1SqOZ4/Ir3I1sl4NF5h37eYvQ9vSeS80nTsxPsMFPgcTsINvHFkEL2dIpxLfoSYBHoxgl+edvatQmkERtyXI1/EUisA2TfQyGd4LMMb5Cn7z5vCYGUbMVIveXaZy4tUEjxQM2pcs8X7+MKU/wwj6twBVwtyIP1vFEydfOa5Tq4ttLBMIbaiynv8wDOfK08zLlBLt6XuILstgo2LyabGCrA4vstQt1spMmnkbN1fTZgYGKA0Rz0OvirfoJGLn092R0lJmN0iqNaon1E6+yIQxDkXT84fKrE5ogXZIzWXeTu1wnetWDTlujR0lMZ6av8XBX3R3idTXeShiCJg== 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)(36840700001)(46966006)(316002)(37006003)(36860700001)(36756003)(2616005)(86362001)(7696005)(426003)(47076005)(7636003)(83380400001)(2906002)(6286002)(1076003)(450100002)(508600001)(70586007)(54906003)(8676002)(6666004)(336012)(82310400003)(36906005)(4326008)(16526019)(6862004)(70206006)(8936002)(5660300002)(186003)(356005)(55016002)(6636002)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2021 06:46:40.5733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a0b34a5-b560-4e82-bee7-08d950ca4a34 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: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1630 Subject: [dpdk-dev] [PATCH v2 1/2] net/mlx5: fix RSS L4 proto 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 RSS hash types defined in the API do not support setting the L4 proto type (TCP or UDP) without setting the L3 proto. For example, ETH_RSS_TCP is defined as (ETH_RSS_NONFRAG_IPV4_TCP | \ ETH_RSS_NONFRAG_IPV6_TCP | \ ETH_RSS_IPV6_TCP_EX). The L3 proto of the RSS hash type may be different than the one defined in the pattern, for example: testpmd> flow create .../ ipv4 / tcp / end actions rss types ipv6-tcp-ex end / end If the RSS hash type also includes L4 proto type as in the above example, the selection flags for the RX hash are currently set with SPORT/DPORT without setting SRC/DST IP. As this combination is not supported, it does not match any of the pre-created TIRs of the indirect RSS action and the flow creation fails. The fix is to prevent setting the selection flags for the RX hash with SPORT/DPORT without setting SRC/DST IP. It applies non-RSS processing of the received packets. In case of indirect RSS action, it will match the MLX5_RSS_HASH_NONE pre-created TIR. Fixes: b1d63d829378 ("net/mlx5: support RSS on src or dst fields only") Fixes: 4a78c88e3bae ("net/mlx5: fix Verbs flow tunnel") Cc: stable@dpdk.org Signed-off-by: Lior Margalit Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 12 +++++++++--- drivers/net/mlx5/mlx5_flow_verbs.c | 10 ++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 736227bc0c..fe922b6fbe 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -10896,10 +10896,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))) { @@ -10922,6 +10920,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) { @@ -10947,6 +10951,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; } /** diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 7b3d0b320d..a36b8adf6b 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1821,8 +1821,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)); @@ -1833,8 +1834,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