diff mbox

[8/9] ibacm: Store the base GID with acm_port

Message ID 1395605901-9080-9-git-send-email-sean.hefty@intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Hefty, Sean March 23, 2014, 8:18 p.m. UTC
From: Sean Hefty <sean.hefty@intel.com>

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@intel.com>
---
 src/acm.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
diff mbox

Patch

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;