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 25D41A00C4; Wed, 9 Nov 2022 10:55:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 40C09410FC; Wed, 9 Nov 2022 10:55:48 +0100 (CET) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2047.outbound.protection.outlook.com [40.107.212.47]) by mails.dpdk.org (Postfix) with ESMTP id AB211410E7 for ; Wed, 9 Nov 2022 10:55:46 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bK+6ExcvWxqdq8KPIrD9HZrpIGSAV3+HU+j/fNMeIB2nkLP6QUTGn7LZwIS+KRrsxzhqNaYE4Qq6PDWU2G1rTkSwKCkIfMeAHiZiNrMQ5Qg5tQ6iGEQRt+wGMm4EAz56RwCMpzy//21nE4puXTj29IETkE7dnXAR8deFAy790NMrs1tEofouhxYmV6DiPBuYgfFTCXfGm/DwKItkUamgIQOswARaf3Ja7fcMFmhRzeNRbSogA+NvrspXllCvdOgPXZ/Z0130iFvRSvWtO2NQ0tsjyXY9x5Fk8XYVUvdhxhmjIFfM35i0pSFDIQIvwLT1ZhF1ZfuURk2oIT1mK0TfNw== 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=qnQNNtgW4Nxi8+fUQRwQE9aS7W3iFrgfWowLgphm568=; b=a6pkCqAaHaw81Zu3m0T077kc8gApK1DCqvDVvq9lpcCUIBJbJCfG7WNqIcrpsX1ZgjAYXIRHnuBfigcE4J8EeCr+Zb/h63CYgqRh7GiyuEdKBSZxX08Ki+ECe1WxceHtO1X2ir7SUyfLmoO/XbKEl0Pk6qiex2wMlP5lZJ6Ffj5+/WuNLnH3/FbYrOPVA2bMsLXoQ3yg9y4zumBaLBSdCJ+A5JdCQtOZzcoM0ZFSdOSqQ1H4eU7T/E4dDqxof/AFcpOhJ6rrtFb3iVuArKyheeAhAF/wuRJcgD8TPeItuOiH7hb4L1r1ja0uz9RmyObkRLFxt0GY1EFHj6/dfMfUcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=qnQNNtgW4Nxi8+fUQRwQE9aS7W3iFrgfWowLgphm568=; b=udTy0vocoDfIHoRG//hRpEZh5ypUQhwbQsAMBbmnGnGdCAA3WkEdSlID50fJnYOppxL4Z7zdpbxrED0tT73gI+KmxPExtoR4193ML6HOiCjjdIU9S8cXbBJ1/QYhd8oWufFHn8FrsVi60YnXcv0cPK67243i3QlbPIEYKbkDcW8VvEnHYKE3gfNH5CLiofbPxk+kCmUbWcaFiduaBrC1qt8+UFmOnU1jzlpyuHP1fA6Sl5rCNK2il8IEFP6CuwE7iNs795J04ZkOO+4sLQfDW6ORM3/TGTMKcy4AJA3oXbRtbaMB9JSR24ADZuFhD4eShZrqjaFZRZtVpRlyB6+jYA== Received: from CY5PR19CA0043.namprd19.prod.outlook.com (2603:10b6:930:1a::33) by IA0PR12MB7773.namprd12.prod.outlook.com (2603:10b6:208:431::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Wed, 9 Nov 2022 09:55:45 +0000 Received: from CY4PEPF0000B8EF.namprd05.prod.outlook.com (2603:10b6:930:1a:cafe::59) by CY5PR19CA0043.outlook.office365.com (2603:10b6:930:1a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.21 via Frontend Transport; Wed, 9 Nov 2022 09:55:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000B8EF.mail.protection.outlook.com (10.167.241.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.11 via Frontend Transport; Wed, 9 Nov 2022 09:55:43 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 9 Nov 2022 01:55:25 -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.36; Wed, 9 Nov 2022 01:55:23 -0800 From: Dariusz Sosnowski To: Matan Azrad , Viacheslav Ovsiienko , Alex Vesker , Erez Shitrit CC: , Raslan Darawsheh Subject: [PATCH 2/2] net/mlx5/hws: fix disconnecting matcher Date: Wed, 9 Nov 2022 09:54:31 +0000 Message-ID: <20221109095431.668926-3-dsosnowski@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221109095431.668926-1-dsosnowski@nvidia.com> References: <20221109095431.668926-1-dsosnowski@nvidia.com> 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: CY4PEPF0000B8EF:EE_|IA0PR12MB7773:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bf41649-97e8-42ac-f3a9-08dac238916a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4fuy+Ms/5/c8Yx3YgT0nQcFFUZl2oi0HImW2B8scHvJLtxzO3NOTJ0FVLgNUYLnzdORQTsQDkI6Ni7GlTcxHsuqs4kHI9iyWM4GUr7IsaI7YNabaQy5kO/LNB0d9CvFGOi5gKJm1sQ+C7JhQIfyiJbs72BVdy5shkkO5bnii2FVTcaKdKPBhH5trLKS5lwF3xU5zxhP96FZgNuXSpA3ok+sATjue2t59zAKy3Xua4tc7WajOlsMZ/Y7yDWSeWjEFqldb8rTP9XrF1Ksz3o/KsqahHhokKPjHp9UoT71fWqt06/VbC/9ceUwC9gJc4E/SVRJhfYGeQDjZse2bewh+qW3+0vY0h88vgDmhbXclOUGOpEoMMEyfBYB9DH4VrvSmDz1oSTcHqRvHPyMCXgZWxrnHzgwEPeU0KXGM8exZgFY1WF+MK3s7ElFKb7NooL7JLuoGANWsjIVNn0DaP1M4QFDjRLEDCnL/V7Nmn4NKiJxGgN3nQ5jsM4gTCn/hjvp4M6jlaSM4H69/Rspaz9OMOUomYFPF2uVkRXkIwEio4SFg484WoRIyYaSAS0MD2YLtI537uExZ7wZm54jDC/Q6aicOhDPDFtagtW43sW86ssj53Zkgl/H7or4kQrYZkuIyeLcTrO/maKrFJG3jQCqiAqo0cniPh59BWOdsnT+uUIIYt63aE9zVnFtTsevlsYrNqvMbMrjMzmZEZQUJXRYF476cJrNUOYcJccAUL6V7be2fujGwPkycaLGouJxziaxBwtlWawRCVNfH4n4IFEE9Kg== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199015)(36840700001)(40470700004)(46966006)(2906002)(36756003)(8676002)(4326008)(41300700001)(2616005)(36860700001)(8936002)(5660300002)(110136005)(54906003)(316002)(6636002)(426003)(6666004)(86362001)(40460700003)(82310400005)(107886003)(16526019)(70206006)(1076003)(478600001)(336012)(26005)(6286002)(186003)(47076005)(40480700001)(70586007)(356005)(7696005)(7636003)(82740400003)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2022 09:55:43.8602 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3bf41649-97e8-42ac-f3a9-08dac238916a 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000B8EF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7773 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 From: Erez Shitrit This patch fixes the matcher disconnection handling, by removing the RTC references from flow table if the currently removed matcher was the last one for the given table. As a result RTC in this matcher can be correctly freed, since there are no dangling references to the RTC. Fixes: c467608215b2 ("net/mlx5/hws: add matcher object") Cc: valex@nvidia.com Signed-off-by: Erez Shitrit Signed-off-by: Dariusz Sosnowski Reviewed-by: Alex Vesker --- drivers/net/mlx5/hws/mlx5dr_matcher.c | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c index 67adfeec6c..2e444c1179 100644 --- a/drivers/net/mlx5/hws/mlx5dr_matcher.c +++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c @@ -36,6 +36,30 @@ static void mlx5dr_matcher_destroy_end_ft(struct mlx5dr_matcher *matcher) mlx5dr_table_destroy_default_ft(matcher->tbl, matcher->end_ft); } +static int mlx5dr_matcher_free_rtc_pointing(uint32_t fw_ft_type, + enum mlx5dr_table_type type, + struct mlx5dr_devx_obj *devx_obj) +{ + struct mlx5dr_cmd_ft_modify_attr ft_attr = {0}; + int ret; + + if (type != MLX5DR_TABLE_TYPE_FDB) + return 0; + + ft_attr.modify_fs = MLX5_IFC_MODIFY_FLOW_TABLE_RTC_ID; + ft_attr.type = fw_ft_type; + ft_attr.rtc_id_0 = 0; + ft_attr.rtc_id_1 = 0; + + ret = mlx5dr_cmd_flow_table_modify(devx_obj, &ft_attr); + if (ret) { + DR_LOG(ERR, "Failed to disconnect previous RTC"); + return ret; + } + + return 0; +} + static int mlx5dr_matcher_connect(struct mlx5dr_matcher *matcher) { struct mlx5dr_cmd_ft_modify_attr ft_attr = {0}; @@ -148,6 +172,17 @@ static int mlx5dr_matcher_disconnect(struct mlx5dr_matcher *matcher) LIST_REMOVE(matcher, next); + if (!next) { + /* ft no longer points to any RTC, drop refcount */ + ret = mlx5dr_matcher_free_rtc_pointing(tbl->fw_ft_type, + tbl->type, + prev_ft); + if (ret) { + DR_LOG(ERR, "Failed to reset last RTC refcount"); + return ret; + } + } + return 0; } -- 2.25.1