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 6218341DFF for ; Tue, 7 Mar 2023 11:32:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3EB7C40E03; Tue, 7 Mar 2023 11:32:11 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2051.outbound.protection.outlook.com [40.107.244.51]) by mails.dpdk.org (Postfix) with ESMTP id 1B0F24067E; Tue, 7 Mar 2023 11:32:09 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bTAXZ7dDApFBL+uWNbSuWlc35C3REcXjs/tt2pFV1FwUYsis9asnd5vjOlyxSColrHSy3UtDQK7V90awjJZs+PEwAe89uhFTIztVz11VE+a4ehLbl1kDMTdRk77EsmHM2mThXaIWR1lanrkr+KdXnikPaQJtecA8Bne2yKTLeuOdvwO+QhSLzxEO5UWlDOTbSyHaqD9faVHiODSvY8+vk/pfD4Ge2fChYaC41sPKYpFPzEbrByK5afVf9Ql0t6BacgQ843qwKu8/WrHosxlcl+JiiBMpcGwDU0I/Fc4xnn/5MYhNWggpYX0MtUQLQ8AoMNDeGkFDLQVU39+mgchlfw== 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=LCMiEpOSmbB5kNQw5Y+UFtsT4i4qEcu5hWov8p/6q+U=; b=CMNJ/B3bvT2nIn3947S5JN/1JO+Gr9EmgHoTIJwYiXCpNiU9f3SzZ2PfhaI1CXiULtEm7VHL05yi4N+cyPsMTi6t3ad6Y4u40527/qWI09FCpPRSpCemL6S36upzbfQdmsGDCSjV0axbHWSDXUsI7S8WQMpOVvtmnSy8zOOiJToHzgShd5+/cvuIdVagSP4SKYQCNq/a0XLjcWrQKVWHroPmOFvUEY5g45L8x7QUlfkLECUwMW58ZZoy5EQxXvbpLlizly5zv96XcbKOxeIQ7EvG3G/ZtHjBP65hYvj0AJgZ2BRFuToJSZK10PpvWhFlgYcaOmCxuxnx1BVH10x2OA== 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 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=LCMiEpOSmbB5kNQw5Y+UFtsT4i4qEcu5hWov8p/6q+U=; b=S2XfXM3FBU81EmjDDb1aiFDz4Qs50DyJ8jh5V9TQuvYdJyOY319tC4JjN/KKjMmgQrSXiQiYJFNpb+1qHbOuBMFxfyNrr1zMcwpUkDV85JQ/WCa2qmBdNTyOAStxvC30auDIbw5uyKm9GqtdnzgtGaspk8/ljWTlCZG7ZIGOq7DtfQx2sVK0kBW7NhY7G1muqiSHfRLIbp7YRiuJI0HsWDkMXAejD6OmJH98fsi9YTizJl64lp8Eq/Bs7Ww+U5p0OY919zT4YTowUbNIOyj04uzdqHqGwnsm2BmFhH/GqX2zNghJ+G9jr/ACMAwhjt9S0DepV5F73AG69UXT5Jpznw== Received: from DS7PR06CA0048.namprd06.prod.outlook.com (2603:10b6:8:54::24) by IA1PR12MB7518.namprd12.prod.outlook.com (2603:10b6:208:419::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 10:32:06 +0000 Received: from DM6NAM11FT105.eop-nam11.prod.protection.outlook.com (2603:10b6:8:54:cafe::19) by DS7PR06CA0048.outlook.office365.com (2603:10b6:8:54::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29 via Frontend Transport; Tue, 7 Mar 2023 10:32:06 +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 DM6NAM11FT105.mail.protection.outlook.com (10.13.173.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.16 via Frontend Transport; Tue, 7 Mar 2023 10:32:06 +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.5; Tue, 7 Mar 2023 02:31:56 -0800 Received: from nvidia.com (10.126.230.37) 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.37; Tue, 7 Mar 2023 02:31:54 -0800 From: Bing Zhao To: CC: , , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH] net/mlx5: fix the hairpin Tx queue reference count Date: Tue, 7 Mar 2023 12:31:08 +0200 Message-ID: <20230307103108.464501-1-bingz@nvidia.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] 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: DM6NAM11FT105:EE_|IA1PR12MB7518:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f6154da-4686-40af-3557-08db1ef7330d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FARPimRaj8s64noOAHdwP+CV5agozqV+ZONGfnzPrqPAiyU0i2YhWm/FfG9s+MsK1p7O5Ah8J6WeIE8cg4yBe5CCiH21WgOpz8KwUR6Gnow7Bk7r4f9vclMUa6aVr6/npqxF/1EtJp+4Flp7g8Fx5uAp8awBExCBd+wKpRoO8cFv7E+iRp4leejSFE/M8tXq/t/0G8KC0i6qMA+fKh+R99DBiKE4e3+xxBVWk212GNfaAhVFEBmH2PhvDQO1GplWoCWArN0/lqN17Lbrj29s6uFRbzBbv9fF0O0M4caIjdgeyyrwu7oy5m8iTMkg2+TlRMXmR71wwdEvnTKuyFH/k0S60Fs2tbeOb/56xwuAt4gCJp72nGQ7BwzbTJ3tD1OegFUbsUuVjlvnxAbojvQ6RU93/irwdjveZQqL6kDUqabyO3CGFX8MSi1ZhudVqTkW3vMOHNWk15fLZqdzCZ3nE88wyTHTMTmFwDpkn5BMiqH340TrGeigIQ5dfA26Pk6ssH9cG4EONyKeiXDVdW5/5cL5X4W5mnFbAfiYBafq6PK7PBDfrWGzT5dblb3RdGWioTz2UTPJUcbvGGyDDktuL/uGeXeMC6jMICNAu8lMWF+w2BXzbcKcD6KYwgUz2jgJG4nMrLyvxHAHH2E2/3UZb8/Y4xvkdx9GcN014vMGqBoLy/lCo1ZdQ0vV5eKTnfmP/0kja1J0+Jdams/HmQCIVg== 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:(13230025)(4636009)(376002)(346002)(39860400002)(136003)(396003)(451199018)(40470700004)(36840700001)(46966006)(36756003)(40460700003)(40480700001)(6666004)(107886003)(1076003)(6286002)(450100002)(336012)(2616005)(16526019)(186003)(26005)(316002)(37006003)(6636002)(54906003)(41300700001)(4326008)(8676002)(70206006)(70586007)(7696005)(7636003)(478600001)(2906002)(5660300002)(6862004)(8936002)(86362001)(82310400005)(55016003)(356005)(82740400003)(426003)(47076005)(36860700001)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 10:32:06.3910 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f6154da-4686-40af-3557-08db1ef7330d 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: DM6NAM11FT105.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7518 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 When calling the haipin unbind interface, all the hairpin Tx queues of the port will be unbound from the peer Rx queues. If one of the Tx queue is working in the auto bind mode, the interface will return directly. Only when the Tx and peer Rx ports are the same, the auto bind mode is supported. In this condition branch, the Tx queue release is missed and the reference count is not decreased. Then in the port stop stage, the hardware resources of this Tx queue won't be freed. There would be some assertion or failure when starting the port again. With this commit, the reference count will be operated correctly. Fixes: 37cd4501e873 ("net/mlx5: support two ports hairpin mode") Cc: stable@dpdk.org Signed-off-by: Bing Zhao Acked-by: Matan Azrad Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 3457bf65d3..bbaa7d2aa0 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -896,11 +896,11 @@ mlx5_hairpin_unbind_single_port(struct rte_eth_dev *dev, uint16_t rx_port) } /* Indeed, only the first used queue needs to be checked. */ if (txq_ctrl->hairpin_conf.manual_bind == 0) { + mlx5_txq_release(dev, i); if (cur_port != rx_port) { rte_errno = EINVAL; DRV_LOG(ERR, "port %u and port %u are in" " auto-bind mode", cur_port, rx_port); - mlx5_txq_release(dev, i); return -rte_errno; } else { return 0; -- 2.31.1