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 79884A0547; Thu, 29 Apr 2021 17:44:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 21F8441328; Thu, 29 Apr 2021 17:44:29 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2077.outbound.protection.outlook.com [40.107.101.77]) by mails.dpdk.org (Postfix) with ESMTP id 375CA411E5 for ; Thu, 29 Apr 2021 17:44:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LFQ/QmWIU3adLArlvCVG81gLHWfDU50ZWbmuEiTfYXIVE33e0BCjHMKczTNxiHU7TbYSbkooEfiNJpbUYSXLNl5D3c3/t1Ot2abzO7PRS44obCsTfgcIzvCZ+15flkvE2ICtu6zsJymR1Wkw0WJu7fSERITdFNpkK7SbalQsvANXxVJ7CMFWILGNswO67UdM0Ya7F3uydXUJu72/CWSqh/d6Jdj3NLfDvqu/T7eg+SDzlPV+wzrDehL2U6WKrdPb4hQWIXwQwS4WoX1u0M+tTIEaHooRYyqLtI2QzWLwKFc7yFABXYHLojE/ufdgUXLEviqF36p6vzP8xFcwgtLP6Q== 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=atbM8SjIAc3Y3X7lr0ErctHTbVilFq3OoAh98waUX6g=; b=RJafWnKil2FnYCysr2Wu9CwWRPYXJKoBuNy617g6SyMkz1io/VNkaQYVbLBPNgmQHXfF7focDcnXyhmHM+VMf/JX31ggAVcnh6++USMYte74SE7ryPXEMAT8YjfYDR04ed0OccV/eY+fSjQQjdrDjWj/GwyST1A35FVEKkXC9/4b6z6Dh0J9EX2LPfnJ9CaZgb2jNZDxvwfhaRUqQgH3J9xteeqRsiuRoafiSpz39s8pyvzW/iBcLnD7U7kuRXruFUT7TLafbwZQLyQizeVJX/PcsWcLcHjl2+R8A4WxbEuPN5Tk3B7NFJt5FShNgt0YGfKyepBfR9i0F03QknlU7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=marvell.com 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=atbM8SjIAc3Y3X7lr0ErctHTbVilFq3OoAh98waUX6g=; b=LCoD2/KHZCZqo3gWum8LTYJHXMUG2zI1fJ+hwco2XcB2e+5twpb0NDZkgqYcUhufT3DRESyYP0GgSncT9eJhjc3aOUUfGY2MchDqIdYQ8mJcRHaXpBGaDGCM+ZU65juRTZZmoENFSD5wyU1jRQchTlSUZ6jtnVa3h65BPMDni2S/K1/YRdxGTBJRIr/1TUZ5rVTWWoiUmU2b51G1v9HQBOvqIVH8hMltFG5YDNCI7jJtHUVkEHh6uHwSBb0iYi/eGOwRW/zAXYicRQ+pVzwc8kmhaHqSN2pGHpQbD5bCHuixvuzdzSOCpFG7um1k8BikgsILGbjUm4+BKciux9O6uQ== Received: from DM5PR07CA0092.namprd07.prod.outlook.com (2603:10b6:4:ae::21) by DM6PR12MB4729.namprd12.prod.outlook.com (2603:10b6:5:7f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Thu, 29 Apr 2021 15:44:22 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ae:cafe::a3) by DM5PR07CA0092.outlook.office365.com (2603:10b6:4:ae::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Thu, 29 Apr 2021 15:44:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; marvell.com; dkim=none (message not signed) header.d=none;marvell.com; 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 DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.32 via Frontend Transport; Thu, 29 Apr 2021 15:44: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; Thu, 29 Apr 2021 15:44:08 +0000 From: Matan Azrad To: CC: , , , "Dekel Peled" Date: Thu, 29 Apr 2021 18:43:22 +0300 Message-ID: <20210429154335.2820028-4-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210429154335.2820028-1-matan@nvidia.com> References: <20210408204849.9543-1-shirik@nvidia.com> <20210429154335.2820028-1-matan@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: 9ac87f71-d9db-4903-8482-08d90b25a91b X-MS-TrafficTypeDiagnostic: DM6PR12MB4729: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1775; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fzuo5jGP8Amhzdgdb/CxqyCsYTQUjF882y/b7thG25pUGcls5At+f/DMvTmwBO9PFI6lXrZfNAdnJQQkWlyj3P4Hz/5YZe0NWmxgOZMdNBhk/Cc7F97fWsc3SXU8rGH+HAnxBNbbotvKK+V75D/Dc0IU75GLSxlLfqiWl8VMBZC+GrUelIg2ANzChi2xvF0L0R9ZN7qaYTXIorPgy23duSC+SgK/X2LlxJFYPxMaGuI7zwG3KX5xgXxuJ0jRB1oiebF4gB9w5+jLUu+qD490d+GZLN0P4BDPnGh01gR1EICTgNvKnTV78BmhliLMere6cr9Ob26jlYbrQhYWJeDgGfhu+2R54rYgC6bSztCR1IHQWXMU7etIQCC/oBqNMQBYH4rq32HTTjXzkC9s4WzQuO8dyngQWS6a7PM6cw+umRX2SZ/n6dmi5zElE/FRL+1k5etuctfNxFVHBUwaRVeve3TdupJZ0xF9A5dP1qeEDCEI/oW+edF9R1RV6uct3rLSTD3CEgN99TfXu7MFLItbGbwj3o1xxQjeOM9GNTbpKju/X6laHFohYEmnG5QF4Q+MJh8cpZTWu4xbNpLZEQuiVPSWsfdZBh5ztX0cD0ReD2qro5DMXWl/9ELMM3rOKxEH30poiWHC5XTJgQ1fQXr7bwV13mtmR6ZsRtED/qYroa0= 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)(39860400002)(346002)(136003)(376002)(396003)(46966006)(36840700001)(6666004)(336012)(107886003)(82310400003)(82740400003)(426003)(6916009)(2906002)(26005)(36756003)(316002)(86362001)(47076005)(55016002)(6286002)(7696005)(356005)(36860700001)(36906005)(8676002)(5660300002)(54906003)(70206006)(1076003)(4326008)(2616005)(16526019)(186003)(478600001)(7636003)(83380400001)(8936002)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2021 15:44:22.7444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ac87f71-d9db-4903-8482-08d90b25a91b 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: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4729 Subject: [dpdk-dev] [PATCH v2 03/16] common/mlx5: optimize read of general obj type caps 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" From: Dekel Peled General object types support is indicated in bitmap general_obj_types, which is part of HCA capabilities list. Currently this bitmap is read multiple times, and each time a different bit is extracted. This patch optimizes the code, reading the bitmap once into a local variable, and then extracting the required bits. Signed-off-by: Dekel Peled Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_devx_cmds.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c index 831175efc5..a0bf0d3009 100644 --- a/drivers/common/mlx5/mlx5_devx_cmds.c +++ b/drivers/common/mlx5/mlx5_devx_cmds.c @@ -647,6 +647,7 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, uint32_t out[MLX5_ST_SZ_DW(query_hca_cap_out)] = {0}; void *hcattr; int status, syndrome, rc, i; + uint64_t general_obj_types_supported = 0; MLX5_SET(query_hca_cap_in, in, opcode, MLX5_CMD_OP_QUERY_HCA_CAP); MLX5_SET(query_hca_cap_in, in, op_mod, @@ -725,12 +726,22 @@ mlx5_devx_cmd_query_hca_attr(void *ctx, attr->regex = MLX5_GET(cmd_hca_cap, hcattr, regexp); attr->regexp_num_of_engines = MLX5_GET(cmd_hca_cap, hcattr, regexp_num_of_engines); - attr->flow_hit_aso = !!(MLX5_GET64(cmd_hca_cap, hcattr, - general_obj_types) & + /* Read the general_obj_types bitmap and extract the relevant bits. */ + general_obj_types_supported = MLX5_GET64(cmd_hca_cap, hcattr, + general_obj_types); + attr->vdpa.valid = !!(general_obj_types_supported & + MLX5_GENERAL_OBJ_TYPES_CAP_VIRTQ_NET_Q); + attr->vdpa.queue_counters_valid = + !!(general_obj_types_supported & + MLX5_GENERAL_OBJ_TYPES_CAP_VIRTIO_Q_COUNTERS); + attr->parse_graph_flex_node = + !!(general_obj_types_supported & + MLX5_GENERAL_OBJ_TYPES_CAP_PARSE_GRAPH_FLEX_NODE); + attr->flow_hit_aso = !!(general_obj_types_supported & MLX5_GENERAL_OBJ_TYPES_CAP_FLOW_HIT_ASO); - attr->geneve_tlv_opt = !!(MLX5_GET64(cmd_hca_cap, hcattr, - general_obj_types) & - MLX5_GENERAL_OBJ_TYPES_CAP_GENEVE_TLV_OPT); + attr->geneve_tlv_opt = !!(general_obj_types_supported & + MLX5_GENERAL_OBJ_TYPES_CAP_GENEVE_TLV_OPT); + /* Add reading of other GENERAL_OBJ_TYPES_CAP bits above this line. */ attr->log_max_cq = MLX5_GET(cmd_hca_cap, hcattr, log_max_cq); attr->log_max_qp = MLX5_GET(cmd_hca_cap, hcattr, log_max_qp); attr->log_max_cq_sz = MLX5_GET(cmd_hca_cap, hcattr, log_max_cq_sz); -- 2.25.1