From patchwork Mon Jan 2 12:22:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 9493423 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 1F3A662AB3 for ; Mon, 2 Jan 2017 12:22:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11637266F3 for ; Mon, 2 Jan 2017 12:22:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 061F22684F; Mon, 2 Jan 2017 12:22:29 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM,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 4D523266F3 for ; Mon, 2 Jan 2017 12:22:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755557AbdABMW1 (ORCPT ); Mon, 2 Jan 2017 07:22:27 -0500 Received: from mail-oi0-f51.google.com ([209.85.218.51]:35682 "EHLO mail-oi0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755356AbdABMW0 (ORCPT ); Mon, 2 Jan 2017 07:22:26 -0500 Received: by mail-oi0-f51.google.com with SMTP id b126so479981742oia.2 for ; Mon, 02 Jan 2017 04:22:26 -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=US2dQNXabFDod1dOTm1qq3ga8gyRrd/rgJhyjLj0zAA=; b=fl2bD1KnE4lUFQ5P9A7yT7GXPL7kvJiq5iVUntW6WFWzxysJFx/WAV6Ql/K8BsEK9W Z6yeomLSHPWiRgyS0QI4ljPN+ApfkusQmty+T9u3W/NwYjPio65bbIWh0CySaHFnaIEd kGfnYwIJK0InscSZlIVVyNyle3wVCSUBFcpSsCQBAgCZ2LvftJCgQzwwIsofsLrv/vCW k3ihMFGt80+s6ZJWGK2dcqeJwKe3gU1mNtrJKOMJDzMj9i+2HL6FEylv9KpKvjUhuRmV egtBZU/2mFPH7RYGsq2qNHV9/3zYwSc3Vr7esUzBBnNVoBH5dx1wXO3c+xEK0CVgUApw BzQg== 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=US2dQNXabFDod1dOTm1qq3ga8gyRrd/rgJhyjLj0zAA=; b=ZBTzg1XVvUW/u8nUHhxj4RHdyZBEFOjm3nWDxlkGQazH7XSsf9+STevIP8y7dLMcff fgPDbZts2Kf1rdFKsJxES9rBMtJ5xO/tIXBUmsf/cw/d/jk+UVUNOPjsYwgJKMiCEtXc r3LFs4Q0JDYkA+L1nYh+W8b8OoLOhSPkJIN1hWqmRsnXW+XC1eKECWDKSiHcC8cXa90m Sk3a/JQ9TkvzG9Xyd8RkqSbzYxcpQKE03SG3nG1oExvRBdaJ+LFk9qXptgD0NH+qIEQP uciAfOrh3EhNCVtzvYQnw4Q135wT9v3GhJ+8FIYrmeEquzf347OORel7wBky08RYmsXc r34Q== X-Gm-Message-State: AIkVDXKF2EMSx4Sud5nbG9aFHaEaAo90TVM/kYV40fea6RfDRtfU3/xXpMWuT2KzJ07ny36V07gkqwnyLTKHGEzT X-Received: by 10.157.27.134 with SMTP id z6mr28291392otd.189.1483359745931; Mon, 02 Jan 2017 04:22:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.241.198 with HTTP; Mon, 2 Jan 2017 04:22:05 -0800 (PST) From: Jinpu Wang Date: Mon, 2 Jan 2017 13:22:05 +0100 Message-ID: Subject: [PATCHv2 4/4] cma: use cached port state when bind loopback 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 From 3aba8b8413027835e9af9d0809a8eb33285bd673 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Mon, 12 Dec 2016 10:29:00 +0100 Subject: [PATCH 4/4] cma: use cached port state when bind loopback Signed-off-by: Jack Wang Reviewed-by: Michael Wang Acked-by: Sean Hefty --- drivers/infiniband/core/cma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) } From 3aba8b8413027835e9af9d0809a8eb33285bd673 Mon Sep 17 00:00:00 2001 From: Jack Wang Date: Mon, 12 Dec 2016 10:29:00 +0100 Subject: [PATCH 4/4] cma: use cached port state when bind loopback Signed-off-by: Jack Wang Reviewed-by: Michael Wang Acked-by: Sean Hefty --- drivers/infiniband/core/cma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index fcd5047..8bbf306 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -2635,8 +2635,8 @@ static void cma_set_loopback(struct sockaddr *addr) static int cma_bind_loopback(struct rdma_id_private *id_priv) { struct cma_device *cma_dev, *cur_dev; - struct ib_port_attr port_attr; union ib_gid gid; + enum ib_port_state port_state; u16 pkey; int ret; u8 p; @@ -2652,8 +2652,8 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv) cma_dev = cur_dev; for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) { - if (!ib_query_port(cur_dev->device, p, &port_attr) && - port_attr.state == IB_PORT_ACTIVE) { + if (!ib_get_cached_port_state(cur_dev->device, p, &port_state) && + port_state == IB_PORT_ACTIVE) { cma_dev = cur_dev; goto port_found; } -- 2.7.4