]> git.openfabrics.org - ~ardavis/dapl.git/commitdiff
dapl providers: fix compiler warnings in cma and scm providers
authorArlin Davis <arlin.r.davis@intel.com>
Mon, 1 Sep 2008 22:41:27 +0000 (15:41 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Mon, 1 Sep 2008 22:41:27 +0000 (15:41 -0700)
Signed-off by: Arlin Davis ardavis@ichips.intel.com

dapl/include/dapl.h
dapl/openib_cma/dapl_ib_cq.c
dapl/openib_cma/dapl_ib_util.c
dapl/openib_cma/dapl_ib_util.h
dapl/openib_scm/dapl_ib_cm.c
dapl/openib_scm/dapl_ib_util.c
dapl/openib_scm/dapl_ib_util.h

index 80c9ff3ddc0313989f1886bd0c4099af0e957378..9d3f546ced0258498383579d7d345260cf8a82de 100644 (file)
 #include "dapl_osd.h"
 #include "dapl_debug.h"
 
-#ifdef IBAPI
-#include "dapl_ibapi_util.h"
-#elif VAPI
-#include "dapl_vapi_util.h"
-#elif __OPENIB__
-#include "dapl_openib_util.h"
-#include "dapl_openib_cm.h"
-#elif DUMMY
-#include "dapl_dummy_util.h"
-#elif OPENIB
-#include "dapl_ib_util.h"
-#endif
-
 /*********************************************************************
  *                                                                   *
  * Enumerations                                                      *
@@ -215,12 +202,6 @@ typedef struct dapl_rmr_cookie             DAPL_RMR_COOKIE;
 
 typedef struct dapl_private            DAPL_PRIVATE;
 
-typedef void (*DAPL_CONNECTION_STATE_HANDLER) (
-       IN      DAPL_EP *,
-       IN      ib_cm_events_t,
-       IN      const void *,
-       OUT     DAT_EVENT *);
-
 
 /*********************************************************************
  *                                                                   *
@@ -252,6 +233,19 @@ struct dapl_cookie_buffer
     DAPL_ATOMIC                tail;
 };
 
+#ifdef IBAPI
+#include "dapl_ibapi_util.h"
+#elif VAPI
+#include "dapl_vapi_util.h"
+#elif __OPENIB__
+#include "dapl_openib_util.h"
+#include "dapl_openib_cm.h"
+#elif DUMMY
+#include "dapl_dummy_util.h"
+#elif OPENIB
+#include "dapl_ib_util.h"
+#endif
+
 struct dapl_hca
 {
     DAPL_OS_LOCK       lock;
@@ -673,6 +667,12 @@ void dapls_io_trc_dump (
  *                                                                   *
  *********************************************************************/
 
+typedef void (*DAPL_CONNECTION_STATE_HANDLER) (
+       IN      DAPL_EP *,
+       IN      ib_cm_events_t,
+       IN      const void *,
+       OUT     DAT_EVENT *);
+
 /*
  * DAT Mandated functions
  */
index 25b4551ea32d7ee0eab3027ebdf6bb42fad156ae..cf19f38ccaaf0474aa32f25c50ee2d3e059618f8 100644 (file)
@@ -497,7 +497,10 @@ dapls_ib_wait_object_wakeup (IN ib_wait_obj_handle_t p_cq_wait_obj_handle)
                        p_cq_wait_obj_handle );
 
         /* write to pipe for wake up */
-        write(p_cq_wait_obj_handle->pipe[1], "w", sizeof "w");
+       if (write(p_cq_wait_obj_handle->pipe[1], "w", sizeof "w") == -1)\r
+                 dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                          " wait object wakeup write error = %s\n",
+                          strerror(errno));
        return DAT_SUCCESS;
 }
 
index e76e319b140e981575c4db73bc15fd16fe576532..afb7463faa4e68275cbe259e36570d41053bb21c 100755 (executable)
@@ -321,7 +321,10 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name, IN DAPL_HCA *hca_ptr)
        dapl_llist_add_tail(&g_hca_list, 
                            (DAPL_LLIST_ENTRY*)&hca_ptr->ib_trans.entry, 
                            &hca_ptr->ib_trans.entry);
-       write(g_ib_pipe[1], "w", sizeof "w");
+       if (write(g_ib_pipe[1], "w", sizeof "w") == -1)\r
+               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                        " open_hca: thread wakeup error = %s\n",\r
+                        strerror(errno));\r
        dapl_os_unlock(&g_hca_lock);
        
        dapl_dbg_log(
@@ -388,14 +391,20 @@ DAT_RETURN dapls_ib_close_hca(IN DAPL_HCA *hca_ptr)
         * Wakeup work thread to remove from polling list
         */
        hca_ptr->ib_trans.destroy = 1;
-       write(g_ib_pipe[1], "w", sizeof "w");
+       if (write(g_ib_pipe[1], "w", sizeof "w") == -1)\r
+               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                        " close_hca: thread wakeup error = %s\n",\r
+                        strerror(errno));
 
        /* wait for thread to remove HCA references */
        while (hca_ptr->ib_trans.destroy != 2) {
                struct timespec sleep, remain;
                sleep.tv_sec = 0;
                sleep.tv_nsec = 10000000; /* 10 ms */
-               write(g_ib_pipe[1], "w", sizeof "w");
+               if (write(g_ib_pipe[1], "w", sizeof "w") == -1)\r
+                       dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                                " close_hca: thread wakeup error = %s\n",\r
+                                strerror(errno));              
                dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
                             " ib_thread_destroy: wait on hca %p destroy\n");
                nanosleep (&sleep, &remain);
