From patchwork Sun Mar 23 20:18:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 3880681 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B0D6F9F334 for ; Sun, 23 Mar 2014 20:18:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DBB7E20259 for ; Sun, 23 Mar 2014 20:18:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED6D920220 for ; Sun, 23 Mar 2014 20:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751293AbaCWUSq (ORCPT ); Sun, 23 Mar 2014 16:18:46 -0400 Received: from mga11.intel.com ([192.55.52.93]:30878 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbaCWUSd (ORCPT ); Sun, 23 Mar 2014 16:18:33 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 23 Mar 2014 13:18:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,715,1389772800"; d="scan'208";a="505038309" Received: from cst-linux.jf.intel.com ([10.23.221.72]) by fmsmga002.fm.intel.com with ESMTP; 23 Mar 2014 13:18:32 -0700 From: sean.hefty@intel.com To: sean.hefty@intel.com, ira.weiny@intel.com, kaike.wan@intel.com, john.fleck@intel.com, linux-rdma@vger.kernel.org Subject: [PATCH 8/9] ibacm: Store the base GID with acm_port Date: Sun, 23 Mar 2014 13:18:20 -0700 Message-Id: <1395605901-9080-9-git-send-email-sean.hefty@intel.com> X-Mailer: git-send-email 1.7.3 In-Reply-To: <1395605901-9080-1-git-send-email-sean.hefty@intel.com> References: <1395605901-9080-1-git-send-email-sean.hefty@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Hefty Record the base GID of a port with acm_port. This avoids needing to query again for it later. Signed-off-by: Sean Hefty --- src/acm.c | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/acm.c b/src/acm.c index eba027d..2d9ecee 100644 --- a/src/acm.c +++ b/src/acm.c @@ -117,6 +117,7 @@ struct acm_port { int mad_portid; int mad_agentid; struct acm_dest sa_dest; + union ibv_gid base_gid; enum ibv_port_state state; enum ibv_mtu mtu; enum ibv_rate rate; @@ -1569,34 +1570,25 @@ static void acm_port_join(struct acm_port *port) { struct acm_device *dev; struct acm_ep *ep; - union ibv_gid port_gid; DLIST_ENTRY *ep_entry; - int ret; dev = port->dev; acm_log(1, "device %s port %d\n", dev->verbs->device->name, port->port_num); - ret = ibv_query_gid(dev->verbs, port->port_num, 0, &port_gid); - if (ret) { - acm_log(0, "ERROR - ibv_query_gid %d device %s port %d\n", - ret, dev->verbs->device->name, port->port_num); - return; - } - for (ep_entry = port->ep_list.Next; ep_entry != &port->ep_list; ep_entry = ep_entry->Next) { ep = container_of(ep_entry, struct acm_ep, entry); ep->mc_cnt = 0; - acm_join_group(ep, &port_gid, 0, 0, 0, min_rate, min_mtu); + acm_join_group(ep, &port->base_gid, 0, 0, 0, min_rate, min_mtu); if ((ep->state = ep->mc_dest[0].state) != ACM_READY) continue; if ((route_prot == ACM_ROUTE_PROT_ACM) && (port->rate != min_rate || port->mtu != min_mtu)) - acm_join_group(ep, &port_gid, 0, 0, 0, port->rate, port->mtu); + acm_join_group(ep, &port->base_gid, 0, 0, 0, port->rate, port->mtu); } acm_log(1, "joins for device %s port %d complete\n", dev->verbs->device->name, port->port_num); @@ -3206,6 +3198,9 @@ static void acm_port_up(struct acm_port *port) ret = ibv_query_gid(port->dev->verbs, port->port_num, port->gid_cnt, &gid); if (ret || !gid.global.interface_id) break; + + if (port->gid_cnt == 0) + port->base_gid = gid; } port->lid = attr.lid;