diff mbox

[1/1] ibacm: open only prov endpoints with name/addr configured

Message ID 1420660821-19596-1-git-send-email-kaike.wan@intel.com (mailing list archive)
State Rejected
Headers show

Commit Message

Wan, Kaike Jan. 7, 2015, 8 p.m. UTC
From: Kaike Wan <kaike.wan@intel.com>

This patch modifies the ibacm core so that it will request the provider to
open those endpoints that have been assigned with at least one name or address.
This change will avoid unnecessary endpoint open and close for those without
any name/address configured by the administrator.

Signed-off-by: Kaike Wan <kaike.wan@intel.com>
---
 src/acm.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

Comments

Hefty, Sean Jan. 7, 2015, 10:27 p.m. UTC | #1
Thanks - merged
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/acm.c b/src/acm.c
index 2d0d2e1..815a916 100644
--- a/src/acm.c
+++ b/src/acm.c
@@ -1517,6 +1517,17 @@  acm_ep_insert_addr(struct acmc_ep *ep, const char *name, uint8_t *addr,
 			goto out;
 		}
 
+		/* Open the provider endpoint only if at least a name or
+		   address is found */
+		if (!ep->prov_ep_context) {
+			ret = ep->port->prov->open_endpoint(&ep->endpoint,
+				ep->port->prov_port_context, 
+				&ep->prov_ep_context);
+			if (ret) {
+				acm_log(0, "Error: failed to open prov ep\n");
+				goto out;
+			}
+		}
 		ep->addr_info[i].addr.type = addr_type;
 		strncpy(ep->addr_info[i].string_buf, name, ACM_MAX_ADDRESS);
 		memcpy(ep->addr_info[i].addr.info.addr, tmp, ACM_MAX_ADDRESS);
@@ -1735,12 +1746,6 @@  static void acm_ep_up(struct acmc_port *port, uint16_t pkey)
 	if (!ep)
 		return;
 
-	if (port->prov->open_endpoint(&ep->endpoint, port->prov_port_context, 
-				      &ep->prov_ep_context)) {
-		acm_log(0, "Error -- failed to open prov endpoint\n");
-		goto err;
-	}
-
 	ret = acm_assign_ep_names(ep);
 	if (ret) {
 		acm_log(0, "ERROR - unable to assign EP name for pkey 0x%x\n", pkey);
@@ -1751,9 +1756,9 @@  static void acm_ep_up(struct acmc_port *port, uint16_t pkey)
 	return;
 
 ep_close:
-	port->prov->close_endpoint(ep->prov_ep_context);
+	if (ep->prov_ep_context) 
+		port->prov->close_endpoint(ep->prov_ep_context);
 
-err:
 	free(ep);
 }