From patchwork Tue Nov 23 22:31:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 104634 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 15C94A0C4C; Tue, 23 Nov 2021 23:32:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25DF941152; Tue, 23 Nov 2021 23:32:20 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2063.outbound.protection.outlook.com [40.107.101.63]) by mails.dpdk.org (Postfix) with ESMTP id B994640040 for ; Tue, 23 Nov 2021 23:32:17 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JNNYLCiev2u0oC99ElwvA+eBJn4/NzCQk6Cltm4YHH/rzzXZEJFQvSgBg2ti8GUGMQVXf5IxaF/LUx7x32bfoG+c43IaugG/E+c2eCP80zp1SoYci11DRzn1i59bpdPHYoh21i/t0THGvKGlXvYpeJ47EGBdOdn+PUFXbxX1GgsK0XhWTlrf/dtVzaZsTHY9bEhr8Z3SDWsZH80fzOItBavFtC4zh55QMXnEWxqFvcB9qg8bVRRUvaRsHWiMxwdEvCKgzHkjdq8nxoHFoFiakmwd3HO1F0rYMGFU980x7Wx/GM/k4deE/a4ejiK4hgiJAga0CUnCdBHTcofbihshvg== 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=+ptZHFWO6YTp0clNQoAGZT9zrgFvgfi35RSo365NPXY=; b=N7a/rX9piqeU8avMUmjNjdQHpO7ntpc/Csys1BkAg6oEIyGEzes8ngTUa86l7ys+F2L3K+TTadia6LAFUK2V91i0lmp4Vat8z5qS2v35USZ9ginkU4gVVWdcygri1Ww5h3msm2QFdQQnUKpf0/N6xc6KNvUNe0SgsL6CuYEGXDKV7QGS5DA+SrS2pkPwGy6HWxhlU4IIxUSod6py4/dAL6GkpFzA55aVCzcgeRLILIR7frYP2vgXGXkZEtJbzTkec0trb3pq55E9Dmo6JH6PGLR7QJwzAdEedFPNyanLLKuSggxhh+Kz+JTFueA5sAfvVzWpCsWT1jAlT8y6v2/RNg== 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=quarantine 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=+ptZHFWO6YTp0clNQoAGZT9zrgFvgfi35RSo365NPXY=; b=mzvNShZ/XhEKhKOWU90mqGQV0NAsPTkQuqyVWYcMvLkhU4RASbDCtd/NQgY78d+/Fmrcju70aGko5JwV0cBx4AIcS/1/zoPGrSAaOS0rpIEdhuaPjwQcd2NP41nmu4h7tj5IIZrYL/jy1p7pTgmp/5UPdQe/+bR4ZmIleHKvuOoAc1boAPSHOQZgtpT9TPhlQfe+tZeFcL6J5phdLAquXz6jcCdnAUGtXLyZ3xZxFSn7E6oK0JInoG4tlqFmxnI3l8BCMd0IjEM1UThlTQPPYDXb+knO6YKjp49W/TEQnVvh8v01TmepfPeby6h9cw4CX0d1frgXOh2RoaqEEJAzzQ== Received: from DM6PR10CA0011.namprd10.prod.outlook.com (2603:10b6:5:60::24) by CH2PR12MB4117.namprd12.prod.outlook.com (2603:10b6:610:ae::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21; Tue, 23 Nov 2021 22:32:16 +0000 Received: from DM6NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:5:60:cafe::c6) by DM6PR10CA0011.outlook.office365.com (2603:10b6:5:60::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21 via Frontend Transport; Tue, 23 Nov 2021 22:32:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.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 DM6NAM11FT003.mail.protection.outlook.com (10.13.173.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Tue, 23 Nov 2021 22:32:15 +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.18; Tue, 23 Nov 2021 22:32:13 +0000 From: Dmitry Kozlyuk To: CC: Raslan Darawsheh , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 1/2] net/mlx5: fix indirect RSS creation when port is stopped Date: Wed, 24 Nov 2021 00:31:58 +0200 Message-ID: <20211123223159.3324247-2-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123223159.3324247-1-dkozlyuk@nvidia.com> References: <20211123223159.3324247-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 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: ae2834dd-eea0-407a-00a4-08d9aed119fa X-MS-TrafficTypeDiagnostic: CH2PR12MB4117: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xgEqTM5sC/qHp1s7m2XV22vSFzb9G54Vij/jY8fOSZ8SHqnmI4bhB4aKFOz95KYRWbK7XA8PNLXZUxKc3YRYnV0z07tqtYYt5NgF0rU9LjekmdvqTGsTW3xBh6aUlI1qZX425vAdyMIUSaFWCXScMETjb4ZK1gKgLZR/FqjM+AiApyy9CYv3CoP/nsZ4Zyl9VKwtm15l58JGKrdbrc1pTIh3CL7jc4hhvI+041qvb3Uj+34afDaBcMU9n6xZ290dphUqQvH0Y5d5MLNY23omZFjbC26jT3lkia83Cgxj2JQ1Kp+JbfAs9BFlilo3tz5Jz4555aZaMlx1dD7W9ZGj5QDIdEUhhng9/OXVOyht3PrWD1fVnjMPL6cHaHjr2QP8n0jmkKK2Hhd/574+x9INu6tsjQ6PYT/nT/IpwCxB94vN4G4qERYPCWqcW2ImWxBSZsSSloylgV3VO6mIxM96b6UyWgg5Q9aixnb98MhqMxtF6fApliuQIAFFfJmGH+CVxXxyhcCbpFzgXX8JNePpdRb5kIhxfDtk0NHjUhQREUQXJVU5BYr2MC1dYSIy4yumBV+5LoI/yXHCjmwiOnWBfgTtO1MMknluAg7ZBIxKVFvlPp639hHRTT7iW4p7+oJr/T0iOLVLSdUJte6hvvNSaJfAxC+v1IWNz5hMiv8vmR12eH4mh73WmUCgTVrX0UZySpPZng8C4GNT9yGhT/tndA== 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)(46966006)(36840700001)(6666004)(426003)(7696005)(70206006)(1076003)(2616005)(6916009)(8676002)(86362001)(508600001)(356005)(6286002)(316002)(83380400001)(5660300002)(7636003)(26005)(54906003)(36756003)(186003)(2906002)(16526019)(4326008)(82310400004)(336012)(55016003)(47076005)(8936002)(107886003)(70586007)(36860700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2021 22:32:15.5049 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae2834dd-eea0-407a-00a4-08d9aed119fa 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: DM6NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4117 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 mlx5_ind_table_obj_setup() was incrementing RxQ reference counters even when the port was stopped, which prevented RxQ release and triggered an internal assertion. Only increment reference counter when the port is started. Fixes: ec4e11d41d12 ("net/mlx5: preserve indirect actions on restart") Signed-off-by: Dmitry Kozlyuk --- drivers/net/mlx5/mlx5_rxq.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 47dc24793b..8f9a94572f 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2270,6 +2270,7 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, struct mlx5_ind_table_obj *ind_tbl) { struct mlx5_priv *priv = dev->data->dev_private; + bool dev_started = priv->dev_data->dev_started; uint32_t queues_n = ind_tbl->queues_n; uint16_t *queues = ind_tbl->queues; unsigned int i, j; @@ -2278,22 +2279,25 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev, log2above(queues_n) : log2above(priv->config.ind_table_max_size); - for (i = 0; i != queues_n; ++i) { - if (mlx5_rxq_ref(dev, queues[i]) == NULL) { - ret = -rte_errno; - goto error; + if (dev_started) + for (i = 0; i != queues_n; ++i) { + if (mlx5_rxq_ref(dev, queues[i]) == NULL) { + ret = -rte_errno; + goto error; + } } - } ret = priv->obj_ops.ind_table_new(dev, n, ind_tbl); if (ret) goto error; __atomic_fetch_add(&ind_tbl->refcnt, 1, __ATOMIC_RELAXED); return 0; error: - err = rte_errno; - for (j = 0; j < i; j++) - mlx5_rxq_deref(dev, ind_tbl->queues[j]); - rte_errno = err; + if (dev_started) { + err = rte_errno; + for (j = 0; j < i; j++) + mlx5_rxq_deref(dev, queues[j]); + rte_errno = err; + } DRV_LOG(DEBUG, "Port %u cannot setup indirection table.", dev->data->port_id); return ret; From patchwork Tue Nov 23 22:31:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 104635 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38222A0C4C; Tue, 23 Nov 2021 23:32:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5904941160; Tue, 23 Nov 2021 23:32:22 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2041.outbound.protection.outlook.com [40.107.243.41]) by mails.dpdk.org (Postfix) with ESMTP id 911284115F for ; Tue, 23 Nov 2021 23:32:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XKsJPi5t1lQJGEAd7AbmsH9Yyd2LmW2AEgGmu4fei8KJVjH6M2ihV4omN69/VC2vW5VJOqjtTLLDE63993nolI1Lbzw2ibSaeqnLzKouzXa/76jvl/bPhE5iwP8eSWn8fTQ3/1ww3Hn41EbXYLGlgU/FTxK9V+x7hNkmlb3entbAsrp/s0gOx5MiV4JkJ3YjQPYuh3h2mTymta/syQTtNDVxH0dwrMuBH6O4pK92t650xZ8HD7ffFZLb0Nb3mmsnLuV7/NJ3GzI8A8iAqORC9C0lxghO2Ihzq/dwRftHJ/fLrrs7BKWsvwZsLhxeL0JTRHN38+O+pstuV9hJeQtqJA== 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=CTczPIoVs4abf3QLjpIRuTKmOCtz3QQD5CTYIZDk6+s=; b=feK1s3zSPjzsIaiOz+ytPQmITxAiedN8mnvg5XNjoeZ2njw4n/wUmEJlA6VjE3BTDUf7fgeMxpKs1I1E5FEc8lECDGTy3xscCg8yIc4hdJe3RM//WhiehzAIgEKSqjfYBcmXWtf0Od1FOmzCw77KyYo2ZJfBJAWpnjxIMBWsPR9nDJE1bcmQf503ObjkALNgrYYtVaSJ9Iltdk74K+ojOfnsmmwjXKYlFiG8vb1YsKa0i0egKlvy0Jp/yV0TPmNgcRpfBiGvdCIPaL2dlCveioGfO4ja04Pgz+WBIUSiGWkE05CX9T/neG1F8qSP3O4bT17W7qNR5uRGcuTBuaHcRA== 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=quarantine 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=CTczPIoVs4abf3QLjpIRuTKmOCtz3QQD5CTYIZDk6+s=; b=UILRJ1GSL04IOs78nn5r3iseh38rWS6MIINNvUwA3QHbjn/fMGybmDwqQRgH579NrVDEhIMQQE0hRPo9lXAXPESiHNRkMB8ijRm5KEM5+52OJjWxUPgoLxwoFbGav4Pa17dtm0qiyRAyzUZFeYISVrn1S7lswFrghM1bpw1p3/rplWE+qM0AnrieXyYnyT1syMD/fY0bCPyqtF8rerO80tanRL8/NOr7RGBtWD8KhT+tHGPl5mGlre9zHXTC2I+jBOPIs9Uogpc2el5Rp5pu7LrEfD4REl+K8pUYdM2pmaj95RDkF5nw1OmA1EOqbrYLQz0OOEu73MTcW6LFmE3nRg== Received: from DM6PR10CA0018.namprd10.prod.outlook.com (2603:10b6:5:60::31) by SA0PR12MB4575.namprd12.prod.outlook.com (2603:10b6:806:73::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Tue, 23 Nov 2021 22:32:17 +0000 Received: from DM6NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:5:60:cafe::b8) by DM6PR10CA0018.outlook.office365.com (2603:10b6:5:60::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Tue, 23 Nov 2021 22:32:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.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 DM6NAM11FT003.mail.protection.outlook.com (10.13.173.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4713.20 via Frontend Transport; Tue, 23 Nov 2021 22:32:17 +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.18; Tue, 23 Nov 2021 22:32:15 +0000 From: Dmitry Kozlyuk To: CC: Raslan Darawsheh , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 2/2] net/mlx5: fix RxQ reference counting for indirect RSS Date: Wed, 24 Nov 2021 00:31:59 +0200 Message-ID: <20211123223159.3324247-3-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123223159.3324247-1-dkozlyuk@nvidia.com> References: <20211123223159.3324247-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 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: 9b996973-dfe0-448e-8a10-08d9aed11b1a X-MS-TrafficTypeDiagnostic: SA0PR12MB4575: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 95BCbyvb89YkAZxJlEV25wCVEdU4n5JvNICiuf3rGSvw1ijjXhdLMVqMaCRbRV+j7+NOTHocS7Ivkioi/iU0U4dKbamRQIFHQ9gHcEOzpERnLnZR7JzIzH0zaCUkLQ1yToVjvaW9hgSkpOtZpKqYoOOe/gH8lpLZXijL8nWoshw3N3J6Sn5PPCnSD4CKwCQGQDHxXfYg9CS3rkP8Jc2eBRQkc0Sc/xA615khjoSDWAhvLigCZSE/RdnrdXECpV258vYOz7f/j34cjZPx1vKlag5xjd+IE5qNYdvuXSMUp74eeo9/dflaDwSyB2jF9ilNBqZLcOcBv/BOe4bQkU+z036mov56waudW7XXUlQdY/BZiHcNGCizvC0SYsV+R2wkeW17/drtgKPiUosIvuAoirG7NzIS5rrVAzG8U0h7s6SIjwM2O4EXf5zHY8HWFS1e9KT+mpgHXorldyeu958Be/pYoIlLdoQcGiYmF3GRDRV/KR9cXMeWmZ8zl/qIyoMEN7Mp92r1fzdAW3Q2uzkNKnzzfntjeDSXLWImlyxkWyB4rCtnK8HXvam0gdMjZYnA2t/ehQ+chDe32AsxJxpDYSHyjtz4QNwbQs0/qZjJstGfsvs5BAqCNxPloIi+6Iq/HvBmvta3zxNmd8UnOPBZzajMNZ3x+ck4rIDAQ4U6Q94z9HceF0JtMdB7CzK6VW2mDDZ/QbHt8IgbZl6vdYyvkg== 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)(46966006)(36840700001)(5660300002)(36756003)(8936002)(7696005)(36860700001)(55016003)(26005)(508600001)(82310400004)(4326008)(7636003)(86362001)(47076005)(356005)(186003)(16526019)(6286002)(426003)(336012)(316002)(1076003)(54906003)(83380400001)(70206006)(2906002)(8676002)(70586007)(2616005)(6666004)(107886003)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2021 22:32:17.3269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b996973-dfe0-448e-8a10-08d9aed11b1a 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: DM6NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4575 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 mlx5_ind_table_obj_modify() was not changing the reference counters of neither the new set of RxQs, nor the old set of RxQs. On the other hand, creation of the RSS incremented the RxQ refcnt. If an RxQ was present in both the initial and the modified set, its reference counter was incremented one extra time compared to the queues that were only present in the new set. This prevented releasing said RxQ resources on port stop: flow indirect_action 0 create action_id 1 \ action rss queues 0 1 end / end flow indirect_action 0 update 1 \ action rss queues 2 3 end / end quit ... mlx5_net: mlx5.c:1622: mlx5_dev_close(): port 0 some Rx queue objects still remain mlx5_net: mlx5.c:1626: mlx5_dev_close(): port 0 some Rx queues still remain Increment reference counters for the new set of RxQs and decrement them for the old set of RxQs. Only do this when the port is started when the port is started. Remove explicit referencing of RxQ from mlx5_ind_table_obj_attach() because it reuses mlx5_ind_table_obj_modify() code doing this. Fixes: ec4e11d41d12 ("net/mlx5: preserve indirect actions on restart") Signed-off-by: Dmitry Kozlyuk --- drivers/net/mlx5/mlx5_rxq.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 8f9a94572f..46d6536be5 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2392,7 +2392,8 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, bool standalone) { struct mlx5_priv *priv = dev->data->dev_private; - unsigned int i; + bool dev_started = priv->dev_data->dev_started; + unsigned int i, j; int ret = 0, err; const unsigned int n = rte_is_power_of_2(queues_n) ? log2above(queues_n) : @@ -2402,22 +2403,30 @@ mlx5_ind_table_obj_modify(struct rte_eth_dev *dev, RTE_SET_USED(standalone); if (mlx5_ind_table_obj_check_standalone(dev, ind_tbl) < 0) return -rte_errno; - for (i = 0; i != queues_n; ++i) { - if (!mlx5_rxq_get(dev, queues[i])) { - ret = -rte_errno; - goto error; + if (dev_started) + for (i = 0; i != queues_n; ++i) { + if (!mlx5_rxq_ref(dev, queues[i])) { + ret = -rte_errno; + goto error; + } } - } MLX5_ASSERT(priv->obj_ops.ind_table_modify); ret = priv->obj_ops.ind_table_modify(dev, n, queues, queues_n, ind_tbl); if (ret) goto error; + if (dev_started) + for (i = 0; i < ind_tbl->queues_n; i++) + claim_nonzero(mlx5_rxq_deref(dev, ind_tbl->queues[i])); ind_tbl->queues_n = queues_n; ind_tbl->queues = queues; return 0; error: - err = rte_errno; - rte_errno = err; + if (dev_started) { + err = rte_errno; + for (j = 0; j < i; j++) + mlx5_rxq_deref(dev, queues[j]); + rte_errno = err; + } DRV_LOG(DEBUG, "Port %u cannot setup indirection table.", dev->data->port_id); return ret; @@ -2438,19 +2447,14 @@ int mlx5_ind_table_obj_attach(struct rte_eth_dev *dev, struct mlx5_ind_table_obj *ind_tbl) { - unsigned int i; int ret; ret = mlx5_ind_table_obj_modify(dev, ind_tbl, ind_tbl->queues, ind_tbl->queues_n, true); - if (ret != 0) { + if (ret != 0) DRV_LOG(ERR, "Port %u could not modify indirect table obj %p", dev->data->port_id, (void *)ind_tbl); - return ret; - } - for (i = 0; i < ind_tbl->queues_n; i++) - mlx5_rxq_ref(dev, ind_tbl->queues[i]); - return 0; + return ret; } /**