[openib-general] [PATCH] [kDAPL] Remove unused variable in CM callbacks

Hal Rosenstock halr at voltaire.com
Wed May 4 22:38:35 PDT 2005


Remove unused variable in CM callbacks
Also, ensure CM ID of connection listener set to invalid when removed

Signed-off-by: Hal Rosenstock <halr at voltaire.com>


Index: dapl_openib_cm.c
===================================================================
-- dapl_openib_cm.c	(revision 2254)
+++ dapl_openib_cm.c	(working copy)
@@ -47,12 +47,12 @@
 #define IB_TARGET_MAX      4	/* responder resources (max_qp_ous_rd_atom) */
 #define IB_INITIATOR_DEPTH 4	/* initiator depth (max_qp_init_rd_atom) */
 
-static int do_active_idle(DAPL_EP * ep_ptr)
+static void do_active_idle(DAPL_EP * ep_ptr)
 {
 	ib_cm_events_t cm_event;
 
 	if (ep_ptr->cm_handle == IB_INVALID_HANDLE)
-		return 0;
+		return;
 
 	if (ep_ptr->param.connect_evd_handle) {
 		cm_event = IB_CME_DISCONNECTED;
@@ -60,21 +60,20 @@
 					     cm_event, NULL, (void *)ep_ptr);
 	}
 
-	return 0;
 }
 
-static int do_active_rep_recv(DAPL_EP * ep_ptr,
+static void do_active_rep_recv(DAPL_EP * ep_ptr,
 			      struct ib_cm_id *comm_id,
 			      struct ib_cm_event *rep_recv_param)
 {
 	int status;
 
 	if (ep_ptr->cm_handle == IB_INVALID_HANDLE)
-		return 0;
+		return;
 
 	if (ep_ptr->qp_handle == IB_INVALID_HANDLE) {
 		dapl_dbg_log(DAPL_DBG_TYPE_ERR, " do_active_rep_recv: invalid qp handle\n");
-		return 0;
+		return;
 	}
 
 	/* First, transition QP to RTR */
@@ -107,21 +106,18 @@
 					     rep_recv_param->private_data,
 					     (void *)ep_ptr);
 
-	return 0;
 }
 
