[openib-general] RE: [PATCH2] uDAPL openib_cma: fixed address bindings, getaddrinfo, and added debug messages for rejects

Arlin Davis arlin.r.davis at intel.com
Thu Apr 27 14:48:41 PDT 2006


James,

Here is a new patch with your recommended changes.

-arlin

Signed-off by: Arlin Davis <ardavis at ichips.intel.com>

Index: dapl/openib_cma/dapl_ib_util.c
===================================================================
--- dapl/openib_cma/dapl_ib_util.c	(revision 6672)
+++ dapl/openib_cma/dapl_ib_util.c	(working copy)
@@ -121,11 +121,12 @@ static int getipaddr(char *name, char *a
 	if (getaddrinfo(name, NULL, NULL, &res)) {
 		/* retry using network device name */
 		ret = getipaddr_netdev(name,addr,len);
-		if (ret)
+		if (ret) {
 			dapl_dbg_log(DAPL_DBG_TYPE_WARN, 
 			     " getipaddr: invalid name, addr, or netdev(%s)\n",
 			     name);
-		return ret;
+			return ret;
+		}
 	} else {
 		if (len >= res->ai_addrlen)
 			memcpy(addr, res->ai_addr, res->ai_addrlen);
Index: dapl/openib_cma/dapl_ib_cm.c
===================================================================
--- dapl/openib_cma/dapl_ib_cm.c	(revision 6672)
+++ dapl/openib_cma/dapl_ib_cm.c	(working copy)
@@ -274,11 +274,21 @@ static void dapli_cm_active_cb(struct da
 	switch (event->event) {
 	case RDMA_CM_EVENT_UNREACHABLE:
 	case RDMA_CM_EVENT_CONNECT_ERROR:
+		dapl_dbg_log(
+			DAPL_DBG_TYPE_WARN,
+			" dapli_cm_active_handler: CONN_ERR "
+			" event=0x%x status=%d\n",	
+			event->event, event->status);
+
 		dapl_evd_connection_callback(conn,
 					     IB_CME_DESTINATION_UNREACHABLE,
 					     NULL, conn->ep);
 		break;
 	case RDMA_CM_EVENT_REJECTED:
+		dapl_dbg_log(
+			DAPL_DBG_TYPE_WARN,
+			" dapli_cm_active_handler: REJECTED reason=%d\n",	
+			event->status);
 		dapl_evd_connection_callback(conn, IB_CME_DESTINATION_REJECT,
 					     NULL, conn->ep);
 		break;
@@ -320,6 +330,9 @@ static void dapli_cm_passive_cb(struct d
 			       struct rdma_cm_event *event)
 {
 	struct dapl_cm_id *new_conn;
+#ifdef DAPL_DBG
+	struct rdma_addr *ipaddr = &conn->cm_id->route.addr;
+#endif
 
 	dapl_dbg_log(DAPL_DBG_TYPE_CM, 
 		     " passive_cb: conn %p id %d event %d\n",
@@ -343,13 +356,48 @@ static void dapli_cm_passive_cb(struct d
 				 	  event->private_data, new_conn->sp);
 		break;
 	case RDMA_CM_EVENT_UNREACHABLE:
+		dapls_cr_callback(conn, IB_CME_DESTINATION_UNREACHABLE,
+				 NULL, conn->sp);
+
 	case RDMA_CM_EVENT_CONNECT_ERROR:
+
+		dapl_dbg_log(
+			DAPL_DBG_TYPE_WARN, 
+			" dapli_cm_passive: CONN_ERR "
+			" event=0x%x status=%d",
+			" on SRC 0x%x,0x%x DST 0x%x,0x%x\n",
+			event->event, event->status,
+			ntohl(((struct sockaddr_in *)
+				&ipaddr->src_addr)->sin_addr.s_addr),
+			ntohs(((struct sockaddr_in *)
+				&ipaddr->src_addr)->sin_port),
+			ntohl(((struct sockaddr_in *)
+				&ipaddr->dst_addr)->sin_addr.s_addr),
+			ntohs(((struct sockaddr_in *)
+				&ipaddr->dst_addr)->sin_port));
+
 		dapls_cr_callback(conn, IB_CME_DESTINATION_UNREACHABLE,
 				 NULL, conn->sp);
 		break;
+
 	case RDMA_CM_EVENT_REJECTED:
-		dapls_cr_callback(conn, IB_CME_DESTINATION_REJECT, NULL,
-				 conn->sp);
+
+		dapl_dbg_log(
+			DAPL_DBG_TYPE_WARN, 
+			" dapli_cm_passive: REJECTED reason=%d"
+			" on SRC 0x%x,0x%x DST 0x%x,0x%x\n", 
+			event->status,
+			ntohl(((struct sockaddr_in *)
+				&ipaddr->src_addr)->sin_addr.s_addr),
+			ntohs(((struct sockaddr_in *)
+				&ipaddr->src_addr)->sin_port),
+			ntohl(((struct sockaddr_in *)
+				&ipaddr->dst_addr)->sin_addr.s_addr),
+			ntohs(((struct sockaddr_in *)
+				&ipaddr->dst_addr)->sin_port));
+
+		dapls_cr_callback(conn, IB_CME_DESTINATION_REJECT, 
+				  NULL, conn->sp);
 		break;
 	case RDMA_CM_EVENT_ESTABLISHED:
 		
@@ -556,6 +604,7 @@ dapls_ib_setup_conn_listener(IN DAPL_IA 
 {
 	DAT_RETURN dat_status = DAT_SUCCESS;
 	ib_cm_srvc_handle_t conn;
+	DAT_SOCK_ADDR6	addr;	/* local binding address */
 
 	/* Allocate CM and initialize lock */
 	if ((conn = dapl_os_alloc(sizeof(*conn))) == NULL) 
@@ -571,11 +620,12 @@ dapls_ib_setup_conn_listener(IN DAPL_IA 
 	}
 	
 	/* open identifies the local device; per DAT specification */
-	((struct sockaddr_in *)&ia_ptr->hca_ptr->hca_address)->sin_port = 
-						htons(MAKE_PORT(ServiceID));
+	/* Get family and address then set port to consumer's ServiceID */
+	dapl_os_memcpy(&addr, &ia_ptr->hca_ptr->hca_address, sizeof(addr));
+	((struct sockaddr_in *)&addr)->sin_port = htons(MAKE_PORT(ServiceID));
+
 
-	if (rdma_bind_addr(conn->cm_id,
-			   (struct sockaddr *)&ia_ptr->hca_ptr->hca_address)) {
+	if (rdma_bind_addr(conn->cm_id,(struct sockaddr *)&addr)) {
 		if (errno == EBUSY)
 			dat_status = DAT_CONN_QUAL_IN_USE;
 		else




More information about the general mailing list