From patchwork Thu Jun 3 06:50:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12296375 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 04101C47096 for ; Thu, 3 Jun 2021 06:50:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6ACF613DA for ; Thu, 3 Jun 2021 06:50:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229823AbhFCGwf (ORCPT ); Thu, 3 Jun 2021 02:52:35 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34702 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbhFCGwd (ORCPT ); Thu, 3 Jun 2021 02:52:33 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1536iAFm092844; Thu, 3 Jun 2021 06:50:45 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=0xnZuqywDE9QdYXfpLOoGfwDCijxtA93CKj+6YxFdnM=; b=FMRHp4eHpJYTm+tqc/Ly2JrkzFEJhf6BxAk36FhLcfLyBXNDJ4+dG8z77e1SotS+/ErZ lpz2VEB5ReQ6lQNRNCIA43qIivVoGB9cj9lTfZzn9QNAw8Xjk9hGNtx+PNI+LotxSjHo Z5Ul0VHAZLH+pjBRY1gj/7xtyKvr43tK1gtE246VmAfbv+H+thxOsUfSaGpDxkgVh0Yh TO8cjionpjHVfDC46QTJ5+TGHzmIAHL5dWssg0LqNj7NB3mObCpE8VeFjhMwu9/XIXpG gdZ6b7abHrQLAmCCQ5GBRPlKTCEAy93r/N713QgNVtGv/lPtMRXUxMuKZ3UlfK+p8vxz sA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 38ue8pjd50-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Jun 2021 06:50:45 +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 1536ohxk045097; Thu, 3 Jun 2021 06:50:45 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by userp3020.oracle.com with ESMTP id 38x1bdm5ay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Jun 2021 06:50:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cQxnpHEIZuo7MwTUOs/v1dPtPhefzCaMLXIZRSMl8bnasd8QbWznKIUiItYfgy7klahsWDnV0bNlS838KQapXyvficsON6ns/EHLUAR4hD1bzmosw1EmHqxliUDD74imGAAQ4XBaL11qWzOM1JCW7DfhqllNFav5FcGJDQRnGkGFwkL+QmZk60gxT95m1mAEOhRNshZ6EspwCT6lBqfBvHvsUIleKU/ejeAf6CwmSt50zcFNOmhxvvEnjInmF9i1EmFk2Koy9eoiiOQVQf6BXTeOXLPUyqAYAe0Xub++A4ZrMVKxsPeRQ6XyFjEn3dpYJdhMz9tbgwO6lvRE1Q+hFg== 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=0xnZuqywDE9QdYXfpLOoGfwDCijxtA93CKj+6YxFdnM=; b=IoylUl/LgitYu8m06ObHKeXUpENT/sJDqTDL4uG6y4k/GvJoKib1EwguUP+iAyXkH9qm7jXQmpFQ99K3dr9DUwBZq0vGB3pDs6ACNKOR+wsURiuvYN7okxoHL/h3RtriXtISAp9vUucud85dpjWo9NbtjqOi6Uf/KtF0OOcAfNy+uBLDo5YdXmyaU7BRDpww1r84LugeKIRO8xG0gTD1aQ4hnvW3hwMpIDHei1nJKRggnj2fj8F5ciVXU8FZM6++o6ZlPpdPE2JkRmVETgl+gOmdL6RsINHsAnnONI+oHwkALPFSMzTt3R8WKZANOwxLCRNzzyT3ynwhZ+rzYskCww== 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=0xnZuqywDE9QdYXfpLOoGfwDCijxtA93CKj+6YxFdnM=; b=NKvQ4e/lGPN0CDiNJ062ghJiiXyvyMPLneTq28ZqQYMRBr9HsQ/fX67jeF1FZ4GneaTA+aa4qhss81uSV+9Bpr1P/4AOliB6FH4VKFHPxpIAzwshraRod/E7Tm2uGcdKscQ+h0U4AYWxIVzGNgyXDPTDGyq1ybl1ITvtJjG3Nt0= 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 DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) by DM6PR10MB3979.namprd10.prod.outlook.com (2603:10b6:5:1f7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Thu, 3 Jun 2021 06:50:41 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71%5]) with mapi id 15.20.4173.029; Thu, 3 Jun 2021 06:50:41 +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 v2 1/3] IB/core: Removed port validity check from ib_get_cached_subnet_prefix Date: Thu, 3 Jun 2021 12:20:22 +0530 Message-Id: <20210603065024.1051-2-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210603065024.1051-1-anand.a.khoje@oracle.com> References: <20210603065024.1051-1-anand.a.khoje@oracle.com> X-Originating-IP: [103.127.23.88] X-ClientProxiedBy: SG2PR06CA0205.apcprd06.prod.outlook.com (2603:1096:4:68::13) To DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from AAKHOJE-T480.in.oracle.com (103.127.23.88) by SG2PR06CA0205.apcprd06.prod.outlook.com (2603:1096:4:68::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Thu, 3 Jun 2021 06:50:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69fcf725-c0e9-46e4-a062-08d9265be740 X-MS-TrafficTypeDiagnostic: DM6PR10MB3979: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LkN4Xag3qhKBvh3yReq24gMQ2hl1Qcr2N9dDP+5PjfxVt3SeCp2xc8eAtsN3GVk268qjY1PZz4Ahyjhv/UXsfyrVWJ+F7qLLJwvuLO9t3UQWSSTpi+bUBL8OLwFqvOxQmKy9BOM2iZkLUvwFkMuz5w6jxHJrR+zRyzxhyDDk7RAjpijjYdfvMJCA3zMBX/NeHY2GZ3GtJFHOXZjM5emhEJ8jqb/8qcZLsMEHhrxXY9GfnOhSk7KBlZISvRgwqaIr52LPQCLM8PWi0QSukIlcJ4e52JgzvQUpJT9aG426WFH9ywu6ptubIJQiVCLmfTn7qxIFIch/Ua1lJy2IchEC0P3Hogc6DY5+PXSNFoO5Uqv6qPS1eSvpAfc6CvT634AmGCYBeUhbvviE6ZXNUUFw9Yd0zEzxNFxdST2nKM5QxrCrzDv4/JStvYqbALX4rWGV9B0B9tZc7m11EbYlOrJ1W3p/zXpecLP8af911dg/z3ZdTR6cYY7Uu+BHxmJJ35XbpJS2If0Rsyvv3UjLzADS7i627rFBI9B7+2ynVX6xsvZtsNGDNYZiQGdoKFzHNTbYjYZZBAU5PYhi04tjpMgGvq0sOb/x/IgN/ffhYgl4f0oU0pPYDXIcIP9sF52NLAteYIYLe4gI9raIOJadxXv48Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2091.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(376002)(136003)(396003)(346002)(366004)(66946007)(66556008)(66476007)(6666004)(6486002)(2616005)(7696005)(8676002)(86362001)(52116002)(5660300002)(1076003)(956004)(36756003)(38350700002)(4326008)(103116003)(38100700002)(186003)(478600001)(16526019)(2906002)(83380400001)(316002)(26005)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 23V4TA+vFldMqVxZpYR9Kv/veKyg1qBbbQBnF5jYxBPCaegkF48sGUxC9mufpffs2CDMiI8lRpoPb041fChRmMGx0CqHZ4Bs5VsAEK0vJSEVYKhEF36wFLi+M50VWq15iYgZe/nufHUz4+4DzQLk3glvYtJ4+UNNOmahgymXsOuAH3z/3+SybNkp416Dlf8T08V6y1ONyEUYzj+7bhR6Za2YgvDM8OxMy4zUd6OGdGG2tDNCgokTjhpaqxwMVlCMk94eAKvmH31U3ny3uRGdjlrYFktMCKnGZ0JmrylOfI0gUU+RhiNvgnxcJ1KRsESUR91F/Oa7STYhdCwyehZZiFCybSOpH5QWu4LKN7TpWEjo1r99EPNWazGTQC0sngJf/w3bcRImVRCUTUDU4EqXW0F6R188IpCqYkotEdrFLH2PfxVXsSEwts8OTIkoFkXa4qNwbrbByfu8ju+lcEW/9SXVcQpxFzPH/mzkE4DXiSj21Zlc939FYYKcD2kt15cSDQo7G8EXGxrbCU7Bi4KFPpRdWn4RnkYJc6MuMswq/7nqtUkRPs/mLxg8m8wX05DI9MquxCtG9aImkWgBo3kWofxTUV6tNpx0eGt56j+HbWY2uFexiSDCLi4zSoQqbtp9CAfA7pOCjyPkTW6ZZFeEMb3j8S6Pf3fZhEOYGZwRovQLfCzqzxeqETaJe9ypiRrxtloteUzX5u+M300ETtzB9x/ODaToSzQzJPqNNuHeW1+VR24qYEaCI1gqeWEOQ8FNRgfoynOqr9rMHIa/XHZG8jQbrnREVaDTZ8MHztIS8xb9Ya68jn/wz+pCR8krT5rjOP0r9Bx0opY1HcEYBHAqBp6u1PzOG6U5TD7ciPybHAWMs2grpfWnTmz9HqqVc0BcCnnaY6vlq6KEX/wPSmoJmYyW7X6UYHO7wRNFe1yDxYTx6VOTRH8dtTEJwxVoY4nhUDXQxW9TQ5NKCR7/7ZfsOOHRC86CH6mAMlTuX84QjfkqNfU1N4BNXzazunkGXaVfp2s4DTNbprtzPI8uVeFbWFZ9mp0yzfA6DiehKBViFcTqo5cmHhk1eeh3rdTDVDOOKbC1Zl+hoVDnclhKLSdxYFjOV84rQsFsTzLwQiJ3O6TlI7OElQiDMjS5i/yaRiayUlf1/Qe5lEVnlMe48VgET5hYCSLp4CO0DoKosqPLyKCu/M3zecrkben7I62OpVcy2xeZR5bwP2JAg9IJQ3rH9YgXEuITL5PMd+G3y0paoRMMSF3Q3zYp7mj+qTzeaQluXIx+YlC4lV1sm58u7cZ7PX0y3ojq27DaUeXMJy1kVhsRyF0hYTvxfm2Z8ol7U80w X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69fcf725-c0e9-46e4-a062-08d9265be740 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2021 06:50:41.6945 (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: 790+wCb88ZJ6Jee7Ss7kBP0oOnDBVM/kRl+PXMeAOPQad2I0sn1czFiNtrCKIAB1N7PRL6FO1AQUOO7XokaWStJd+BcLuTwzOewjPOLNlDw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3979 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10003 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030046 X-Proofpoint-GUID: RRUaoFQ5733TRUr2bD--Zz28A1QAOku4 X-Proofpoint-ORIG-GUID: RRUaoFQ5733TRUr2bD--Zz28A1QAOku4 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10003 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 malwarescore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 phishscore=0 priorityscore=1501 clxscore=1011 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030045 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Removed port validity check from ib_get_cached_subnet_prefix() as this check is not needed because "port_num" is valid. Suggested-by: Leon Romanovsky Signed-off-by: Anand Khoje Signed-off-by: Haakon Bugge --- drivers/infiniband/core/cache.c | 7 ++----- drivers/infiniband/core/core_priv.h | 2 +- drivers/infiniband/core/device.c | 14 +++++--------- drivers/infiniband/core/security.c | 7 ++----- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 3b0991f..b6700ad 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1069,19 +1069,16 @@ int ib_get_cached_pkey(struct ib_device *device, } EXPORT_SYMBOL(ib_get_cached_pkey); -int ib_get_cached_subnet_prefix(struct ib_device *device, u32 port_num, +void ib_get_cached_subnet_prefix(struct ib_device *device, u32 port_num, u64 *sn_pfx) { unsigned long flags; - if (!rdma_is_port_valid(device, port_num)) - return -EINVAL; - read_lock_irqsave(&device->cache_lock, flags); *sn_pfx = device->port_data[port_num].cache.subnet_prefix; read_unlock_irqrestore(&device->cache_lock, flags); - return 0; + return; } EXPORT_SYMBOL(ib_get_cached_subnet_prefix); diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 29809dd..0b23f50 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h @@ -214,7 +214,7 @@ int ib_nl_handle_ip_res_resp(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack); -int ib_get_cached_subnet_prefix(struct ib_device *device, +void ib_get_cached_subnet_prefix(struct ib_device *device, u32 port_num, u64 *sn_pfx); diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index c660cef..c2fa592 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -886,15 +886,11 @@ static void ib_policy_change_task(struct work_struct *work) rdma_for_each_port (dev, i) { u64 sp; - int ret = ib_get_cached_subnet_prefix(dev, - i, - &sp); - - WARN_ONCE(ret, - "ib_get_cached_subnet_prefix err: %d, this should never happen here\n", - ret); - if (!ret) - ib_security_cache_change(dev, i, sp); + ib_get_cached_subnet_prefix(dev, + i, + &sp); + + ib_security_cache_change(dev, i, sp); } } up_read(&devices_rwsem); diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c index e5a78d1..5433912 100644 --- a/drivers/infiniband/core/security.c +++ b/drivers/infiniband/core/security.c @@ -72,7 +72,7 @@ static int get_pkey_and_subnet_prefix(struct ib_port_pkey *pp, if (ret) return ret; - ret = ib_get_cached_subnet_prefix(dev, pp->port_num, subnet_prefix); + ib_get_cached_subnet_prefix(dev, pp->port_num, subnet_prefix); return ret; } @@ -664,10 +664,7 @@ static int ib_security_pkey_access(struct ib_device *dev, if (ret) return ret; - ret = ib_get_cached_subnet_prefix(dev, port_num, &subnet_prefix); - - if (ret) - return ret; + ib_get_cached_subnet_prefix(dev, port_num, &subnet_prefix); return security_ib_pkey_access(sec, subnet_prefix, pkey); } From patchwork Thu Jun 3 06:50:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12296377 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 58AF2C47096 for ; Thu, 3 Jun 2021 06:50:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37C3C613DA for ; Thu, 3 Jun 2021 06:50:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbhFCGwg (ORCPT ); Thu, 3 Jun 2021 02:52:36 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:39346 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229845AbhFCGwg (ORCPT ); Thu, 3 Jun 2021 02:52:36 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1536irjs151974; Thu, 3 Jun 2021 06:50:48 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=V63sIKFdjmrcTFbvj/KozRZrymLzgW1D9E1HfERWKZE=; b=y0r+5IZNgIhLVdKE6Qffq26FKQI1I4vdp8OjIJp1+dGzOOGbEW1smHlYUz26A3w6PH2p kzjQYjgUdBQntQbYPSlfIEpsq2TefgmOAgU4LTtX1CuzaDfyY84b0PaCn8WKPpliehM5 O7u2kJdUdm5xf45PRuzUG5x5fl+Y3cSpY0MRdODyDFPjVhEyeAOoW7w1xK5pe/dfjqKq TsWn/tA7m/DSBw3+5RxiR2h+BIvuIjx37LcKHY0wkEyVsMEhByu/EV37zGUqGIpqN5Pp SiCuoNiTlz5lxlGRPGC3XxWgMkILS2qXCkMBq0dwqrJwD0isEjqZFLfyY/mXsZiKC6c6 MQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 38ud1sjdhn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Jun 2021 06:50:47 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1536jUcI128113; Thu, 3 Jun 2021 06:50:47 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2170.outbound.protection.outlook.com [104.47.58.170]) by aserp3020.oracle.com with ESMTP id 38udee2fkg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Jun 2021 06:50:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ggRde2RKcGfuQQtH3fVJ0gVjIL7CM+uzMDGgngmpRjVo7ZP3dXo8ap+EehKVf8CvZNWn6mwO3/H3gXFPY7Hipy2tD3RFsrMoH3NbyqJCZrja9hPwNOwQsx09grAToWSKm1LGBdV10izbp1m51Y7TtXZRBIJk29l/Lvd73Xp9TD8SDdbvJiwyksdaCSe8E7GggCtWUs662gfMU7+UVlhTeYderRtSiTM4wsVv2IR5CJc1oCx0hWdu/zXNTiCKzU+aYcjBLucHNL19gHU0fFak25E4gBHZMq0tpt9J1aX+O1AVvZno5iO2P9JlWh3p0x7keRSv3PWjTjybpqKOW98A/w== 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=V63sIKFdjmrcTFbvj/KozRZrymLzgW1D9E1HfERWKZE=; b=WGD3o3CbanRFe/Kxqwd1sKKd8Wr4tSYwhXZuwyoc34jFudUFF9vTBQlWLZLeCJhXzsDahvsuYzMZVCncj0yoEAA6Eb3sljyjuSZUMASgaUkFl4lTZSRAFOd5TEAESbTDCVBLAp9ArvGb7vb5dE3BiYAD2b25Hz95qi6Zmnif09TeekkpsBiDMXdwPcNkOEi8Gpkk3QrA0oPSusfCLLyKQZZ6IvhJ/PvEq4LBnrBIvqZncZybRugHawPPTYc4nTfdzzl4ANKllssILpd5lvEfANCVVa2OGth12SZBkvWIiR/sCCaopvuuOlRHvaVK1QjAdaEt/ljMS+RXWG65QZVu6Q== 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=V63sIKFdjmrcTFbvj/KozRZrymLzgW1D9E1HfERWKZE=; b=o04xB/rek8Ez5bNdGl6C48h/6R8J7rnwk3LCkLoy1cHGnZNPQayVVmKDXyiAZwrkV1w9KFaQG4hakjpxaTypEDVFY+ymmdiQ+xEaTOjU41rvSNF6nmUDBPj/fTsI/XAzKCM1xUUAVZqFoYYrrEH9qxYOIq+e0YdytRn4QZ66mcA= 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 DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) by DM6PR10MB3979.namprd10.prod.outlook.com (2603:10b6:5:1f7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Thu, 3 Jun 2021 06:50:45 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71%5]) with mapi id 15.20.4173.029; Thu, 3 Jun 2021 06:50:45 +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 v2 2/3] IB/core: Shuffle locks in ib_port_data to save memory Date: Thu, 3 Jun 2021 12:20:23 +0530 Message-Id: <20210603065024.1051-3-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210603065024.1051-1-anand.a.khoje@oracle.com> References: <20210603065024.1051-1-anand.a.khoje@oracle.com> X-Originating-IP: [103.127.23.88] X-ClientProxiedBy: SG2PR06CA0205.apcprd06.prod.outlook.com (2603:1096:4:68::13) To DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from AAKHOJE-T480.in.oracle.com (103.127.23.88) by SG2PR06CA0205.apcprd06.prod.outlook.com (2603:1096:4:68::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Thu, 3 Jun 2021 06:50:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4fa37a3-d46d-4ab8-7ec6-08d9265be95a X-MS-TrafficTypeDiagnostic: DM6PR10MB3979: 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: l7lKFcl+o1C/yHmiOGX5S/Tpyg6s6ipuhGHe32CDXs8YFvsHV/w/FMirMdjEgWML10ZvFMoTb8M+th+BwNDQ4sJGn5MrEaWGKsNkaB6zGebjUcPbSYY5JKtMc6/XkN+Si05/mV02QD8iFEBQp3fU3a/tUvZMQQagBS+WSZPBGwbrvYlDmYafIrS0/uYVpuep8/BUaBpuSpsFyfNk1XTZW8QdZv3M0THnxOIVzs8xweurajKuBQxJmJelZS5ZEUzgkrgtZpHX9I1eXSoSYYvshJsCzfB4o9panq5XW1FJGI6IojztN+LkPxITKfAB4Zolp2qz5ghYqo5iB9v0j5113Q0dYh6BX3ynmocKhEaXYFHSH63N70ErlVpWyGX/I5AWW3LsiR0ELXb1mu1otK311uZXVZmeaUQcIGGZVwKe7c1iGv9M1RDqpdvsH4ffreZdxS2k8rlJ7SGERK34M9KakeMRQeB2hxmsj+s7gZqwzsZCTmFmbEqAHaufhVOWL+9f+PKDUVdlYHMHZ6TXWC58hT98VZEy4VCmKquiWH6iSxjcuR7dE1H2PuW58OMzhPXWnlKpliMdRgYsVXYV6fxEmcAiB3PERXcOD9QxtQZk1/q+oymK2gUV6mvQ9UDXE/DGVwypvEMbbvrNqMY4ArD3oFV5qncxErVKQoQ1KX87XS8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2091.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(376002)(136003)(396003)(346002)(366004)(66946007)(66556008)(66476007)(6666004)(6486002)(2616005)(7696005)(8676002)(86362001)(52116002)(5660300002)(1076003)(956004)(36756003)(38350700002)(4326008)(103116003)(38100700002)(186003)(478600001)(16526019)(2906002)(83380400001)(316002)(26005)(4744005)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qvAuLkJSAZoe5qW8fRC1gsY6zlNwqw+gRJ9W953QQVbp41wM4pXce4Y0bKdl6uDv8l2Tqs3fxUlFu+3R/FuX4LWp78iENE/63+LUhK63AlnAZkZmjkEw2hQbeSyn6SgCbyP5U9DHuk8jDF9ipBGrULpIdMCSEiCcpkYVjdni52tRcISZGcSTL0jNMpPI2ov/4hLO2d2vr1Rc9Q/sMX6sJRPfYweykf4Jf6+gxqhV5et2oj2Y2KzQK48R33UCNkeWQLdoOZkTNMWCRdbjo6BX8+6on7CBCLcVvJKWYHfh/Jmr+1qu0NfWJXDSnOldEIfyd8yoWjobwEXAgTDDKA95lSnjBwYN1LDzHpYM9TQkl6CJ9ONc8M1UeZYN5AA3EW2YQpa0s5pnNh8x8yMUUa+IIsBM7fZoxz4ogmLBLpyaTHjf4F504FwtDyDra+NuVhrwNVBZ8SJbaZwsYSQmbokYHsnL5IuurqkmKJSwthMdwj3VXgMqTzAb+5h7Wtwz7Rn74ZLsWWFvxedq/ojeFzN+HHsc1tv3HBwRHjrxWzb6Mvki8UKitGtWwCiMKouqPTyVlPe6Ja2LK5Sqaeg4HxzhtjxJUP6rmpRa+66GV8Z60CMtmBpPaHxAMTypYd26I7ce2pJgoCzy3Qks5rYy4mRiNB6RoUTFb0pwYLj21LLnV0iSswOAfy8QkJRcrHihZ/ktmExvS7vqAKI0s+GbwQTFkLC2E5LsMKZHCGfLpJWn+D+vLcYrM67FLVlce3we43iu3A05Kcz209shwxkQKkofKWmZHBC//ricKKLPhzz19N7LIJXARKgwPN2y7h7aYrB5Fb+fe+v/ylSKPP2hmOpETHe0VThS9L3fCJ+voAjCw1BRZ9diYSdhaNC2zc7Q5Cr2pOyrL5YRa73mrFyw9sUA8h/ozsUNcJguLv3yRIHU4P1sxPS+B0M3oOVTYfELMFK5jSMTwPlLo7WNb87uHP6g6XSegP3CkCx71SPLohEvUuWqjX/Jq3cVwl7LZEjVsgTi7jRLwbtlsZ6oCa/cp31YrGHXRGCpm4s9Oh/cgKagRiOn7X8rgyiogRjCpE004pjByP93O8lwU+zdei40QPckY1Hy2nHkDOI+YPVPq9MGyt3one/y2cBUkp/d1tGfa/h9exDMeA+tOyw6UCfF2ogeNdBcTDKshavhp2g1VIM531KR5A+R3lYnbsKUO7osygvAwQFmWY9MwmfcHQPCYEhczaYw/wTPTmyjKNndmYPjZ4YZYA9qrF/+ZJ/egvw1ufI7QhhPz66rlrdyh1YiE3Gzsu0e5IDCTlAu1h4WzCuXho/Psx2+Jg9tCYDUXU8sHD7w X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4fa37a3-d46d-4ab8-7ec6-08d9265be95a X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2021 06:50:45.1775 (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: GJsUlY4oTAuZzeqAIXbLzGOhU8u0ANNqOwB9Rw8gqe1M+yoVYbZdfieqK3pNkeLQe6LzdrpWHY+F4RgXpbl9vatY5wyIW/7e461n2ljOVNQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3979 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10003 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030045 X-Proofpoint-ORIG-GUID: O3x3kpvjKJctkfZPh1rJFVzk-ey3UCeD X-Proofpoint-GUID: O3x3kpvjKJctkfZPh1rJFVzk-ey3UCeD X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10003 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 priorityscore=1501 suspectscore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 spamscore=0 impostorscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030045 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org pahole shows two 4-byte holes in struct ib_port_data after pkey_list_lock and netdev_lock respectively. Shuffling the netdev_lock to be after pkey_list_lock, this shaves off eight bytes from the struct. Suggested-by: Haakon Bugge Signed-off-by: Anand Khoje Reviewed-by: Leon Romanovsky --- include/rdma/ib_verbs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 7e2f369..41cbec5 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2175,11 +2175,13 @@ struct ib_port_data { struct ib_port_immutable immutable; spinlock_t pkey_list_lock; + + spinlock_t netdev_lock; + struct list_head pkey_list; struct ib_port_cache cache; - spinlock_t netdev_lock; struct net_device __rcu *netdev; struct hlist_node ndev_hash_link; struct rdma_port_counter port_counter; From patchwork Thu Jun 3 06:50:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Khoje X-Patchwork-Id: 12296379 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 214DEC47098 for ; Thu, 3 Jun 2021 06:50:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AD9E613F4 for ; Thu, 3 Jun 2021 06:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229845AbhFCGwj (ORCPT ); Thu, 3 Jun 2021 02:52:39 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34742 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbhFCGwi (ORCPT ); Thu, 3 Jun 2021 02:52:38 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1536ibWd093340; Thu, 3 Jun 2021 06:50:51 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=MWidZL4M6Z31aZWtVKlVX7T88bPx5cGEVfH74LaU8Vk=; b=d2YoMN7nuS7WxJ5D+11qQ6/Xa0N4ULeFLGYTH99CSqVd0CabL/Wn+oDfr2BIM/p7fOdR xLHRMV5tdjVR042isxGnmo0KkYid1o5DqsoqGGis6/tKRM2n/moqosLLi6NNSwBSqugx xNeeT5P0dedjXNGZercK3aCP3hJssFrXI84uIJIw6x8z4ubNC47m2HXvz+Zu4L2YQp7m +6JCh4riqVJ8tNvJEc1oIhbV3nL1n6Rh10rhRwjmI+bx/E26ANVrsVr+tMpiVXF0jcbD lUIuGDFP9p0PRPRCl2W+ZszdlL6MQO9lqRuD792EHFres1vYol3x+IKyaruDP459S3Nd wQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 38ue8pjd56-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Jun 2021 06:50:50 +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 1536ohAC045092; Thu, 3 Jun 2021 06:50:50 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2176.outbound.protection.outlook.com [104.47.58.176]) by userp3020.oracle.com with ESMTP id 38x1bdm5dq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Jun 2021 06:50:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZBFKiPhUVoCYRCKnCdahHmXnlQqJ+8x53uG+lgnPnQKex/VpeUJ9G66VCnACrISYi5E6PAe9Ooz/Xb4k3kG0OgvfEcghTKHn6ZugufnPc7WED/SBdFeeOXpNhzPa/X+gRgiFbcA7yL8V0MGTGXTiggqrUev1OF7Yh/qY7IzhT2nRV3qEpL+IXgWNrtwxAyGcUgh4Pny6jnwMK1t44N1F5DWZeKaoX9uEX0hKFbPOkYuhe0HbbjUWWDH3i0znYKPzM/3X/PMNFTZp325VqD1ciYRIbHxcMuCVJ1UFvu/Ko75MH/CYb01YtCUslQ1lS/gvBeWn0axAjqnIWVgroQiRg== 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=MWidZL4M6Z31aZWtVKlVX7T88bPx5cGEVfH74LaU8Vk=; b=bFdiB7Dlc/oFeuUdz1MpriUNF1xW6ldTYR0NLD/+YOXeNDuu/5TTbjXkMy+m+xIS+GrqFdaFY73khikEU+H5KUtMiYSH/jS0vs6dkbhB36PyGz2gFPF/2uhlEetIeR7ylaVTKccvm7/AL1hlJveY3iHX5HfazmEqtkholFnNen80kVCPkgUdT0f8qE3myRaaAk/4S0ExdX6sMGZpMqGc7tlXteiChyopO4qYtbRgvHLgV8E3LbwUnQyC7Y/hQNMVgH0pj4BJkdok0dJ9UGTM/4ad0amPBXvGOGxeojTyP/QsmecZPoQq8LKbWKVpwNxek4timcAUZprENZjPx3mF6g== 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=MWidZL4M6Z31aZWtVKlVX7T88bPx5cGEVfH74LaU8Vk=; b=AduDJI+mKeEUwPPmLNZwz3Atd0whtnw0bieZMlrwRERIYeJyJP8H4PUQlcWMNFpdZfJNU3XZ+Qsx4Tb4v/yIkQP4UUsNHvsCO2vwwZj5nrAdH008ynEwsFVWXc1PoLzxCBCH8t04oqlYWTn7zM+leW2/WNn2D635akSC9aHNciw= 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 DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) by DM6PR10MB3979.namprd10.prod.outlook.com (2603:10b6:5:1f7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.23; Thu, 3 Jun 2021 06:50:48 +0000 Received: from DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71]) by DM5PR1001MB2091.namprd10.prod.outlook.com ([fe80::5c05:40f0:dbae:4c71%5]) with mapi id 15.20.4173.029; Thu, 3 Jun 2021 06:50: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 v2 3/3] IB/core: Obtain subnet_prefix from cache in IB devices Date: Thu, 3 Jun 2021 12:20:24 +0530 Message-Id: <20210603065024.1051-4-anand.a.khoje@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210603065024.1051-1-anand.a.khoje@oracle.com> References: <20210603065024.1051-1-anand.a.khoje@oracle.com> X-Originating-IP: [103.127.23.88] X-ClientProxiedBy: SG2PR06CA0205.apcprd06.prod.outlook.com (2603:1096:4:68::13) To DM5PR1001MB2091.namprd10.prod.outlook.com (2603:10b6:4:2c::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from AAKHOJE-T480.in.oracle.com (103.127.23.88) by SG2PR06CA0205.apcprd06.prod.outlook.com (2603:1096:4:68::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.15 via Frontend Transport; Thu, 3 Jun 2021 06:50:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0931585-33c9-467c-5434-08d9265beb3b X-MS-TrafficTypeDiagnostic: DM6PR10MB3979: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PO7B5bLFZyIk5wbG5hoj6kw0j4wQbX7/Nzu8G522d3sqNNE4Izyortt8PXSRnCbY0E9K61C0UIipCS/nCGJMrp/nbnitm2kPp0MBhLHmiWv31MZcuRYgg+a98naqYjBj4Sd6RJqy3N1NSzuv63YJhASt348hyLZ5jJJCRYTrTog7EW19cN3AmsyV0gVHciFKZ7EQaIjzpU8ISxWQfefRj3QBaj8sNrh0mDA9uMj3PsF6jV9COjm+ArXag7Tla1K2vw8h/tb8SYfXI5C0nc0li+mX4GmPK0uSUJiY/KsBVafmCltK780fTSVRhol0/yGn78UAr+fUa8QolhXZdixrndgNF1LQ9RPUyKoXsU1hBmz/cyVxH3GHe7Kt8l38Ffx1cpLmeg2bWE1hwLGfup4OzJGRjmeHtBS725qjl1z9TTyE8zOTV1CMR3iVn5Aw7UwcmG3fc65EDyep4pPnskTibJBTmLVLlrW/ww7/33vdLobEUqa1N/dw6SVgY0WOq2bxvzkI/jT4G20QASa5Vs0uCORcz3DJRfQkBrvoSCiGBF1G1DlvRz8mwVBaYRnJzmElRyU9V48df+FYx6q6/YX78cyQgQHxZ7GXtywB+sLOZl5j4tdcVaVKzBKW3ViKCDiI4PZRzemYh1TryrEtStkjgQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2091.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39860400002)(376002)(136003)(396003)(346002)(366004)(66946007)(66556008)(66476007)(6666004)(6486002)(2616005)(7696005)(8676002)(86362001)(52116002)(5660300002)(1076003)(956004)(36756003)(38350700002)(4326008)(103116003)(38100700002)(186003)(478600001)(16526019)(2906002)(83380400001)(316002)(26005)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zSf2AanW6Kys3lezN4AzC92wepYmo9mh2zYoSDbvDiaQ0fV38FTBCBw8PcEOXFU8MY6aH4tZhRpBBdvh9exIoQwBbHAU8mDXtKjQkOnm8bIBGhai5poyxoDr6hRhnRwoBGVE0lCe/fLCBABomVXVW8aaeHtmRnQM2TBhpAJLxr8gna1nhZ8LMczTPWEa5hcxNRORAE6btmfnzVoRF3fjt1kRglTSYcmg46A3XqjyefKbaZsABZS76nQ/bSDTAkD2ZcBfhV29fllXuCoxHOhEp9Pgf1Nb+2rCJU5yJVOrOSq2ZGVhugaM1aXVy6OTpGc8ByXdbNCZfK6oKNi7K4ZAFpczgcuH5x/DBsqpl8jNG910Rt9zLMvlQ6b0FC86C7OXv5qpEWX9Ue4kh6kV5o4EzTyRsMcXdNPKnjLK6XvCBcJ7VmEKTmVI8wir2lRzgazIeeNpdsbl5NkfXlAsUqow5FQ2JG8uhJgf5jpcldMg43UjdKWGkfYAKm65TH0aGCr/JK3wJ6iZuE7L9MpDGmrn1HUZsLAPFPyMETc8NwFU+VEpjoRDDHQeipUDD1HQ/+9KLs+UeTyyrJ0JJe6a1QOh/Fk7dE0Gekj4ed4MQoQoAB+Syhoyc2igXf6abmwDOmkglFRVLafOtk3No6IoU+EmzG/CFefVhcGg17rbkMrWzdISY/8lO4BMDwm6UPntC3mW61lLJV4/vKm1Sn/E4q2QJYm/kpBynrHIkR74NOabHz/032TCrYwwh2upfaYXTcLJuDX878afipE48M0yyiidUHucNuqeakr03GhjdPBkL+o7xbEPqO5Hso7MmxdwRjoVWWlWxGjC7PY1HHopZQyhNrHQkJV4ABZm10hGfNS9hUyFDQYp3VLx6aT18cwP7Zbvu/n/HmBiUFBt956kaFbCxS775wfVw3OaOR5TwipVi86MNhx2SzW9y7WAkmXnZFtOVgo2TYYt7GjlpAaKWYigJQO5FTzUPbXDmrmgxrZUgBuvTAY15+iAGpmx5k8Zoj1v8XInZC7gpI/s8C5TNDL49sjrzcsdqSPfAe2TXM8g+WSXGTYZzEwxQsLQsxOBKbEyGsuzJfDFzFw25Dce1RpxaUiGKaaSx0EEvLXquB/fpbc9YFoOIJExcF/OggCMqTlfas1VeqZFGmWjB6WgfQsO3y4HKqSiz2QOdg2YgDc7d6uMd/gmVKgs7VUNFwLWWU8tUJvhjR5HfT4/IqjfX2ws3fzsrq9UYrpgUoQTYlP7llJK4k7jhYRbDLp8nFq/4hBXzMewpO6fEmhCDVJDa6L4HVeVJLP4fMkQRWUjvL973seQ1nvtobdDIhFMVo+hFcA9 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0931585-33c9-467c-5434-08d9265beb3b X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2091.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2021 06:50:48.3277 (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: CokmtA9du5lM+CGRW3MsR/zB6yNqGt41zZh7heNBsR0jxrwr/mzGRUnzneeIilkqQAQJXfOOPMcH/G6yEmpGSaN9OE/EIeMejKlj5eMWJrY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3979 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10003 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030046 X-Proofpoint-GUID: SzSg0Rxbgk_jcDzW3sted2xCPWwgMD9_ X-Proofpoint-ORIG-GUID: SzSg0Rxbgk_jcDzW3sted2xCPWwgMD9_ X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10003 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 malwarescore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 phishscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106030045 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 function ib_cache_is_initialised() is introduced because ib_query_port() gets called early in the stage when the cache is not built while reading port immutable property. 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 | 7 ++++++- drivers/infiniband/core/device.c | 9 +++++++++ include/rdma/ib_cache.h | 6 ++++++ include/rdma/ib_verbs.h | 6 ++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index b6700ad..724ac0e 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1624,6 +1624,8 @@ int ib_cache_setup_one(struct ib_device *device) err = ib_cache_update(device, p, true); if (err) return err; + set_bit(IB_PORT_CACHE_INITIALIZED, + &device->port_data[p].flags); } return 0; @@ -1639,8 +1641,11 @@ void ib_cache_release_one(struct ib_device *device) * all the device's resources when the cache could no * longer be accessed. */ - rdma_for_each_port (device, p) + rdma_for_each_port (device, p) { + clear_bit(IB_PORT_CACHE_INITIALIZED, + &device->port_data[p].flags); kfree(device->port_data[p].cache.pkey); + } gid_table_release_one(device); } diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index c2fa592..b3e20ac 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2060,6 +2060,15 @@ static int __ib_query_port(struct ib_device *device, IB_LINK_LAYER_INFINIBAND) return 0; + if (!ib_cache_is_initialised(device, port_num)) + 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_cache.h b/include/rdma/ib_cache.h index 226ae37..1526fc6 100644 --- a/include/rdma/ib_cache.h +++ b/include/rdma/ib_cache.h @@ -114,4 +114,10 @@ ssize_t rdma_query_gid_table(struct ib_device *device, struct ib_uverbs_gid_entry *entries, size_t max_entries); +static inline bool ib_cache_is_initialised(struct ib_device *device, + u8 port_num) +{ + return test_bit(IB_PORT_CACHE_INITIALIZED, + &device->port_data[port_num].flags); +} #endif /* _IB_CACHE_H */ diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 41cbec5..ad2a55e 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2169,6 +2169,10 @@ struct ib_port_immutable { u32 max_mad_size; }; +enum ib_port_data_flags { + IB_PORT_CACHE_INITIALIZED = 1 << 0, +}; + struct ib_port_data { struct ib_device *ib_dev; @@ -2178,6 +2182,8 @@ struct ib_port_data { spinlock_t netdev_lock; + unsigned long flags; + struct list_head pkey_list; struct ib_port_cache cache;