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 0E50CA0A02 for ; Mon, 17 May 2021 10:01:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07765410EA; Mon, 17 May 2021 10:01:26 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2043.outbound.protection.outlook.com [40.107.243.43]) by mails.dpdk.org (Postfix) with ESMTP id 5AC534003E; Wed, 12 May 2021 12:21:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n6sf5ZCixQpt9sjTj9f0oh3obKJuhW5uVb8bL/AXOVLRA2z7QTZLWmJdIy5RW4mgS+QZ68IF8txY8zXqF83u0Lh7LvZuYB5SPdovLs6FhtXzd7w7BCBS6aTEgJwLi71l3oBPJ6gW3nwjOoIxqlifAIYke23L3VBrZUIhqE44G1wKVJTcMZdgdcIeb5AncfGHfVbuifgtqK2fV1yuDEkNwMv0ER5NCawfsBuqR8cVjNEGuu98QZmxuo8qOeym+hyPds4GF+pdOEyIju8MF2ylUU9A8rBr0PjVzY13IbXM/P4xPUdo4Qv8+1Ljl54SMRhwa0/t9ryHtSFyfxK7K2nSbQ== 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=HD5ir0k0y4UxdR1Q7o/htdlDOZO85vyKNh5iaSl9FpQ=; b=FS934RAf+PthLCEAmU4A/DqONtgbD2ZQd3DBM2qEDm/Ipv2TxMjj4WqwjQ3RcXMqOvGDlX0SxmFEibp3ghBonswTtwTOhlyS9OJYbZwCtz5tBmsWDMRpBUDAz50EPL7mwXd8GEcWfHrxsZs+9uEBfexIK417z/EX9GbpKCLqcBo9uF8PZqurZDTX0Iuh9EDzc82NHW9D84SYz4lzKVLk3nOWU3VWXwZnqEO94GIomY8ZMvx01wUi8se/7H994tmyBFPehBAWCWAf+pRLKI5eFRryoszHJSpK3oxBzVEABgRMC7HrNgfhd9s9+snsupOAT3pm4qXoJznQHXD/52KSoA== 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=HD5ir0k0y4UxdR1Q7o/htdlDOZO85vyKNh5iaSl9FpQ=; b=Rr+VaVD9utI/omcCBKUtgSawjvlAlvoA1/Wu8/36XDdMzLzUgkkdnmbJPwjDPAFmW4li0Nc4B99EaBezOac3iQfbBrmEqBobt1UPoXO92QW05fQjsUkqhr8RvlkfjxAmpI80MCEcz/SG8kxDIr20za0WR4IhQL9dh13p+L8H79hrur0KGMJYk4vqEh8EUjBC+0F1PugIlM58QHz/YPcySbgAZna0GhLqzw0/c4RgGGW/8ds4YaUxapEnQol/oxswYoNKMiTy+TmzdFKwkx8M+B/K9VnK/d0bT6u4742w71SXfUn3+b/8qtn12Q+YMD8cNLwjiXxI0Le6mEa6nAOtTQ== Received: from DM5PR2001CA0016.namprd20.prod.outlook.com (2603:10b6:4:16::26) by DM6PR12MB2844.namprd12.prod.outlook.com (2603:10b6:5:45::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Wed, 12 May 2021 10:21:22 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:4:16:cafe::c4) by DM5PR2001CA0016.outlook.office365.com (2603:10b6:4:16::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 10:21:22 +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 DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 12 May 2021 10:21:22 +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; Wed, 12 May 2021 10:21:19 +0000 From: Shun Hao To: , , , , CC: , , , , Date: Wed, 12 May 2021 13:20:59 +0300 Message-ID: <20210512102100.23870-1-shunh@nvidia.com> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 54af033b-171e-419e-4c4a-08d9152fb0f5 X-MS-TrafficTypeDiagnostic: DM6PR12MB2844: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ojNlStbKkNuGTbI2+1tenuNn/no8zRJ2FhLLQT1nma6LdZGvc5R8XdVJoKmirGAj3hmht5ZcNM1YmUBcPo8xuQxw5vtNkV8Tmz1zHEFZPEhKdbA0RK2KpOiULxzX65ByWv3oyIzeNYxjbK11Hl+TQxzW9b+RrJm4t4X96KIJB4AlBlI6xcLsvLP1ufQqblLe8Ad9fQdPqcCFuULRUNDRwMOrrstC5yrVppf9y7EY9xz97AkedpbmgeBDGhtijlg3AiCF1OmCcrnqmwB1MZZSBSLowKIDrZckKF/r39LHrZoiFCKezGwhRHNR10CrVi2O55jtnWD/IQrGnMU3qGVhiWuiEZ8G7NpYG9mUQlUBuhH5LNCb9XoCpaexf0e8k0hpz4XaJ8lR2o938FUbMXT1U0ZgYiNI7htYgy9nb6Xzx9WumYemNYr/vHgGdiqp8OZ9mqrXfXyZxRNiEoX7XSGefljUTl/5buZrSezDmKreWMp6QIz0VlHCsQJhBEpW+e2ZFHHaRiXmaGHk/8K5tsNHzdxbcHWADGTM381Th0txWu6YQLFnaAE+mLc7dwXCHun3HueT44AebDB4Z1UpXJOioyn2DTgAa7mvpjKMSWdcnetNKNw1fDCpjLXtg6X0uOTOqO9gjNr75squnP25sRow7rcTHQCH0i/gmlj40spPRdE= 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)(136003)(346002)(396003)(39860400002)(376002)(46966006)(36840700001)(356005)(6666004)(316002)(83380400001)(7636003)(426003)(2906002)(86362001)(8676002)(2616005)(110136005)(1076003)(26005)(82310400003)(36756003)(16526019)(8936002)(54906003)(5660300002)(336012)(478600001)(55016002)(186003)(82740400003)(70206006)(47076005)(7696005)(4326008)(70586007)(36860700001)(6286002)(6636002)(36906005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 10:21:22.4858 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54af033b-171e-419e-4c4a-08d9152fb0f5 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: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2844 X-Mailman-Approved-At: Mon, 17 May 2021 10:01:24 +0200 Subject: [dpdk-stable] [PATCH v1] net/mlx5: fix meter flow id 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 Sender: "stable" When getting meter flow_id bits, there's an issue that not handling correctly if flow_id is 0. This fix this issue that when flow_id is 0, treat it as 1 bit. Fixes: 83306d6c46 ("net/mlx5: fix meter statistics") Cc: stable@dpdk.org Signed-off-by: Shun Hao --- drivers/net/mlx5/mlx5_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 32634c9af7..edfac0d99f 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -4794,8 +4794,8 @@ flow_meter_split_prep(struct rte_eth_dev *dev, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "Failed to allocate meter flow id."); flow_id = tag_id - 1; - flow_id_bits = MLX5_REG_BITS - __builtin_clz(flow_id); - flow_id_bits = flow_id_bits ? flow_id_bits : 1; + flow_id_bits = (!flow_id) ? 1 : + (MLX5_REG_BITS - __builtin_clz(flow_id)); if ((flow_id_bits + priv->sh->mtrmng->max_mtr_bits) > mtr_reg_bits) { mlx5_ipool_free(fm->flow_ipool, tag_id); -- 2.20.0