]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
common,scm: add debug capabilities to print in-process CM lists
authorArlin Davis <arlin.r.davis@intel.com>
Sat, 20 Jun 2009 03:52:51 +0000 (20:52 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Sat, 20 Jun 2009 03:52:51 +0000 (20:52 -0700)
Add a new debug bit DAPL_DBG_TYPE_CM_LIST.
If set, the pending CM requests will be
dumped when dat_print_counters is called.
Only provided when built with -DDAPL_COUNTERS

Add new dapl_cm_state_str() call for state
to string conversion for debug prints.

Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
dapl/common/dapl_debug.c
dapl/include/dapl_debug.h
dapl/openib_cma/dapl_ib_util.h
dapl/openib_scm/dapl_ib_cm.c
dapl/openib_scm/dapl_ib_util.h

index 672321789279262c3d50489580d5ace3caa379d3..18b6e7ea288c6251cc5804cc979f41fe28609fbf 100644 (file)
@@ -232,6 +232,12 @@ void dapl_print_counter(DAT_HANDLE dh, int counter, int reset)
                                p_cntrs[i] = 0;
                }
        }
+
+       /* Print in process CR's for this IA, if debug type set */
+       if ((type == DAT_HANDLE_TYPE_IA) && 
+           (g_dapl_dbg_type & DAPL_DBG_TYPE_CM_LIST)) {
+               dapls_print_cm_list((DAPL_IA*)dh);
+       }
        return;
 }
 
index bb823d96110525e2e8a35408f45f913eae8f39f2..92e3d3b7a6435c310394f9382b21da98ec86ee61 100644 (file)
@@ -65,7 +65,8 @@ typedef enum
     DAPL_DBG_TYPE_RTN          = 0x0200,
     DAPL_DBG_TYPE_EXCEPTION    = 0x0400,
     DAPL_DBG_TYPE_SRQ          = 0x0800,
-    DAPL_DBG_TYPE_CNTR         = 0x1000
+    DAPL_DBG_TYPE_CNTR         = 0x1000,
+    DAPL_DBG_TYPE_CM_LIST      = 0x2000
 
 } DAPL_DBG_TYPE;
 
index 46c9b356c9f14dde76ea979c60a5ed7534169d75..dde5fac31d2366c71f8745072583efe0518a2ea3 100755 (executable)
@@ -286,6 +286,11 @@ STATIC _INLINE_ void dapl_ib_release_name (IN IB_HCA_NAME name)
        return;
 }
 
+STATIC _INLINE_ void dapls_print_cm_list(IN DAPL_IA * ia_ptr)
+{
+       return;
+}
+
 /*
  *  Convert errno to DAT_RETURN values
  */
index 6d39a4a5210efc86d8720f709931e4fcbf626d21..27defb6169ef351321aafb76e049d72a9a80ef2c 100644 (file)
@@ -1723,3 +1723,40 @@ void cr_thread(void *arg)
        hca_ptr->ib_trans.cr_state = IB_THREAD_EXIT;
        dapl_dbg_log(DAPL_DBG_TYPE_UTIL, " cr_thread(hca %p) exit\n", hca_ptr);
 }
+
+
+#ifdef DAPL_COUNTERS
+/* Debug aid: List all Connections in process and state */
+void dapls_print_cm_list(IN DAPL_IA *ia_ptr)
+{
+       /* Print in process CR's for this IA, if debug type set */
+       int i = 0;
+       dp_ib_cm_handle_t cr, next_cr;
+
+       dapl_os_lock(&ia_ptr->hca_ptr->ib_trans.lock);
+       if (!dapl_llist_is_empty((DAPL_LLIST_HEAD*)
+                                &ia_ptr->hca_ptr->ib_trans.list))
+                                next_cr = dapl_llist_peek_head((DAPL_LLIST_HEAD*)
+                                &ia_ptr->hca_ptr->ib_trans.list);
+       else
+               next_cr = NULL;
+
+        printf("\n DAPL IA CONNECTIONS IN PROCESS:\n");
+       while (next_cr) {
+               cr = next_cr;
+               next_cr = dapl_llist_next_entry((DAPL_LLIST_HEAD*)
+                                &ia_ptr->hca_ptr->ib_trans.list,
+                               (DAPL_LLIST_ENTRY*)&cr->entry);
+
+               printf( "  CONN[%d]: sp %p ep %p sock %d %s %s -> %s\n",
+                       i, cr->sp, cr->ep, cr->socket,
+                       cr->dst.qp_type == IBV_QPT_RC ? "RC" : "UD",
+                       dapl_cm_state_str(cr->state),
+                       inet_ntoa(((struct sockaddr_in *)
+                                 &cr->dst.ia_address)->sin_addr));
+               i++;
+       }
+       printf("\n");
+       dapl_os_unlock(&ia_ptr->hca_ptr->ib_trans.lock);
+}
+#endif
index ef98ab663ba76a602c09802c75cf2f03a86bba69..294ef3d994603f7eccac09a7403a60285633d8c5 100644 (file)
@@ -317,6 +317,7 @@ void cr_thread(void *arg);
 int dapli_cq_thread_init(struct dapl_hca *hca_ptr);
 void dapli_cq_thread_destroy(struct dapl_hca *hca_ptr);
 DAT_RETURN dapli_socket_disconnect(dp_ib_cm_handle_t cm_ptr);
+void dapls_print_cm_list(IN DAPL_IA *ia_ptr);
 
 DAT_RETURN
 dapls_modify_qp_state ( IN ib_qp_handle_t      qp_handle,
@@ -369,6 +370,24 @@ dapl_convert_errno( IN int err, IN const char *str )
     }
  }
 
+STATIC _INLINE_ char * dapl_cm_state_str(IN int st)
+{
+       static char *cm_state[] = {
+               "SCM_INIT",
+               "SCM_LISTEN",
+               "SCM_CONN_PENDING",
+               "SCM_RTU_PENDING",
+               "SCM_ACCEPTING",
+               "SCM_ACCEPTING_DATA",
+               "SCM_ACCEPTED",
+               "SCM_REJECTED",
+               "SCM_CONNECTED",
+               "SCM_DISCONNECTED",
+               "SCM_DESTROY"
+        };
+        return ((st < 0 || st > 10) ? "Invalid CM state?" : cm_state[st]);
+}
+
 /*
  * Definitions required only for DAT 1.1 builds
  */