Whamcloud - gitweb
* new-config; simple 2 node echo test working with single API interface
authoreeb <eeb>
Thu, 21 Apr 2005 17:14:20 +0000 (17:14 +0000)
committereeb <eeb>
Thu, 21 Apr 2005 17:14:20 +0000 (17:14 +0000)
lnet/lnet/api-ni.c
lnet/lnet/lib-eq.c

index 364add2..0b8f121 100644 (file)
@@ -655,7 +655,7 @@ PtlInit(int *max_interfaces)
         CFS_INIT_LIST_HEAD(&ptl_nal_table);
         ptl_apini.apini_refcount = 0;
 
-#ifdef __KERNEL__
+#ifndef __KERNEL__
         /* process  */
         /* Kernel NALs register themselves when their module loads, and
          * unregister themselves when their module is unloaded.  Userspace NALs
@@ -701,9 +701,9 @@ PtlNIInit(ptl_interface_t interface, ptl_pid_t requested_pid,
         LASSERT (ptl_init);
         CDEBUG(D_OTHER, "refs %d\n", ptl_apini.apini_refcount);
 
-        if (ptl_apini.apini_refcount != 0) {
-                rc = PTL_IFACE_DUP;
+        if (ptl_apini.apini_refcount > 0) {
                 ptl_apini.apini_refcount++;
+                rc = PTL_IFACE_DUP;
                 goto out;
         }
 
@@ -711,10 +711,14 @@ PtlNIInit(ptl_interface_t interface, ptl_pid_t requested_pid,
                                requested_limits, actual_limits);
         if (rc != PTL_OK)
                 goto out;
-        
+
         rc = ptl_startup_nalnis();
-        if (rc != PTL_OK)
+        if (rc != PTL_OK) {
+                ptl_shutdown_apini();
                 goto out;
+        }
+
+        ptl_apini.apini_refcount = 1;
 
         memset (handle, 0, sizeof(*handle));
         LASSERT (!PtlHandleIsEqual(*handle, PTL_INVALID_HANDLE));
index 2684a33..a8db651 100644 (file)
@@ -32,11 +32,8 @@ PtlEQAlloc(ptl_handle_ni_t interface, ptl_size_t count,
         ptl_eq_t      *eq;
         unsigned long  flags;
 
-        if (!ptl_init)
-                return PTL_NO_INIT;
-
-        if (ptl_apini.apini_refcount == 0)
-                return PTL_HANDLE_INVALID;
+        LASSERT (ptl_init);
+        LASSERT (ptl_apini.apini_refcount > 0);
         
         /* We need count to be a power of 2 so that when eq_{enq,deq}_seq
          * overflow, they don't skip entries, so the queue has the same
@@ -93,11 +90,8 @@ PtlEQFree(ptl_handle_eq_t eqh)
         ptl_event_t   *events;
         unsigned long  flags;
 
-        if (!ptl_init)
-                return PTL_NO_INIT;
-        
-        if (ptl_apini.apini_refcount == 0)
-                return PTL_EQ_INVALID;
+        LASSERT (ptl_init);
+        LASSERT (ptl_apini.apini_refcount > 0);
         
         PTL_LOCK(flags);
 
@@ -194,11 +188,8 @@ PtlEQPoll (ptl_handle_eq_t *eventqs, int neq, int timeout_ms,
 #endif
         ENTRY;
 
-        if (!ptl_init)
-                RETURN(PTL_NO_INIT);
-        
-        if (ptl_apini.apini_refcount == 0)
-                RETURN(PTL_HANDLE_INVALID);
+        LASSERT (ptl_init);
+        LASSERT (ptl_apini.apini_refcount > 0);
 
         if (neq < 1)
                 RETURN(PTL_EQ_INVALID);