Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2513815pxv; Sun, 27 Jun 2021 00:13:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwX0UaKkhVVxT6L0CZl7bpK1YI0CPuvljs76Yy/vLYkMrXDPdBTN0QcLxoS28MMvC3MEzrb X-Received: by 2002:a5e:930e:: with SMTP id k14mr15934225iom.136.1624778034609; Sun, 27 Jun 2021 00:13:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1624778034; cv=pass; d=google.com; s=arc-20160816; b=RiS5p0yEAKMAO0qdYWX5O/AI1NuGdQGRmZjJLPKsn2mOuEWdAJDlD2sb5SLMxwh4u0 zF18vngGJUlRGHITznKGU1FoeVPrDQf/1zPpdtxKSIDfQ1XpWamGINW08IxeAx+0e35+ lfLW0nvtuddBqJdM6z8VT54bqVX2uxMLxJMVJ2kAZL/ZfwEiMddxWWvnuo8146kn0OB5 FB4Yb71rYpAZqXl6VmlY0wd3uCquZ5gG3ItsWRRAiz1F72XE1VIwAj+xE7piaOMY+DrX zsh7YtHUldpoSpURWxKi403dnMlun96o+35aM1VSZadpMsaHHJvngVtZwe17JoxCG/rL TLmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=fooMx7WBOS/aanX8irE85qe45p9K5Px9Z8HRLrQQ1Mg=; b=L+3RGgloeRGfsr10KWCviUzoNG6CHjgXcTYjmca+P9VRYa4Gygp5TL9VCVtQtZWtzN VOd9FtkjHgXpCUpVxH+kDiBjt4Cdt2z/mGENG3EHGwlh/eEYA/D4Ou9ocdM9Hiz72e+b Dk33Lzxw42iLRcPF6ZNIsQ/X4p1t7wLbiSMdShCnLBkOH8QvDf68xbfZ/tKUWHB91dY8 sY1tmymHltqxJ33ZdQsDDkSYfmDDwzqZSh9Q5vwTgZOK/wzO0LQDKxS1kT/dgH//VA91 vF+f774xguvkIkwc9E0MgyqkAfzKCO5EGbzgb9oAJwwNbg9gErvDKalj1EWS5Vrh3Onr KcOQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=iXvYnK5j; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=njsEI8hd; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p31si14535131jac.95.2021.06.27.00.13.39; Sun, 27 Jun 2021 00:13:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=iXvYnK5j; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=njsEI8hd; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230049AbhF0Guu (ORCPT + 99 others); Sun, 27 Jun 2021 02:50:50 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:51012 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230051AbhF0Gut (ORCPT ); Sun, 27 Jun 2021 02:50:49 -0400 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15R6le0H031729; Sun, 27 Jun 2021 06:48:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=fooMx7WBOS/aanX8irE85qe45p9K5Px9Z8HRLrQQ1Mg=; b=iXvYnK5jw7mInPrlXFo6RJrPPDdpH8YS69khTkCFXt1PzAyd44E34pVTZCWuzpbIvV9I aJvMwVn6DtIffZjNDaxe9tQxz+tIVJgP63cp6crtVwzwg7umQXB6NFQVDSpBMFRAhe9n 4SZ8/eL1ipq8TUuOu3c+2GQX7B0d6iuoo8+ObGZ5vPkhedbMfSoRrW46m37aCajJu1tz KEMquFHJuVJ9Q4KEanwFdex3GeI2bllZxlwku3xzE7hUpLDzzeQpAPpifoBDSZJR8gnh M8/9QRfR4ogI7ttVrDEjDseMP/uWkQ9m4hOoHBaWd2xbqgYbcHxCL0P9jGzqqCdDUXqD sg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 39dv4ah2nv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 27 Jun 2021 06:48:23 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15R6jVCk091536; Sun, 27 Jun 2021 06:48:21 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2109.outbound.protection.outlook.com [104.47.55.109]) by userp3030.oracle.com with ESMTP id 39dsbte86r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 27 Jun 2021 06:48:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QrItG52SiRBgzV7l90v9ny0bFpfGCXvGpfOZ5CWq1wYGnHUY9zJ16wLdk4fmn7r79ADq+/9+IZmmKWmUGCHaC/5qbbY5+OC0xjAu/C3S/rxtGwLgM9w1CHAmNZ3rK+hhCEHaG9S9OuHWRZg7WtCpSNyRCuEnaQd8f4Jx++yVtpZopP+0XzMoDs5Qe2/fsXVNqwS1h5mUSFp0Jw0inr1uFwSZnV2mXP061cGlFqpsU7YwXKRvuYd7PONzV61Q8YHDAVjd7cP33SpfBJb7HddlsRijv6CvfRTROmplseKUyqMD3GwN0UpH5+OOPJJjaniEx4tfQFwhQeMtqY60hT/uYQ== 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=fooMx7WBOS/aanX8irE85qe45p9K5Px9Z8HRLrQQ1Mg=; b=g3BQc14CskTtGzEyL8YzR4slH+OfCF+ZLMoZiuW5kZqGiLd5dPU83kT9YbN1EYgUXZ9c6/ahN+TU2nGY1FyDJr55NRHtyNDX4swK3fK2ES5NZcxmDe/EvtYPrbEbax1KPzS1KCEvagoOBFYZSfNwpUMuLVPtIoHzZ937LyOSf2ozHySs8zeGI/xgSdtrb/vnlCyAmE60S2KKlgbLDrl+mbCMMwZ4djRKaCr4BL5ZxdpEfzqk8F2hliAfc+J5UG1tA5qCj5SrpCT2DEXaUqVGZCjhfK366GcLiTZqGvRa7FjI8eefUHuI9EjbS9P1B9ZV8vAMJDuPq3etj3/ZvO86Iw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fooMx7WBOS/aanX8irE85qe45p9K5Px9Z8HRLrQQ1Mg=; b=njsEI8hd5MMDc7qqcoUcv0z8yqJ6Ugx31WQqEWxJXyrX49TuHWlIAv5fU0QubJst9NBdBjOdV6oCxFcnjpWtOvm3+TNyjTeczuD0bVSj1SwNmSaiKAAUBA3LxM4ubtGTSRTjk1jMRQhqyvQOngAz0/8MJFytHGuh+ZB1b1tQW9E= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from CY4PR1001MB2086.namprd10.prod.outlook.com (2603:10b6:910:49::39) by CY4PR10MB1704.namprd10.prod.outlook.com (2603:10b6:910:8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.21; Sun, 27 Jun 2021 06:48:19 +0000 Received: from CY4PR1001MB2086.namprd10.prod.outlook.com ([fe80::19cf:f38f:51e0:a5f4]) by CY4PR1001MB2086.namprd10.prod.outlook.com ([fe80::19cf:f38f:51e0:a5f4%5]) with mapi id 15.20.4264.026; Sun, 27 Jun 2021 06:48:19 +0000 From: Anand Khoje To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: dledford@redhat.com, jgg@ziepe.ca, haakon.bugge@oracle.com, leon@kernel.org Subject: [PATCH v6 for-next 2/2] IB/core: Read subnet_prefix in ib_query_port via cache. Date: Sun, 27 Jun 2021 12:17:53 +0530 Message-Id: <20210627064753.1012-3-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210627064753.1012-1-anand.a.khoje@oracle.com> References: <20210627064753.1012-1-anand.a.khoje@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [49.36.45.114] X-ClientProxiedBy: SG2PR01CA0109.apcprd01.prod.exchangelabs.com (2603:1096:4:40::13) To CY4PR1001MB2086.namprd10.prod.outlook.com (2603:10b6:910:49::39) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from AAKHOJE-T480.in.oracle.com (49.36.45.114) by SG2PR01CA0109.apcprd01.prod.exchangelabs.com (2603:1096:4:40::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.19 via Frontend Transport; Sun, 27 Jun 2021 06:48:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a62deb6f-3743-44c0-d1cc-08d939378c36 X-MS-TrafficTypeDiagnostic: CY4PR10MB1704: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ECNPUH0OFfteoZ31LXPtB+g5tP6Cna4njNNqOu3B5WPLfrLkpNykOw5f9IVTxlGasACYnfGaR5CAfUHl/mwLXYnQlOI4F3M7C211IwIPtw5hHopXuZvfj4LuIJtbxr+UjsySgeEmHiuy714v9TQyJSdHfqQz+VQ6PCgyFZW+G+dZApyUGUI1BQ9rbpoRj/SOo4M3JAlZDit1ibTkWWEjRLMw1fieKNj45azjDORxtAZTH+hBIoM3EbxTvydSATMNBncq/M5Xs1rKSTOAt3PsRaem1ftyvTTQ5VfwxBsptHZra9RJTNYJPIoghs1QJtbpCKOyukVSm5y9GCj7eBzGsxLDDuyVWdjMoZ9hqBEGh+MRSTwxZ9vAZIUIqLmgsGO5yBL6ljgO9WbdhE7FnlpqatxRbMTnS/AUbI7z+GXQkor9wVgyB4nSMkniwRPQyuYOn63ScX1btqNwD5Xwy4VKblBiIb3DukTE+ItnpNqEM0XwvROQe5llQi5lGKiWuDhHjjBphlAp29hvP3OSXt1xLdLcHdejhkqPq4MGaknYFJnW3/EsWBv63gxjMtMsv9IMp+CMykrndW47Mk/TJ8DtFUr73NzIkUYiGYyP7BPIMMIXCTjihht5G8Xq4qIMuGEpMJ5XesC4nbkTgnAadX2Ji8Aq23eqRsS/4E5TpoG3rGti8jzYbDuPLRhlDM1o+1KVPFKh9of/+HpL54lVMRn73A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR1001MB2086.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(346002)(366004)(396003)(39860400002)(376002)(6666004)(2616005)(8676002)(36756003)(6486002)(16526019)(66946007)(103116003)(1076003)(478600001)(1006002)(4326008)(186003)(86362001)(956004)(2906002)(66476007)(66556008)(7696005)(8936002)(83380400001)(26005)(38350700002)(316002)(52116002)(38100700002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WEVLeJMya/w5o051aAFbQb9Divf4D3F10xggOLnvIa4Hk3jez8V4OpxmDmGK?= =?us-ascii?Q?vBQKNedXagHU+7OcxL09hVLmViOh+6ZisA1rglOOPN1nN1MwEUxuYmwfyJHd?= =?us-ascii?Q?glnOQDwnd9ZC47AzEnrrNhq4+uHv9X4BIVv0tobdVpysgB+Gj+rD7aPTPi35?= =?us-ascii?Q?bhzk70kYRfF7jeyuhnBGubCy3KPHFKDhm9OD9tZpeKZchmgFlC+gXM+80yol?= =?us-ascii?Q?D+U/+4rJmC05GLru276KM5s0ShoO4083vFZK+rMGP0INfaAlfQ62CWSTiR0w?= =?us-ascii?Q?F2EqdK3/Hu3QiO8gPJiPtIOszzDHcHhetUzsFSAiNybll8YcfWf3jK7RskHc?= =?us-ascii?Q?iocQ19Q3sAB2ILheV1gPdPiZu++nNVhhvAdHAftFp6bKiisovXwpyLhNfyuo?= =?us-ascii?Q?AZU9ayZ/NNVUCtde1UlZOQupicxfvGlEHeVXhksRL4syDXKY8Lcsx5tPkXiF?= =?us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.com X-MS-Exchange-CrossTenant-Network-Message-Id: a62deb6f-3743-44c0-d1cc-08d939378c36 X-MS-Exchange-CrossTenant-AuthSource: CY4PR1001MB2086.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2021 06:48:19.2330 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CjTue/bdg4OCOeDcu1k50m8FqxamZgvb7q3rT3I8AnuCpqlygeC24ETGwDr8khDn36JLSRJ0e1zXdZFnnBEHnTI0tPOnXb4OovS6weQb9Ug= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR10MB1704 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10027 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106270048 X-Proofpoint-ORIG-GUID: v70_UC-1K5shYghl1kgIwjewFyKfpKKD X-Proofpoint-GUID: v70_UC-1K5shYghl1kgIwjewFyKfpKKD Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ib_query_port() calls device->ops.query_port() to get the port attributes. The method of querying is device driver specific. The same function calls device->ops.query_gid() to get the GID and extract the subnet_prefix (gid_prefix). The GID and subnet_prefix are stored in a cache. But they do not get read from the cache if the device is an Infiniband device. The following change takes advantage of the cached subnet_prefix. Testing with RDBMS has shown a significant improvement in performance with this change. Fixes: fad61ad ("IB/core: Add subnet prefix to port info") Signed-off-by: Anand Khoje Signed-off-by: Haakon Bugge --- drivers/infiniband/core/device.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index fa20b18..9ad10c8 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2050,7 +2050,6 @@ static int __ib_query_port(struct ib_device *device, u32 port_num, struct ib_port_attr *port_attr) { - union ib_gid gid = {}; int err; memset(port_attr, 0, sizeof(*port_attr)); @@ -2063,11 +2062,9 @@ static int __ib_query_port(struct ib_device *device, IB_LINK_LAYER_INFINIBAND) return 0; - err = device->ops.query_gid(device, port_num, 0, &gid); - if (err) - return err; + ib_get_cached_subnet_prefix(device, port_num, + &port_attr->subnet_prefix); - port_attr->subnet_prefix = be64_to_cpu(gid.global.subnet_prefix); return 0; } -- 1.8.3.1