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 47782A0A02; Tue, 4 May 2021 19:55:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 34C49410E9; Tue, 4 May 2021 19:55:54 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2050.outbound.protection.outlook.com [40.107.243.50]) by mails.dpdk.org (Postfix) with ESMTP id 6A78D40147 for ; Tue, 4 May 2021 19:55:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjudDJau6NFC6tjWkLf6r6PzpTyPCkPX5IB3NzuVJ5SiTWHbJ4P3jz8uLCXVv88suMnWI2rXuJq1+/THagBoV8DDF63PlWcanUI9pAyiwGFL2s11YzGOkt551UyyRjCQ0i8ImvMzOX+dC96K2fyMPZH1pAoL7sBSCYiFZ+l2t4AyUGXc0eGKTB3SB5/eMtLh0niRMzRDtVtFHJov2sy49uNXJoXmcp7Az2qpx/dMGTkW05SvnLcEzlrwqMPTqWKSbaf3DhRRegsYMKN2BdWcWPctFjkd3W9UoQUwWScs6gsWMm5IQQzDog//OUH4h3xjaKrg/ZwhHhov2blizUoA8A== 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=H1fKxF/HwV3ePbZC0yzLry/m1jE5vTi30fC3tlUYuqpk3ttEpJdytRVYUYzvpBJ3qQbeCOZ8SsP1RQhwuudBBB8JFuLeuBjQe7xz0VnQZzk2AS2zhibuSAIxLuzeYOh/YCTm0F1M3jDPhnAYoA0Dt2WGYnaNdO0KdaR2EpibWnO+F9GDTgwXub9PInqvc7za6UWqF4L2iEyTBlGr3CGqsc+f/edCTvYdmb4mprDZ9QAVrhT9bF172qR05YHBLn/d1xppXtlXbc7fNBnMkxKs594fKDXNW9CEru7r2gxUJeDlRrTF5PNwfk+fYd2rqNR8wgtChXKltcXg7+UDptFPlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=monjalon.net 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=ZyR6JrJfTPHoX9h6o6oE8tbvE6gc/ZmjgiKzuLK1EnMyDBtL3aJO0pBk6uJpixuqhgZZh8k2kjRD86gu2xuT+agoGjkzB/tHnQ2ihSDNAnHqiHqZPOFsAIIc/SPHS5aFbkzCMsHiUIYTDRpL8W6TiKXdxv+i+l8TvdlWfELhm/+ai0ppmmAZaFZGIZys2Rs6bb/ifXItP/oPmP7QAVX2aZi6g4NhyY9aAdSNUW3EAVq6tir0D2PKaQHqBrSEvbC7Bo08zEH0Fm6XcD20UH1mnc3YHHLRCQeSYp2vc4ZOP8KpfGlJEfeypCsl0kqS/Znkumd99i3/IgskxiAdDyPXtQ== Received: from DM6PR02CA0167.namprd02.prod.outlook.com (2603:10b6:5:332::34) by SN6PR12MB2733.namprd12.prod.outlook.com (2603:10b6:805:77::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.41; Tue, 4 May 2021 17:55:51 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:5:332:cafe::e1) by DM6PR02CA0167.outlook.office365.com (2603:10b6:5:332::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Tue, 4 May 2021 17:55:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; 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 DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.27 via Frontend Transport; Tue, 4 May 2021 17:55:50 +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, 4 May 2021 17:55:48 +0000 From: Matan Azrad To: CC: , , , "Thomas Monjalon" , Dekel Peled Date: Tue, 4 May 2021 20:54:48 +0300 Message-ID: <20210504175500.3385811-4-matan@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210504175500.3385811-1-matan@nvidia.com> References: <20210429154335.2820028-1-matan@nvidia.com> <20210504175500.3385811-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: 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: 5ae8b0ca-e8be-4481-ca8e-08d90f25dae9 X-MS-TrafficTypeDiagnostic: SN6PR12MB2733: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr 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: 29QrigdKbNBIVyI2ObXp/Eu1WY4CrarlJjUpI577FikUnam2dh6j/6R8TP8at0kC+ejZoFndWmp8pgPbjvCWpShPNj0ibaONcz7EgS/F930K2ZrIj/h5Hhvpfyj3uz21Y5cXWHdejX8NREuFbDKiqWCqB7m1GU7kxqQTRsy0OGsL2186hswS/jFIPfvD3fmwArK3j9i8MOAHiBAgLLc3OlqrvikDuvUCKJRzUB5Kcbit6eNKJzFLAhJegP4WWan7A9+OKOh7LbnZQx6C3wivTk4u0tfQa6xL38j2ovJmez4XICZRattVnzUHz5iOqxvzp9BYTqhlrd/E8jBOwTdJcuQKe9GzIgvtoclCwa2UPgzvycHZNBzkRSa/EvhwiCsYNt7R9uURb1dzXK0zOxBmHxlX97KOM9VlXapNJ93zwIm8yJde1nJ6sy8j1SJx8hwgZBWadAj9cyEleAk0X2xPPLIB6ZLGN99Ji3/dPqXrPPD9HCQl8rTFIPVYWRvK7yJRrGvyXlM+qviW1U7IQQ2D7dTkTUwYEjKrBUPgAqU3bwQmg12CEji/7LXBu8hTX5HnM8yhjfG5uczNOPcA4x0+N2NgDDIapAB9eOLjr6VgjNmq6f/qne1NwK6q9EmjXAllKwou9tBD1JxkXRSwkDUxY+OfoYmbz4HogErHoekuV7Y= 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)(376002)(396003)(346002)(136003)(36840700001)(46966006)(47076005)(316002)(8936002)(1076003)(336012)(70586007)(6916009)(70206006)(86362001)(82740400003)(186003)(478600001)(54906003)(36860700001)(55016002)(5660300002)(36906005)(7636003)(82310400003)(83380400001)(356005)(8676002)(6286002)(107886003)(4326008)(16526019)(36756003)(26005)(7696005)(426003)(2616005)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2021 17:55:50.9507 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ae8b0ca-e8be-4481-ca8e-08d90f25dae9 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: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2733 Subject: [dpdk-dev] [PATCH v3 03/15] 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