@@ -671,14 +680,20 @@ void dapli_ib_thread_destroy(void)
                goto bail;
                        
        g_ib_thread_state = IB_THREAD_CANCEL;
-       write(g_ib_pipe[1], "w", sizeof "w");
+       if (write(g_ib_pipe[1], "w", sizeof "w") == -1)\r
+               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                        " destroy: thread wakeup error = %s\n",\r
+                        strerror(errno));      
        while ((g_ib_thread_state != IB_THREAD_EXIT) && (retries--)) {
                struct timespec sleep, remain;
                sleep.tv_sec = 0;
                sleep.tv_nsec = 2000000; /* 2 ms */
                dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
                        " ib_thread_destroy: waiting for ib_thread\n");
-               write(g_ib_pipe[1], "w", sizeof "w");
+               if (write(g_ib_pipe[1], "w", sizeof "w") == -1)\r
+                       dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                                " destroy: thread wakeup error = %s\n",\r
+                                strerror(errno));      
                dapl_os_unlock( &g_hca_lock );
                nanosleep(&sleep, &remain);
                dapl_os_lock( &g_hca_lock );
@@ -894,8 +909,11 @@ void dapli_thread(void *arg)
                /* check and process user events, PIPE */
                if (ufds[0].revents == POLLIN) {
 
-                       read(g_ib_pipe[0], rbuf, 2);
-                       
+                       if (read(g_ib_pipe[0], rbuf, 2) == -1)\r
+                               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                                        " ib_thread: pipe rd err= %s\n",\r
+                                        strerror(errno));\r
+       
                        /* cleanup any device on list marked for destroy */
                        for(idx=3;idx<fds;idx++) {
                                if(uhca[idx] && uhca[idx]->destroy == 1) {
index 1e464b242912e53ec2cb35549e1a8359eb79a782..1d919d966c24832c9206d2dc7ca468ac3626e3ec 100755 (executable)
@@ -164,18 +164,6 @@ typedef enum
 
 } ib_thread_state_t;
 
-/* 
- * dapl_llist_entry in dapl.h but dapl.h depends on provider 
- * typedef's in this file first. move dapl_llist_entry out of dapl.h
- */
-struct ib_llist_entry
-{
-    struct dapl_llist_entry    *flink;
-    struct dapl_llist_entry    *blink;
-    void                       *data;
-    struct dapl_llist_entry    *list_head;
-};
-
 struct dapl_cm_id {
        DAPL_OS_LOCK                    lock;
        int                             destroy;
@@ -256,7 +244,7 @@ typedef void (*ib_async_handler_t)(
 /* ib_hca_transport_t, specific to this implementation */
 typedef struct _ib_hca_transport
 { 
-       struct ib_llist_entry   entry;
+       struct dapl_llist_entry entry;
        int                     destroy;
        struct dapl_hca         *d_hca;
        struct rdma_cm_id       *cm_id;
index 9f845b6618656b8f019bc9cfcc49dd456c99c130..48aa82d9cdf3e205c72410e48e9a49f4b56ce7c3 100644 (file)
@@ -119,7 +119,10 @@ static void dapli_cm_destroy(struct ib_cm_handle *cm_ptr)
        dapl_os_unlock(&cm_ptr->lock);
 
        /* wakeup work thread */
-        write(g_scm_pipe[1], "w", sizeof "w");
+       if (write(g_scm_pipe[1], "w", sizeof "w") == -1)\r
+               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                        " cm_destroy: thread wakeup error = %s\n",\r
+                        strerror(errno));
 }
 
 /* queue socket for processing CM work */
@@ -133,7 +136,10 @@ static void dapli_cm_queue(struct ib_cm_handle *cm_ptr)
        dapl_os_unlock(&cm_ptr->hca->ib_trans.lock);
 
         /* wakeup CM work thread */
-        write(g_scm_pipe[1], "w", sizeof "w");
+       if (write(g_scm_pipe[1], "w", sizeof "w") == -1)\r
+               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                        " cm_queue: thread wakeup error = %s\n",\r
+                        strerror(errno));
 }
 
 static uint16_t dapli_get_lid(IN struct ibv_context *ctx, IN uint8_t port)
