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 E38FBA0A02; Tue, 27 Apr 2021 17:40:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07234412B0; Tue, 27 Apr 2021 17:39:24 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2070.outbound.protection.outlook.com [40.107.92.70]) by mails.dpdk.org (Postfix) with ESMTP id 8E1E8410F5 for ; Tue, 27 Apr 2021 17:39:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fClo9CyGbFNVMHNs2oGjCV7zN5iu+HW9+TypMXZjZg4uYdB9KYaIn7nV+HbTcJmKbJNutcaQCKtu307mUJeKHAJIh4pCxsukB3qkSimBuiwVtbgwlnky6BpIGPvRU7ap0Isffz+OFHfapdt7vftH2PIV/1wbjR7dgtYoWMWZRSD4QfPJmwz6VhAXcMyhrRDxiTYJjbuJayxZJnob1HYCy4VqfIDkwyTK2rOk1SFfWPsfuIf/fwVdal0p23+ZVAE7vboGqRiCVGSsoE+E3Sf1htFPuaJBlAMd9mdlb0Jb5D2irHO8mZhKIIeDflMxDvN7Q1XODIq9PTDMdoPhKEbGzw== 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=syYuTayrmspYgp/kvWZNDeFr/n8om5GI874RD+Ol3iM=; b=kDXKYw8MscY9cZfTSVdmYPdwtgWAHV6wF6eAbnpvv4DC6+MNUtfxH1J6YSKEXwqkdrY3jW64LOXqYG5a+S+X6F81JMqseA3J+HVPSwuPjCKUj9j6nHv+74bMDoordF77yL6pQiPyiyJIO3uRN3iXG5RWfKngYCBkwhlVQ9Yf6UULwQG3BjTWfITwkj1LhxcWv8FRchouidiVl0mueLL5B1clEQJ9sVFx1/Kp7386uFVoctIxGhtrsLjZjArw3Y7MfAyE5HKwk0HGXtyIcaUSQc6L6UnYU58i35T13kVKk5ERWKjrMq6dR3jWMEcTrcW7opxO5PzQpVmB8pkDCYSJxA== 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=none 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=syYuTayrmspYgp/kvWZNDeFr/n8om5GI874RD+Ol3iM=; b=F5BdGYeEFC5+IhRA8pRa6PylTEN38ZoCGZQ/3X3g8nFss5zGlllxDuEHSXeMYaaakghB+BsiPqLsgq8bVSOB9wxH/MtaqAcIDdsCxIvoxL2BgsiobvRGYI1KULwG99KmkrLOASBWg1jhb7s1AXe5D5+o2I2V6bRovt7J1LDXLCdJOwE3VSZMOZP5kIJn9a812CD/hG4e3q5N0e/IQnx7MYBhu5mc7cXbxyH2YvoAGlFo+LGoD71O5H2WnIpl7YwYco8LwKcmydxCrpPPgRYkNOwCpgSD4Nk7WJa0uQC2glFI/KBXnVT6r8i3SrV89zCDiDF1MtdRndR1hKR7PZi1mA== Received: from MW4PR04CA0327.namprd04.prod.outlook.com (2603:10b6:303:82::32) by MN2PR12MB4093.namprd12.prod.outlook.com (2603:10b6:208:198::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.23; Tue, 27 Apr 2021 15:39:20 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:82:cafe::4e) by MW4PR04CA0327.outlook.office365.com (2603:10b6:303:82::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.22 via Frontend Transport; Tue, 27 Apr 2021 15:39:20 +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 CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 15:39:20 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 27 Apr 2021 15:39:18 +0000 From: Bing Zhao To: , CC: , , Date: Tue, 27 Apr 2021 18:38:10 +0300 Message-ID: <20210427153811.11554-17-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210427153811.11554-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e0e1728-3e77-4337-56ba-08d909929fe6 X-MS-TrafficTypeDiagnostic: MN2PR12MB4093: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3aNhJUhMtRWHfDfTn6wixnKevKrq0tOk1Wp/Zryhwf+2CovwLUOIasWWFjxRxjGpxUA3t9G5rbYwrRW+pFRKHfQP6zaAAXZ+EPscU3ozL6LmCdiaQro1bxO//St/t8QfVJgsphSJKMM10H5MoKPn7MCPTvqy2bjg1to3ACFZhemolFQVV/cSpIs/jRpv0r9fLYwQjPWnnUkYoNqwbA1mdIkJawK7SoC/wnlmWMg0/6JwZO5MtmNerTBBa9ls5oKbrTzZShx2gqFYZ90htgTPQ2XZUlRHh9LIvMwnzKFQ9YibkZeqf8Vp+i1SNFMAj8+htcMTqqMvtcYtPpBuGkyE/1w5kbXWoJR6LZjRHR0gGb8h4SfBVt4VwRy8xUql7/cyc0aAyesRAQ9ohx+YsO7nGxTbitTW4EkZK+PA4iUsVtzJZFY+lG/NKjGgnoULBXW0Lsfoc1WORbnhqqCPjpL0HfbQ3WKqZsb40ot48ujpJtH35Yg5Wx16+O8yIFXc4GhfP5K500I8oX40Cikymw+s0Epefs/uTusHegxxI4mbUflK/ivaPeytpft6H4gSNA1STkBtJnd6DNOMV2WH1hqpd4ETwGBnaCusvr8oXnmoE63gOI9LeuC/tOKtpQ7jTTdcZtJAjGBPaGSmyAQVsPbTMw== 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)(396003)(376002)(39860400002)(136003)(346002)(46966006)(36840700001)(36860700001)(70206006)(47076005)(186003)(478600001)(86362001)(7696005)(54906003)(36756003)(82310400003)(110136005)(316002)(356005)(36906005)(6636002)(336012)(6666004)(2616005)(426003)(1076003)(55016002)(2906002)(8936002)(82740400003)(83380400001)(6286002)(5660300002)(4326008)(7636003)(26005)(8676002)(70586007)(16526019)(107886003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 15:39:20.1124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e0e1728-3e77-4337-56ba-08d909929fe6 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: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4093 Subject: [dpdk-dev] [PATCH 16/17] net/mlx5: reduce the reference count of CT 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" In order to release the DR actions and reuse the context of a CT, the reference count should be handled correctly, especially in the flow destroying. The CT index will be recorded in the rte_flow by reusing the age index. The action context type should be saved for CT also. When destroying a flow, if the context type is CT and the index valid. The release process should be handled. By default, the handling will fall back to release the age. Signed-off-by: Bing Zhao --- drivers/net/mlx5/mlx5_flow.h | 6 +++++- drivers/net/mlx5/mlx5_flow_dv.c | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 3b896e3..4ad9910 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -977,11 +977,15 @@ struct rte_flow { uint32_t drv_type:2; /**< Driver type. */ uint32_t tunnel:1; uint32_t meter:24; /**< Holds flow meter id. */ + uint32_t indirect_type:2; /**< Indirect action type. */ uint32_t rix_mreg_copy; /**< Index to metadata register copy table resource. */ uint32_t counter; /**< Holds flow counter. */ uint32_t tunnel_id; /**< Tunnel id */ - uint32_t age; /**< Holds ASO age bit index. */ + union { + uint32_t age; /**< Holds ASO age bit index. */ + uint32_t ct; /**< Holds ASO CT index. */ + }; uint32_t geneve_tlv_option; /**< Holds Geneve TLV option id. > */ } __rte_packed; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 6478625..3e85d5e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -12185,6 +12185,8 @@ flow_dv_translate(struct rte_eth_dev *dev, else dev_flow->dv.actions[actions_n] = ct->dr_action_rply; + flow->indirect_type = MLX5_INDIRECT_ACTION_TYPE_CT; + flow->ct = ct_idx; __atomic_fetch_add(&ct->refcnt, 1, __ATOMIC_RELAXED); actions_n++; action_flags |= MLX5_FLOW_ACTION_CT; @@ -13328,7 +13330,10 @@ flow_dv_destroy(struct rte_eth_dev *dev, struct rte_flow *flow) mlx5_flow_meter_detach(priv, fm); flow->meter = 0; } - if (flow->age) + /* Keep the current age handling by default. */ + if (flow->indirect_type == MLX5_INDIRECT_ACTION_TYPE_CT && flow->ct) + flow_dv_aso_ct_release(dev, flow->ct); + else if (flow->age) flow_dv_aso_age_release(dev, flow->age); if (flow->geneve_tlv_option) { flow_dv_geneve_tlv_option_resource_release(dev); -- 2.5.5