From patchwork Mon Dec 12 11:49:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 9470511 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 3D99460573 for ; Mon, 12 Dec 2016 11:49:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F8AF28456 for ; Mon, 12 Dec 2016 11:49:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 241CC28472; Mon, 12 Dec 2016 11:49:57 +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 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 8AAD82846A for ; Mon, 12 Dec 2016 11:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752475AbcLLLtv (ORCPT ); Mon, 12 Dec 2016 06:49:51 -0500 Received: from mail-oi0-f43.google.com ([209.85.218.43]:35539 "EHLO mail-oi0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbcLLLtu (ORCPT ); Mon, 12 Dec 2016 06:49:50 -0500 Received: by mail-oi0-f43.google.com with SMTP id b126so84745423oia.2 for ; Mon, 12 Dec 2016 03:49:49 -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 :content-transfer-encoding; bh=L8sbL0XsgYx3ydX5L8/BbrvIcukstXAtJjnGFwvJMvw=; b=P/Zbxv8JSh6e/KXq+uR9IE9Cv2Is2SVacuHS8lUY6jQ47+MHyiElFma8cTrkYAc15Y UbyZ7QZ8dlqHfKFu/hMJkZviWObAFlzYJkquIIFPxv7rNkPMm5LEhcZcWR7lVZcPjCyd ZcfYqjA1NnrffPIE+t6d4K9zoAZFd1Qj6Rgemfjw8CW2wVeeePbfqFAvJSEay5l4q/d9 zHyBXC+eNqN64FPbfQZUVqxZebYoESHIkhAhkZ+kPx8/4/G6uFrEbW+5/iC3JU+kLCQi KLJ/Z+zCSQPrDQGOziStF4Gy5lvYpxpU9ST196WMJJQcgJVkp9Iol8IrVzIwOXZ30M8A mmPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=L8sbL0XsgYx3ydX5L8/BbrvIcukstXAtJjnGFwvJMvw=; b=G2/n/TkpnS9QEYsM0yDz/iE2Eu3+qoHov2VOLExRdnw2B1smGkPGDZSbY0LkstgOv7 bRTsNpocQUUVVzAofs8AF06Tr2OtSh80bnmydTxvdCVkKm8T1zN7KWLxp2TP5YM/ttxe TyazQagjRHQBkj7Xmk2xg25xOpS9xUl27WK4z6aq+zbuo03+/b8h3zpgzky7D3y9fP09 HyG2zSLLA5XDRh8teRqzDEEjKkrsHxcVeVd/rUdUHSLCjvy9HDdZdCAzL5+WZvqIdg90 sVr7OYpIg6U5Jhp7svB+JKY9p9jfmdrLKxX0/CBMub1OrdVz4WSSkO3mSZJwnvqLtZnj RMyA== X-Gm-Message-State: AKaTC02MCdSnQ50WP/m33RDPXxG9OiOHa7AxhdCMRWkVVX/CQRS9f9ylvi7e30Kvdx5xDqAmEAtGM+d9nYJ8b0LY X-Received: by 10.157.29.65 with SMTP id m59mr54834750otm.53.1481543384387; Mon, 12 Dec 2016 03:49:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.165.135 with HTTP; Mon, 12 Dec 2016 03:49:24 -0800 (PST) From: Jinpu Wang Date: Mon, 12 Dec 2016 12:49:24 +0100 Message-ID: Subject: [PATCH 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 f2083c81f7738841cc696feda5f0ff5a96beeb01 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 --- 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 3413aec..f57d017 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -2613,8 +2613,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; @@ -2630,8 +2630,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;