Whamcloud - gitweb
merge b_multinet into HEAD
[fs/lustre-release.git] / lustre / portals / knals / qswnal / qswnal_cb.c
index c03d592..a6b4b93 100644 (file)
@@ -569,11 +569,6 @@ kqswnal_sendmsg (nal_cb_t     *nal,
         int                sumnob;
 #endif
         
-        /* NB, the return code from this procedure is ignored.
-         * If we can't send, we must still complete with lib_finalize().
-         * We'll have to wait for 3.2 to return an error event.
-         */
-
         CDEBUG(D_NET, "sending "LPSZ" bytes in %d frags to nid: "LPX64
                " pid %u\n", payload_nob, payload_niov, nid, pid);
 
@@ -588,8 +583,7 @@ kqswnal_sendmsg (nal_cb_t     *nal,
         if (payload_nob > KQSW_MAXPAYLOAD) {
                 CERROR ("request exceeds MTU size "LPSZ" (max %u).\n",
                         payload_nob, KQSW_MAXPAYLOAD);
-                lib_finalize (&kqswnal_lib, private, cookie);
-                return (-1);
+                return (PTL_FAIL);
         }
 
         if (kqswnal_nid2elanid (nid) < 0) {     /* Can't send direct: find gateway? */
@@ -597,14 +591,12 @@ kqswnal_sendmsg (nal_cb_t     *nal,
                 if (rc != 0) {
                         CERROR("Can't route to "LPX64": router error %d\n",
                                nid, rc);
-                        lib_finalize (&kqswnal_lib, private, cookie);
-                        return (-1);
+                        return (PTL_FAIL);
                 }
                 if (kqswnal_nid2elanid (gatewaynid) < 0) {
                         CERROR("Bad gateway "LPX64" for "LPX64"\n",
                                gatewaynid, nid);
-                        lib_finalize (&kqswnal_lib, private, cookie);
-                        return (-1);
+                        return (PTL_FAIL);
                 }
                 nid = gatewaynid;
         }
@@ -616,8 +608,7 @@ kqswnal_sendmsg (nal_cb_t     *nal,
                                           in_interrupt()));
         if (ktx == NULL) {
                 kqswnal_cerror_hdr (hdr);
-                lib_finalize (&kqswnal_lib, private, cookie);
-                return (-1);
+                return (PTL_NOSPACE);
         }
 
         memcpy (ktx->ktx_buffer, hdr, sizeof (*hdr)); /* copy hdr from caller's stack */
@@ -670,8 +661,7 @@ kqswnal_sendmsg (nal_cb_t     *nal,
                                                          payload_niov, payload_iov);
                         if (rc != 0) {
                                 kqswnal_put_idle_tx (ktx);
-                                lib_finalize (&kqswnal_lib, private, cookie);
-                                return (-1);
+                                return (PTL_FAIL);
                         }
                 } 
         }
@@ -686,12 +676,11 @@ kqswnal_sendmsg (nal_cb_t     *nal,
         rc = kqswnal_launch (ktx);
         if (rc != 0) {                    /* failed? */
                 CERROR ("Failed to send packet to "LPX64": %d\n", nid, rc);
-                lib_finalize (&kqswnal_lib, private, cookie);
-                return (-1);
+                return (PTL_FAIL);
         }
 
         CDEBUG(D_NET, "send to "LPSZ" bytes to "LPX64"\n", payload_nob, nid);
-        return (0);
+        return (PTL_OK);
 }
 
 static int