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 46E9B43351 for ; Fri, 17 Nov 2023 10:49:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FFB140648; Fri, 17 Nov 2023 10:49:06 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2045.outbound.protection.outlook.com [40.107.243.45]) by mails.dpdk.org (Postfix) with ESMTP id 86ED240273 for ; Fri, 17 Nov 2023 10:49:04 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TyPtWTUzfHx4wTbMb3Krc0Z2Gd26zAN1Z771if87RS4mJIZg539yk02BbJZ/2WME+au0xISK0l3MQ100BDqnelv0AtD4JulUgs0v3WZriP5HfUYEI3JtS9Z/MiELawSZjg20h9dC7aWn554J1MhbxxHk8TjjV/dOl6os2UjOMYPgf6/RprTOc+f5pZMzf3UuSnRXr37jyxBtZOJoe5fuHsp+B/JnTsor6g7oDXQGiN45XOS4E4/BL61mzWBaOtelJnMmVYzYULuO0Vx1EToAwtv15TOGdzQ6ZBVbOXQPZ9XoJCiBDCfhJpGqUzS5WFb5q2vvQQknb8GnIIswa67clQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B4eVm+KsJqWKVwLpBlL9c/VXAevorxch+5hL0q3BKc4=; b=dYQadEpx+di7wrNzz28b46cB4qUaBwgq0QSqLYdvw7KyRQIOEP5JN19sVj8leEGdDUV4x8opVDzE4LncaCJUjaCdEdv7KLCH24nbNgAwXXfqlXkgdFx9f2H7RsUuBgpzwkOig9A+NkVxq8q3k2SV03xfo/pTBgUDS+AasfDfqwrObGZJWHP0QXGIaj2M9cSyGQKe4ENDzktRBfFtKvroi+i+ku0ZqO65g2puvC9UWvgMRfkQSviQQjNZ/xLvwApF/Xrhz3Oc30D+aMT6C/6Jb33/S+bvQMNgAhMujxf6X4MesEzTE785lkGTokqHNuUHH/2t3jAR1vL39q7fRmXL/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=B4eVm+KsJqWKVwLpBlL9c/VXAevorxch+5hL0q3BKc4=; b=Ex4Z2vQSYc45c50BjwKw6UkFf643RBADxjgUi6lIJy8QI9MoErrp9n+VQLD3smedGPnqS3Kuphfarocrvnng+gRQToYNHwqvZolEQAB6H781CaFJIGof55RZUKxgOPhPuBQviVohcSaL8lAiuEe7iR7O5Xkgf+rQqD0bBFDLSBaG0tLMX5U5oHVDWkEm0OR+tb2YeEnVsmTsDL86TcTv6jbLTW5mtj44J3Yh81aCoq2rats0S2PxF5+9FiSFtM1Mu4EzJ94Ab/qh7gkg71wdSAXMs/WSGXz289uUXOUznf9tFfdei9w8qfNP1dbOFuAFwggS5W/LqQKN5oONNDU5+Q== Received: from MW4PR04CA0252.namprd04.prod.outlook.com (2603:10b6:303:88::17) by CY8PR12MB8243.namprd12.prod.outlook.com (2603:10b6:930:78::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.20; Fri, 17 Nov 2023 09:49:02 +0000 Received: from CO1PEPF000044F8.namprd21.prod.outlook.com (2603:10b6:303:88:cafe::6d) by MW4PR04CA0252.outlook.office365.com (2603:10b6:303:88::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.23 via Frontend Transport; Fri, 17 Nov 2023 09:49:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044F8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.9 via Frontend Transport; Fri, 17 Nov 2023 09:49:01 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 17 Nov 2023 01:48:47 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 17 Nov 2023 01:48:45 -0800 From: Dariusz Sosnowski To: CC: Kevin Traynor , Viacheslav Ovsiienko Subject: [PATCH 21.11] net/mlx5: fix hairpin queue unbind Date: Fri, 17 Nov 2023 11:48:31 +0200 Message-ID: <20231117094831.3607500-1-dsosnowski@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: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F8:EE_|CY8PR12MB8243:EE_ X-MS-Office365-Filtering-Correlation-Id: 852200b5-b124-4d88-422a-08dbe7526dc5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LRYZroWu8S67XLWPTPWySjxlZ8HZqXAM1zZBHVTMWLfvRnHa2uc18Ug9E/DZvLXMzLeKdnoG4yQURaKzKrf6u29fq8lLyVv9O8CXym69CdRbhrLSrtcSprZUh7VMdCiX2Ah60nrj1IifcxtIVSHLTEc+hFuqgn9771wJw/evG2dJ9lbAf+3acWanEZ9AUdboWX/XDWBG9AQOdwmOGvQPyQ0nT3hNL2GzycHnY8lb31JmM9geqXABvIIATDnOQHRFTDuND/bG81v3wf26W36zvvcQ7NpFznWvKdVKvqWMjH3de43zwo2FVpSL2847a0M3GzlZN3VcfGHfZkkBlAG6AlioWEJX06I23GiIaoqa2xnAZawnSUzmL2CwhafldV4/8wuUjuOhJpjhsx/NHV9TgdqXQBSSAkq2E6FoHS9RE9uXDjDTdUwzxHHg0XgEGO2lf9DmrvvNCZOEjqxuYV+1FqQZS50KNRV5WFCjgeX0NUvb7Qfkv1OTxteoXBDIO34kWHNXKl9eq5MplXMGMIyFd2q4n1J/8ckcNRmqRhw3rjqiF4+QzrXLoysz/EAMyw8GClhe9k5d3qyrAJvbr7YlZjQ3GjrOn3XW/VLzUa9g3NUd1Ea3wjvtnuaCDbjWSzOSyom4Y0ZSNDZHUhu6hhb/LI4d1fAlp8kVjq7eqQc7yDaQb66ffNIaxMH6NBd0DDLcNFd5Ii5syCFlMsGWTyymwnKi0ARuJ1iHjZe1kODSjwbZeLmrx6B39lYTTtyEH7Bk X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(82310400011)(64100799003)(451199024)(186009)(1800799009)(40470700004)(46966006)(36840700001)(356005)(40480700001)(7636003)(83380400001)(36860700001)(54906003)(8676002)(8936002)(70586007)(4326008)(70206006)(336012)(6286002)(426003)(107886003)(36756003)(55016003)(41300700001)(47076005)(1076003)(16526019)(26005)(7696005)(2616005)(6666004)(478600001)(2906002)(40460700003)(82740400003)(6916009)(316002)(5660300002)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2023 09:49:01.6316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 852200b5-b124-4d88-422a-08dbe7526dc5 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F8.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8243 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit ab2439f80bdf94e2382efe941cf827da6710b5d7 ] Let's take an application with the following configuration: - It uses 2 ports. - Each port has 3 Rx queues and 3 Tx queues. - On each port, Rx queues have a following purposes: - Rx queue 0 - SW queue, - Rx queue 1 - hairpin queue, bound to Tx queue on the same port, - Rx queue 2 - hairpin queue, bound to Tx queue on another port. - On each port, Tx queues have a following purposes: - Tx queue 0 - SW queue, - Tx queue 1 - hairpin queue, bound to Rx queue on the same port, - Tx queue 2 - hairpin queue, bound to Rx queue on another port. - Application configured all of the hairpin queues for manual binding. After ports are configured and queues are set up, if the application does the following API call sequence: 1. rte_eth_dev_start(port_id=0) 2. rte_eth_hairpin_bind(tx_port=0, rx_port=0) 3. rte_eth_hairpin_bind(tx_port=0, rx_port=1) mlx5 PMD fails to modify SQ and logs this error: mlx5_common: mlx5_devx_cmds.c:2079: mlx5_devx_cmd_modify_sq(): Failed to modify SQ using DevX This error was caused by an incorrect unbind operation taken during error handling inside call (3). (3) fails, because port 1 (Rx side of the hairpin) was not started. As a result of this failure, PMD goes into error handling, where all previously bound hairpin queues are unbound. This is incorrect, since this error handling procedure in rte_eth_hairpin_bind() implementation assumes that all hairpin queues are bound to the same rx_port, which is not the case. The following sequence of function calls appears: - rte_eth_hairpin_queue_peer_unbind(rx_port=**1**, rx_queue=1, 0), - mlx5_hairpin_queue_peer_unbind(dev=**port 0**, tx_queue=1, 1). Which violates the hairpin queue destroy flow, by unbinding Tx queue 1 on port 0, before unbinding Rx queue 1 on port 1. This patch fixes that behavior, by filtering Tx queues on which error handling is done to only affect: - hairpin queues (it also reduces unnecessary debug log messages), - hairpin queues connected to the rx_port which is currently processed. Fixes: 37cd4501e873 ("net/mlx5: support two ports hairpin mode") Cc: stable@dpdk.org Signed-off-by: Dariusz Sosnowski Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_trigger.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 06016eb75c..587bed53af 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -843,6 +843,11 @@ mlx5_hairpin_bind_single_port(struct rte_eth_dev *dev, uint16_t rx_port) txq_ctrl = mlx5_txq_get(dev, i); if (txq_ctrl == NULL) continue; + if (txq_ctrl->type != MLX5_TXQ_TYPE_HAIRPIN || + txq_ctrl->hairpin_conf.peers[0].port != rx_port) { + mlx5_txq_release(dev, i); + continue; + } rx_queue = txq_ctrl->hairpin_conf.peers[0].queue; rte_eth_hairpin_queue_peer_unbind(rx_port, rx_queue, 0); mlx5_hairpin_queue_peer_unbind(dev, i, 1); -- 2.25.1