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 69A72A0C41 for ; Fri, 3 Dec 2021 21:12:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3357640041; Fri, 3 Dec 2021 21:12:13 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2076.outbound.protection.outlook.com [40.107.93.76]) by mails.dpdk.org (Postfix) with ESMTP id CB2B140041 for ; Fri, 3 Dec 2021 21:12:11 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HY5Ud1uplR5/gvHxmQIF9FMHrd3I6JnIaopqGt0DhoXa4F3GhhLsUIYEd9T0JfhcW/G467XwUYwPUAaRRuCckTuwSueLm/nBn1COHmYDn6hEahCddO/oCs99xk8zo5NjUzjS2zHnH9MLRuDjXK9lGszPTSVTHYJunq/MBW2AnMXF5dZsSQMweKJroMfe1hPw/KH3w5v3dEOgd9CEACx5+8pJcOLw4f4o1cJL/ULQdPxeZ9ZMJ/ueTcn9VRVY8uA1Ls+OI2XgH9/1ws/vDUVtScHAsfvvETN2FB/QC1KxsGXuY6lhDzQTV5UBbWLo2kSnlg2ZSZMExf01ufj1CXQ7cA== 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=Nda2w5XpYYHOvD+Mn82xhXOeogMjEGGGEFT2CCWnX1E=; b=gj8S7yhUvb/FvZyxPSMnylk9c4OXjZ7qRSh18Eb/3A3FCU1v92ln0JMbmJujckdjHSuY4Jrf3oDBGwrkXMyAK6tOb6U9ZC2Z4LJLbEmhFh9AqrzvfUCKlUDOA2D28B36x9VzDYCnjO/6O8mtJQzKw/+qFB0vM6OtK0ibyBS2tBG1gndj7UVSYEWAf4lwBMOn2xBRlAK96WiR0ozh1I/8B3KppYobOIrx/E0X3NramOnYn7l+777zgfjYamKaFu/D+wBH+hUeHLp5mWHFspkQDE31DsnZY5j9ZZz1EeEpJhTu4uSwzn9sXzbMBWOM/d+tykA1Jt5/vg7xlwMS/OW0Og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) 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=Nda2w5XpYYHOvD+Mn82xhXOeogMjEGGGEFT2CCWnX1E=; b=SpPUt8YBLmtM5wYPttjMqIsGZJcPYAS8ILz4qYwjXFhKlIP2S+H0JPAMt44U1jKUcECpr6kw1hc2kxiaQ85E3yQtO1fXVlpLkQlhKMzyDcKKLyNXnE+P46nS+R0jyR22cEoOqf7lPl0hJ83h5d2ea549OxcbuhX3JlXsFK+Q0FazuddAm1d58r+KWSj7uqJyXEsdoDaoljNy4/0CD8O0AkYTgssfpiAQCQbshLg2f/N3Vm6au0oTyIL5KQXWvVqoiqkomzm8b1X+5DnWx8Ii8RTuTNJQ7390T8zHMzW3zqud9/23PSDLblRX+dJfAHFkWR1N/Qh80/4gsWIQlGHGDg== Received: from DS7PR03CA0211.namprd03.prod.outlook.com (2603:10b6:5:3ba::6) by DM6PR12MB3243.namprd12.prod.outlook.com (2603:10b6:5:185::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.24; Fri, 3 Dec 2021 20:12:10 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ba:cafe::26) by DS7PR03CA0211.outlook.office365.com (2603:10b6:5:3ba::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23 via Frontend Transport; Fri, 3 Dec 2021 20:12:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) 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.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4755.13 via Frontend Transport; Fri, 3 Dec 2021 20:12:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 3 Dec 2021 20:11:55 +0000 Received: from nvidia.com (172.20.187.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.9; Fri, 3 Dec 2021 12:11:53 -0800 From: Dmitry Kozlyuk To: CC: Xueming Li , Matan Azrad , Viacheslav Ovsiienko Subject: [PATCH 20.11] net/mlx5: fix flow shared age action reference counting Date: Fri, 3 Dec 2021 22:11:39 +0200 Message-ID: <20211203201139.1633370-1-dkozlyuk@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: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de6309ff-2b51-48fc-1e86-08d9b6993004 X-MS-TrafficTypeDiagnostic: DM6PR12MB3243: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IVVy2LFjvxu5lf78q5H2joa64s0kaZftWrE/ItU2CAFEWvQ7eWWqnJ0PtwIa/OUAppy+/u380e3LkcQpoiwiP4uI39ceLZyzvoovYQsOys+t4vpcpMwOb8ZaL3fBUnC93Hpt2Tcy/wVA+FUTj/CicAM+HqGUGbMEG256erM9aVGBV5JG2cmJijctUzqKvwh9XZgGyCEoQ2mrnsPQWeSqd2pgmQN3IRa2ADWcILW3T9LALvjGU+zX87HXcubcvolmpugxqnA5/70rzeLodfXoXz4j+wgxSrTbs93i+aBTQKOG5hdAphXV+V1pXE+SzXKqjoxrF0Cj3SMWotIH+kcrF0uVepgNuHi35WwFz9rhxcs2SwpHVyEoX7Y455O+7c2VzplOVmZdnhuEYJFBQKal3BInVMoQxwp84Ncb8c9usvnLrNW0BzQC3cgquWfmbBXr5EN7l/Xudmjn6qmuOy/ySvGRcBbs9shEY4XA/SLAiktmhsJQRPin6RdpWBXA0SDaUgzVvTwWGSoLeNaZQNWA5acZhueMF2crQLFsRueQ/J/yXuInBLZl4l/IiNLgiW8fuxqr6VWGyyr5VT1PLtx3HciLHlAL48EaKPTDWXx/TobHWcitK4m8hw1IPUneBT3Z83eqSShA2zLnQqTsJpQxce1/Fa8zhMKEPLppctm3n54a4qinfA61XhJYZDPJzlCkdET/LfUR3cOLQbjcfQOSOmXAGZE5Cs1mXQ9/k/WIwcFtsdWdqfjCffrGyFLdV2iYWFlMsPtzSaZKH/7cICa1EQ== X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700001)(55016003)(316002)(508600001)(54906003)(4326008)(70206006)(186003)(36756003)(6286002)(36860700001)(82310400004)(2616005)(6666004)(40460700001)(86362001)(26005)(5660300002)(336012)(7636003)(7696005)(8676002)(70586007)(1076003)(47076005)(6916009)(426003)(2906002)(107886003)(356005)(83380400001)(16526019)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 20:12:10.0369 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de6309ff-2b51-48fc-1e86-08d9b6993004 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.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3243 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 b09c65fa4f8bb55880b6b36c849e4ed1bb815227 ] When an shared AGE action is used in a flow rule with a pattern that causes RSS expansion, each device flow generated by the expansion incremented the reference counter of the action. When such a flow was destroyed, its action reference counter had been decremented only once. The action remained marked as being used and could not be destroyed. The error was only visible with --log-level=pmd.net.mlx5:debug ("...references 1" is not an error): mlx5_pci: Shared age action 65536 was released with references 4. Increment action counter only once for the original flow rule. Fixes: 81073e1f8ce1 ("net/mlx5: support shared age action") Signed-off-by: Dmitry Kozlyuk --- drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 1793683421..66732cbdd4 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -9812,6 +9812,7 @@ flow_dv_translate(struct rte_eth_dev *dev, const struct rte_flow_action_meter *mtr; struct mlx5_flow_tbl_resource *tbl; struct mlx5_aso_age_action *age_act; + uint32_t owner_idx; uint32_t port_id = 0; struct mlx5_flow_dv_port_id_action_resource port_id_resource; int action_type = actions->type; @@ -9951,10 +9952,13 @@ flow_dv_translate(struct rte_eth_dev *dev, MLX5_FLOW_FATE_QUEUE; break; case MLX5_RTE_FLOW_ACTION_TYPE_AGE: - flow->age = (uint32_t)(uintptr_t)(action->conf); - age_act = flow_aso_age_get_by_idx(dev, flow->age); - __atomic_fetch_add(&age_act->refcnt, 1, - __ATOMIC_RELAXED); + owner_idx = (uint32_t)(uintptr_t)action->conf; + age_act = flow_aso_age_get_by_idx(dev, owner_idx); + if (flow->age == 0) { + flow->age = owner_idx; + __atomic_fetch_add(&age_act->refcnt, 1, + __ATOMIC_RELAXED); + } dev_flow->dv.actions[actions_n++] = age_act->dr_action; action_flags |= MLX5_FLOW_ACTION_AGE; break; -- 2.25.1