@@ -167,7 +173,11 @@ dapli_socket_disconnect(ib_cm_handle_t     cm_ptr)
        } else {
                /* send disc date, close socket, schedule destroy */
                if (cm_ptr->socket >= 0) { 
-                       write(cm_ptr->socket, &disc_data, sizeof(disc_data));
+                       if (write(cm_ptr->socket,\r
+                                 &disc_data, sizeof(disc_data)) == -1)\r
+                               dapl_log(DAPL_DBG_TYPE_WARN,\r
+                                        " cm_disc: write error = %s\n",\r
+                                        strerror(errno));\r
                        close(cm_ptr->socket);
                        cm_ptr->socket = -1;
                }
@@ -473,7 +483,10 @@ dapli_socket_connect_rtu(ib_cm_handle_t    cm_ptr)
        dapl_dbg_log(DAPL_DBG_TYPE_EP," connect_rtu: send RTU\n"); 
 
        /* complete handshake after final QP state change */
-       write(cm_ptr->socket, &rtu_data, sizeof(rtu_data));
+       if (write(cm_ptr->socket, &rtu_data, sizeof(rtu_data)) == -1)
+               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                        " CONN_RTU: write error = %s\n",\r
+                        strerror(errno));
 
        /* init cm_handle and post the event with private data */
        ep_ptr->cm_handle = cm_ptr;
@@ -1011,7 +1024,10 @@ dapls_ib_remove_conn_listener (
                /* cr_thread will free */
                cm_ptr->state = SCM_DESTROY;
                sp_ptr->cm_srvc_handle = NULL;
-               write(g_scm_pipe[1], "w", sizeof "w");
+               if (write(g_scm_pipe[1], "w", sizeof "w") == -1)\r
+                       dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                                " remove_listen: thread wakeup error = %s\n",\r
+                                strerror(errno));
        }
        return DAT_SUCCESS;
 }
@@ -1106,7 +1122,10 @@ dapls_ib_reject_connection (
 
        /* cr_thread will destroy CR */
        cm_ptr->state = SCM_REJECTED;
-        write(g_scm_pipe[1], "w", sizeof "w");
+       if (write(g_scm_pipe[1], "w", sizeof "w") == -1)\r
+               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                        " reject_connection: thread wakeup error = %s\n",\r
+                        strerror(errno));
        return DAT_SUCCESS;
 }
 
@@ -1442,7 +1461,10 @@ void cr_thread(void *arg)
        poll(ufds,idx+1,-1); /* infinite, all sockets and pipe */
        /* if pipe used to wakeup, consume */
        if (ufds[0].revents == POLLIN)
-               read(g_scm_pipe[0], rbuf, 2);
+               if (read(g_scm_pipe[0], rbuf, 2) == -1)\r
+                       dapl_log(DAPL_DBG_TYPE_CM,\r
+                                " cr_thread: read pipe error = %s\n",\r
+                                strerror(errno));\r
        dapl_dbg_log(DAPL_DBG_TYPE_CM," cr_thread: wakeup\n");
        dapl_os_lock(&hca_ptr->ib_trans.lock);
     } 
index 76bde893ae014ceab8c9ec39c70cd6c43e9b90e0..f1f6103bdae005b113b72372749ec7f5695747be 100644 (file)
@@ -359,11 +359,18 @@ DAT_RETURN dapls_ib_close_hca (   IN   DAPL_HCA   *hca_ptr )
 
        /* destroy cr_thread and lock */
        hca_ptr->ib_trans.cr_state = IB_THREAD_CANCEL;
-       write(g_scm_pipe[1], "w", sizeof "w");
+       if (write(g_scm_pipe[1], "w", sizeof "w") == -1)\r
+               dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                        " close_hca: thread wakeup error = %s\n",\r
+                        strerror(errno));
        while (hca_ptr->ib_trans.cr_state != IB_THREAD_EXIT) {
                struct timespec sleep, remain;
                sleep.tv_sec = 0;
                sleep.tv_nsec = 2000000; /* 2 ms */
+               if (write(g_scm_pipe[1], "w", sizeof "w") == -1)\r
+                       dapl_log(DAPL_DBG_TYPE_UTIL,\r
+                                " close_hca: thread wakeup error = %s\n",\r
+                                strerror(errno));
                dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
                             " close_hca: waiting for cr_thread\n");
                nanosleep (&sleep, &remain);
index 8ed4facbbe888992488f255e522042dabd9db55e..91a4e67764f34b7914094644c50f6c4e8f6da9f7 100644 (file)
@@ -85,18 +85,6 @@ typedef struct _ib_qp_cm
         union ibv_gid          gid;
 } ib_qp_cm_t;
 
-/* 
- * dapl_llist_entry in dapl.h but dapl.h depends on provider 
- * typedef's in this file first. move dapl_llist_entry out of dapl.h
- */
-struct ib_llist_entry
-{
-    struct dapl_llist_entry    *flink;
-    struct dapl_llist_entry    *blink;
-    void                       *data;
-    struct dapl_llist_entry    *list_head;
-};
-
 typedef enum scm_state 
 {
        SCM_INIT,
@@ -114,7 +102,7 @@ typedef enum scm_state
 
 struct ib_cm_handle
 { 
-       struct ib_llist_entry   entry;
+       struct dapl_llist_entry entry;
        DAPL_OS_LOCK            lock;
        SCM_STATE               state;
        int                     socket;