From patchwork Mon Jun 28 09:29:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12347507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1B3C2B9F4 for ; Mon, 28 Jun 2021 09:29:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E16C8619F1 for ; Mon, 28 Jun 2021 09:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbhF1JcM (ORCPT ); Mon, 28 Jun 2021 05:32:12 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:37722 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232152AbhF1JcK (ORCPT ); Mon, 28 Jun 2021 05:32:10 -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 15S9LOF8007220; Mon, 28 Jun 2021 09:29:42 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=2jc2HTXzMepww3QH2bWX+3YpvCGaGqs+ihG1ComwaOg=; b=CwCxUexiPlZ2s7xmZ/9eWF66k4SrbPRqJE2EEyE8cuSPPWQDhHwJSSDB6IEEtlCZj+R0 DGatZU82oG75zT3YQdj1XJST1ypfYKp4L8Qy8Ip+9S9ULviQENMuOv1YrhemZKsSsQGv I8BrkjV4nWA1X/xoItQelA02LfWN+VvUcCdFdvaQB5ETc/ASA5nlSYjbO+1fvrufno9j WrVZCYctY1Wn2aymCoTojzlE1ulgFFOQreXL6NalUVpNcfQetwgfPH1zwKrHmTrh+iXL n1mbG0ODvxTP+Hw6jsseip5aZ8aUUT3M1y7jPaR2kwSQxe7V6HSQ8qCJ+5rqRsLuqIlU MA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 39esfks6n2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Jun 2021 09:29:42 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15S9K1KN126863; Mon, 28 Jun 2021 09:29:41 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2177.outbound.protection.outlook.com [104.47.73.177]) by aserp3030.oracle.com with ESMTP id 39dt9cfgu7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Jun 2021 09:29:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cusM2iPTNqDaWa+/7gqwg7pfwxRemjAdPTnouUK1COja14cVTKFSX2gg/SwICm+POqQbceg8lmeT5DcsbYre4CryMH4+wb3iJoJAOdys4TMiR1JwUGwcaQRO50JqGrdiRWwvK0jI5udTeOhXeogXKTe1ulnfXCEAepXffNhzMfci6s/+2yP1ecNkKQFvJpkQZ4Rw+p3Ezr1ILvelp2Q3NsTJHTDcmmoZrslOmDKSz8SAzdj55zi/q5CWeJPwXKqzOKNWrOu+JEEGLSybuBZppCSwdF1Q90B5Nt5nV6zX9Ajpp7P7fIMFYGux1d+FqBgxJdmfKMNlIi4sk7v8pIWmKQ== 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=2jc2HTXzMepww3QH2bWX+3YpvCGaGqs+ihG1ComwaOg=; b=Pi3DIxhePxg2TJZdKLZAyOPBedLXlGjVp5CqceW3ZKiX2QKOKHdLxldZ4qdo2fFSCMTYJhMa95Zb1bo5TMPsnoaWQFDIdukBMqXOGzGQAExDv/AP41nc7G7hyoEdPkCXqpbBYP8OG7D4zLFu3+o98A9jRWHDC0i5e//rAODXm00s7Mst0qaLftMlzVdRNiWEpWAtuM/QLGidr5bhtMMvdm86A7KH3LWV/UISC2iqoqYpspqgA+0yeWk4Ywkr4Cp+93OK9t68U7U/j47cPhGGXLJmZVJ9Y+e7tstX3sDp4foIS1DMDdLlIypiSv8N6znTQtKQr1gGBNK4lIXLJwvGnw== 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=2jc2HTXzMepww3QH2bWX+3YpvCGaGqs+ihG1ComwaOg=; b=f2qAIUM7ajwttWfBjefGCUTX6LUB3cBg7/UfWBVfZe3DCWi40tIEdBXH87Sd6DNYK58DlUs5bzrGFtqfzSUGFeluxfucmgd383XaQnLUHhV/TSC3Ji9UT2Vh9kJR7k1QW5i020FEZylZ95yJA2SlQMJEOhw1rD5lXpGofyvZGrA= 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 CY4PR10MB1607.namprd10.prod.outlook.com (2603:10b6:910:e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.23; Mon, 28 Jun 2021 09:29:39 +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; Mon, 28 Jun 2021 09:29:39 +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 v7 for-next 1/2] IB/core: Updating cache for subnet_prefix in config_non_roce_gid_cache() Date: Mon, 28 Jun 2021 14:59:19 +0530 Message-Id: <20210628092920.1088-2-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210628092920.1088-1-anand.a.khoje@oracle.com> References: <20210628092920.1088-1-anand.a.khoje@oracle.com> X-Originating-IP: [49.36.45.114] X-ClientProxiedBy: TY2PR06CA0011.apcprd06.prod.outlook.com (2603:1096:404:42::23) 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 TY2PR06CA0011.apcprd06.prod.outlook.com (2603:1096:404:42::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Mon, 28 Jun 2021 09:29:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 376678af-6904-4b32-745b-08d93a1740a9 X-MS-TrafficTypeDiagnostic: CY4PR10MB1607: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H8a++wa4XUnLnwVuYKVadWqhw6u714z4eGnZ7AMIaSuKaxcJJ/2mYjNzSthn0BzSHtIQ8uPMc0djVaDepGdTFbZ1y8u+ryCpfGGEGvB0naFf3PmXPfEkNO4bIIdgbRHSIPuziUYAbLODRpN4RLINOt/bQ/l155EiXX2sJBMCD4XW1C8OL/+U61rj39ch1BiE3+ZhnrxYT05xeZ7K8VIXafAERg1fMq44bMdX7dGmc63+cbMesYDnR0yB39W+SDpvpESL+KDF9z8qSK2SHTMHSx++Xd5TJ+APMYmuo9vBHnxzLtlJbp2lhKDvke0+3raD/Mfgjw+uwdlYriOoMnWnbLckiKB9QLll7B0ew/JjOnYHK0wVVPGkhVmxCbziQUVJxUcK3jE/pDU7/bCpsvngebJ4NTU3KjYb9rk+a5vDcJnCWtp6hIMHWEQ2maA8jrko5+kwp/JhBzMwLZOo1FRGMMZfw+y9nDrB0nTjI/fgvGnPTMXRw/WTdJlSNm58f4r+R/ZETKv7MEboYJrkr5xYdkDp5kJ0TOnNjX+/kJizKeB7KZvjCjqJiTOGo68axyYVaFnaPmJL1OI08bP6h6H3lKj2P5rOkonTgMFsac19L9PlAAuXjl8PlSDPLFrXjrQ1gGiZWg7HVI1uJX+pvHm07lxr639x0i+bDe2CiEO67beGaIRGBulXe4bPmOPKU++efbBNklyC8LyyVjo0m4c2+A== 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:(39860400002)(396003)(376002)(346002)(366004)(136003)(6486002)(8676002)(956004)(36756003)(2616005)(4326008)(7696005)(103116003)(478600001)(8936002)(5660300002)(2906002)(26005)(52116002)(83380400001)(1076003)(66946007)(186003)(16526019)(66556008)(66476007)(86362001)(38350700002)(6666004)(316002)(1006002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yww44T9epgdy9pkpstCO1KT36cZ5L1GPKbTC7RG3f3x4KJbX7a8aQwQ/S92kVwDH6d1ykEezECX/hv+r8+FXl4uELcNE6w8Y80NQJvI+wettHngqk8zRu5lclC9rAYexbpm7ThBhuBI6fzvQKWfyHzeZhTT3qHf6e01KNxVnnvPK4CNUCyhX4Vd0uX/DlrZcxvWx3kXildM3Ircd2zKFq5moqtIYlh/8PEAnJYD/OVONoUg8FfuLOcpa3jAfw8gW3QA6cQY7ZSE5zO+krhwmQ+ZGuv7aC7Q3ACdiXzwklEWy8s6DMgJxU/3hLTdQIBAe33guxMV2LHIHzmSM4okSNf/5qJGmRi5vMRCrHD5/Qj8g1lBUY6UMZFnJwSXPwzZsP6pXGwm7RKzX8lE5juLsjvVVa1LFp7RglK9G91VEWutLVQNyAbCsDFif0G4y6gObkgaRhie7+nM8M+Agr7uEwr4NcuHgm9nj9gzcELKBYUV9VdBJZYw93Ou+6sfKqiq1n0rndnmqoN/PYnNamN1ACaJpNRtHZHI3NpJh48GZg1zHCUSSKs5W/2uA3nP7bjfJQcIapADrne9/wSwdwi11aTELohLLeIzqh2gZi+xQNu78MNW4dK9S7XBlgZtZmdcs3JxCHKxKxu+Ox5qeiuY+kGI22lKdj8EuJb2kJpUGXrcsr4OuEX3MFxQixsSTeSdpBJIxEUwlmgMVC1vwie4cuTuJLrMdy8SYFziONcOWy1qZkdoiY1Hp2saWn2bZOAP2xKtbY624vMEB+VqSkWvqIUB4ytael6c6QZrTYJUIMFgYHNx6BtyAq514Huqj/VJy2qpq9KpEpD9nXxNgM7j68ubY299iVbmgUvn9qIBIPkdJxnFTmeal5DafJJWCmyuxyGTehK2n/gmNr+PZTALlsMgkqPeoeQK8dqsZLM6kpW5LMJ33CDQQIPhCSo+hI94zIZDtmLEG6Z4J/wvhkr/qqTIJuKAhBTGmDFUL9GJu82mVgfZ+GmG8HXAiS7M3jYUH1XhyAS1p1EvMNINSquZN6/bfaRZ5uAoSjhUqFQOEZaIzdWMv2QM1XsWvFudKe9MeBd0H7/G6jw2xEmVI9AIpt8VtoquSswtdfuDu6suqA/HTFmZOLCkAN5pWdgyKR86z1Kaz/boIezUpWotZEPfpb8MabwPWq9Uy/Wwoo48TcWijZlLYd6SlbDGBYvSN/k0qmtHudKpg7IPxD6xNuX45XSieS80c4C3R6SoSumudFvylYzKpMwe/xOS2+N/5LHvo9C9oC90izLE7yvOSbrxZ6XhebfWZX03whIhf92J1KXfXDB13QIIMQGwzD0ua9dbC X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 376678af-6904-4b32-745b-08d93a1740a9 X-MS-Exchange-CrossTenant-AuthSource: CY4PR1001MB2086.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2021 09:29:39.7029 (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: hSfz9BQVdhI4cXkACF8PU632p7nUCpvPVlULF5IPpsYIfzEM6QFSaqaNrxYYyNW+CNNQh2JWozsC+HS6hs1ZXkHPZw6xmzI8VhEmecQLmM0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR10MB1607 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10028 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 spamscore=0 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106280065 X-Proofpoint-ORIG-GUID: _Wc04Fv4aFjykfQZ4z5KQdeLGTgGxk1P X-Proofpoint-GUID: _Wc04Fv4aFjykfQZ4z5KQdeLGTgGxk1P Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Currently cache for subnet_prefix was getting updated by reading port attributes via ib_query_port. ib_query_port() calls ops.query_gid() to get subnet_prefix and returns it via port_attr. In ib_cache_update(), config_non_roce_gid_cache() obtains GIDs by calling ops.query_gid(). We utilize this to store subnet_prefix in cache. Suggested-by: Jason Gunthorpe Suggested-by: Aru Kolappan Signed-off-by: Anand Khoje Signed-off-by: Haakon Bugge --- drivers/infiniband/core/cache.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index c9e9fc8..929399e 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1429,7 +1429,7 @@ int rdma_read_gid_l2_fields(const struct ib_gid_attr *attr, EXPORT_SYMBOL(rdma_read_gid_l2_fields); static int config_non_roce_gid_cache(struct ib_device *device, - u32 port, int gid_tbl_len) + u32 port, struct ib_port_attr *tprops) { struct ib_gid_attr gid_attr = {}; struct ib_gid_table *table; @@ -1441,7 +1441,7 @@ static int config_non_roce_gid_cache(struct ib_device *device, table = rdma_gid_table(device, port); mutex_lock(&table->lock); - for (i = 0; i < gid_tbl_len; ++i) { + for (i = 0; i < tprops->gid_tbl_len; ++i) { if (!device->ops.query_gid) continue; ret = device->ops.query_gid(device, port, i, &gid_attr.gid); @@ -1452,6 +1452,8 @@ static int config_non_roce_gid_cache(struct ib_device *device, goto err; } gid_attr.index = i; + tprops->subnet_prefix = + be64_to_cpu(gid_attr.gid.global.subnet_prefix); add_modify_gid(table, &gid_attr); } err: @@ -1484,7 +1486,7 @@ static int config_non_roce_gid_cache(struct ib_device *device, if (!rdma_protocol_roce(device, port) && update_gids) { ret = config_non_roce_gid_cache(device, port, - tprops->gid_tbl_len); + tprops); if (ret) goto err; } From patchwork Mon Jun 28 09:29:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12347509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2969FC2B9F4 for ; Mon, 28 Jun 2021 09:29:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E54C619B2 for ; Mon, 28 Jun 2021 09:29:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232556AbhF1JcT (ORCPT ); Mon, 28 Jun 2021 05:32:19 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:41928 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232536AbhF1JcO (ORCPT ); Mon, 28 Jun 2021 05:32:14 -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 15S9LtRL029749; Mon, 28 Jun 2021 09:29:46 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=af0IkJc3lxR3eYOOygeUUzolcUHuEBHqEPd78I3SJZM=; b=AVT7o3DeHvfMoDbEDU/vbP+rPp3zgUSWqZKI2kHdemynJh+YhFWbBQ0D7CjKvp/GvGq+ UAHSId69ZT2NEXvPxmfLEaR/5btlNlHTH0xOfYQU2KLMryl/l47PQB/TPgU+CC5lMlIs NBvj+e0pxgy1vQXHYWR4Wok2fuUMajzj5gnxyMd/p8jTXCwxTljRxMvxOUsdquaJovoM RvWrblddPa/++Su3P83zRKKhj8milfnh9OS2rhj6B1W4fq939bCmeQdfiDc2YUWO1LmA lVCERMjj3O2gA3u2pMCiUA8OgQh3a0ZqiiEeF/lq+6lWHRa03x7X/tGr+PeHQUC6xjd5 Kg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 39f6pq8kxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Jun 2021 09:29:46 +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 15S9LZse135012; Mon, 28 Jun 2021 09:29:45 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam08lp2174.outbound.protection.outlook.com [104.47.73.174]) by userp3030.oracle.com with ESMTP id 39dsbv47sb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Jun 2021 09:29:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FX8ML19qarf0vx5n16UTX1QIU/FHqsd8XMhH/09S4ajjUMIeoWyQou7b7chx5lRY6rGHBV97raMyp5YFerswJzY5KlaNzN5jhdjTeYCYNwiPR3XrCDLO9esYmkW9BD+iYGAqR1QvkcTqDnbQsk9wTiO6GASgfVSv5qfDjKTcuKePeZo8BNswV8zFUBASgPFyZ/e9/naee7pFAJbrnKJAw+QuuUpG4ROvo4keh+PPIFuxGmUkUl4w/G2oYbW2HUzPiUyj8AEqKn2Ql3YR1da8yHpgmpxkqbwNVWru/GkLU1Zr9C0qGbb0PS2urS9TSGcyuGUwPcoftYPVyuXYM7ZGVw== 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=af0IkJc3lxR3eYOOygeUUzolcUHuEBHqEPd78I3SJZM=; b=CQbiDsn0soOHm1FEhitebexz+z3iGO578VSR5Gd6sMNqyC8HEC3fFE3akxy+yOyLlaXb8snXBttcTTTPb6aNxWvbL4PpabcSyeJgsRiK2HWLPJtMaHATbiKF9oIBTiHy1cRtUNfb3OIOstYj2kLF9XJuOnpsJ3PIfbx6bHhtI7wPokDOost9jZ85ZhZr9abxp05Ze/CWua5tXRYyAUBBNf1VGhXIKJEYUV/zDGXwtriEufcXY1QjdfrVOChQDhv+pmAq0ANIp2wdIvEz7uPh1wJQSp7lG+3f4xaCZ966xURzPlvfrdmWgAa8WcGVzinHPildXHBT3XtU5CixGLk9IQ== 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=af0IkJc3lxR3eYOOygeUUzolcUHuEBHqEPd78I3SJZM=; b=dFtt/4q/q0l6FK/YW9u7NRLnRvBCaY+4+/Pe5ZHW1lPof/o5WSez/TkGZ/8B4e+pZNL3v0878kKWPvTkDlsmyYNLVzejq11j10klADHiw+SPjwP6JmtU5r7KZcOODJXTctNb12h9eVyjkdXiFtld3hqgNF5gB72HnidOAeGncvc= 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 CY4PR10MB1607.namprd10.prod.outlook.com (2603:10b6:910:e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.23; Mon, 28 Jun 2021 09:29:42 +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; Mon, 28 Jun 2021 09:29:42 +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 v7 for-next 2/2] IB/core: Read subnet_prefix in ib_query_port via cache. Date: Mon, 28 Jun 2021 14:59:20 +0530 Message-Id: <20210628092920.1088-3-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210628092920.1088-1-anand.a.khoje@oracle.com> References: <20210628092920.1088-1-anand.a.khoje@oracle.com> X-Originating-IP: [49.36.45.114] X-ClientProxiedBy: TY2PR06CA0011.apcprd06.prod.outlook.com (2603:1096:404:42::23) 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 TY2PR06CA0011.apcprd06.prod.outlook.com (2603:1096:404:42::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18 via Frontend Transport; Mon, 28 Jun 2021 09:29:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b68a413b-ab26-42b3-4161-08d93a17427c X-MS-TrafficTypeDiagnostic: CY4PR10MB1607: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VvQDy8poWZw2eJ8WBrO/A8SKYGx1RHAYZ2gedo6LYAVz9/JPaonpWrRhXO4/0TCgFCFBU2c/GEto+WhbdUyzQZtz3m562BC9uu9iCZWyg5ifsWVuzPMLIcOtB5DEgavyGM58ffWA4O1zXb1e4ihJLsvKgAdIHJl89zd4Yjcb7g1RXxBnWAVv59i3Eg0dxQjcPBanbVCOKh1eftiKJdUv2SrUO+rvoYOznkOyl1/6C2UJdvlJaQ2wB1crlve47afacIN56NNzSMVFGlOqWXAPweP1+TNXYc/LIkbUoFIjQXqmoTcF8SzkFeKTw6aA0KXoqaJnDgWcLTNsN0nwlvNa5RT7ZzwSdCRP5gXhrXH9VHfD5eKupC58TFiXAzDdlRthioFQO8THXQuTCPnA9gd5+qL7lX1rw0zCfwayEp7fGodfH5zUtETUHe2MmOGWpDOHlQlEA/6Qx1M49Q5NowAyAUmsLMLN52+qYXVpRAkvLAkzoUNcCUdD3M1Ur7slerHINhM8vabVKxZje03EAQE6vLxNk8+DtwtT+5iuAoDyzDs8V4QuOlKvg/nG44ToWEJVlB07zSJVb5h9IKHUKLs9iMe2Q4qDeLJxIzZBhlBBwFeFGic5kU7vi/XN5O/ftHQSJAHX4uHocXh1CNznpbpM+WQllIp9HK8D/X3i6EyFh4sh3fUlaYoXnRoZWgj7s3K19S/BAh5a9A0wTD1L+edcSg== 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:(39860400002)(396003)(376002)(346002)(366004)(136003)(6486002)(8676002)(956004)(36756003)(2616005)(4326008)(7696005)(103116003)(478600001)(8936002)(5660300002)(2906002)(26005)(52116002)(83380400001)(1076003)(66946007)(186003)(16526019)(66556008)(66476007)(86362001)(38350700002)(6666004)(316002)(1006002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RKGzwU43e3i1zHKi1lgx8y4OD2y2X7a+x4HWUY1VJqk/fkTWEqglPsxke6lyqmvqqOasZGUZ/KJHLbpM20/4p/432XiBzDo524CiSWjKeARvX7IG/nbgxU53JZ6puqQNE020obTOUbh0aYrPpTQqeNnV5iiO/GhzYNqulNkKHW6NxxFA0bit2Lq8EWlzKJdejwkl7GoDDzbw/GY0riFaA5OtuDkNvuMqpQzdyi2ti3zQDBWy4xt22dtNknaA2A1apHQ3cFq9VhIzCxx6IzaIc8utHgm/sT4bVMF30IMfVtdqczgYlt103Mhp/7tJXnXLzFW6pLr0qoHfDKQfCxNaPCK8QThThsPR763LpaKvJo7GvxCQBhCSWXgUX1Lqg/AfvqiLSy8btAaVQP44Mv+B5ISmIVKwRWEmOrtHfCmnSG3dqFxebrcms3BESKRTlyYJV3Itko1g+/xeb21YK5ZEz2oZvDhIgzRMHQageYUjOYbQAYFwYVyG6xkshUXs8DHk55dEonyBfxNpEhl4Q2gfSDVbVaGE17ciqkGl84RYkggtKg/4Riokw12OwPf0VSEcBHcLJlBGRrBrzuu6fTTexNLLjDm/FPGnINvbsxCoTuewa103AUsisEbJ/9zP7AYLWIn7LvZkqH28Zf61cd6FxgkKBk262ovxDVqPZwBQtNUMyugYkCtPHi5shzYw4oK0qk4PKwKLsSgZewzIefc0yBpMRA+42NZWalL9/EsxAtNS5mdEgjZHiJDlXqZ4dqJqMqrzAkX0Trek4Tt10OCYH+IBkUSBoDuqLioNazHGMDrv2zdVYyPWxJxToDx007nB852PYiPyIX9ZWKKk2BZZnScYPsyD5gBTANl8Ume6nHorweSolBCLCQdZd9a5lfnPIt6yowbuoy8C6N6Ege+LqYg39x+uEARVSEcjENXw5rHwsE+f24vpLsWiqTTS7cMYybJ/LAKm+Kvt5aRGMY7tl80+kPF+NMZrpYQe5FMfXyi1DxLhGECs8DpvPelCYJOK/3P8GG8/p3y4EdD24KOQh7ajFS8P+WbFuGomKUJa5+m5TWRV/8fKIPqq8MAn6FMXNSZNEAbBuvAyDc0q7IeWF8FY0QYBem7JcYDVpyixHeY/t8s2bodWpIDHAwtqNimUThGb2RBjPrUN7l7lpCBCcxohtSeGhlENPViMwPutD+idLBw/hfqyDvS/BYKPQbOMAqQjqo4VlWfQfibU0ZWDJYo/pmsXcBYLx5XUnaVshh7tchCGrfs8g4njLGW888al1h5/PF3fdGBXImiNGNp1cEUlSi8mIWtYHJ3yaoBsylaW1tY+fVNblC80XhnqvGzD X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b68a413b-ab26-42b3-4161-08d93a17427c X-MS-Exchange-CrossTenant-AuthSource: CY4PR1001MB2086.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2021 09:29:42.7681 (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: RvXzGv79u9GiY3MV9X2VTWJTjLuUhYnt9aMCB5oNRsQPAfjHfhDOr6PDL2jlLg2VCfhtzKJP6F2e9A++y1EV6voQ1wyER0l4/P8eFcHH9X4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR10MB1607 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10028 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-2106280065 X-Proofpoint-GUID: uCZ12oyEgwu_rbAWDlx-ELscXx5-wppk X-Proofpoint-ORIG-GUID: uCZ12oyEgwu_rbAWDlx-ELscXx5-wppk Precedence: bulk List-ID: X-Mailing-List: linux-rdma@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. The variable cache_is_initialized is added because ib_query_port() gets called early in the stage when cache is not built while reading port immutable properties. In that case, the default GID still gets read from HCA for IB link- layer devices. Fixes: fad61ad ("IB/core: Add subnet prefix to port info") Signed-off-by: Anand Khoje Signed-off-by: Haakon Bugge --- drivers/infiniband/core/cache.c | 1 + drivers/infiniband/core/device.c | 9 +++++++++ include/rdma/ib_verbs.h | 1 + 3 files changed, 11 insertions(+) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 929399e..4150043 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1631,6 +1631,7 @@ int ib_cache_setup_one(struct ib_device *device) err = ib_cache_update(device, p, true, true, true); if (err) return err; + device->port_data[p].cache_is_initialized = 1; } return 0; diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index fa20b18..e078a48 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2063,6 +2063,15 @@ static int __ib_query_port(struct ib_device *device, IB_LINK_LAYER_INFINIBAND) return 0; + if (!device->port_data[port_num].cache_is_initialized) + goto query_gid_from_device; + + ib_get_cached_subnet_prefix(device, port_num, + &port_attr->subnet_prefix); + + return 0; + +query_gid_from_device: err = device->ops.query_gid(device, port_num, 0, &gid); if (err) return err; diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 371df1c..e692f9b 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2179,6 +2179,7 @@ struct ib_port_data { spinlock_t netdev_lock; + u8 cache_is_initialized:1; struct list_head pkey_list; struct ib_port_cache cache;