Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2929091pxv; Mon, 12 Jul 2021 05:29:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtb5/lPfVuLro03JCJh70Aeu11DMn4iEeikRKASevEjQKdc5qK9Nek7P+I8BW/ILBv9lfh X-Received: by 2002:a05:6638:3882:: with SMTP id b2mr32512572jav.15.1626092962308; Mon, 12 Jul 2021 05:29:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626092962; cv=pass; d=google.com; s=arc-20160816; b=hdjDiQTN7C4id+ALGUtjSCFfRYDyYWiZhc1FG0qMQ1FK+DDHHzWeayW6WGUid8W8zd gAQT7W8EY5slaIsxJdWLbzqbHxvc59yq1z6G2rXN6arA6LRhf9ceKoQBgQVBy86DSSRS 8Bwdp6ot1X4MAX1ju5rKUyy5SuTDwyW1z86Jag2VM5wQ6pwqc7wNGBrZ71s2RCvWklPS L9qxsSU9eww6GgAd8KVoqM8ucpswCLUhiHeKFpwWx6bTbqRZAGXyHEqwfmBuq85v/fKJ zN9XlHUa5gPGTmSOBahTrIhl9vmUt5RakVE8ZXsjhH3BJr7AdyA+UgwCWWyI5+6qSiti yE6g== 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=nPL9GAXtRlfciMoN/+AWdGirYzSQ3Lj5Ad3nP/ubmeA=; b=uaP9JQZaLLQMBlPRIofaIOvfSvxmRcr5ieiNLWf1iiKzirP5SlhC4zcpiZfupQWYZp FTUDlriKuQww6gcjSge7YEE3n5RzcJkl3dgT6aOHJoTX+rtx6/P2Qc/I0y4qLS0KYpeF WPueSgnY6VDUZGB8yPfyQyyos8XtfVDSK+0e5uuosE00Of+v4ZmugkLh1dMW7RJZhJ2u /pbuQ/Yo8wdrq0U6EIhZ41JEpsRDyqeYG0VZHkNBMWc4j49tFaFxvbGTJwPou2j2QcCG amAeRI0uft7kODv1EB/OrlzHIkwTijQJKEhWnQzWgk0gRWNjWyRfyjDcZ9Z+46Mekvke GJyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=gl3nhTqZ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=RqWCEtpa; 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 t3si18546548iof.33.2021.07.12.05.29.10; Mon, 12 Jul 2021 05:29:22 -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=gl3nhTqZ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=RqWCEtpa; 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 S233600AbhGLM3p (ORCPT + 99 others); Mon, 12 Jul 2021 08:29:45 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:47646 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233028AbhGLM3m (ORCPT ); Mon, 12 Jul 2021 08:29:42 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16CCNGJR027762; Mon, 12 Jul 2021 12:26:52 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=nPL9GAXtRlfciMoN/+AWdGirYzSQ3Lj5Ad3nP/ubmeA=; b=gl3nhTqZMWL/BIYKZocfIWXwQi5JAE9AAyS0rW/xrT+IsT1xlBKCGQqJYKrBQaMoF+SK P8DZN2vPErvCPqhTt71etuPYSMvCYQKqt3MudlnVe6adKARbKD1qTyXm8Vs09D95C9lF 7efTPZpx3aKfZ+W37kdPqg8+Ac2DIK79L5xMM2VB5EV+ADU6+5NijSt8pmNPaBjLlAsJ taUbD3kpv72GZ37o4pNx32dVou5ocE9eQOucIa9XnNLwU8B0cXHqTZHd6P52LN31+J+i FfXnEjnw/KNvSfCGi6NBi2XrmW9UjpKPMRgoi/WOsCt5+Qz5zBLzdzCH0CrI0cgNWe2m Og== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 39r9hch0y7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jul 2021 12:26:51 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 16CCKpGn028598; Mon, 12 Jul 2021 12:26:50 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by userp3020.oracle.com with ESMTP id 39qnatuwy1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Jul 2021 12:26:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ST2MhC0EzHWhfUwpSZOcX08vWlHqACl6Vcl1d+NxotRQg/YVpsFs5/GMRnGlioWjk0x1gICGTKobXLSOoUSYA3pL2pHFzzjQpwBzVYtJAjx9LxqWuqoeRRDFbF8inb+Ziab3xOXXt0MQxVxabxBchN0gvi/fbFgRsYrAAj29etyJ+dLvkyO/oE0qoCerzoDGVRf6gyyaaYdLi1yp/kUl9CEDAEvOLt1HWAc5eXBPt+abpE+uZcjQD2PFIHvjcuFdQa2knHqvwmYm9ApbFYXX5T+TlpKj8n2Xo8em1bGDHy4yX4xVnmK5RvfV1omYIozXkxiM371BSPAuQ6A0Y6UKgw== 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=nPL9GAXtRlfciMoN/+AWdGirYzSQ3Lj5Ad3nP/ubmeA=; b=Du5pA7ZHVGXfE/Nvqt6JXfroRcLASJRN3kvOLyM8XF/wTYj6ZPdYGecrgYwWKK3sUcEScydWeTNYz3dBn8hv1AcfzeUkOvGvKz5PaKepM9uy5XhcWNxOAhBag+BJDTF6PIytV/a4MHCamDABD2wvUuNS19uybJlbaTyJ2baVC+Ye4bf8At4ETYxYwUkcmlcYx9FJz6SW9SHbDmazqVRYqs8pAkSEqATp4FY4R8qoRfdvU2tYg8SkzNFEd1Htp66+SM7r6PYxLFqEXXYBZlB9Q7wl94P0h4nl181JxUBKw2yaw2t3a6z8FdlWyVPkInwJQ7B3nOd+vUEVcF/DXUM3rg== 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=nPL9GAXtRlfciMoN/+AWdGirYzSQ3Lj5Ad3nP/ubmeA=; b=RqWCEtpaGE3UWZMRi73yEdLmoATV+3zZ/C65SWWRDNqUnHLye4AJGwUnFTBr7sb+6g9jYL0gYI+uLzTP115XLukQ7FSWE04AVVROYB4TGGU1lUvjhVDl6yEQ7q74f7CpEva16Hwt2RDcyMAPIg0H0f6lJ3uT4qWA0lIEZqYMp4Q= 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 CY4PR1001MB2262.namprd10.prod.outlook.com (2603:10b6:910:42::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.22; Mon, 12 Jul 2021 12:26:48 +0000 Received: from CY4PR1001MB2086.namprd10.prod.outlook.com ([fe80::9dcb:26d6:7408:b4d5]) by CY4PR1001MB2086.namprd10.prod.outlook.com ([fe80::9dcb:26d6:7408:b4d5%6]) with mapi id 15.20.4308.026; Mon, 12 Jul 2021 12:26:48 +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 v8 for-next 3/3] IB/core: Read subnet_prefix in ib_query_port via cache. Date: Mon, 12 Jul 2021 17:56:25 +0530 Message-Id: <20210712122625.1147-4-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712122625.1147-1-anand.a.khoje@oracle.com> References: <20210712122625.1147-1-anand.a.khoje@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYAP286CA0005.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8015::10) 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 (122.170.228.204) by TYAP286CA0005.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8015::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20 via Frontend Transport; Mon, 12 Jul 2021 12:26:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ac9b8072-f781-435b-f5cb-08d9453051c4 X-MS-TrafficTypeDiagnostic: CY4PR1001MB2262: 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: O0fFlVNL3EkLSZTU4gJnonv1WLMzZwZjqiTAxdWSSPoGXEoW8c1hk1TTBUy5siRyGQE3GcFHsSO25WI/p7UIHlFP16//SdfgLTRCq+JLrOA1ocDs8bPAZRp/r/09lD9KoiNuGVwQYMfur1/AZ6yyqJWUgLudPB3WikXEhMMZGk4131sHrnMUA8ZG/wpxDWsG3vegYfBVHYPmdYPCHL+7LRfTcvlVcTwIhpiUTJYeWWye2feXmgZNvdqExWLRPNwTxJhPVKr3/NAy2uFJrVJXBKRiH8z9VGH/6dQYp9iZK4xZBb0a57T7z4u75UwaTZyK4x3s6VBy5usBhkVkx93IbE3tsp0X8O7dpWmZB5KxeZMCYK2ClngHiEOFvAVR+JdPDOWzRGfRfbuv96Xodqvg60GMRnsq1R6AoVl2RREiMv/F4LzX0i795Cminz6KTaelua1eQ/InoIoOPUNlpPcEDzfMycA7Oqy1hYRq7CaMxxFQDXfG/9ETYoz+WFfnGtuDCmcpe4xAPt9tphHUwacW5DGehr2u/bPB7casCV44E1fZ/u69xw2Fy93dwmBfqGLYYnp+VSFM2CBj23a4MqSoROygyIBKuOAUgYFsqriGJGBOzjharLXX1mRt3mtPOMiWqKgzgVxTXm34ke0pkSBKqX2+wCs/XfTMwzoHQ1ND4+D4l0rHDOqYhErgsj5g4gkDvsxeZCLrTwjZxj+8pY/ORA== 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:(366004)(39860400002)(396003)(346002)(136003)(376002)(38100700002)(38350700002)(5660300002)(83380400001)(66556008)(36756003)(6666004)(186003)(26005)(55236004)(52116002)(66476007)(478600001)(103116003)(1076003)(4326008)(956004)(2616005)(66946007)(8936002)(316002)(86362001)(8676002)(2906002)(7696005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xhNeym7Aie8zZ2PBEukDQU1/edS0BBg/Dbcf5KYVJB9K6jsG6bubvySt/A2Z?= =?us-ascii?Q?l9Te/6/2Gx8zjkVheCtI4H25PA+t3wdEjPsApHHQFNXI9Z6CYVeh2dCYhscR?= =?us-ascii?Q?xSuBn+qn15rMWTofsxhUhsw0/ZmvmnH0Oy4jy9nWzFssYV/H8YteD/leqdiQ?= =?us-ascii?Q?6iqiN6jsmkhiNrNipRuhJO3h9pci5de4Myn50RczPOVHMqKtAn+lkFQaVxTe?= =?us-ascii?Q?zcherx+0Lz4Hwv0A0SnL8SGzgjebwCxrjnp1OKZGCntgmVyrHtYxeHHQrbRd?= =?us-ascii?Q?vnYgXEZXp5Sc3GGSG9Ed6vrPPxIlXoQ5vhIvRJYvltJBnNSgA5JDAnfyt3Xi?= =?us-ascii?Q?LQb9JKI7teklQpWBPbtTJZMtJzkiWuPk6FricQ4KW54y5z3u22F5t91/mROU?= =?us-ascii?Q?dsaFiShUKnywOObRwEJcY+O89mfeZYuFh0PjfZqazZIwYIx8l28os0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X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac9b8072-f781-435b-f5cb-08d9453051c4 X-MS-Exchange-CrossTenant-AuthSource: CY4PR1001MB2086.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2021 12:26:48.6142 (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: AIJ4gfSzWXnOsZvQmDA2ycBDE9vVc9axYn5EAUqYKZDpBw/1PYUwwejmKEy+dZ2L9mqaROowzxbyybjpZiuOfLXY0J1BQDkwrNv8+6kvHiw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2262 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10042 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107120097 X-Proofpoint-ORIG-GUID: hEbnMwGRPH8gCnpSl3rTDWywQPOEzzlH X-Proofpoint-GUID: hEbnMwGRPH8gCnpSl3rTDWywQPOEzzlH 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 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index ba0ad72..9056f48 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2052,7 +2052,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)); @@ -2065,11 +2064,8 @@ 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; - - port_attr->subnet_prefix = be64_to_cpu(gid.global.subnet_prefix); + ib_get_cached_subnet_prefix(device, port_num, + &port_attr->subnet_prefix); return 0; } -- 1.8.3.1