[DAPL2] DAPL Counters 2.0.3 & extensions.
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Mar 2009 17:38:47 +0000 (17:38 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 3 Mar 2009 17:38:47 +0000 (17:38 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2005 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

39 files changed:
ulp/dapl2/dapl/common/dapl_ep_post_rdma_read.c
ulp/dapl2/dapl/common/dapl_ep_post_rdma_write.c
ulp/dapl2/dapl/common/dapl_ep_post_recv.c
ulp/dapl2/dapl/common/dapl_ep_post_send.c
ulp/dapl2/dapl/common/dapl_ep_util.c
ulp/dapl2/dapl/common/dapl_evd_connection_callb.c
ulp/dapl2/dapl/common/dapl_evd_cq_async_error_callb.c
ulp/dapl2/dapl/common/dapl_evd_dequeue.c
ulp/dapl2/dapl/common/dapl_evd_dto_callb.c
ulp/dapl2/dapl/common/dapl_evd_free.c
ulp/dapl2/dapl/common/dapl_evd_qp_async_error_callb.c
ulp/dapl2/dapl/common/dapl_evd_un_async_error_callb.c
ulp/dapl2/dapl/common/dapl_evd_util.c
ulp/dapl2/dapl/common/dapl_ia_close.c
ulp/dapl2/dapl/common/dapl_ia_query.c
ulp/dapl2/dapl/common/dapl_ia_util.c
ulp/dapl2/dapl/common/dapl_lmr_free.c
ulp/dapl2/dapl/common/dapl_psp_create.c
ulp/dapl2/dapl/common/dapl_psp_create_any.c
ulp/dapl2/dapl/common/dapl_psp_free.c
ulp/dapl2/dapl/common/dapl_pz_create.c
ulp/dapl2/dapl/common/dapl_pz_free.c
ulp/dapl2/dapl/common/dapl_rmr_create.c
ulp/dapl2/dapl/common/dapl_rmr_free.c
ulp/dapl2/dapl/common/dapl_rsp_create.c
ulp/dapl2/dapl/common/dapl_rsp_free.c
ulp/dapl2/dapl/common/dapl_srq_create.c
ulp/dapl2/dapl/common/dapl_srq_free.c
ulp/dapl2/dapl/common/dapl_timer_util.c
ulp/dapl2/dapl/ibal/dapl_ibal_extensions.c
ulp/dapl2/dapl/include/dapl.h
ulp/dapl2/dapl/include/dapl_debug.h
ulp/dapl2/dapl/udapl/dapl_evd_create.c
ulp/dapl2/dapl/udapl/dapl_evd_wait.c
ulp/dapl2/dapl/udapl/dapl_init.c
ulp/dapl2/dapl/udapl/dapl_lmr_create.c
ulp/dapl2/dapl/udapl/linux/dapl_osd.h
ulp/dapl2/dat/include/dat/dat_ib_extensions.h
ulp/dapl2/dat/udat/linux/dat_osd.h

index ea00363..0adc70d 100644 (file)
@@ -86,7 +86,6 @@ dapl_ep_post_rdma_read (
                  user_cookie.as_64,\r
                  remote_iov, \r
                  completion_flags);\r
-    DAPL_CNTR(DCNT_POST_RDMA_READ);\r
 \r
     dat_status = dapl_ep_post_send_req(ep_handle, \r
                                  num_segments, \r
index 4d2f29d..7d71995 100644 (file)
@@ -85,7 +85,6 @@ dapl_ep_post_rdma_write (
                  user_cookie.as_64,\r
                  remote_iov, \r
                  completion_flags);\r
-    DAPL_CNTR(DCNT_POST_RDMA_WRITE);\r
 \r
     dat_status = dapl_ep_post_send_req(ep_handle, \r
                                  num_segments, \r
index d8ceb81..fb45845 100644 (file)
@@ -85,7 +85,6 @@ dapl_ep_post_recv (
                  local_iov,\r
                  user_cookie.as_64,\r
                  completion_flags);\r
-    DAPL_CNTR (DCNT_POST_RECV);\r
 \r
     if ( DAPL_BAD_HANDLE (ep_handle, DAPL_MAGIC_EP) )\r
     {\r
index 6055e70..e0e20b9 100644 (file)
@@ -84,7 +84,6 @@ dapl_ep_post_send (
                  local_iov, \r
                  user_cookie.as_64,\r
                  completion_flags);\r
-    DAPL_CNTR(DCNT_POST_SEND);\r
 \r
     dat_status = dapl_ep_post_send_req(ep_handle,\r
                                  num_segments,\r
index bea9b92..388ab16 100644 (file)
@@ -120,6 +120,16 @@ dapl_ep_alloc (
     /* zero the structure */\r
     dapl_os_memzero (ep_ptr, sizeof (DAPL_EP) + sizeof (DAT_SOCK_ADDR));\r
 \r
+#ifdef COUNTERS\r
+    /* Allocate counters */\r
+    ep_ptr->cntrs = dapl_os_alloc(sizeof(DAT_UINT64) * DCNT_EP_ALL_COUNTERS);\r
+    if (ep_ptr->cntrs == NULL) {\r
+       dapl_os_free(ep_ptr, sizeof (DAPL_EP) + sizeof (DAT_SOCK_ADDR));\r
+       return (NULL);\r
+    }\r
+    dapl_os_memzero (ep_ptr->cntrs, sizeof(DAT_UINT64) * DCNT_EP_ALL_COUNTERS);\r
+#endif /* COUNTERS */\r
+\r
     /*\r
      * initialize the header\r
      */\r
@@ -222,6 +232,11 @@ dapl_ep_dealloc (
         ep_ptr->ibal_cm_handle = NULL;\r
     }\r
 #endif\r
+\r
+#ifdef COUNTERS\r
+    dapl_os_free(ep_ptr->cntrs, sizeof(DAT_UINT64) * DCNT_EP_ALL_COUNTERS);\r
+#endif /* COUNTERS */\r
+\r
     dapl_os_free (ep_ptr, sizeof (DAPL_EP) + sizeof (DAT_SOCK_ADDR) );\r
 }\r
 \r
index 100d77e..113e56c 100644 (file)
@@ -84,8 +84,6 @@ dapl_evd_connection_callback (
        ib_cm_event,\r
        (void *) ib_cm_handle );\r
 \r
-    DAPL_CNTR(DCNT_EVD_CONN_CALLBACK);\r
-\r
     /*\r
      * Determine the type of handle passed back to us in the context\r
      * and sort out key parameters.\r
@@ -101,6 +99,7 @@ dapl_evd_connection_callback (
      */\r
     ep_ptr  = (DAPL_EP *) context;\r
     evd_ptr = (DAPL_EVD *) ep_ptr->param.connect_evd_handle;\r
+    DAPL_CNTR(evd_ptr, DCNT_EVD_CONN_CALLBACK);\r
 \r
     prd_ptr = (DAPL_PRIVATE *)private_data_ptr;\r
     private_data_size = 0;\r
index c5d0cda..7279a96 100644 (file)
@@ -79,6 +79,7 @@ dapl_evd_cq_async_error_callback (
 \r
     evd = (DAPL_EVD *) context;\r
     async_evd = evd->header.owner_ia->async_error_evd;\r
+    DAPL_CNTR(evd->header.owner_ia, DCNT_IA_ASYNC_CQ_ERROR);\r
 \r
     dat_status = dapls_evd_post_async_error_event(\r
        async_evd,\r
index 95fa5fa..48a3c10 100644 (file)
@@ -75,7 +75,6 @@ DAT_RETURN DAT_API dapl_evd_dequeue (
                  "dapl_evd_dequeue (%p, %p)\n",\r
                  evd_handle, \r
                  event);\r
-    DAPL_CNTR(DCNT_EVD_DEQUEUE);\r
 \r
     evd_ptr = (DAPL_EVD *)evd_handle;\r
     dat_status = DAT_SUCCESS;\r
@@ -91,6 +90,7 @@ DAT_RETURN DAT_API dapl_evd_dequeue (
        dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
        goto bail;\r
     }\r
+    DAPL_CNTR(evd_ptr, DCNT_EVD_DEQUEUE);\r
 \r
     /*\r
      * We need to dequeue under lock, as the IB OS Access API\r
@@ -122,17 +122,18 @@ DAT_RETURN DAT_API dapl_evd_dequeue (
        *event = *local_event;\r
        dat_status = dapls_rbuf_add (&evd_ptr->free_event_queue, \r
                                     local_event);\r
-       DAPL_CNTR(DCNT_EVD_DEQUEUE_FOUND);\r
+       DAPL_CNTR(evd_ptr, DCNT_EVD_DEQUEUE_FOUND);\r
+\r
     }\r
     else if (evd_ptr->ib_cq_handle != IB_INVALID_HANDLE)\r
     {\r
        dat_status = dapls_evd_cq_poll_to_event(evd_ptr, event);\r
-       DAPL_CNTR(DCNT_EVD_DEQUEUE_POLL);\r
+       DAPL_CNTR(evd_ptr, DCNT_EVD_DEQUEUE_POLL);\r
     }\r
     else\r
     {\r
        dat_status = DAT_ERROR (DAT_QUEUE_EMPTY,0);\r
-       DAPL_CNTR(DCNT_EVD_DEQUEUE_NOT_FOUND);\r
+       DAPL_CNTR(evd_ptr, DCNT_EVD_DEQUEUE_NOT_FOUND);\r
     }\r
 \r
     dapl_os_unlock ( &evd_ptr->header.lock );\r
index b354e2a..d10416c 100644 (file)
@@ -84,9 +84,9 @@ dapl_evd_dto_callback (
                  hca_handle, \r
                  cq_handle, \r
                  user_context);\r
-    DAPL_CNTR(DCNT_EVD_DTO_CALLBACK);\r
 \r
     evd_ptr = (DAPL_EVD *) user_context;\r
+    DAPL_CNTR(evd_ptr, DCNT_EVD_DTO_CALLBACK);\r
 \r
     dapl_os_assert (hca_handle == evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle);\r
     dapl_os_assert (evd_ptr->ib_cq_handle == cq_handle);\r
index c142b3a..2a17b72 100644 (file)
@@ -68,7 +68,6 @@ DAT_RETURN DAT_API dapl_evd_free (
     DAT_RETURN  dat_status;\r
 \r
     dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_evd_free (%p)\n", evd_handle);\r
-    DAPL_CNTR (DCNT_EVD_FREE);\r
 \r
     dat_status = DAT_SUCCESS;\r
     evd_ptr = (DAPL_EVD *)evd_handle;\r
@@ -79,6 +78,8 @@ DAT_RETURN DAT_API dapl_evd_free (
        goto bail;\r
     }\r
 \r
+    DAPL_CNTR(evd_ptr->header.owner_ia, DCNT_IA_EVD_FREE);\r
+\r
     if (dapl_os_atomic_read (&evd_ptr->evd_ref_count) != 0)\r
     {\r
        dat_status = DAT_ERROR (DAT_INVALID_STATE, DAT_INVALID_STATE_EVD_IN_USE);\r
index 82f1da6..1fe9201 100644 (file)
@@ -120,6 +120,7 @@ dapl_evd_qp_async_error_callback (
 \r
     ia_ptr    = ep_ptr->header.owner_ia;\r
     async_evd = (DAPL_EVD *) ia_ptr->async_error_evd;\r
+    DAPL_CNTR(ia_ptr, DCNT_IA_ASYNC_QP_ERROR);\r
 \r
     dapl_dbg_log (\r
        DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,\r
index 5e636ff..f99edf8 100644 (file)
@@ -78,6 +78,7 @@ dapl_evd_un_async_error_callback (
     }\r
 \r
     async_evd = (DAPL_EVD *) context;\r
+    DAPL_CNTR(async_evd->header.owner_ia, DCNT_IA_ASYNC_ERROR);\r
 \r
     dat_status = dapls_ib_get_async_event(cause_ptr, &async_event);\r
 \r
index 28b10a8..1c63f17 100644 (file)
@@ -274,6 +274,17 @@ dapls_evd_alloc (
     /* zero the structure */\r
     dapl_os_memzero (evd_ptr, sizeof (DAPL_EVD));\r
 \r
+#ifdef COUNTERS\r
+    /* Allocate counters */\r
+    evd_ptr->cntrs = dapl_os_alloc(sizeof(DAT_UINT64) * DCNT_EVD_ALL_COUNTERS);\r
+    if (evd_ptr->cntrs == NULL) {\r
+       dapl_os_free(evd_ptr, sizeof(DAPL_EVD));\r
+       return (NULL);\r
+    }\r
+    dapl_os_memzero(evd_ptr->cntrs, \r
+                   sizeof(DAT_UINT64) * DCNT_EVD_ALL_COUNTERS);\r
+#endif /* COUNTERS */\r
+\r
     /*\r
      * initialize the header\r
      */\r
@@ -543,6 +554,10 @@ dapls_evd_dealloc (
     }\r
 #endif\r
 \r
+#ifdef COUNTERS\r
+    dapl_os_free(evd_ptr->cntrs, sizeof(DAT_UINT64) * DCNT_EVD_ALL_COUNTERS);\r
+#endif /* COUNTERS */\r
+\r
     dapl_os_free (evd_ptr, sizeof (DAPL_EVD));\r
 \r
 bail:\r
index dec1078..34fac13 100644 (file)
@@ -77,7 +77,11 @@ dapl_ia_close (
        dat_status = DAT_ERROR (DAT_INVALID_HANDLE,DAT_INVALID_HANDLE_IA);\r
        goto bail;\r
     }\r
-    \r
+\r
+#ifdef COUNTERS\r
+    dapl_print_counter(ia_handle, DCNT_IA_ALL_COUNTERS, 0);\r
+#endif /* COUNTERS */  \r
+\r
     if ( DAT_CLOSE_ABRUPT_FLAG == ia_flags )\r
     {\r
         dat_status = dapl_ia_abrupt_close (ia_ptr);\r
@@ -90,7 +94,7 @@ dapl_ia_close (
     {\r
        dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
     }\r
-\r
+     \r
  bail:\r
     return dat_status;\r
 }\r
index 64a778d..5c4fcf0 100644 (file)
@@ -228,6 +228,10 @@ bail:
                        "dapl_ia_query () returns 0x%x\n", dat_status);\r
     }\r
 \r
+#ifdef COUNTERS\r
+    dapl_print_counter(ia_handle, DCNT_IA_ALL_COUNTERS, 0);\r
+#endif /* COUNTERS */\r
+\r
     return dat_status;\r
 }\r
 \r
index debf1a2..3ee6f49 100644 (file)
@@ -78,6 +78,16 @@ dapl_ia_alloc ( DAT_PROVIDER * provider, DAPL_HCA * hca_ptr )
     /* zero the structure */\r
     dapl_os_memzero (ia_ptr, sizeof (DAPL_IA));\r
 \r
+#ifdef COUNTERS\r
+    /* Allocate counters */\r
+    ia_ptr->cntrs = dapl_os_alloc(sizeof(DAT_UINT64) * DCNT_IA_ALL_COUNTERS);\r
+    if (ia_ptr->cntrs == NULL) {\r
+       dapl_os_free (ia_ptr, sizeof(DAPL_IA));\r
+       return (NULL);\r
+    }\r
+    dapl_os_memzero(ia_ptr->cntrs, sizeof(DAT_UINT64) * DCNT_IA_ALL_COUNTERS);\r
+#endif /* COUNTERS */\r
+\r
     /*\r
      * initialize the header\r
      */\r
@@ -596,6 +606,10 @@ dapls_ia_free ( DAPL_IA *ia_ptr )
     ia_ptr->header.magic = DAPL_MAGIC_INVALID; /* reset magic to prevent reuse */\r
     dapl_os_lock_destroy (&ia_ptr->header.lock);\r
 \r
+#ifdef COUNTERS\r
+    dapl_os_free(ia_ptr->cntrs, sizeof(DAT_UINT64) * DCNT_IA_ALL_COUNTERS);\r
+#endif /* COUNTERS */\r
+\r
     dapl_os_free (ia_ptr, sizeof (DAPL_IA));\r
 }\r
 \r
index 5e7cefb..6d40c11 100644 (file)
@@ -62,6 +62,7 @@ dapl_lmr_free (
     IN DAT_LMR_HANDLE  lmr_handle )\r
 {\r
     DAPL_LMR           *lmr;\r
+    DAPL_PZ            *pz;\r
     DAT_RETURN         dat_status;\r
 \r
     dapl_dbg_log (DAPL_DBG_TYPE_API, "dapl_lmr_free (%p)\n", lmr_handle);\r
@@ -72,7 +73,10 @@ dapl_lmr_free (
        goto bail;\r
     }\r
 \r
-    lmr = (DAPL_LMR *) lmr_handle;\r
+    lmr = (DAPL_LMR *)lmr_handle;\r
+    pz = (DAPL_PZ *)lmr->param.pz_handle;\r
+    \r
+    DAPL_CNTR(pz->header.owner_ia, DCNT_IA_LMR_FREE);\r
 \r
     switch (lmr->param.mem_type)\r
     {\r
@@ -85,8 +89,6 @@ dapl_lmr_free (
        case DAT_MEM_TYPE_VIRTUAL:\r
        case DAT_MEM_TYPE_LMR:\r
        {\r
-           DAPL_PZ     *pz;\r
-\r
            if ( 0 != dapl_os_atomic_read (&lmr->lmr_ref_count) )\r
            {\r
                return DAT_INVALID_STATE;\r
@@ -103,10 +105,7 @@ dapl_lmr_free (
 \r
            if (dat_status == DAT_SUCCESS)\r
            {\r
-\r
-               pz = (DAPL_PZ *) lmr->param.pz_handle;\r
                dapl_os_atomic_dec (&pz->pz_ref_count);\r
-\r
                dapl_lmr_dealloc (lmr);\r
            }\r
            else\r
index ce5a7be..49b4d70 100644 (file)
@@ -114,7 +114,8 @@ dapl_psp_create (
        dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG4);\r
        goto bail;\r
     }\r
-       \r
+\r
+    DAPL_CNTR(ia_ptr, DCNT_IA_PSP_CREATE);     \r
 \r
     /*\r
      * See if we have a quiescent listener to use for this PSP, else\r
index ca3918b..e767a31 100644 (file)
@@ -133,6 +133,8 @@ dapl_psp_create_any (
        goto bail;\r
     }\r
 \r
+    DAPL_CNTR(ia_ptr, DCNT_IA_PSP_CREATE_ANY); \r
+\r
     /*\r
      * Fill out the args for a PSP\r
      */\r
index de4e796..21ad95f 100644 (file)
@@ -82,6 +82,8 @@ dapl_psp_free (
 \r
     ia_ptr = sp_ptr->header.owner_ia;\r
 \r
+    DAPL_CNTR(ia_ptr->header.owner_ia, DCNT_IA_PSP_FREE);\r
+\r
     /* \r
      * Remove the connection listener if it has been established\r
      * and there are no current connections in progress.\r
index 12fd22c..6c93c91 100644 (file)
@@ -90,6 +90,7 @@ dapl_pz_create (
        dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
        goto bail;\r
     }\r
+    DAPL_CNTR(ia, DCNT_IA_PZ_CREATE);\r
 \r
     dat_status = dapls_ib_pd_alloc (ia, pz);\r
     if ( DAT_SUCCESS != dat_status )\r
index a890c56..55b7960 100644 (file)
@@ -72,6 +72,8 @@ dapl_pz_free (
 \r
     pz = (DAPL_PZ *) pz_handle;\r
 \r
+    DAPL_CNTR(pz->header.owner_ia, DCNT_IA_PZ_FREE);\r
+\r
     if ( 0 != dapl_os_atomic_read (&pz->pz_ref_count) )\r
     {\r
        dat_status = DAT_ERROR (DAT_INVALID_STATE,DAT_INVALID_STATE_PZ_IN_USE);\r
index 4c4db55..50d7c66 100644 (file)
@@ -71,7 +71,6 @@ dapl_rmr_create (
     }\r
 \r
     pz = (DAPL_PZ *) pz_handle;\r
-\r
     rmr = dapl_rmr_alloc (pz);\r
 \r
     if ( rmr == NULL )\r
@@ -79,6 +78,7 @@ dapl_rmr_create (
        dat_status = DAT_ERROR (DAT_INSUFFICIENT_RESOURCES,DAT_RESOURCE_MEMORY);\r
        goto bail;\r
     }\r
+    DAPL_CNTR(pz->header.owner_ia, DCNT_IA_RMR_CREATE);\r
 \r
     dat_status = dapls_ib_mw_alloc (rmr);\r
 \r
index 329cbc6..2b301d2 100644 (file)
@@ -58,6 +58,7 @@ dapl_rmr_free (
     IN DAT_RMR_HANDLE  rmr_handle )\r
 {\r
     DAPL_RMR           *rmr;\r
+    DAPL_PZ            *pz;\r
     DAT_RETURN         dat_status;\r
 \r
     dat_status = DAT_SUCCESS;\r
@@ -69,6 +70,8 @@ dapl_rmr_free (
     }\r
 \r
     rmr = (DAPL_RMR *) rmr_handle;\r
+    pz = (DAPL_PZ *)rmr->param.pz_handle;\r
+    DAPL_CNTR(pz->header.owner_ia, DCNT_IA_RMR_FREE);\r
 \r
     /*\r
      * If the user did not perform an unbind op, release\r
index 5ea1bd1..92fc1b4 100644 (file)
@@ -126,6 +126,8 @@ dapl_rsp_create (
        goto bail;\r
     }\r
 \r
+    DAPL_CNTR(ia_ptr, DCNT_IA_RSP_CREATE);     \r
+\r
     sp_ptr = dapls_ia_sp_search (ia_ptr, conn_qual, DAT_FALSE);\r
     sp_found = DAT_TRUE;\r
     if (sp_ptr == NULL)\r
index 0e37a73..78e4033 100644 (file)
@@ -85,6 +85,8 @@ dapl_rsp_free (
     /* ia_ptr = (DAPL_IA *)sp_ptr->header.owner_ia; */\r
     ia_ptr = sp_ptr->header.owner_ia;\r
 \r
+    DAPL_CNTR(ia_ptr, DCNT_IA_RSP_FREE);       \r
+\r
     /*\r
      * Remove the connection listener if there are no connections.  If\r
      * we defer removing the sp it becomes something of a zombie\r
index 21295e4..874e779 100644 (file)
@@ -97,6 +97,8 @@ dapl_srq_create (
        goto bail;\r
     }\r
 \r
+    DAPL_CNTR(ia_ptr, DCNT_IA_SRQ_CREATE);\r
+\r
     /*\r
      * Verify non-required parameters.\r
      * N.B. Assumption: any parameter that can be\r
index cecda0c..d493917 100644 (file)
@@ -96,6 +96,8 @@ dapl_srq_free (
 \r
     ia_ptr = srq_ptr->header.owner_ia;\r
 \r
+    DAPL_CNTR(ia_ptr, DCNT_IA_SRQ_FREE);\r
+\r
     /*\r
      * Do verification of parameters and the state change atomically.\r
      */\r
index 0267780..f6f963b 100644 (file)
@@ -107,7 +107,6 @@ dapls_timer_set (
     DAPL_OS_TIMEVAL            cur_time;\r
     DAT_BOOLEAN                        wakeup_tmo_thread;\r
 \r
-    DAPL_CNTR(DCNT_TIMER_SET);\r
     /*\r
      * Start the timer thread the first time we need a timer\r
      */\r
@@ -216,7 +215,6 @@ void
 dapls_timer_cancel (\r
        IN  DAPL_OS_TIMER               *timer)\r
 {\r
-    DAPL_CNTR(DCNT_TIMER_CANCEL);\r
     dapl_os_lock ( &g_daplTimerHead.lock );\r
     /*\r
      * make sure the entry has not been removed by another thread\r
index 618cbae..49b5bdb 100644 (file)
@@ -93,7 +93,7 @@ dapl_extensions(IN DAT_HANDLE         dat_handle,
                     "dapl_extensions(hdl %p operation %d, ...)\n",\r
                     dat_handle, ext_op);\r
 \r
-       DAPL_CNTR(DCNT_EXTENSION);\r
+       DAPL_CNTR(dat_handle,DCNT_EXTENSION);\r
 \r
        switch ((int)ext_op)\r
        {\r
index 4264863..6f1772c 100644 (file)
@@ -316,6 +316,9 @@ struct dapl_ia
     DAPL_LLIST_HEAD    psp_list_head;          /* PSP queue */\r
     DAPL_LLIST_HEAD    rsp_list_head;          /* RSP queue */\r
     DAPL_LLIST_HEAD    srq_list_head;          /* SRQ queue */\r
+#ifdef COUNTERS\r
+    void               *cntrs;\r
+#endif\r
 };\r
 \r
 /* DAPL_CNO maps to DAT_CNO_HANDLE */\r
@@ -391,6 +394,10 @@ struct dapl_evd
 \r
     DAT_COUNT          threshold;\r
     DAPL_EVD_COMPLETION        completion_type;\r
+\r
+#ifdef COUNTERS\r
+    void               *cntrs;\r
+#endif\r
 };\r
 \r
 /* DAPL_PRIVATE used to pass private data in a connection */\r
@@ -471,6 +478,9 @@ struct dapl_ep
     DAT_BOOLEAN         sent_discreq;\r
     dp_ib_cm_handle_t   ibal_cm_handle;\r
 #endif\r
+#ifdef COUNTERS\r
+    void               *cntrs;\r
+#endif\r
 };\r
 \r
 /* DAPL_SRQ maps to DAT_SRQ_HANDLE */\r
index 023ead9..8a1e46b 100644 (file)
@@ -100,50 +100,25 @@ static __inline void dapl_dbg_log ( DAPL_DBG_TYPE type,  const char *fmt,  ...)
 \r
 #endif /* !DAPL_DBG */\r
 \r
-/*\r
- * Counters\r
- */\r
-#define DCNT_EP_CREATE                 0\r
-#define DCNT_EP_FREE                   1\r
-#define DCNT_EP_CONNECT                        2\r
-#define DCNT_EP_DISCONNECT             3\r
-#define DCNT_POST_SEND                 4\r
-#define DCNT_POST_RECV                 5\r
-#define DCNT_POST_RDMA_WRITE           6\r
-#define DCNT_POST_RDMA_READ            7\r
-#define DCNT_EVD_CREATE                        8\r
-#define DCNT_EVD_FREE                  9\r
-#define DCNT_EVD_WAIT                  10\r
-#define DCNT_EVD_WAIT_BLOCKED          11\r
-#define DCNT_EVD_WAIT_CMP_NTFY         12\r
-#define DCNT_EVD_DTO_CALLBACK          13\r
-#define DCNT_EVD_CONN_CALLBACK         14\r
-#define DCNT_EVD_DEQUEUE               15\r
-#define DCNT_EVD_DEQUEUE_POLL          16\r
-#define DCNT_EVD_DEQUEUE_FOUND         17\r
-#define DCNT_EVD_DEQUEUE_NOT_FOUND     18\r
-#define DCNT_TIMER_SET                 19\r
-#define DCNT_TIMER_CANCEL              20\r
-#define DCNT_EXTENSION                 21\r
-#define DCNT_NUM_COUNTERS              22\r
-#define DCNT_ALL_COUNTERS               DCNT_NUM_COUNTERS\r
-\r
-#if defined(DAPL_COUNTERS)\r
-\r
-extern void dapl_dump_cntr( int cntr );\r
-extern int dapl_dbg_counters[];\r
-\r
-#define DAPL_CNTR(cntr)         dapl_os_atomic_inc (&dapl_dbg_counters[cntr]);\r
-#define DAPL_DUMP_CNTR(cntr)    dapl_dump_cntr( cntr );\r
-#define DAPL_COUNTERS_INIT()\r
+#include <dat/dat_ib_extensions.h>\r
 \r
-#else\r
+#ifdef COUNTERS\r
 \r
-#define DAPL_CNTR(cntr)\r
-#define DAPL_DUMP_CNTR(cntr) \r
-#define DAPL_COUNTERS_INIT()\r
+#define DAPL_CNTR(h_ptr, cntr) ((DAT_UINT64*)h_ptr->cntrs)[cntr]++\r
+#define DAPL_CNTR_DATA(h_ptr, cntr, data) ((DAT_UINT64*)h_ptr->cntrs)[cntr]+= data\r
+\r
+DAT_RETURN dapl_query_counter(DAT_HANDLE dh, \r
+                             int counter, \r
+                             void *p_cntrs_out,\r
+                             int reset);\r
+char *dapl_query_counter_name(DAT_HANDLE dh, int counter);\r
+void dapl_print_counter(DAT_HANDLE dh, int counter, int reset);\r
+\r
+#else\r
 \r
-#endif /* DAPL_COUNTERS */\r
+#define DAPL_CNTR(handle, cntr)\r
+#define DAPL_CNTR_DATA(handle, cntr, data)\r
 \r
+#endif /* COUNTERS */\r
 \r
 #endif /* _DAPL_DEBUG_H_ */\r
index ee30544..33f53cd 100644 (file)
@@ -95,7 +95,6 @@ DAT_RETURN DAT_API dapl_evd_create (
                  cno_handle, \r
                  evd_flags, \r
                  evd_handle);\r
-    DAPL_CNTR(DCNT_EVD_CREATE);\r
 \r
     ia_ptr      = (DAPL_IA *)ia_handle;\r
     cno_ptr     = (DAPL_CNO *)cno_handle;\r
@@ -109,6 +108,8 @@ DAT_RETURN DAT_API dapl_evd_create (
        goto bail;\r
     }\r
 \r
+    DAPL_CNTR(ia_ptr, DCNT_IA_EVD_CREATE);\r
+\r
     if ( evd_min_qlen <= 0 )\r
     {\r
        dat_status = DAT_ERROR (DAT_INVALID_PARAMETER,DAT_INVALID_ARG2);\r
index 63998d2..a40e444 100644 (file)
@@ -85,7 +85,6 @@ DAT_RETURN DAT_API dapl_evd_wait (
                  threshold, \r
                  event, \r
                  nmore);\r
-    DAPL_CNTR(DCNT_EVD_WAIT);\r
 \r
     evd_ptr = (DAPL_EVD *)evd_handle;\r
     dat_status = DAT_SUCCESS;\r
@@ -122,6 +121,7 @@ DAT_RETURN DAT_API dapl_evd_wait (
        dat_status = DAT_ERROR (DAT_INVALID_STATE,0);\r
        goto bail;\r
     }\r
+    DAPL_CNTR(evd_ptr, DCNT_EVD_WAIT);\r
 \r
     dapl_dbg_log (DAPL_DBG_TYPE_EVD, \r
                  "dapl_evd_wait: EVD %p, CQ %p\n", \r
@@ -203,7 +203,7 @@ DAT_RETURN DAT_API dapl_evd_wait (
                (evd_ptr->completion_type == DAPL_EVD_STATE_SOLICITED_WAIT) ?\r
                     IB_NOTIFY_ON_SOLIC_COMP : IB_NOTIFY_ON_NEXT_COMP );  \r
 \r
-           DAPL_CNTR(DCNT_EVD_WAIT_CMP_NTFY);\r
+           DAPL_CNTR(evd_ptr, DCNT_EVD_WAIT_NOTIFY);\r
            /* FIXME report error */\r
            dapl_os_assert(dat_status == DAT_SUCCESS);\r
 \r
@@ -222,7 +222,7 @@ DAT_RETURN DAT_API dapl_evd_wait (
         */\r
        evd_ptr->threshold = threshold; \r
 \r
-       DAPL_CNTR(DCNT_EVD_WAIT_BLOCKED);\r
+       DAPL_CNTR(evd_ptr, DCNT_EVD_WAIT_BLOCKED);\r
 \r
 #ifdef CQ_WAIT_OBJECT\r
        if (evd_ptr->cq_wait_obj_handle)\r
index d8e9c28..bbf877f 100644 (file)
@@ -117,8 +117,6 @@ void dapl_init ( void )
        goto bail;\r
     }\r
 \r
-    DAPL_COUNTERS_INIT();\r
-\r
     return;\r
 \r
 bail:\r
index b3f8c6c..20aae7b 100644 (file)
@@ -488,6 +488,8 @@ dapl_lmr_create (
     ia = (DAPL_IA *) ia_handle;\r
     pz = (DAPL_PZ *) pz_handle;\r
 \r
+    DAPL_CNTR(ia, DCNT_IA_LMR_CREATE); \r
+\r
     switch (mem_type)\r
     {\r
        case DAT_MEM_TYPE_VIRTUAL:\r
index 1ac8adf..6209723 100644 (file)
@@ -54,7 +54,7 @@
 #endif\r
 \r
 \r
-#include <dat2/udat.h>\r
+#include <dat/udat.h>\r
 #include <assert.h>\r
 #include <errno.h>\r
 #include <pthread.h>\r
index b94c5ce..62a61ce 100644 (file)
  *     DAT_NAMED_ATTR  name == extended operations and version, \r
  *                     version_value = version number of extension API\r
  */\r
-#define DAT_IB_EXTENSION_VERSION       201     /* 2.0.1 */\r
\r
+ /* 2.0.1 - Initial IB extension support, atomic and immed data\r
+  *         dat_ib_post_fetch_and_add()\r
+  *         dat_ib_post_cmp_and_swap()\r
+  *         dat_ib_post_rdma_write_immed()\r
+  *            \r
+  * 2.0.2 - Add UD support, post send and remote_ah via connect events \r
+  *         dat_ib_post_send_ud()\r
+  *\r
+  * 2.0.3 - Add query/print counter support for IA, EP, and EVD's \r
+  *         dat_query_counters(), dat_print_counters()\r
+  *\r
+  */\r
+#define DAT_IB_EXTENSION_VERSION       203     /* 2.0.3 */\r
+#define DAT_ATTR_COUNTERS                      "DAT_COUNTERS"\r
 #define DAT_IB_ATTR_FETCH_AND_ADD      "DAT_IB_FETCH_AND_ADD"\r
 #define DAT_IB_ATTR_CMP_AND_SWAP       "DAT_IB_CMP_AND_SWAP"\r
 #define DAT_IB_ATTR_IMMED_DATA         "DAT_IB_IMMED_DATA"\r
@@ -81,6 +95,8 @@ typedef enum dat_ib_op
        DAT_IB_FETCH_AND_ADD_OP,\r
        DAT_IB_CMP_AND_SWAP_OP,\r
        DAT_IB_RDMA_WRITE_IMMED_OP,\r
+       DAT_IB_UD_SEND_OP,\r
+       DAT_QUERY_COUNTERS_OP\r
        \r
 } DAT_IB_OP;\r
 \r
@@ -170,6 +186,81 @@ typedef enum dat_ib_mem_priv_flags
        \r
 } DAT_IB_MEM_PRIV_FLAGS;\r
 \r
+/*\r
+ * Definitions for 64-bit IA Counters\r
+ */\r
+typedef enum dat_ia_counters\r
+{\r
+       DCNT_IA_PZ_CREATE,\r
+       DCNT_IA_PZ_FREE,\r
+       DCNT_IA_LMR_CREATE,\r
+       DCNT_IA_LMR_FREE,\r
+       DCNT_IA_RMR_CREATE,\r
+       DCNT_IA_RMR_FREE,\r
+       DCNT_IA_PSP_CREATE,\r
+       DCNT_IA_PSP_CREATE_ANY,\r
+       DCNT_IA_PSP_FREE,\r
+       DCNT_IA_RSP_CREATE,\r
+       DCNT_IA_RSP_FREE,\r
+       DCNT_IA_EVD_CREATE,\r
+       DCNT_IA_EVD_FREE,\r
+       DCNT_IA_EP_CREATE,\r
+       DCNT_IA_EP_FREE,\r
+       DCNT_IA_SRQ_CREATE,\r
+       DCNT_IA_SRQ_FREE,\r
+       DCNT_IA_SP_CR,\r
+       DCNT_IA_SP_CR_ACCEPTED,\r
+       DCNT_IA_SP_CR_REJECTED,\r
+       DCNT_IA_MEM_ALLOC,\r
+       DCNT_IA_MEM_ALLOC_DATA,\r
+       DCNT_IA_MEM_FREE,\r
+       DCNT_IA_ASYNC_ERROR,\r
+       DCNT_IA_ASYNC_QP_ERROR,\r
+       DCNT_IA_ASYNC_CQ_ERROR,\r
+       DCNT_IA_ALL_COUNTERS,  /* MUST be last */\r
+\r
+} DAT_IA_COUNTERS;\r
+\r
+/*\r
+ * Definitions for 64-bit EP Counters\r
+ */\r
+typedef enum dat_ep_counters\r
+{\r
+       DCNT_EP_CONNECT,\r
+       DCNT_EP_DISCONNECT,\r
+       DCNT_EP_POST_SEND,\r
+       DCNT_EP_POST_SEND_DATA,\r
+       DCNT_EP_POST_SEND_UD,\r
+       DCNT_EP_POST_RECV,\r
+       DCNT_EP_POST_RECV_DATA,\r
+       DCNT_EP_POST_WRITE,\r
+       DCNT_EP_POST_WRITE_DATA,\r
+       DCNT_EP_POST_WRITE_IMM,\r
+       DCNT_EP_POST_WRITE_IMM_DATA,\r
+       DCNT_EP_POST_READ,\r
+       DCNT_EP_POST_READ_DATA,\r
+       DCNT_EP_ALL_COUNTERS,  /* MUST be last */\r
+\r
+} DAT_EP_COUNTERS;\r
+\r
+/*\r
+ * Definitions for 64-bit EVD Counters\r
+ */\r
+typedef enum dat_evd_counters\r
+{\r
+       DCNT_EVD_WAIT,\r
+       DCNT_EVD_WAIT_BLOCKED,\r
+       DCNT_EVD_WAIT_NOTIFY,\r
+       DCNT_EVD_DEQUEUE,\r
+       DCNT_EVD_DEQUEUE_FOUND,\r
+       DCNT_EVD_DEQUEUE_NOT_FOUND,\r
+       DCNT_EVD_DEQUEUE_POLL,\r
+       DCNT_EVD_DEQUEUE_POLL_FOUND,\r
+       DCNT_EVD_CONN_CALLBACK,\r
+       DCNT_EVD_DTO_CALLBACK,\r
+       DCNT_EVD_ALL_COUNTERS,  /* MUST be last */\r
+\r
+} DAT_EVD_COUNTERS;\r
 \r
 /* \r
  * Definitions for extended event data:\r
@@ -306,5 +397,28 @@ dat_strerror_ext_status (
                                (idata), \\r
                                (flgs))\r
 \r
+\r
+/* \r
+ * Query counters:  \r
+ * Provide IA, EP, or EVD and call will return appropriate counters\r
+ *     DAT_HANDLE dat_handle, enum cntr, *DAT_UINT64 p_cntrs_out, int reset\r
+ */\r
+#define dat_query_counters(dat_handle, cntr, p_cntrs_out, reset) \\r
+            dat_extension_op(  dat_handle, \\r
+                               DAT_QUERY_COUNTERS_OP, \\r
+                               (cntr), \\r
+                               (p_cntrs_out), \\r
+                               (reset))\r
+/* \r
+ * Print counter(s):  \r
+ * Provide IA, EP, or EVD and call will print appropriate counters\r
+ *     DAT_HANDLE dat_handle, int cntr, reset\r
+ */\r
+#define dat_print_counters(dat_handle, counter) \\r
+            dat_extension_op(  dat_handle, \\r
+                               DAT_PRINT_COUNTERS_OP, \\r
+                               (cntr), \\r
+                               (reset))\r
+\r
 #endif /* _DAT_IB_EXTENSIONS_H_ */\r
 \r
index 586d452..80a803c 100644 (file)
@@ -52,7 +52,7 @@
 #error "UNDEFINED OS TYPE"\r
 #endif /* __linux__ */\r
 \r
-#include <dat2/udat.h>\r
+#include <dat/udat.h>\r
 \r
 #include <assert.h>\r
 #include <ctype.h>\r