From patchwork Mon Jan 2 12:17:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 9493417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E933962AB3 for ; Mon, 2 Jan 2017 12:18:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA0AA1FF15 for ; Mon, 2 Jan 2017 12:18:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD5CB24560; Mon, 2 Jan 2017 12:18:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_TVD_MIME_EPI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4ED71FF15 for ; Mon, 2 Jan 2017 12:17:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755396AbdABMR6 (ORCPT ); Mon, 2 Jan 2017 07:17:58 -0500 Received: from mail-oi0-f43.google.com ([209.85.218.43]:34541 "EHLO mail-oi0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755261AbdABMR6 (ORCPT ); Mon, 2 Jan 2017 07:17:58 -0500 Received: by mail-oi0-f43.google.com with SMTP id 3so297007736oih.1 for ; Mon, 02 Jan 2017 04:17:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=icT5YASt0TFMvjmqfacb06Qzy36nUmbbCjanwUGFF8I=; b=Ds8JjoLeoe2URGhy+tCc0u7C+mRVHuujYc6KtHJ9Gqo7k9obN7y22yWHKywTCs5EwE VQJTtHhrWetFvH1DSdyHkm7kdsqBO7j5/TjDh1MbbNsmW679gpMOE0B0SOvSlCblnS5s hvhBSRfnVgXzcF3mmKIhxkOqagLLFwcS9mITEy+7ZthvNhal2/0InQWE1xvlwNteICXz rOGfT282lg3ybKwaOhr3bM20clRBOjylOsQNyqhQKXCnPABoj7CsuwAzBFm2s0OWY6d0 MWaQEjAIwvp93opaTR9Stp1umkWvVmpLrYukB9yMKLYY2ac45oJH00KG2BnrQ8JqbIKe nppQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=icT5YASt0TFMvjmqfacb06Qzy36nUmbbCjanwUGFF8I=; b=OLX1HbwA3Bahrkey8zkDV+3lZgZGa41mdoyZ12IjzOokTJcWeHX0QHecvqiJxP4+po ywRSV3d97i5Vq8xZIVgd/NBiNfF3du5NYNUp6JG1ickq2ntCu9LYdS9QV6EBbvwtjd8E Bt0NZIlILVaoksJizfbFpvulVSU/Q2YfYn8rf5opIGLTK6RTW4so42eaUG9kCqLEue3v fRtUft6q1AWuuhOxVURguvRHfhXoJtarM+vtpGOC54UdPNWOEENDQ6SepmaKEWz1VNov qkn5uu/2oYO7z+PKZlROByNSCaL/6gUwcGEd7RvV5Y7Z2Yprs8A0gC5u2nAZCp1kmfpj HSCw== X-Gm-Message-State: AIkVDXLqYO6olG0w/urginU6NLOVyLHusVLyC72Uz+/Ge6S6p51jm4g8X6NAn+2VRsYZkjcxeKjo8juaDccNRtGU X-Received: by 10.157.5.166 with SMTP id 35mr26472946otd.50.1483359477179; Mon, 02 Jan 2017 04:17:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.241.198 with HTTP; Mon, 2 Jan 2017 04:17:36 -0800 (PST) From: Jinpu Wang Date: Mon, 2 Jan 2017 13:17:36 +0100 Message-ID: Subject: [PATCHv2 1/4] IB/core: add port state cache To: Doug Ledford , "Hefty, Sean" , Hal Rosenstock , "linux-rdma@vger.kernel.org" , Michael Wang , Jason Gunthorpe Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To avoid gmail mangle the format, I also put it attached. From 83a45b0e34bb8515ec9db51629aa4e7e37dfc2e8 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Mon, 12 Dec 2016 09:52:42 +0100 Subject: [PATCH 1/4] IB/core: add port state cache We need a port state cache in ib_core, later we will use in rdma_cm. Signed-off-by: Jack Wang Reviewed-by: Michael Wang Acked-by: Sean Hefty --- drivers/infiniband/core/cache.c | 10 +++++++++- include/rdma/ib_verbs.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) From 83a45b0e34bb8515ec9db51629aa4e7e37dfc2e8 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Mon, 12 Dec 2016 09:52:42 +0100 Subject: [PATCH 1/4] IB/core: add port state cache We need a port state cache in ib_core, later we will use in rdma_cm. Signed-off-by: Jack Wang Reviewed-by: Michael Wang Acked-by: Sean Hefty --- drivers/infiniband/core/cache.c | 10 +++++++++- include/rdma/ib_verbs.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index ae04826..87fd7c3 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1105,6 +1105,8 @@ static void ib_cache_update(struct ib_device *device, } device->cache.lmc_cache[port - rdma_start_port(device)] = tprops->lmc; + device->cache.port_state_cache[port - rdma_start_port(device)] = + tprops->state; write_unlock_irq(&device->cache.lock); @@ -1164,7 +1166,11 @@ int ib_cache_setup_one(struct ib_device *device) (rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL); - if (!device->cache.pkey_cache || + device->cache.port_state_cache = kmalloc(sizeof *device->cache.port_state_cache * + (rdma_end_port(device) - + rdma_start_port(device) + 1), + GFP_KERNEL); + if (!device->cache.pkey_cache || !device->cache.port_state_cache || !device->cache.lmc_cache) { err = -ENOMEM; goto free; @@ -1190,6 +1196,7 @@ int ib_cache_setup_one(struct ib_device *device) free: kfree(device->cache.pkey_cache); kfree(device->cache.lmc_cache); + kfree(device->cache.port_state_cache); return err; } @@ -1211,6 +1218,7 @@ void ib_cache_release_one(struct ib_device *device) gid_table_release_one(device); kfree(device->cache.pkey_cache); kfree(device->cache.lmc_cache); + kfree(device->cache.port_state_cache); } void ib_cache_cleanup_one(struct ib_device *device) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 8029d2a..7115c0f 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1781,6 +1781,7 @@ struct ib_cache { struct ib_pkey_cache **pkey_cache; struct ib_gid_table **gid_cache; u8 *lmc_cache; + enum ib_port_state *port_state_cache; }; struct ib_dma_mapping_ops { -- 2.7.4