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 AF28EA0C53; Wed, 1 Sep 2021 10:20:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 134AD40E78; Wed, 1 Sep 2021 10:20:22 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) by mails.dpdk.org (Postfix) with ESMTP id 9366A40DF7; Wed, 1 Sep 2021 10:20:20 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xsjroq5JzDGz3U4NUdzsxDR01+EHZciQtcym31IkVDej5pJ76ckWFxC1lWT8BEdGD2xPNYqrCpvBI0ZnkuLujnXLnCLIfe7MtWQuV0oGwqofmF9Cm3cwBwOMCDMFKgPA7sY7JC3sHZmZNKsMcK69B1Vy5qlJfShnVuA3jfxOrVyNwnpDnJiZ73hBhf5/4wgBp38SMuH7VKJQ/0ku8itynIMRBJbjDccWlUWCzPwRpjBaAI+wsmdpeluzScdy9aTyfqCFOts+uYFOG4XT0G5rkkX/qVx5yB7fWCiX/RFh8e+PNDU/vgWkTHmkPD04Btk6Kud076Lsd2frATVHLHlSHQ== 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; bh=BzVj3O7CLE2JRpU1u0waZzKkH0O7qw7kWr7Mp1Jo2H4=; b=PD+Z5p/7FBC0PAfba5y3uRZK3GnShATxPUF5YJGLh8pLIQ1wju5pdzxgiQYqKlNxtZ+iHksXX6nlUn2ByFz8pjBBOvRx5zxAhWSFgjLktDHXDH/dzuvYP/xthU72GNm1B5JjKkbRMcyU/792NRjv4M9x2mDP3UzTxcyyR/LTTl9axsqOak1hmG9qAK9QPxrRu7h+Z9obAhc9pfK+yCUYQgQGrkqY/6jnSSD8TykebC7sy3WAkG7lKCPWcLjK7lxQrwqnD5tbhEQtj9YJPS+V+0UZHJfJMXGIqZFEMHgZ7+BWta00GpdULKV0ilTZXuSansQcZIwbCiJ1XMXa1ILbjQ== 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=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=BzVj3O7CLE2JRpU1u0waZzKkH0O7qw7kWr7Mp1Jo2H4=; b=dib1PRfFNI7JEXBZKxsfT2u0J04fyBwQFyc4u98fDTNx5lLQqg9BlZT/CdR0zPUAEEUJsb/+tbjjVCgrNWGhbuTxfLbZjEZqtxoOt58ekJwbo0wYyRqEgJ0cBRmD6Sdew4KoeyIP/kvXXUnUW+UsSpFw6zJYdarF4iQLztlb6/ig7rXfPNWz1Tucij2AOsRW6C/HJUw8FWBgQPfgXhH/OmIUMiyRCKOoOQH0bMm5SSfivMdFHK0HFdSQ2oXpp5Yb/rCJStVXh07N8lzRYIxw/jMZj9hksjRDb9ZVNxVQL2DwULXo6VDbg8jc7a1M0aVgsdhHAQ4JCgoNzP/U8g3P/w== Received: from BN7PR06CA0059.namprd06.prod.outlook.com (2603:10b6:408:34::36) by MN2PR12MB3293.namprd12.prod.outlook.com (2603:10b6:208:106::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17; Wed, 1 Sep 2021 08:20:19 +0000 Received: from BN8NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:408:34:cafe::97) by BN7PR06CA0059.outlook.office365.com (2603:10b6:408:34::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Wed, 1 Sep 2021 08:20:19 +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 BN8NAM11FT006.mail.protection.outlook.com (10.13.177.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4478.19 via Frontend Transport; Wed, 1 Sep 2021 08:20:18 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Sep 2021 08:20:18 +0000 Received: from nvidia.com (172.20.187.6) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Sep 2021 08:20:16 +0000 From: Dmitry Kozlyuk To: CC: , , , , Viacheslav Ovsiienko , "Shahaf Shuler" Date: Wed, 1 Sep 2021 11:19:58 +0300 Message-ID: <20210901081958.3643375-3-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901081958.3643375-1-dkozlyuk@nvidia.com> References: <20210901081958.3643375-1-dkozlyuk@nvidia.com> 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 DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 22fa1c2a-a5a8-4ad9-6055-08d96d2155c9 X-MS-TrafficTypeDiagnostic: MN2PR12MB3293: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: paDZs16ReYi/wvX/nNZWk0hBfqh75ecBQ3so9620bKNlo0nf7FO2zuJocfTjzxRmtpjmDqZ6S7EY/BU8r9QDpq+m/Ad2O4VBJcRKQ988Ognjhl7hMFFEp3nPZsgBUxsF9CInxlqr9LgGiCe79SU2SD8I4DnI/jNEBsSg5z5bAeIJ2ObzOEMcjrSYYTPAw85LsmzziiHmXtpHyZj0Q48Knwe86rtaHNKXZxmgDyl1hSM5f25YS49GouRdVITdvZyivmp+rxeYIMiBlj0EIy51E2COpNn6vU+ogF2YZvCOp6aMMqkVdxHbGjPt3wQPsYOne8I+iTByydldQmjAeOT2tJgsj4rV0ug297frBccErBVboO4zAk0+ObkxyP8WqtG1zjiLyVEzHgKqIyWG83jPllxHlXGL+6njnckfQ76zwOAvhJpkbG46R1odHDerVJJItSjCYRO7kFgTsN2kCjVmmdgmEmNTLYZtB8DVmBOodU9o9ZE12ttJ9jGtkoSz5Uf5ZAhl2UlW4Aedim90pF9Hwc+GajP49+vlCfpBlRIGjGUHn8k/xdyq6hENmUGhXeIj1T46/Exu3s/+xLY5bixbSiS82HILH/26BLt5O4ij/0Ge3P+s2uk941pjpxsU9C90FB9l98P3CdJvtgv3bcbhhkRDJ662lUOEi1kqGvMYtHrEdzjH2Cr42QvmEB//L185DlqE4z0LAohhEwm2dGaTlw== 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)(376002)(346002)(136003)(396003)(39860400002)(36840700001)(46966006)(316002)(36906005)(6666004)(478600001)(83380400001)(8936002)(8676002)(54906003)(82310400003)(5660300002)(26005)(6286002)(356005)(186003)(16526019)(70586007)(70206006)(7636003)(7696005)(2906002)(47076005)(36860700001)(1076003)(82740400003)(336012)(86362001)(426003)(6916009)(450100002)(4326008)(107886003)(36756003)(2616005)(55016002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2021 08:20:18.8316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22fa1c2a-a5a8-4ad9-6055-08d96d2155c9 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: BN8NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3293 Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix flow indirect action reference counting 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" When an indirect 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. COUNT, AGE, and CONNTRACK indirect actions have been affected (for AGE the error was not immediately observable). Increment action counter only once for the original flow rule. Fixes: 81073e1f8ce1 ("net/mlx5: support shared age action") Fixes: 2d084f69aa26 ("net/mlx5: add translation of connection tracking action") Fixes: f3191849f2c2 ("net/mlx5: support flow count action handle") Cc: matan@nvidia.com Cc: bingz@nvidia.com Cc: michaelba@nvidia.com Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow_dv.c | 37 ++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index b769ae4007..626513ce56 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -12840,10 +12840,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); + } age_act_pos = actions_n++; action_flags |= MLX5_FLOW_ACTION_AGE; break; @@ -12853,9 +12856,9 @@ flow_dv_translate(struct rte_eth_dev *dev, action_flags |= MLX5_FLOW_ACTION_AGE; break; case MLX5_RTE_FLOW_ACTION_TYPE_COUNT: - cnt_act = flow_dv_counter_get_by_idx(dev, - (uint32_t)(uintptr_t)action->conf, - NULL); + owner_idx = (uint32_t)(uintptr_t)action->conf; + cnt_act = flow_dv_counter_get_by_idx(dev, owner_idx, + NULL); MLX5_ASSERT(cnt_act != NULL); /** * When creating meter drop flow in drop table, the @@ -12866,10 +12869,12 @@ flow_dv_translate(struct rte_eth_dev *dev, dev_flow->dv.actions[actions_n++] = cnt_act->action; } else { - flow->counter = - (uint32_t)(uintptr_t)(action->conf); - __atomic_fetch_add(&cnt_act->shared_info.refcnt, - 1, __ATOMIC_RELAXED); + if (flow->counter == 0) { + flow->counter = owner_idx; + __atomic_fetch_add + (&cnt_act->shared_info.refcnt, + 1, __ATOMIC_RELAXED); + } /* Save information first, will apply later. */ action_flags |= MLX5_FLOW_ACTION_COUNT; } @@ -13192,9 +13197,13 @@ 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 = owner_idx; - __atomic_fetch_add(&ct->refcnt, 1, __ATOMIC_RELAXED); + if (flow->ct == 0) { + flow->indirect_type = + MLX5_INDIRECT_ACTION_TYPE_CT; + flow->ct = owner_idx; + __atomic_fetch_add(&ct->refcnt, 1, + __ATOMIC_RELAXED); + } actions_n++; action_flags |= MLX5_FLOW_ACTION_CT; break; -- 2.25.1