-static int do_active_disc(DAPL_EP * ep_ptr, struct ib_cm_id *comm_id)
+static void do_active_disc(DAPL_EP * ep_ptr, struct ib_cm_id *comm_id)
 {
 	dapl_evd_connection_callback(comm_id,
 				     IB_CME_DISCONNECTED, NULL, (void *)ep_ptr);
-	return 0;
 }
 
 int dapl_cm_active_cb_handler(struct ib_cm_id *comm_id,
 			      struct ib_cm_event *event)
 {
 	DAPL_EP *ep_ptr;
-	int ret = 0;
 
 	ep_ptr = (DAPL_EP *) comm_id->context;
 	/* Is this check needed ? */
@@ -133,16 +129,16 @@
 
 	switch (comm_id->state) {
 	case IB_CM_IDLE:
-		ret = do_active_idle(ep_ptr);
+		do_active_idle(ep_ptr);
 		break;
 	case IB_CM_REP_RCVD:
-		ret = do_active_rep_recv(ep_ptr, comm_id, event);
+		do_active_rep_recv(ep_ptr, comm_id, event);
 		break;
 	case IB_CM_ESTABLISHED:
 		/* Nothing to do */
 		break;
 	case IB_CM_DREQ_RCVD:
-		ret = do_active_disc(ep_ptr, comm_id);
+		do_active_disc(ep_ptr, comm_id);
 		break;
 	default:
 		dapl_dbg_log(DAPL_DBG_TYPE_ERR,
@@ -154,7 +150,7 @@
 	return 0;
 }
 
-static int do_passive_idle(struct ib_cm_id *comm_id)
+static void do_passive_idle(struct ib_cm_id *comm_id)
 {
 	ib_cm_events_t cm_event;
 
@@ -162,20 +158,18 @@
 
 	dapl_cr_callback(comm_id, cm_event, NULL, comm_id->context);
 
-	return 0;
 }
 
-static int do_passive_req_recv(struct ib_cm_id *comm_id,
+static void do_passive_req_recv(struct ib_cm_id *comm_id,
 			       struct ib_cm_event *req_recv_param)
 {
 	dapl_cr_callback(comm_id, IB_CME_CONNECTION_REQUEST_PENDING, 
                          req_recv_param->private_data,
 			 comm_id->context);
 
-	return 0;
 }
 
-static int do_passive_established(struct ib_cm_id *comm_id)
+static void do_passive_established(struct ib_cm_id *comm_id)
 {
 	DAPL_SP *sp_ptr;
 	DAPL_CR *cr_ptr;
@@ -186,7 +180,7 @@
 	cr_ptr = dapl_sp_search_cr(sp_ptr, comm_id);
 	if (cr_ptr == NULL) {
 		printk(KERN_ERR "do_passive_established: No CR found for CM ID 0x%p\n", comm_id);
-		return 0;
+		return;
 	}
 	ep_ptr = (DAPL_EP *)cr_ptr->param.local_ep_handle;
 	/* Quick check to ensure our EP is still valid */
@@ -211,34 +205,30 @@
                      IB_CME_CONNECTED, 
                      NULL, (void *)comm_id->context);
 
-	return 0;
 }
 
-static int do_passive_disc(struct ib_cm_id *comm_id)
+static void do_passive_disc(struct ib_cm_id *comm_id)
 {
 	dapl_cr_callback(comm_id,
 			 IB_CME_DISCONNECTED,
 			 NULL, (void *)comm_id->context);
-	return 0;
 }
 
 int dapl_cm_passive_cb_handler(struct ib_cm_id *comm_id,
 			       struct ib_cm_event *event)
 {
-	int ret = 0;
-
 	switch (comm_id->state) {
 	case IB_CM_IDLE:
-		ret = do_passive_idle(comm_id);
+		do_passive_idle(comm_id);
 		break;
 	case IB_CM_REQ_RCVD:
-		ret = do_passive_req_recv(comm_id, event);
+		do_passive_req_recv(comm_id, event);
 		break;
 	case IB_CM_ESTABLISHED:
-		ret = do_passive_established(comm_id);
+		do_passive_established(comm_id);
 		break;
 	case IB_CM_DREQ_RCVD:
-		ret = do_passive_disc(comm_id);
+		do_passive_disc(comm_id);
 		break;
 	default:
 		dapl_dbg_log(DAPL_DBG_TYPE_ERR,
@@ -510,6 +500,7 @@
  * Input:                                                                       
  *      ep_ptr          DAPL_EP                                                 
  *      active          Indicates active side of connection                     
+ *	ib_cm_event	
  *                                                                              
  * Output:                                                                      
  *      none                                                                    
@@ -621,10 +612,9 @@
 	status = ib_cm_listen(sp_ptr->cm_srvc_handle,
 			      be64_to_cpu(ServiceID), 0);
 	if (status) {
-		/* need to destroy CM ID ??? */
+		/* Need to also destroy CM ID ? */
+		sp_ptr->cm_srvc_handle = IB_INVALID_HANDLE;
 
-		sp_ptr->cm_srvc_handle = NULL;
-
 		if (status == -EBUSY)
 			return DAT_CONN_QUAL_IN_USE;
 		else
@@ -659,6 +649,7 @@
 		return DAT_SUCCESS;
 
 	status = dapl_ib_queue_destroy_cm_id(sp_ptr->cm_srvc_handle);
+	sp_ptr->cm_srvc_handle = IB_INVALID_HANDLE;
 	if (status) {
 		dapl_dbg_log(DAPL_DBG_TYPE_ERR,
 			     " dapl_ib_remove_conn_listener: ib_destroy_cm_id failed: %d\n", status);





More information about the general mailing list