public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	john.fleck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 8/9] ibacm: Store the base GID with acm_port
Date: Sun, 23 Mar 2014 13:18:20 -0700	[thread overview]
Message-ID: <1395605901-9080-9-git-send-email-sean.hefty@intel.com> (raw)
In-Reply-To: <1395605901-9080-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

From: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Record the base GID of a port with acm_port.  This avoids
needing to query again for it later.

Signed-off-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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;
-- 
1.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-03-23 20:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-23 20:18 [PATCH 0/9] ibacm: Preparation for supporting different providers sean.hefty-ral2JQCrhuEAvxtiuMwx3w
     [not found] ` <1395605901-9080-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-03-23 20:18   ` [PATCH 1/9] ibacm: Release the refcnt on the correct client sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-03-23 20:18   ` [PATCH 2/9] ibacm: Rename client array sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-03-23 20:18   ` [PATCH 3/9] ibacm: Eliminate strict aliasing compiler warnings sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-03-23 20:18   ` [PATCH 4/9] ibacm: Relocate client refcnt sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-03-23 20:18   ` [PATCH 5/9] ibacm: Record index for source and destination addresses sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-03-23 20:18   ` [PATCH 6/9] ibacm: Change base endpoint name sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-03-23 20:18   ` [PATCH 7/9] ibacm: Reset endpoint state on error sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-03-23 20:18   ` sean.hefty-ral2JQCrhuEAvxtiuMwx3w [this message]
2014-03-23 20:18   ` [PATCH 9/9] ibacm: Restructure acm_port_join sean.hefty-ral2JQCrhuEAvxtiuMwx3w

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395605901-9080-9-git-send-email-sean.hefty@intel.com \
    --to=sean.hefty-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=john.fleck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=kaike.wan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox