Whamcloud - gitweb
b=20805 rate limit D_NETERR messages
authorJohann Lombardi <johann@sun.com>
Fri, 8 Jan 2010 15:24:51 +0000 (16:24 +0100)
committerJohann Lombardi <johann@sun.com>
Fri, 8 Jan 2010 15:24:51 +0000 (16:24 +0100)
i=isaac
i=liang

add CNETERR() macro that uses CDEBUG_LIMIT() for D_NETERR messages

19 files changed:
lnet/include/libcfs/libcfs.h
lnet/klnds/gmlnd/gmlnd_comm.c
lnet/klnds/iiblnd/iiblnd_cb.c
lnet/klnds/mxlnd/mxlnd.c
lnet/klnds/mxlnd/mxlnd_cb.c
lnet/klnds/o2iblnd/o2iblnd_cb.c
lnet/klnds/openiblnd/openiblnd_cb.c
lnet/klnds/qswlnd/qswlnd_cb.c
lnet/klnds/ralnd/ralnd.c
lnet/klnds/socklnd/socklnd_cb.c
lnet/klnds/socklnd/socklnd_proto.c
lnet/klnds/viblnd/viblnd_cb.c
lnet/libcfs/darwin/darwin-tcpip.c
lnet/libcfs/linux/linux-tcpip.c
lnet/lnet/acceptor.c
lnet/lnet/lib-move.c
lnet/lnet/router.c
lnet/selftest/rpc.c
lustre/mds/mds_open.c

index ef6488f..6bb84c3 100644 (file)
@@ -271,6 +271,7 @@ do {                                                                    \
 
 #define CWARN(format, a...)          CDEBUG_LIMIT(D_WARNING, format, ## a)
 #define CERROR(format, a...)         CDEBUG_LIMIT(D_ERROR, format, ## a)
+#define CNETERR(format, a...)        CDEBUG_LIMIT(D_NETERROR, format, ## a)
 #define CEMERG(format, a...)         CDEBUG_LIMIT(D_EMERG, format, ## a)
 
 #define LCONSOLE(mask, format, a...) CDEBUG(D_CONSOLE | (mask), format, ## a)
index 88bcf98..6be69a4 100644 (file)
@@ -240,8 +240,8 @@ gmnal_tx_callback(gm_port_t *gm_port, void *context, gm_status_t status)
                 return;
 
         case GM_SEND_DROPPED:
-                CDEBUG(D_NETERROR, "Dropped tx %p to %s\n",
-                       tx, libcfs_nid2str(tx->tx_nid));
+                CNETERR("Dropped tx %p to %s\n",
+                        tx, libcfs_nid2str(tx->tx_nid));
                 /* Another tx failed and called gm_drop_sends() which made this
                  * one complete immediately */
                 gmnal_tx_done(tx, -EIO);
@@ -250,9 +250,9 @@ gmnal_tx_callback(gm_port_t *gm_port, void *context, gm_status_t status)
         default:
                 /* Some error; NB don't complete tx yet; we need its credit for
                  * gm_drop_sends() */
-                CDEBUG(D_NETERROR, "tx %p error %d(%s), nid %s\n",
-                       tx, status, gmnal_gmstatus2str(status),
-                       libcfs_nid2str(tx->tx_nid));
+                CNETERR("tx %p error %d(%s), nid %s\n",
+                        tx, status, gmnal_gmstatus2str(status),
+                        libcfs_nid2str(tx->tx_nid));
 
                 gmnal_notify_peer_down(tx);
 
index 9e7b62c..0416c12 100644 (file)
@@ -1040,79 +1040,79 @@ kibnal_tx_complete (IB_WORK_COMPLETION *wc)
                 IB_LOCAL_DATASEGMENT *gl = &tx->tx_gl[0];
                 lnet_msg_t           *lntmsg = tx->tx_lntmsg[0];
 #endif
-                CDEBUG(D_NETERROR, "tx -> %s type %x cookie "LPX64
-                       " sending %d waiting %d failed %d nwrk %d\n", 
-                       libcfs_nid2str(conn->ibc_peer->ibp_nid),
-                       tx->tx_msg->ibm_type, tx->tx_cookie,
-                       tx->tx_sending, tx->tx_waiting, wc->Status,
-                       tx->tx_nwrq);
+                CNETERR("tx -> %s type %x cookie "LPX64
+                        " sending %d waiting %d failed %d nwrk %d\n",
+                        libcfs_nid2str(conn->ibc_peer->ibp_nid),
+                        tx->tx_msg->ibm_type, tx->tx_cookie,
+                        tx->tx_sending, tx->tx_waiting, wc->Status,
+                        tx->tx_nwrq);
 #if KIBLND_DETAILED_DEBUG
                 for (i = 0; i < tx->tx_nwrq; i++, wrq++, gl++) {
                         switch (wrq->Operation) {
                         default:
-                                CDEBUG(D_NETERROR, "    [%3d] Addr %p Next %p OP %d "
-                                       "DSList %p(%p)/%d: "LPX64"/%d K %x\n",
-                                       i, wrq, wrq->Next, wrq->Operation,
-                                       wrq->DSList, gl, wrq->DSListDepth,
-                                       gl->Address, gl->Length, gl->Lkey);
+                                CNETERR("    [%3d] Addr %p Next %p OP %d "
+                                        "DSList %p(%p)/%d: "LPX64"/%d K %x\n",
+                                        i, wrq, wrq->Next, wrq->Operation,
+                                        wrq->DSList, gl, wrq->DSListDepth,
+                                        gl->Address, gl->Length, gl->Lkey);
                                 break;
                         case WROpSend:
-                                CDEBUG(D_NETERROR, "    [%3d] Addr %p Next %p SEND "
-                                       "DSList %p(%p)/%d: "LPX64"/%d K %x\n",
-                                       i, wrq, wrq->Next, 
-                                       wrq->DSList, gl, wrq->DSListDepth,
-                                       gl->Address, gl->Length, gl->Lkey);
+                                CNETERR("    [%3d] Addr %p Next %p SEND "
+                                        "DSList %p(%p)/%d: "LPX64"/%d K %x\n",
+                                        i, wrq, wrq->Next,
+                                        wrq->DSList, gl, wrq->DSListDepth,
+                                        gl->Address, gl->Length, gl->Lkey);
                                 break;
                         case WROpRdmaWrite:
-                                CDEBUG(D_NETERROR, "    [%3d] Addr %p Next %p DMA "
-                                       "DSList: %p(%p)/%d "LPX64"/%d K %x -> "
-                                       LPX64" K %x\n",
-                                       i, wrq, wrq->Next, 
-                                       wrq->DSList, gl, wrq->DSListDepth,
-                                       gl->Address, gl->Length, gl->Lkey,
-                                       wrq->Req.SendRC.RemoteDS.Address,
-                                       wrq->Req.SendRC.RemoteDS.Rkey);
+                                CNETERR("    [%3d] Addr %p Next %p DMA "
+                                        "DSList: %p(%p)/%d "LPX64"/%d K %x -> "
+                                        LPX64" K %x\n",
+                                        i, wrq, wrq->Next,
+                                        wrq->DSList, gl, wrq->DSListDepth,
+                                        gl->Address, gl->Length, gl->Lkey,
+                                        wrq->Req.SendRC.RemoteDS.Address,
+                                        wrq->Req.SendRC.RemoteDS.Rkey);
                                 break;
                         }
                 }
-                
+
                 switch (tx->tx_msg->ibm_type) {
                 default:
-                        CDEBUG(D_NETERROR, "  msg type %x %p/%d, No RDMA\n", 
-                               tx->tx_msg->ibm_type, 
-                               tx->tx_msg, tx->tx_msg->ibm_nob);
+                        CNETERR("  msg type %x %p/%d, No RDMA\n",
+                                tx->tx_msg->ibm_type,
+                                tx->tx_msg, tx->tx_msg->ibm_nob);
                         break;
 
                 case IBNAL_MSG_PUT_DONE:
                 case IBNAL_MSG_GET_DONE:
-                        CDEBUG(D_NETERROR, "  msg type %x %p/%d, RDMA key %x frags %d...\n", 
-                               tx->tx_msg->ibm_type, 
+                        CNETERR("  msg type %x %p/%d, RDMA key %x frags %d..\n",
+                               tx->tx_msg->ibm_type,
                                tx->tx_msg, tx->tx_msg->ibm_nob,
                                tx->tx_rd->rd_key, tx->tx_rd->rd_nfrag);
                         for (i = 0; i < tx->tx_rd->rd_nfrag; i++)
-                                CDEBUG(D_NETERROR, "    [%d] "LPX64"/%d\n", i,
-                                       tx->tx_rd->rd_frags[i].rf_addr,
-                                       tx->tx_rd->rd_frags[i].rf_nob);
+                                CNETERR(, "    [%d] "LPX64"/%d\n", i,
+                                        tx->tx_rd->rd_frags[i].rf_addr,
+                                        tx->tx_rd->rd_frags[i].rf_nob);
                         if (lntmsg == NULL) {
-                                CDEBUG(D_NETERROR, "  No lntmsg\n");
+                                CNETERR("  No lntmsg\n");
                         } else if (lntmsg->msg_iov != NULL) {
-                                CDEBUG(D_NETERROR, "  lntmsg in %d VIRT frags...\n", 
-                                       lntmsg->msg_niov);
+                                CNETERR("  lntmsg in %d VIRT frags...\n",
+                                        lntmsg->msg_niov);
                                 for (i = 0; i < lntmsg->msg_niov; i++)
-                                        CDEBUG(D_NETERROR, "    [%d] %p/%d\n", i,
-                                               lntmsg->msg_iov[i].iov_base,
-                                               lntmsg->msg_iov[i].iov_len);
+                                        CNETERR("    [%d] %p/%d\n", i,
+                                                lntmsg->msg_iov[i].iov_base,
+                                                lntmsg->msg_iov[i].iov_len);
                         } else if (lntmsg->msg_kiov != NULL) {
-                                CDEBUG(D_NETERROR, "  lntmsg in %d PAGE frags...\n", 
-                                       lntmsg->msg_niov);
+                                CNETERR("  lntmsg in %d PAGE frags...\n",
+                                        lntmsg->msg_niov);
                                 for (i = 0; i < lntmsg->msg_niov; i++)
-                                        CDEBUG(D_NETERROR, "    [%d] %p+%d/%d\n", i,
-                                               lntmsg->msg_kiov[i].kiov_page,
-                                               lntmsg->msg_kiov[i].kiov_offset,
-                                               lntmsg->msg_kiov[i].kiov_len);
+                                        CNETERR("    [%d] %p+%d/%d\n", i,
+                                                lntmsg->msg_kiov[i].kiov_page,
+                                                lntmsg->msg_kiov[i].kiov_offset,
+                                                lntmsg->msg_kiov[i].kiov_len);
                         } else {
-                                CDEBUG(D_NETERROR, "  lntmsg in %d frags\n", 
-                                       lntmsg->msg_niov);
+                                CNETERR("  lntmsg in %d frags\n",
+                                        lntmsg->msg_niov);
                         }
                         
                         break;
@@ -1948,36 +1948,38 @@ kibnal_close_conn_locked (kib_conn_t *conn, int error)
             list_empty(&conn->ibc_tx_queue_nocred) &&
             list_empty(&conn->ibc_active_txs)) {
                 CDEBUG(D_NET, "closing conn to %s"
-                       " rx# "LPD64" tx# "LPD64"\n", 
+                       " rx# "LPD64" tx# "LPD64"\n",
                        libcfs_nid2str(peer->ibp_nid),
                        conn->ibc_txseq, conn->ibc_rxseq);
         } else {
-                CDEBUG(D_NETERROR, "Closing conn to %s: error %d%s%s%s%s"
-                       " rx# "LPD64" tx# "LPD64"\n",
-                       libcfs_nid2str(peer->ibp_nid), error,
-                       list_empty(&conn->ibc_tx_queue) ? "" : "(sending)",
-                       list_empty(&conn->ibc_tx_queue_rsrvd) ? "" : "(sending_rsrvd)",
-                       list_empty(&conn->ibc_tx_queue_nocred) ? "" : "(sending_nocred)",
-                       list_empty(&conn->ibc_active_txs) ? "" : "(waiting)",
-                       conn->ibc_txseq, conn->ibc_rxseq);
+                CNETERR("Closing conn to %s: error %d%s%s%s%s"
+                        " rx# "LPD64" tx# "LPD64"\n",
+                        libcfs_nid2str(peer->ibp_nid), error,
+                        list_empty(&conn->ibc_tx_queue) ? "" : "(sending)",
+                        list_empty(&conn->ibc_tx_queue_rsrvd) ?
+                                "" : "(sending_rsrvd)",
+                        list_empty(&conn->ibc_tx_queue_nocred) ?
+                                "" : "(sending_nocred)",
+                        list_empty(&conn->ibc_active_txs) ? "" : "(waiting)",
+                        conn->ibc_txseq, conn->ibc_rxseq);
 #if 0
-                /* can't skip down the queue without holding ibc_lock (see above) */
+                /* can't skip down queue without holding ibc_lock (see above) */
                 list_for_each(tmp, &conn->ibc_tx_queue) {
                         kib_tx_t *tx = list_entry(tmp, kib_tx_t, tx_list);
-                        
+
                         CERROR("   queued tx type %x cookie "LPX64
-                               " sending %d waiting %d ticks %ld/%d\n", 
-                               tx->tx_msg->ibm_type, tx->tx_cookie, 
+                               " sending %d waiting %d ticks %ld/%d\n",
+                               tx->tx_msg->ibm_type, tx->tx_cookie,
                                tx->tx_sending, tx->tx_waiting,
                                (long)(tx->tx_deadline - jiffies), HZ);
                 }
 
                 list_for_each(tmp, &conn->ibc_active_txs) {
                         kib_tx_t *tx = list_entry(tmp, kib_tx_t, tx_list);
-                        
+
                         CERROR("   active tx type %x cookie "LPX64
-                               " sending %d waiting %d ticks %ld/%d\n", 
-                               tx->tx_msg->ibm_type, tx->tx_cookie, 
+                               " sending %d waiting %d ticks %ld/%d\n",
+                               tx->tx_msg->ibm_type, tx->tx_cookie,
                                tx->tx_sending, tx->tx_waiting,
                                (long)(tx->tx_deadline - jiffies), HZ);
                 }
@@ -2158,15 +2160,15 @@ kibnal_peer_connect_failed (kib_peer_t *peer, int type, int error)
         }
 
         peer->ibp_error = error;
-        
+
         write_unlock_irqrestore(&kibnal_data.kib_global_lock, flags);
 
         kibnal_peer_notify(peer);
 
         if (list_empty (&zombies))
                 return;
-        
-        CDEBUG (D_NETERROR, "Deleting messages for %s: connection failed\n",
+
+        CNETERR("Deleting messages for %s: connection failed\n",
                 libcfs_nid2str(peer->ibp_nid));
 
         kibnal_txlist_done (&zombies, -EHOSTUNREACH);
@@ -2805,10 +2807,10 @@ kibnal_pathreq_callback (void *arg, QUERY *qry,
         CM_REQUEST_INFO   *req = &conn->ibc_cvars->cv_cmci.Info.Request;
         PATH_RESULTS      *path = (PATH_RESULTS *)qrslt->QueryResult;
         FSTATUS            frc;
-        
-        if (qrslt->Status != FSUCCESS || 
+
+        if (qrslt->Status != FSUCCESS ||
             qrslt->ResultDataSize < sizeof(*path)) {
-                CDEBUG (D_NETERROR, "pathreq %s failed: status %d data size %d\n", 
+                CNETERR("pathreq %s failed: status %d data size %d\n",
                         libcfs_nid2str(conn->ibc_peer->ibp_nid),
                         qrslt->Status, qrslt->ResultDataSize);
                 kibnal_connreq_done(conn, IBNAL_CONN_ACTIVE, -EHOSTUNREACH);
@@ -2816,7 +2818,7 @@ kibnal_pathreq_callback (void *arg, QUERY *qry,
         }
 
         if (path->NumPathRecords < 1) {
-                CDEBUG (D_NETERROR, "pathreq %s failed: no path records\n",
+                CNETERR("pathreq %s failed: no path records\n",
                         libcfs_nid2str(conn->ibc_peer->ibp_nid));
                 kibnal_connreq_done(conn, IBNAL_CONN_ACTIVE, -EHOSTUNREACH);
                 return;
@@ -2905,16 +2907,16 @@ kibnal_dump_service_records(SERVICE_RECORD_RESULTS *results)
 }
 
 void
-kibnal_service_get_callback (void *arg, QUERY *qry, 
+kibnal_service_get_callback (void *arg, QUERY *qry,
                              QUERY_RESULT_VALUES *qrslt)
 {
         kib_conn_t              *conn = arg;
         SERVICE_RECORD_RESULTS  *svc;
         FSTATUS                  frc;
 
-        if (qrslt->Status != FSUCCESS || 
+        if (qrslt->Status != FSUCCESS ||
             qrslt->ResultDataSize < sizeof(*svc)) {
-                CDEBUG (D_NETERROR, "Lookup %s failed: status %d data size %d\n", 
+                CNETERR("Lookup %s failed: status %d data size %d\n",
                         libcfs_nid2str(conn->ibc_peer->ibp_nid),
                         qrslt->Status, qrslt->ResultDataSize);
                 kibnal_connreq_done(conn, IBNAL_CONN_ACTIVE, -EHOSTUNREACH);
@@ -2923,7 +2925,7 @@ kibnal_service_get_callback (void *arg, QUERY *qry,
 
         svc = (SERVICE_RECORD_RESULTS *)qrslt->QueryResult;
         if (svc->NumServiceRecords < 1) {
-                CDEBUG (D_NETERROR, "lookup %s failed: no service records\n",
+                CNETERR("lookup %s failed: no service records\n",
                         libcfs_nid2str(conn->ibc_peer->ibp_nid));
                 kibnal_connreq_done(conn, IBNAL_CONN_ACTIVE, -EHOSTUNREACH);
                 return;
index 4c82e6e..8660b36 100644 (file)
@@ -345,7 +345,7 @@ mxlnd_init_mx(lnet_ni_t *ni)
         mxret = mx_connect(kmxlnd_data.kmx_endpt, nic_id, ep_id, MXLND_MSG_MAGIC,
                            MXLND_CONNECT_TIMEOUT/HZ*1000, &kmxlnd_data.kmx_epa);
         if (mxret != MX_SUCCESS) {
-                CDEBUG(D_NETERROR, "unable to connect to myself (%s)\n", mx_strerror(mxret));
+                CNETERR("unable to connect to myself (%s)\n", mx_strerror(mxret));
                 goto failed_with_endpoint;
         }
 
index cb93415..b225425 100644 (file)
@@ -186,16 +186,16 @@ mxlnd_get_idle_rx(kmx_conn_t *conn)
 
 #if MXLND_DEBUG
         if (rx->mxc_get != rx->mxc_put) {
-                CDEBUG(D_NETERROR, "*** RX get (%llu) != put (%llu) ***\n", rx->mxc_get, rx->mxc_put);
-                CDEBUG(D_NETERROR, "*** incarnation= %lld ***\n", rx->mxc_incarnation);
-                CDEBUG(D_NETERROR, "*** deadline= %ld ***\n", rx->mxc_deadline);
-                CDEBUG(D_NETERROR, "*** state= %s ***\n", mxlnd_ctxstate_to_str(rx->mxc_state));
-                CDEBUG(D_NETERROR, "*** listed?= %d ***\n", !list_empty(&rx->mxc_list));
-                CDEBUG(D_NETERROR, "*** nid= 0x%llx ***\n", rx->mxc_nid);
-                CDEBUG(D_NETERROR, "*** peer= 0x%p ***\n", rx->mxc_peer);
-                CDEBUG(D_NETERROR, "*** msg_type= %s ***\n", mxlnd_msgtype_to_str(rx->mxc_msg_type));
-                CDEBUG(D_NETERROR, "*** cookie= 0x%llx ***\n", rx->mxc_cookie);
-                CDEBUG(D_NETERROR, "*** nob= %d ***\n", rx->mxc_nob);
+                CNETERR("*** RX get (%llu) != put (%llu) ***\n", rx->mxc_get, rx->mxc_put);
+                CNETERR("*** incarnation= %lld ***\n", rx->mxc_incarnation);
+                CNETERR("*** deadline= %ld ***\n", rx->mxc_deadline);
+                CNETERR("*** state= %s ***\n", mxlnd_ctxstate_to_str(rx->mxc_state));
+                CNETERR("*** listed?= %d ***\n", !list_empty(&rx->mxc_list));
+                CNETERR("*** nid= 0x%llx ***\n", rx->mxc_nid);
+                CNETERR("*** peer= 0x%p ***\n", rx->mxc_peer);
+                CNETERR("*** msg_type= %s ***\n", mxlnd_msgtype_to_str(rx->mxc_msg_type));
+                CNETERR("*** cookie= 0x%llx ***\n", rx->mxc_cookie);
+                CNETERR("*** nob= %d ***\n", rx->mxc_nob);
         }
 #endif
         LASSERT (rx->mxc_get == rx->mxc_put);
@@ -237,7 +237,7 @@ mxlnd_get_idle_tx(void)
         spin_lock(&kmxlnd_data.kmx_tx_idle_lock);
 
         if (list_empty (&kmxlnd_data.kmx_tx_idle)) {
-                CDEBUG(D_NETERROR, "%d txs in use\n", kmxlnd_data.kmx_tx_used);
+                CNETERR("%d txs in use\n", kmxlnd_data.kmx_tx_used);
                 spin_unlock(&kmxlnd_data.kmx_tx_idle_lock);
                 return NULL;
         }
@@ -430,7 +430,7 @@ mxlnd_conn_cancel_pending_rxs(kmx_conn_t *conn)
                                                   &ctx->mxc_mxreq,
                                                   &result);
                                 if (mxret != MX_SUCCESS) {
-                                        CDEBUG(D_NETERROR, "mx_cancel() returned %s (%d)\n", mx_strerror(mxret), mxret);
+                                        CNETERR("mx_cancel() returned %s (%d)\n", mx_strerror(mxret), mxret);
                                 }
                                 if (result == 1) {
                                         ctx->mxc_errno = -ECONNABORTED;
@@ -587,7 +587,7 @@ mxlnd_conn_alloc_locked(kmx_conn_t **connp, kmx_peer_t *peer)
 
         MXLND_ALLOC(conn, sizeof (*conn));
         if (conn == NULL) {
-                CDEBUG(D_NETERROR, "Cannot allocate conn\n");
+                CNETERR("Cannot allocate conn\n");
                 return -ENOMEM;
         }
         CDEBUG(D_NET, "allocated conn 0x%p for peer 0x%p\n", conn, peer);
@@ -737,8 +737,8 @@ mxlnd_deq_pending_ctx(kmx_ctx_t *ctx)
                 ctx->mxc_state == MXLND_CTX_COMPLETED);
         if (ctx->mxc_state != MXLND_CTX_PENDING &&
             ctx->mxc_state != MXLND_CTX_COMPLETED) {
-                CDEBUG(D_NETERROR, "deq ctx->mxc_state = %s\n",
-                       mxlnd_ctxstate_to_str(ctx->mxc_state));
+                CNETERR("deq ctx->mxc_state = %s\n",
+                        mxlnd_ctxstate_to_str(ctx->mxc_state));
         }
         ctx->mxc_state = MXLND_CTX_COMPLETED;
         if (!list_empty(&ctx->mxc_list)) {
@@ -877,7 +877,7 @@ mxlnd_peer_alloc(kmx_peer_t **peerp, lnet_nid_t nid, u32 board, u32 ep_id, u64 n
 
         MXLND_ALLOC(peer, sizeof (*peer));
         if (peer == NULL) {
-                CDEBUG(D_NETERROR, "Cannot allocate peer for NID 0x%llx\n", nid);
+                CNETERR("Cannot allocate peer for NID 0x%llx\n", nid);
                 return -ENOMEM;
         }
         CDEBUG(D_NET, "allocated peer 0x%p for NID 0x%llx\n", peer, nid);
@@ -970,7 +970,7 @@ mxlnd_find_peer_by_nid(lnet_nid_t nid, int create)
                                 if (ret != 0) {
                                         /* we tried, return the peer only.
                                          * the caller needs to see if the conn exists */
-                                        CDEBUG(D_NETERROR, "%s: %s could not alloc conn\n",
+                                        CNETERR("%s: %s could not alloc conn\n",
                                         __func__, libcfs_nid2str(peer->mxp_nid));
                                 } else {
                                         /* drop extra conn ref */
@@ -1119,7 +1119,7 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
 
         /* 6 bytes are enough to have received magic + version */
         if (nob < 6) {
-                CDEBUG(D_NETERROR, "not enough bytes for magic + hdr: %d\n", nob);
+                CNETERR("not enough bytes for magic + hdr: %d\n", nob);
                 return -EPROTO;
         }
 
@@ -1128,24 +1128,24 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
         } else if (msg->mxm_magic == __swab32(MXLND_MSG_MAGIC)) {
                 flip = 1;
         } else {
-                CDEBUG(D_NETERROR, "Bad magic: %08x\n", msg->mxm_magic);
+                CNETERR("Bad magic: %08x\n", msg->mxm_magic);
                 return -EPROTO;
         }
 
         if (msg->mxm_version !=
             (flip ? __swab16(MXLND_MSG_VERSION) : MXLND_MSG_VERSION)) {
-                CDEBUG(D_NETERROR, "Bad version: %d\n", msg->mxm_version);
+                CNETERR("Bad version: %d\n", msg->mxm_version);
                 return -EPROTO;
         }
 
         if (nob < hdr_size) {
-                CDEBUG(D_NETERROR, "not enough for a header: %d\n", nob);
+                CNETERR("not enough for a header: %d\n", nob);
                 return -EPROTO;
         }
 
         msg_nob = flip ? __swab32(msg->mxm_nob) : msg->mxm_nob;
         if (msg_nob > nob) {
-                CDEBUG(D_NETERROR, "Short message: got %d, wanted %d\n", nob, msg_nob);
+                CNETERR("Short message: got %d, wanted %d\n", nob, msg_nob);
                 return -EPROTO;
         }
 
@@ -1154,7 +1154,7 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
         msg_cksum = flip ? __swab32(msg->mxm_cksum) : msg->mxm_cksum;
         msg->mxm_cksum = 0;
         if (msg_cksum != 0 && msg_cksum != mxlnd_cksum(msg, msg_nob)) {
-                CDEBUG(D_NETERROR, "Bad checksum\n");
+                CNETERR("Bad checksum\n");
                 return -EPROTO;
         }
         msg->mxm_cksum = msg_cksum;
@@ -1172,13 +1172,13 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
         }
 
         if (msg->mxm_srcnid == LNET_NID_ANY) {
-                CDEBUG(D_NETERROR, "Bad src nid: %s\n", libcfs_nid2str(msg->mxm_srcnid));
+                CNETERR("Bad src nid: %s\n", libcfs_nid2str(msg->mxm_srcnid));
                 return -EPROTO;
         }
 
         switch (msg->mxm_type) {
         default:
-                CDEBUG(D_NETERROR, "Unknown message type %x\n", msg->mxm_type);
+                CNETERR("Unknown message type %x\n", msg->mxm_type);
                 return -EPROTO;
 
         case MXLND_MSG_NOOP:
@@ -1186,7 +1186,7 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
 
         case MXLND_MSG_EAGER:
                 if (msg_nob < offsetof(kmx_msg_t, mxm_u.eager.mxem_payload[0])) {
-                        CDEBUG(D_NETERROR, "Short EAGER: %d(%d)\n", msg_nob,
+                        CNETERR("Short EAGER: %d(%d)\n", msg_nob,
                                (int)offsetof(kmx_msg_t, mxm_u.eager.mxem_payload[0]));
                         return -EPROTO;
                 }
@@ -1194,7 +1194,7 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
 
         case MXLND_MSG_PUT_REQ:
                 if (msg_nob < hdr_size + sizeof(msg->mxm_u.put_req)) {
-                        CDEBUG(D_NETERROR, "Short PUT_REQ: %d(%d)\n", msg_nob,
+                        CNETERR("Short PUT_REQ: %d(%d)\n", msg_nob,
                                (int)(hdr_size + sizeof(msg->mxm_u.put_req)));
                         return -EPROTO;
                 }
@@ -1204,7 +1204,7 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
 
         case MXLND_MSG_PUT_ACK:
                 if (msg_nob < hdr_size + sizeof(msg->mxm_u.put_ack)) {
-                        CDEBUG(D_NETERROR, "Short PUT_ACK: %d(%d)\n", msg_nob,
+                        CNETERR("Short PUT_ACK: %d(%d)\n", msg_nob,
                                (int)(hdr_size + sizeof(msg->mxm_u.put_ack)));
                         return -EPROTO;
                 }
@@ -1216,7 +1216,7 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
 
         case MXLND_MSG_GET_REQ:
                 if (msg_nob < hdr_size + sizeof(msg->mxm_u.get_req)) {
-                        CDEBUG(D_NETERROR, "Short GET_REQ: %d(%d)\n", msg_nob,
+                        CNETERR("Short GET_REQ: %d(%d)\n", msg_nob,
                                (int)(hdr_size + sizeof(msg->mxm_u.get_req)));
                         return -EPROTO;
                 }
@@ -1228,7 +1228,7 @@ mxlnd_unpack_msg(kmx_msg_t *msg, int nob)
         case MXLND_MSG_CONN_REQ:
         case MXLND_MSG_CONN_ACK:
                 if (msg_nob < hdr_size + sizeof(msg->mxm_u.conn_req)) {
-                        CDEBUG(D_NETERROR, "Short connreq/ack: %d(%d)\n", msg_nob,
+                        CNETERR("Short connreq/ack: %d(%d)\n", msg_nob,
                                (int)(hdr_size + sizeof(msg->mxm_u.conn_req)));
                         return -EPROTO;
                 }
@@ -1277,8 +1277,8 @@ mxlnd_recv_msg(lnet_msg_t *lntmsg, kmx_ctx_t *rx, u8 msg_type, u64 cookie, u32 l
                           cookie, mask, (void *) rx, &rx->mxc_mxreq);
         if (mxret != MX_SUCCESS) {
                 mxlnd_deq_pending_ctx(rx);
-                CDEBUG(D_NETERROR, "mx_kirecv() failed with %s (%d)\n",
-                                   mx_strerror(mxret), (int) mxret);
+                CNETERR("mx_kirecv() failed with %s (%d)\n",
+                        mx_strerror(mxret), (int) mxret);
                 return -1;
         }
         return 0;
@@ -1323,7 +1323,7 @@ mxlnd_unexpected_recv(void *context, mx_endpoint_addr_t source,
 
         /* TODO this will change to the net struct */
         if (context != NULL) {
-                CDEBUG(D_NETERROR, "non-NULL context\n");
+                CNETERR("non-NULL context\n");
         }
 
 #if MXLND_DEBUG
@@ -1357,8 +1357,8 @@ mxlnd_unexpected_recv(void *context, mx_endpoint_addr_t source,
 
                 if (conn) mxlnd_conn_decref(conn); /* drop ref taken above */
                 if (unlikely(length != expected || !data_if_available)) {
-                        CDEBUG(D_NETERROR, "received invalid CONN_REQ from %llx "
-                               "length=%d (expected %d)\n", nic_id, length, expected);
+                        CNETERR("received invalid CONN_REQ from %llx "
+                                "length=%d (expected %d)\n", nic_id, length, expected);
                         mxlnd_send_message(source, MXLND_MSG_CONN_ACK, EPROTO, 0);
                         return MX_RECV_FINISHED;
                 }
@@ -1366,8 +1366,8 @@ mxlnd_unexpected_recv(void *context, mx_endpoint_addr_t source,
                 ret = mxlnd_connparams_alloc(&cp, context, source, match_value, length,
                                          conn, peer, data_if_available);
                 if (unlikely(ret != 0)) {
-                        CDEBUG(D_NETERROR, "unable to alloc CONN_REQ from %llx:%d\n",
-                                        nic_id, ep_id);
+                        CNETERR("unable to alloc CONN_REQ from %llx:%d\n",
+                                nic_id, ep_id);
                         mxlnd_send_message(source, MXLND_MSG_CONN_ACK, ENOMEM, 0);
                         return MX_RECV_FINISHED;
                 }
@@ -1384,12 +1384,11 @@ mxlnd_unexpected_recv(void *context, mx_endpoint_addr_t source,
 
                 LASSERT(conn);
                 if (unlikely(error != 0)) {
-                        CDEBUG(D_NETERROR, "received CONN_ACK from %s "
-                               "with error -%d\n",
+                        CNETERR("received CONN_ACK from %s with error -%d\n",
                                libcfs_nid2str(peer->mxp_nid), (int) error);
                         mxlnd_conn_disconnect(conn, 1, 0);
                 } else if (unlikely(length != expected || !data_if_available)) {
-                        CDEBUG(D_NETERROR, "received %s CONN_ACK from %s "
+                        CNETERR("received %s CONN_ACK from %s "
                                "length=%d (expected %d)\n",
                                data_if_available ? "short" : "missing",
                                libcfs_nid2str(peer->mxp_nid), length, expected);
@@ -1399,7 +1398,7 @@ mxlnd_unexpected_recv(void *context, mx_endpoint_addr_t source,
                         ret = mxlnd_connparams_alloc(&cp, context, source, match_value, length,
                                          conn, peer, data_if_available);
                         if (unlikely(ret != 0)) {
-                                CDEBUG(D_NETERROR, "unable to alloc kmx_connparams_t"
+                                CNETERR("unable to alloc kmx_connparams_t"
                                                " from %llx:%d\n", nic_id, ep_id);
                                 mxlnd_conn_disconnect(conn, 1, 1);
                         } else {
@@ -1423,9 +1422,9 @@ mxlnd_unexpected_recv(void *context, mx_endpoint_addr_t source,
                 if (length <= MXLND_MSG_SIZE) {
                         ret = mxlnd_recv_msg(NULL, rx, msg_type, match_value, length);
                 } else {
-                        CDEBUG(D_NETERROR, "unexpected large receive with "
-                                           "match_value=0x%llx length=%d\n",
-                                           match_value, length);
+                        CNETERR("unexpected large receive with "
+                                "match_value=0x%llx length=%d\n",
+                                match_value, length);
                         ret = mxlnd_recv_msg(NULL, rx, msg_type, match_value, 0);
                 }
 
@@ -1435,7 +1434,7 @@ mxlnd_unexpected_recv(void *context, mx_endpoint_addr_t source,
                         rx->mxc_peer = peer;
                         rx->mxc_nid = peer->mxp_nid;
                 } else {
-                        CDEBUG(D_NETERROR, "could not post receive\n");
+                        CNETERR("could not post receive\n");
                         mxlnd_put_idle_rx(rx);
                 }
         }
@@ -1447,12 +1446,12 @@ mxlnd_unexpected_recv(void *context, mx_endpoint_addr_t source,
         if (rx == NULL || ret != 0) {
                 mxlnd_conn_decref(conn); /* drop ref taken above */
                 if (rx == NULL) {
-                        CDEBUG(D_NETERROR, "no idle rxs available - dropping rx"
-                               " 0x%llx from %s\n", match_value,
-                               libcfs_nid2str(peer->mxp_nid));
+                        CNETERR("no idle rxs available - dropping rx"
+                                " 0x%llx from %s\n", match_value,
+                                libcfs_nid2str(peer->mxp_nid));
                 } else {
                         /* ret != 0 */
-                        CDEBUG(D_NETERROR, "disconnected peer - dropping rx\n");
+                        CNETERR("disconnected peer - dropping rx\n");
                 }
                 seg.segment_ptr = 0ULL;
                 seg.segment_length = 0;
@@ -1642,7 +1641,7 @@ mxlnd_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)
                 break;
         }
         default:
-                CDEBUG(D_NETERROR, "unknown ctl(%d)\n", cmd);
+                CNETERR("unknown ctl(%d)\n", cmd);
                 break;
         }
 
@@ -1797,7 +1796,7 @@ mxlnd_setup_iov(kmx_ctx_t *ctx, u32 niov, struct iovec *iov, u32 offset, u32 nob
 
         MXLND_ALLOC(seg, nseg * sizeof(*seg));
         if (seg == NULL) {
-                CDEBUG(D_NETERROR, "MXLND_ALLOC() failed\n");
+                CNETERR("MXLND_ALLOC() failed\n");
                 return -1;
         }
         memset(seg, 0, nseg * sizeof(*seg));
@@ -1866,7 +1865,7 @@ mxlnd_setup_kiov(kmx_ctx_t *ctx, u32 niov, lnet_kiov_t *kiov, u32 offset, u32 no
 
         MXLND_ALLOC(seg, nseg * sizeof(*seg));
         if (seg == NULL) {
-                CDEBUG(D_NETERROR, "MXLND_ALLOC() failed\n");
+                CNETERR("MXLND_ALLOC() failed\n");
                 return -1;
         }
         memset(seg, 0, niov * sizeof(*seg));
@@ -1940,7 +1939,7 @@ mxlnd_send_data(lnet_ni_t *ni, lnet_msg_t *lntmsg, kmx_peer_t *peer, u8 msg_type
 
         tx = mxlnd_get_idle_tx();
         if (tx == NULL) {
-                CDEBUG(D_NETERROR, "Can't allocate %s tx for %s\n",
+                CNETERR("Can't allocate %s tx for %s\n",
                         msg_type == MXLND_MSG_PUT_DATA ? "PUT_DATA" : "GET_DATA",
                         libcfs_nid2str(target.nid));
                 goto failed_0;
@@ -1958,8 +1957,8 @@ mxlnd_send_data(lnet_ni_t *ni, lnet_msg_t *lntmsg, kmx_peer_t *peer, u8 msg_type
         /* This setups up the mx_ksegment_t to send the DATA payload  */
         if (nob == 0) {
                 /* do not setup the segments */
-                CDEBUG(D_NETERROR, "nob = 0; why didn't we use an EAGER reply "
-                                   "to %s?\n", libcfs_nid2str(target.nid));
+                CNETERR("nob = 0; why didn't we use an EAGER reply "
+                        "to %s?\n", libcfs_nid2str(target.nid));
                 ret = 0;
         } else if (kiov == NULL) {
                 ret = mxlnd_setup_iov(tx, niov, iov, offset, nob);
@@ -1967,8 +1966,8 @@ mxlnd_send_data(lnet_ni_t *ni, lnet_msg_t *lntmsg, kmx_peer_t *peer, u8 msg_type
                 ret = mxlnd_setup_kiov(tx, niov, kiov, offset, nob);
         }
         if (ret != 0) {
-                CDEBUG(D_NETERROR, "Can't setup send DATA for %s\n",
-                                   libcfs_nid2str(target.nid));
+                CNETERR("Can't setup send DATA for %s\n",
+                        libcfs_nid2str(target.nid));
                 tx->mxc_errno = -EIO;
                 goto failed_1;
         }
@@ -1981,7 +1980,7 @@ failed_1:
         return;
 
 failed_0:
-        CDEBUG(D_NETERROR, "no tx avail\n");
+        CNETERR("no tx avail\n");
         lnet_finalize(ni, lntmsg, -EIO);
         return;
 }
@@ -2044,13 +2043,13 @@ mxlnd_recv_data(lnet_ni_t *ni, lnet_msg_t *lntmsg, kmx_ctx_t *rx, u8 msg_type, u
         if (msg_type == MXLND_MSG_GET_DATA) {
                 rx->mxc_lntmsg[1] = lnet_create_reply_msg(kmxlnd_data.kmx_ni, lntmsg);
                 if (rx->mxc_lntmsg[1] == NULL) {
-                        CDEBUG(D_NETERROR, "Can't create reply for GET -> %s\n",
-                                           libcfs_nid2str(target.nid));
+                        CNETERR("Can't create reply for GET -> %s\n",
+                                libcfs_nid2str(target.nid));
                         ret = -1;
                 }
         }
         if (ret != 0) {
-                CDEBUG(D_NETERROR, "Can't setup %s rx for %s\n",
+                CNETERR("Can't setup %s rx for %s\n",
                        msg_type == MXLND_MSG_PUT_DATA ? "PUT_DATA" : "GET_DATA",
                        libcfs_nid2str(target.nid));
                 return -1;
@@ -2069,8 +2068,8 @@ mxlnd_recv_data(lnet_ni_t *ni, lnet_msg_t *lntmsg, kmx_ctx_t *rx, u8 msg_type, u
                 if (rx->mxc_conn != NULL) {
                         mxlnd_deq_pending_ctx(rx);
                 }
-                CDEBUG(D_NETERROR, "mx_kirecv() failed with %d for %s\n",
-                                   (int) mxret, libcfs_nid2str(target.nid));
+                CNETERR("mx_kirecv() failed with %d for %s\n",
+                        (int) mxret, libcfs_nid2str(target.nid));
                 return -1;
         }
 
@@ -2173,9 +2172,9 @@ mxlnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
 
                 tx = mxlnd_get_idle_tx();
                 if (unlikely(tx == NULL)) {
-                        CDEBUG(D_NETERROR, "Can't allocate %s tx for %s\n",
-                               type == LNET_MSG_PUT ? "PUT" : "REPLY",
-                               libcfs_nid2str(nid));
+                        CNETERR("Can't allocate %s tx for %s\n",
+                                type == LNET_MSG_PUT ? "PUT" : "REPLY",
+                                libcfs_nid2str(nid));
                         if (conn) mxlnd_conn_decref(conn);
                         return -ENOMEM;
                 }
@@ -2195,8 +2194,8 @@ mxlnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
 
                 rx = mxlnd_get_idle_rx(conn);
                 if (unlikely(rx == NULL)) {
-                        CDEBUG(D_NETERROR, "Can't allocate rx for PUT_ACK for %s\n",
-                                           libcfs_nid2str(nid));
+                        CNETERR("Can't allocate rx for PUT_ACK for %s\n",
+                                libcfs_nid2str(nid));
                         mxlnd_put_idle_tx(tx);
                         if (conn) mxlnd_conn_decref(conn); /* for the ref taken above */
                         return -ENOMEM;
@@ -2212,7 +2211,7 @@ mxlnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
                 length = offsetof(kmx_msg_t, mxm_u) + sizeof(kmx_putack_msg_t);
                 ret = mxlnd_recv_msg(lntmsg, rx, MXLND_MSG_PUT_ACK, rx->mxc_match, length);
                 if (unlikely(ret != 0)) {
-                        CDEBUG(D_NETERROR, "recv_msg() failed for PUT_ACK for %s\n",
+                        CNETERR("recv_msg() failed for PUT_ACK for %s\n",
                                            libcfs_nid2str(nid));
                         rx->mxc_lntmsg[0] = NULL;
                         mxlnd_put_idle_rx(rx);
@@ -2238,15 +2237,15 @@ mxlnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
                  * then post GET_REQ tx */
                 tx = mxlnd_get_idle_tx();
                 if (unlikely(tx == NULL)) {
-                        CDEBUG(D_NETERROR, "Can't allocate GET tx for %s\n",
-                                           libcfs_nid2str(nid));
+                        CNETERR("Can't allocate GET tx for %s\n",
+                                libcfs_nid2str(nid));
                         mxlnd_conn_decref(conn); /* for the ref taken above */
                         return -ENOMEM;
                 }
                 rx_data = mxlnd_get_idle_rx(conn);
                 if (unlikely(rx_data == NULL)) {
-                        CDEBUG(D_NETERROR, "Can't allocate DATA rx for %s\n",
-                                           libcfs_nid2str(nid));
+                        CNETERR("Can't allocate DATA rx for %s\n",
+                                libcfs_nid2str(nid));
                         mxlnd_put_idle_tx(tx);
                         mxlnd_conn_decref(conn); /* for the ref taken above */
                         return -ENOMEM;
@@ -2259,8 +2258,8 @@ mxlnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
 
                 ret = mxlnd_recv_data(ni, lntmsg, rx_data, MXLND_MSG_GET_DATA, tx->mxc_cookie);
                 if (unlikely(ret != 0)) {
-                        CDEBUG(D_NETERROR, "Can't setup GET sink for %s\n",
-                                           libcfs_nid2str(nid));
+                        CNETERR("Can't setup GET sink for %s\n",
+                                libcfs_nid2str(nid));
                         mxlnd_put_idle_rx(rx_data);
                         mxlnd_put_idle_tx(tx);
                         mxlnd_conn_decref(conn); /* for the rx_data... */
@@ -2293,8 +2292,8 @@ mxlnd_send(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
 
         tx = mxlnd_get_idle_tx();
         if (unlikely(tx == NULL)) {
-                CDEBUG(D_NETERROR, "Can't send %s to %s: tx descs exhausted\n",
-                                   mxlnd_lnetmsg_to_str(type), libcfs_nid2str(nid));
+                CNETERR("Can't send %s to %s: tx descs exhausted\n",
+                        mxlnd_lnetmsg_to_str(type), libcfs_nid2str(nid));
                 mxlnd_conn_decref(conn); /* drop ref taken above */
                 return -ENOMEM;
         }
@@ -2370,8 +2369,8 @@ mxlnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed,
                 nob = offsetof(kmx_msg_t, mxm_u.eager.mxem_payload[rlen]);
                 len = rx->mxc_status.xfer_length;
                 if (unlikely(nob > len)) {
-                        CDEBUG(D_NETERROR, "Eager message from %s too big: %d(%d)\n",
-                                           libcfs_nid2str(nid), nob, len);
+                        CNETERR("Eager message from %s too big: %d(%d)\n",
+                                libcfs_nid2str(nid), nob, len);
                         ret = -EPROTO;
                         break;
                 }
@@ -2398,7 +2397,7 @@ mxlnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed,
 
                 tx = mxlnd_get_idle_tx();
                 if (unlikely(tx == NULL)) {
-                        CDEBUG(D_NETERROR, "Can't allocate tx for %s\n", libcfs_nid2str(nid));
+                        CNETERR("Can't allocate tx for %s\n", libcfs_nid2str(nid));
                         /* Not replying will break the connection */
                         ret = -ENOMEM;
                         break;
@@ -2435,8 +2434,8 @@ mxlnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed,
 
                 if (unlikely(ret != 0)) {
                         /* Notify peer that it's over */
-                        CDEBUG(D_NETERROR, "Can't setup PUT_DATA rx for %s: %d\n",
-                                           libcfs_nid2str(nid), ret);
+                        CNETERR("Can't setup PUT_DATA rx for %s: %d\n",
+                                libcfs_nid2str(nid), ret);
                         mxlnd_ctx_init(tx);
                         tx->mxc_state = MXLND_CTX_PREP;
                         tx->mxc_peer = peer;
@@ -2468,8 +2467,8 @@ mxlnd_recv (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg, int delayed,
                          * Send the error in bits 52-59 and the cookie in bits 0-51 */
                         tx = mxlnd_get_idle_tx();
                         if (unlikely(tx == NULL)) {
-                                CDEBUG(D_NETERROR, "Can't get tx for GET NAK for %s\n",
-                                                   libcfs_nid2str(nid));
+                                CNETERR("Can't get tx for GET NAK for %s\n",
+                                        libcfs_nid2str(nid));
                                 /* we can't get a tx, notify the peer that the GET failed */
                                 mxlnd_send_message(conn->mxk_epa, MXLND_MSG_GET_DATA,
                                                    ENODATA, cookie);
@@ -2698,8 +2697,8 @@ mxlnd_iconnect(kmx_peer_t *peer, u8 msg_type)
                 spin_lock(&conn->mxk_lock);
                 mxlnd_set_conn_status(conn, MXLND_CONN_FAIL);
                 spin_unlock(&conn->mxk_lock);
-                CDEBUG(D_NETERROR, "mx_iconnect() failed with %s (%d) to %s\n",
-                       mx_strerror(mxret), mxret, libcfs_nid2str(peer->mxp_nid));
+                CNETERR("mx_iconnect() failed with %s (%d) to %s\n",
+                        mx_strerror(mxret), mxret, libcfs_nid2str(peer->mxp_nid));
                 mxlnd_conn_decref(conn);
         }
         mx_set_request_timeout(kmxlnd_data.kmx_endpt, request, MXLND_CONNECT_TIMEOUT/HZ*1000);
@@ -2746,7 +2745,7 @@ mxlnd_check_sends(kmx_peer_t *peer)
 
         if (conn == NULL) {
                 /* we do not have any conns */
-                CDEBUG(D_NETERROR, "peer %s has no conn\n", libcfs_nid2str(peer->mxp_nid));
+                CNETERR("peer %s has no conn\n", libcfs_nid2str(peer->mxp_nid));
                 return -1;
         }
 
@@ -2979,8 +2978,8 @@ mxlnd_check_sends(kmx_peer_t *peer)
                         if (likely(mxret == MX_SUCCESS)) {
                                 ret = 0;
                         } else {
-                                CDEBUG(D_NETERROR, "mx_kisend() failed with %s (%d) "
-                                       "sending to %s\n", mx_strerror(mxret), (int) mxret,
+                                CNETERR("mx_kisend() failed with %s (%d) "
+                                        "sending to %s\n", mx_strerror(mxret), (int) mxret,
                                        libcfs_nid2str(peer->mxp_nid));
                                 /* NOTE mx_kisend() only fails if there are not enough
                                 * resources. Do not change the connection status. */
@@ -3098,8 +3097,7 @@ mxlnd_handle_tx_completion(kmx_ctx_t *tx)
                 }
         case MXLND_MSG_CONN_REQ:
                 if (failed) {
-                        CDEBUG(D_NETERROR, "%s failed with %s (%d) (errno = %d)"
-                               " to %s\n",
+                        CNETERR("%s failed with %s (%d) (errno = %d) to %s\n",
                                type == MXLND_MSG_CONN_REQ ? "CONN_REQ" : "CONN_ACK",
                                mx_strstatus(code), code, tx->mxc_errno,
                                libcfs_nid2str(tx->mxc_nid));
@@ -3115,7 +3113,7 @@ mxlnd_handle_tx_completion(kmx_ctx_t *tx)
                 break;
 
         default:
-                CDEBUG(D_NETERROR, "Unknown msg type of %d\n", type);
+                CNETERR("Unknown msg type of %d\n", type);
                 LBUG();
         }
 
@@ -3196,10 +3194,10 @@ mxlnd_handle_rx_completion(kmx_ctx_t *rx)
 
         if (rx->mxc_status.code != MX_STATUS_SUCCESS &&
             rx->mxc_status.code != MX_STATUS_TRUNCATED) {
-                CDEBUG(D_NETERROR, "rx from %s failed with %s (%d)\n",
-                                   libcfs_nid2str(rx->mxc_nid),
-                                   mx_strstatus(rx->mxc_status.code),
-                                   rx->mxc_status.code);
+                CNETERR("rx from %s failed with %s (%d)\n",
+                        libcfs_nid2str(rx->mxc_nid),
+                        mx_strstatus(rx->mxc_status.code),
+                        rx->mxc_status.code);
                 credit = 0;
                 goto cleanup;
         }
@@ -3214,8 +3212,8 @@ mxlnd_handle_rx_completion(kmx_ctx_t *rx)
                         goto cleanup;
                 } else {
                         /* we had a rx complete with 0 bytes (no hdr, nothing) */
-                        CDEBUG(D_NETERROR, "rx from %s returned with 0 bytes\n",
-                                           libcfs_nid2str(rx->mxc_nid));
+                        CNETERR("rx from %s returned with 0 bytes\n",
+                                libcfs_nid2str(rx->mxc_nid));
                         goto cleanup;
                 }
         }
@@ -3234,8 +3232,8 @@ mxlnd_handle_rx_completion(kmx_ctx_t *rx)
 
         ret = mxlnd_unpack_msg(msg, nob);
         if (ret != 0) {
-                CDEBUG(D_NETERROR, "Error %d unpacking rx from %s\n",
-                                   ret, libcfs_nid2str(rx->mxc_nid));
+                CNETERR("Error %d unpacking rx from %s\n",
+                        ret, libcfs_nid2str(rx->mxc_nid));
                 goto cleanup;
         }
         rx->mxc_nob = nob;
@@ -3243,21 +3241,21 @@ mxlnd_handle_rx_completion(kmx_ctx_t *rx)
 
         if (!lnet_ptlcompat_matchnid(rx->mxc_nid, msg->mxm_srcnid) ||
             !lnet_ptlcompat_matchnid(kmxlnd_data.kmx_ni->ni_nid, msg->mxm_dstnid)) {
-                CDEBUG(D_NETERROR, "rx with mismatched NID (type %s) (my nid is "
-                       "0x%llx and rx msg dst is 0x%llx)\n",
-                       mxlnd_msgtype_to_str(type), kmxlnd_data.kmx_ni->ni_nid,
-                       msg->mxm_dstnid);
+                CNETERR("rx with mismatched NID (type %s) (my nid is "
+                        "0x%llx and rx msg dst is 0x%llx)\n",
+                        mxlnd_msgtype_to_str(type), kmxlnd_data.kmx_ni->ni_nid,
+                        msg->mxm_dstnid);
                 goto cleanup;
         }
 
         if ((conn != NULL && msg->mxm_srcstamp != conn->mxk_incarnation) ||
             msg->mxm_dststamp != kmxlnd_data.kmx_incarnation) {
-                CDEBUG(D_NETERROR, "Stale rx from %s with type %s "
-                       "(mxm_srcstamp (%lld) != mxk_incarnation (%lld) "
-                       "|| mxm_dststamp (%lld) != kmx_incarnation (%lld))\n",
-                       libcfs_nid2str(rx->mxc_nid), mxlnd_msgtype_to_str(type),
-                       msg->mxm_srcstamp, conn->mxk_incarnation,
-                       msg->mxm_dststamp, kmxlnd_data.kmx_incarnation);
+                CNETERR("Stale rx from %s with type %s "
+                        "(mxm_srcstamp (%lld) != mxk_incarnation (%lld) "
+                        "|| mxm_dststamp (%lld) != kmx_incarnation (%lld))\n",
+                        libcfs_nid2str(rx->mxc_nid), mxlnd_msgtype_to_str(type),
+                        msg->mxm_srcstamp, conn->mxk_incarnation,
+                        msg->mxm_dststamp, kmxlnd_data.kmx_incarnation);
                 credit = 0;
                 goto cleanup;
         }
@@ -3271,8 +3269,8 @@ mxlnd_handle_rx_completion(kmx_ctx_t *rx)
                 if (msg->mxm_srcstamp == conn->mxk_incarnation) {
                         if ((conn->mxk_credits + msg->mxm_credits) >
                              *kmxlnd_tunables.kmx_peercredits) {
-                                CDEBUG(D_NETERROR, "mxk_credits %d  mxm_credits %d\n",
-                                       conn->mxk_credits, msg->mxm_credits);
+                                CNETERR("mxk_credits %d  mxm_credits %d\n",
+                                        conn->mxk_credits, msg->mxm_credits);
                         }
                         conn->mxk_credits += msg->mxm_credits;
                         LASSERT(conn->mxk_credits >= 0);
@@ -3301,8 +3299,8 @@ mxlnd_handle_rx_completion(kmx_ctx_t *rx)
         case MXLND_MSG_PUT_ACK: {
                 u64  cookie = (u64) msg->mxm_u.put_ack.mxpam_dst_cookie;
                 if (cookie > MXLND_MAX_COOKIE) {
-                        CDEBUG(D_NETERROR, "NAK for msg_type %d from %s\n", rx->mxc_msg_type,
-                                           libcfs_nid2str(rx->mxc_nid));
+                        CNETERR("NAK for msg_type %d from %s\n", rx->mxc_msg_type,
+                                libcfs_nid2str(rx->mxc_nid));
                         result = -((u32) MXLND_ERROR_VAL(cookie));
                         lntmsg[0] = rx->mxc_lntmsg[0];
                 } else {
@@ -3320,8 +3318,8 @@ mxlnd_handle_rx_completion(kmx_ctx_t *rx)
                 break;
 
         default:
-                CDEBUG(D_NETERROR, "Bad MXLND message type %x from %s\n", msg->mxm_type,
-                                libcfs_nid2str(rx->mxc_nid));
+                CNETERR("Bad MXLND message type %x from %s\n", msg->mxm_type,
+                        libcfs_nid2str(rx->mxc_nid));
                 ret = -EPROTO;
                 break;
         }
@@ -3390,8 +3388,8 @@ mxlnd_handle_connect_msg(kmx_peer_t *peer, u8 msg_type, mx_status_t status)
         if (status.code != MX_STATUS_SUCCESS) {
                 int send_bye    = (msg_type == MXLND_MSG_ICON_REQ ? 0 : 1);
 
-                CDEBUG(D_NETERROR, "mx_iconnect() failed for %s with %s (%d) "
-                       "to %s mxp_nid = 0x%llx mxp_nic_id = 0x%0llx mxp_ep_id = %d\n",
+                CNETERR("mx_iconnect() failed for %s with %s (%d) "
+                        "to %s mxp_nid = 0x%llx mxp_nic_id = 0x%0llx mxp_ep_id = %d\n",
                         mxlnd_msgtype_to_str(msg_type),
                         mx_strstatus(status.code), status.code,
                         libcfs_nid2str(peer->mxp_nid),
@@ -3403,7 +3401,7 @@ mxlnd_handle_connect_msg(kmx_peer_t *peer, u8 msg_type, mx_status_t status)
                 spin_unlock(&conn->mxk_lock);
 
                 if (time_after(jiffies, peer->mxp_reconnect_time + MXLND_CONNECT_TIMEOUT)) {
-                        CDEBUG(D_NETERROR, "timeout, calling conn_disconnect()\n");
+                        CNETERR("timeout, calling conn_disconnect()\n");
                         mxlnd_conn_disconnect(conn, 0, send_bye);
                 }
 
@@ -3431,9 +3429,9 @@ mxlnd_handle_connect_msg(kmx_peer_t *peer, u8 msg_type, mx_status_t status)
         /* we are still using the conn ref from iconnect() - do not take another */
         tx = mxlnd_get_idle_tx();
         if (tx == NULL) {
-                CDEBUG(D_NETERROR, "Can't obtain %s tx for %s\n",
-                       mxlnd_msgtype_to_str(type),
-                       libcfs_nid2str(peer->mxp_nid));
+                CNETERR("Can't obtain %s tx for %s\n",
+                        mxlnd_msgtype_to_str(type),
+                        libcfs_nid2str(peer->mxp_nid));
                 spin_lock(&conn->mxk_lock);
                 mxlnd_set_conn_status(conn, MXLND_CONN_FAIL);
                 spin_unlock(&conn->mxk_lock);
@@ -3518,10 +3516,10 @@ mxlnd_request_waitd(void *arg)
                        (u64) status.match_info, status.msg_length);
 
                 if (status.code != MX_STATUS_SUCCESS) {
-                        CDEBUG(D_NETERROR, "wait_any() failed with %s (%d) with "
-                               "match_info 0x%llx and length %d\n",
-                               mx_strstatus(status.code), status.code,
-                               (u64) status.match_info, status.msg_length);
+                        CNETERR("wait_any() failed with %s (%d) with "
+                                "match_info 0x%llx and length %d\n",
+                                mx_strstatus(status.code), status.code,
+                                (u64) status.match_info, status.msg_length);
                 }
 
                 msg_type = MXLND_MSG_TYPE(status.match_info);
@@ -3558,7 +3556,7 @@ mxlnd_request_waitd(void *arg)
                                 mxlnd_handle_rx_completion(ctx);
                                 break;
                         default:
-                                CDEBUG(D_NETERROR, "Unknown ctx type %d\n", req_type);
+                                CNETERR("Unknown ctx type %d\n", req_type);
                                 LBUG();
                                 break;
                         }
@@ -3661,34 +3659,34 @@ mxlnd_passive_connect(kmx_connparams_t *cp)
         ret = mxlnd_unpack_msg(msg, cp->mxr_nob);
         if (ret != 0) {
                 if (peer) {
-                        CDEBUG(D_NETERROR, "Error %d unpacking CONN_REQ from %s\n",
-                               ret, libcfs_nid2str(peer->mxp_nid));
+                        CNETERR("Error %d unpacking CONN_REQ from %s\n",
+                                ret, libcfs_nid2str(peer->mxp_nid));
                 } else {
-                        CDEBUG(D_NETERROR, "Error %d unpacking CONN_REQ from "
-                               "unknown host with nic_id 0x%llx\n", ret, nic_id);
+                        CNETERR("Error %d unpacking CONN_REQ from "
+                                "unknown host with nic_id 0x%llx\n", ret, nic_id);
                 }
                 goto cleanup;
         }
         if (!lnet_ptlcompat_matchnid(kmxlnd_data.kmx_ni->ni_nid, msg->mxm_dstnid)) {
-                CDEBUG(D_NETERROR, "Can't accept %s: bad dst nid %s\n",
-                                libcfs_nid2str(msg->mxm_srcnid),
-                                libcfs_nid2str(msg->mxm_dstnid));
+                CNETERR("Can't accept %s: bad dst nid %s\n",
+                        libcfs_nid2str(msg->mxm_srcnid),
+                        libcfs_nid2str(msg->mxm_dstnid));
                 goto cleanup;
         }
         if (msg->mxm_u.conn_req.mxcrm_queue_depth != *kmxlnd_tunables.kmx_peercredits) {
-                CDEBUG(D_NETERROR, "Can't accept %s: incompatible queue depth "
-                            "%d (%d wanted)\n",
-                                libcfs_nid2str(msg->mxm_srcnid),
-                                msg->mxm_u.conn_req.mxcrm_queue_depth,
-                                *kmxlnd_tunables.kmx_peercredits);
+                CNETERR("Can't accept %s: incompatible queue depth "
+                        "%d (%d wanted)\n",
+                        libcfs_nid2str(msg->mxm_srcnid),
+                        msg->mxm_u.conn_req.mxcrm_queue_depth,
+                        *kmxlnd_tunables.kmx_peercredits);
                 incompatible = 1;
         }
         if (msg->mxm_u.conn_req.mxcrm_eager_size != MXLND_MSG_SIZE) {
-                CDEBUG(D_NETERROR, "Can't accept %s: incompatible EAGER size "
-                            "%d (%d wanted)\n",
-                                libcfs_nid2str(msg->mxm_srcnid),
-                                msg->mxm_u.conn_req.mxcrm_eager_size,
-                                (int) MXLND_MSG_SIZE);
+                CNETERR("Can't accept %s: incompatible EAGER size "
+                        "%d (%d wanted)\n",
+                        libcfs_nid2str(msg->mxm_srcnid),
+                        msg->mxm_u.conn_req.mxcrm_eager_size,
+                        (int) MXLND_MSG_SIZE);
                 incompatible = 1;
         }
 
@@ -3731,7 +3729,7 @@ mxlnd_passive_connect(kmx_connparams_t *cp)
                         mxlnd_peer_decref(peer); /* drop ref taken above */
                         write_unlock(g_lock);
                         if (ret != 0) {
-                                CDEBUG(D_NETERROR, "Cannot allocate mxp_conn\n");
+                                CNETERR("Cannot allocate mxp_conn\n");
                                 goto cleanup;
                         }
                 }
@@ -3750,7 +3748,7 @@ mxlnd_passive_connect(kmx_connparams_t *cp)
                         * conn_decref() which will eventually free it. */
                         ret = mxlnd_conn_alloc(&conn, peer);
                         if (ret != 0) {
-                                CDEBUG(D_NETERROR, "Cannot allocate peer->mxp_conn\n");
+                                CNETERR("Cannot allocate peer->mxp_conn\n");
                                 goto cleanup;
                         }
                         /* conn_alloc() adds one ref for the peer and one
@@ -3798,26 +3796,26 @@ mxlnd_check_conn_ack(kmx_connparams_t *cp)
         ret = mxlnd_unpack_msg(msg, cp->mxr_nob);
         if (ret != 0) {
                 if (peer) {
-                        CDEBUG(D_NETERROR, "Error %d unpacking CONN_ACK from %s\n",
-                               ret, libcfs_nid2str(peer->mxp_nid));
+                        CNETERR("Error %d unpacking CONN_ACK from %s\n",
+                                ret, libcfs_nid2str(peer->mxp_nid));
                 } else {
-                        CDEBUG(D_NETERROR, "Error %d unpacking CONN_ACK from "
-                               "unknown host with nic_id 0x%llx\n", ret, nic_id);
+                        CNETERR("Error %d unpacking CONN_ACK from "
+                                "unknown host with nic_id 0x%llx\n", ret, nic_id);
                 }
                 ret = -1;
                 incompatible = 1;
                 goto failed;
         }
         if (!lnet_ptlcompat_matchnid(kmxlnd_data.kmx_ni->ni_nid, msg->mxm_dstnid)) {
-                CDEBUG(D_NETERROR, "Can't accept CONN_ACK from %s: "
-                       "bad dst nid %s\n", libcfs_nid2str(msg->mxm_srcnid),
+                CNETERR("Can't accept CONN_ACK from %s: "
+                        "bad dst nid %s\n", libcfs_nid2str(msg->mxm_srcnid),
                         libcfs_nid2str(msg->mxm_dstnid));
                 ret = -1;
                 goto failed;
         }
         if (msg->mxm_u.conn_req.mxcrm_queue_depth != *kmxlnd_tunables.kmx_peercredits) {
-                CDEBUG(D_NETERROR, "Can't accept CONN_ACK from %s: "
-                       "incompatible queue depth %d (%d wanted)\n",
+                CNETERR("Can't accept CONN_ACK from %s: "
+                        "incompatible queue depth %d (%d wanted)\n",
                         libcfs_nid2str(msg->mxm_srcnid),
                         msg->mxm_u.conn_req.mxcrm_queue_depth,
                         *kmxlnd_tunables.kmx_peercredits);
@@ -3826,8 +3824,8 @@ mxlnd_check_conn_ack(kmx_connparams_t *cp)
                 goto failed;
         }
         if (msg->mxm_u.conn_req.mxcrm_eager_size != MXLND_MSG_SIZE) {
-                CDEBUG(D_NETERROR, "Can't accept CONN_ACK from %s: "
-                       "incompatible EAGER size %d (%d wanted)\n",
+                CNETERR("Can't accept CONN_ACK from %s: "
+                        "incompatible EAGER size %d (%d wanted)\n",
                         libcfs_nid2str(msg->mxm_srcnid),
                         msg->mxm_u.conn_req.mxcrm_eager_size,
                         (int) MXLND_MSG_SIZE);
@@ -3969,8 +3967,8 @@ mxlnd_connd(void *arg)
                 spin_lock(g_conn_lock);
                 if (list_empty(conn_reqs)) {
                         if (ret == 0)
-                                CDEBUG(D_NETERROR, "connd woke up but did not "
-                                       "find a kmx_connparams_t or zombie conn\n");
+                                CNETERR("connd woke up but did not find a "
+                                        "kmx_connparams_t or zombie conn\n");
                         spin_unlock(g_conn_lock);
                         continue;
                 }
index 2500341..e7444cd 100644 (file)
@@ -455,8 +455,8 @@ kiblnd_rx_complete (kib_rx_t *rx, int status, int nob)
                 goto ignore;
 
         if (status != IB_WC_SUCCESS) {
-                CDEBUG(D_NETERROR, "Rx from %s failed: %d\n",
-                       libcfs_nid2str(conn->ibc_peer->ibp_nid), status);
+                CNETERR("Rx from %s failed: %d\n",
+                        libcfs_nid2str(conn->ibc_peer->ibp_nid), status);
                 goto failed;
         }
 
@@ -948,11 +948,11 @@ kiblnd_tx_complete (kib_tx_t *tx, int status)
 
         if (failed) {
                 if (conn->ibc_state == IBLND_CONN_ESTABLISHED)
-                        CDEBUG(D_NETERROR, "Tx -> %s cookie "LPX64
-                               " sending %d waiting %d: failed %d\n",
-                               libcfs_nid2str(conn->ibc_peer->ibp_nid),
-                               tx->tx_cookie, tx->tx_sending, tx->tx_waiting,
-                               status);
+                        CNETERR("Tx -> %s cookie "LPX64
+                                " sending %d waiting %d: failed %d\n",
+                                libcfs_nid2str(conn->ibc_peer->ibp_nid),
+                                tx->tx_cookie, tx->tx_sending, tx->tx_waiting,
+                                status);
 
                 kiblnd_close_conn(conn, -EIO);
         } else {
@@ -1772,15 +1772,17 @@ kiblnd_close_conn_locked (kib_conn_t *conn, int error)
             list_empty(&conn->ibc_tx_queue_rsrvd) &&
             list_empty(&conn->ibc_tx_queue_nocred) &&
             list_empty(&conn->ibc_active_txs)) {
-                CDEBUG(D_NET, "closing conn to %s\n", 
+                CDEBUG(D_NET, "closing conn to %s\n",
                        libcfs_nid2str(peer->ibp_nid));
         } else {
-                CDEBUG(D_NETERROR, "Closing conn to %s: error %d%s%s%s%s\n",
-                       libcfs_nid2str(peer->ibp_nid), error,
-                       list_empty(&conn->ibc_tx_queue) ? "" : "(sending)",
-                       list_empty(&conn->ibc_tx_queue_rsrvd) ? "" : "(sending_rsrvd)",
-                       list_empty(&conn->ibc_tx_queue_nocred) ? "" : "(sending_nocred)",
-                       list_empty(&conn->ibc_active_txs) ? "" : "(waiting)");
+                CNETERR("Closing conn to %s: error %d%s%s%s%s\n",
+                        libcfs_nid2str(peer->ibp_nid), error,
+                        list_empty(&conn->ibc_tx_queue) ? "" : "(sending)",
+                        list_empty(&conn->ibc_tx_queue_rsrvd) ?
+                                "" : "(sending_rsrvd)",
+                        list_empty(&conn->ibc_tx_queue_nocred) ?
+                                "" : "(sending_nocred)",
+                        list_empty(&conn->ibc_active_txs) ? "" : "(waiting)");
         }
 
         list_del(&conn->ibc_list);
@@ -1947,7 +1949,7 @@ kiblnd_peer_connect_failed (kib_peer_t *peer, int active, int error)
         if (list_empty (&zombies))
                 return;
 
-        CDEBUG (D_NETERROR, "Deleting messages for %s: connection failed\n",
+        CNETERR("Deleting messages for %s: connection failed\n",
                 libcfs_nid2str(peer->ibp_nid));
 
         kiblnd_txlist_done(peer->ibp_ni, &zombies, -EHOSTUNREACH);
@@ -2373,13 +2375,13 @@ kiblnd_reconnect (kib_conn_t *conn, int version,
                 break;
         }
 
-        CDEBUG(D_NETERROR, "%s: retrying (%s), %x, %x, "
-                           "queue_dep: %d, max_frag: %d, msg_size: %d\n",
-               libcfs_nid2str(peer->ibp_nid),
-               reason, IBLND_MSG_VERSION, version,
-               cp != NULL ? cp->ibcp_queue_depth : IBLND_MSG_QUEUE_SIZE(version),
-               cp != NULL ? cp->ibcp_max_frags   : IBLND_RDMA_FRAGS(version),
-               cp != NULL ? cp->ibcp_max_msg_size: IBLND_MSG_SIZE);
+        CNETERR("%s: retrying (%s), %x, %x, "
+                "queue_dep: %d, max_frag: %d, msg_size: %d\n",
+                libcfs_nid2str(peer->ibp_nid),
+                reason, IBLND_MSG_VERSION, version,
+                cp != NULL? cp->ibcp_queue_depth :IBLND_MSG_QUEUE_SIZE(version),
+                cp != NULL? cp->ibcp_max_frags   : IBLND_RDMA_FRAGS(version),
+                cp != NULL? cp->ibcp_max_msg_size: IBLND_MSG_SIZE);
 
         kiblnd_connect_peer(peer);
 }
@@ -2399,9 +2401,9 @@ kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob)
                 break;
 
         case IB_CM_REJ_INVALID_SERVICE_ID:
-                CDEBUG(D_NETERROR, "%s rejected: no listener at %d\n",
-                       libcfs_nid2str(peer->ibp_nid),
-                       *kiblnd_tunables.kib_service);
+                CNETERR("%s rejected: no listener at %d\n",
+                        libcfs_nid2str(peer->ibp_nid),
+                        *kiblnd_tunables.kib_service);
                 break;
 
         case IB_CM_REJ_CONSUMER_DEFINED:
@@ -2511,8 +2513,8 @@ kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob)
                 }
                 /* fall through */
         default:
-                CDEBUG(D_NETERROR, "%s rejected: reason %d, size %d\n",
-                       libcfs_nid2str(peer->ibp_nid), reason, priv_nob);
+                CNETERR("%s rejected: reason %d, size %d\n",
+                        libcfs_nid2str(peer->ibp_nid), reason, priv_nob);
                 break;
         }
 
@@ -2697,16 +2699,16 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
 
        case RDMA_CM_EVENT_CONNECT_REQUEST:
                 /* destroy cmid on failure */
-               rc = kiblnd_passive_connect(cmid, 
+               rc = kiblnd_passive_connect(cmid,
                                             (void *)KIBLND_CONN_PARAM(event),
                                             KIBLND_CONN_PARAM_LEN(event));
                 CDEBUG(D_NET, "connreq: %d\n", rc);
                 return rc;
-                
+
        case RDMA_CM_EVENT_ADDR_ERROR:
                 peer = (kib_peer_t *)cmid->context;
-                CDEBUG(D_NETERROR, "%s: ADDR ERROR %d\n",
-                       libcfs_nid2str(peer->ibp_nid), event->status);
+                CNETERR("%s: ADDR ERROR %d\n",
+                        libcfs_nid2str(peer->ibp_nid), event->status);
                 kiblnd_peer_connect_failed(peer, 1, -EHOSTUNREACH);
                 kiblnd_peer_decref(peer);
                 return -EHOSTUNREACH;      /* rc != 0 destroys cmid */
@@ -2718,8 +2720,8 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
                        libcfs_nid2str(peer->ibp_nid), event->status);
 
                 if (event->status != 0) {
-                        CDEBUG(D_NETERROR, "Can't resolve address for %s: %d\n",
-                               libcfs_nid2str(peer->ibp_nid), event->status);
+                        CNETERR("Can't resolve address for %s: %d\n",
+                                libcfs_nid2str(peer->ibp_nid), event->status);
                         rc = event->status;
                 } else {
                         rc = rdma_resolve_route(
@@ -2736,8 +2738,8 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
 
        case RDMA_CM_EVENT_ROUTE_ERROR:
                 peer = (kib_peer_t *)cmid->context;
-                CDEBUG(D_NETERROR, "%s: ROUTE ERROR %d\n",
-                       libcfs_nid2str(peer->ibp_nid), event->status);
+                CNETERR("%s: ROUTE ERROR %d\n",
+                        libcfs_nid2str(peer->ibp_nid), event->status);
                 kiblnd_peer_connect_failed(peer, 1, -EHOSTUNREACH);
                 kiblnd_peer_decref(peer);
                 return -EHOSTUNREACH;           /* rc != 0 destroys cmid */
@@ -2750,18 +2752,18 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
                 if (event->status == 0)
                         return kiblnd_active_connect(cmid);
 
-                CDEBUG(D_NETERROR, "Can't resolve route for %s: %d\n",
-                       libcfs_nid2str(peer->ibp_nid), event->status);
+                CNETERR("Can't resolve route for %s: %d\n",
+                        libcfs_nid2str(peer->ibp_nid), event->status);
                 kiblnd_peer_connect_failed(peer, 1, event->status);
                 kiblnd_peer_decref(peer);
                 return event->status;           /* rc != 0 destroys cmid */
-                
+
        case RDMA_CM_EVENT_UNREACHABLE:
                 conn = (kib_conn_t *)cmid->context;
                 LASSERT(conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT ||
                         conn->ibc_state == IBLND_CONN_PASSIVE_WAIT);
-                CDEBUG(D_NETERROR, "%s: UNREACHABLE %d\n",
-                       libcfs_nid2str(conn->ibc_peer->ibp_nid), event->status);
+                CNETERR("%s: UNREACHABLE %d\n",
+                        libcfs_nid2str(conn->ibc_peer->ibp_nid), event->status);
                 kiblnd_connreq_done(conn, -ENETDOWN);
                 kiblnd_conn_decref(conn);
                 return 0;
@@ -2770,8 +2772,8 @@ kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
                 conn = (kib_conn_t *)cmid->context;
                 LASSERT(conn->ibc_state == IBLND_CONN_ACTIVE_CONNECT ||
                         conn->ibc_state == IBLND_CONN_PASSIVE_WAIT);
-                CDEBUG(D_NETERROR, "%s: CONNECT ERROR %d\n",
-                       libcfs_nid2str(conn->ibc_peer->ibp_nid), event->status);
+                CNETERR("%s: CONNECT ERROR %d\n",
+                        libcfs_nid2str(conn->ibc_peer->ibp_nid), event->status);
                 kiblnd_connreq_done(conn, -ENOTCONN);
                 kiblnd_conn_decref(conn);
                 return 0;
@@ -3104,8 +3106,8 @@ kiblnd_complete (struct ib_wc *wc)
                  * failing RDMA because 'tx' might be back on the idle list or
                  * even reused already if we didn't manage to post all our work
                  * items */
-                CDEBUG(D_NETERROR, "RDMA (tx: %p) failed: %d\n",
-                       kiblnd_wreqid2ptr(wc->wr_id), wc->status);
+                CNETERR("RDMA (tx: %p) failed: %d\n",
+                        kiblnd_wreqid2ptr(wc->wr_id), wc->status);
                 return;
 
         case IBLND_WID_TX:
index 31dade0..6fae850 100644 (file)
@@ -848,14 +848,14 @@ kibnal_tx_callback (struct ib_cq_entry *e)
         if (e->status != IB_COMPLETION_STATUS_SUCCESS &&
             tx->tx_status == 0)
                 tx->tx_status = -ECONNABORTED;
-                
+
         spin_unlock_irqrestore(&conn->ibc_lock, flags);
 
         if (idle)
                 kibnal_tx_done (tx);
 
         if (e->status != IB_COMPLETION_STATUS_SUCCESS) {
-                CDEBUG (D_NETERROR, "Tx completion to %s failed: %d\n", 
+                CNETERR("Tx completion to %s failed: %d\n",
                         libcfs_nid2str(conn->ibc_peer->ibp_nid), e->status);
                 kibnal_close_conn (conn, -ENETDOWN);
         } else {
@@ -1520,10 +1520,10 @@ kibnal_close_conn_locked (kib_conn_t *conn, int error)
          * Caller holds kib_global_lock exclusively in irq context */
         kib_peer_t   *peer = conn->ibc_peer;
 
-        CDEBUG (error == 0 ? D_NET : D_NETERROR,
-                "closing conn to %s: error %d\n", 
-                libcfs_nid2str(peer->ibp_nid), error);
-        
+        CDEBUG_LIMIT(error == 0 ? D_NET : D_NETERROR,
+                     "closing conn to %s: error %d\n",
+                     libcfs_nid2str(peer->ibp_nid), error);
+
         LASSERT (conn->ibc_state == IBNAL_CONN_ESTABLISHED ||
                  conn->ibc_state == IBNAL_CONN_CONNECTING);
 
@@ -1627,13 +1627,13 @@ kibnal_peer_connect_failed (kib_peer_t *peer, int active, int error)
                 /* Can't have blocked transmits if there are connections */
                 LASSERT (list_empty(&peer->ibp_tx_queue));
         }
-        
+
         write_unlock_irqrestore (&kibnal_data.kib_global_lock, flags);
 
         kibnal_peer_notify(peer);
-        
+
         if (!list_empty (&zombies))
-                CDEBUG (D_NETERROR, "Deleting messages for %s: connection failed\n",
+                CNETERR("Deleting messages for %s: connection failed\n",
                         libcfs_nid2str(peer->ibp_nid));
 
         kibnal_txlist_done(&zombies, -EHOSTUNREACH);
@@ -1936,14 +1936,14 @@ kibnal_conn_callback (tTS_IB_CM_EVENT event,
 
         switch (event) {
         default:
-                CDEBUG(D_NETERROR, "Connection %p -> %s ERROR %d\n",
-                       conn, libcfs_nid2str(conn->ibc_peer->ibp_nid), event);
+                CNETERR("Connection %p -> %s ERROR %d\n",
+                        conn, libcfs_nid2str(conn->ibc_peer->ibp_nid), event);
                 kibnal_close_conn (conn, -ECONNABORTED);
                 break;
-                
+
         case TS_IB_CM_DISCONNECTED:
-                CDEBUG(D_NETERROR, "Connection %p -> %s DISCONNECTED.\n",
-                       conn, libcfs_nid2str(conn->ibc_peer->ibp_nid));
+                CNETERR("Connection %p -> %s DISCONNECTED.\n",
+                        conn, libcfs_nid2str(conn->ibc_peer->ibp_nid));
                 kibnal_close_conn (conn, 0);
                 break;
 
@@ -2119,8 +2119,8 @@ kibnal_active_conn_callback (tTS_IB_CM_EVENT event,
                 return TS_IB_CM_CALLBACK_PROCEED;
 
         case TS_IB_CM_IDLE:
-                CDEBUG(D_NETERROR, "Connection %p -> %s IDLE\n",
-                       conn, libcfs_nid2str(conn->ibc_peer->ibp_nid));
+                CNETERR("Connection %p -> %s IDLE\n",
+                        conn, libcfs_nid2str(conn->ibc_peer->ibp_nid));
                 /* I assume this connection attempt was rejected because the
                  * peer found a stale QP; I'll just try again */
                 write_lock_irqsave(&kibnal_data.kib_global_lock, flags);
@@ -2132,8 +2132,8 @@ kibnal_active_conn_callback (tTS_IB_CM_EVENT event,
                 return TS_IB_CM_CALLBACK_ABORT;
 
         default:
-                CDEBUG(D_NETERROR, "Connection %p -> %s ERROR %d\n",
-                       conn, libcfs_nid2str(conn->ibc_peer->ibp_nid), event);
+                CNETERR("Connection %p -> %s ERROR %d\n",
+                        conn, libcfs_nid2str(conn->ibc_peer->ibp_nid), event);
                 kibnal_connreq_done(conn, 1, -ECONNABORTED);
                 kibnal_conn_decref(conn); /* drop CM's ref */
                 return TS_IB_CM_CALLBACK_ABORT;
@@ -2150,7 +2150,7 @@ kibnal_pathreq_callback (tTS_IB_CLIENT_QUERY_TID tid, int status,
         kib_msg_t  *msg = &conn->ibc_connreq->cr_msg;
 
         if (status != 0) {
-                CDEBUG (D_NETERROR, "Pathreq %p -> %s failed: %d\n",
+                CNETERR("Pathreq %p -> %s failed: %d\n",
                         conn, libcfs_nid2str(peer->ibp_nid), status);
                 kibnal_connreq_done(conn, 1, status);
                 kibnal_conn_decref(conn); /* drop callback's ref */
@@ -2161,7 +2161,7 @@ kibnal_pathreq_callback (tTS_IB_CLIENT_QUERY_TID tid, int status,
 
         kibnal_init_msg(msg, IBNAL_MSG_CONNREQ, sizeof(msg->ibm_u.connparams));
         msg->ibm_u.connparams.ibcp_queue_depth = IBNAL_MSG_QUEUE_SIZE;
-        kibnal_pack_msg(msg, conn->ibc_version, 0, 
+        kibnal_pack_msg(msg, conn->ibc_version, 0,
                         peer->ibp_nid, conn->ibc_incarnation);
 
         conn->ibc_connreq->cr_connparam = (struct ib_cm_active_param) {
index 109e236..f93a3cb 100644 (file)
@@ -535,7 +535,7 @@ kqswnal_txhandler(EP_TXD *txd, void *arg, int status)
 
         if (status != EP_SUCCESS) {
 
-                CDEBUG (D_NETERROR, "Tx completion to %s failed: %d\n", 
+                CNETERR("Tx completion to %s failed: %d\n",
                         libcfs_nid2str(ktx->ktx_nid), status);
 
                 status = -EHOSTDOWN;
@@ -674,7 +674,8 @@ kqswnal_launch (kqswnal_tx_t *ktx)
                 return (0);
 
         default: /* fatal error */
-                CDEBUG (D_NETERROR, "Tx to %s failed: %d\n", libcfs_nid2str(ktx->ktx_nid), rc);
+                CNETERR("Tx to %s failed: %d\n", libcfs_nid2str(ktx->ktx_nid),
+                        rc);
                 kqswnal_notify_peer_down(ktx);
                 return (-EHOSTUNREACH);
         }
@@ -1245,23 +1246,23 @@ kqswnal_send (lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg)
 #endif
                 nob += payload_nob;
         }
-        
+
         ktx->ktx_port = (nob <= KQSW_SMALLMSG) ?
                         EP_MSG_SVC_PORTALS_SMALL : EP_MSG_SVC_PORTALS_LARGE;
 
         rc = kqswnal_launch (ktx);
 
  out:
-        CDEBUG(rc == 0 ? D_NET : D_NETERROR, "%s %d bytes to %s%s: rc %d\n",
-               routing ? (rc == 0 ? "Routed" : "Failed to route") :
-                         (rc == 0 ? "Sent" : "Failed to send"),
-               nob, libcfs_nid2str(target.nid),
-               target_is_router ? "(router)" : "", rc);
+        CDEBUG_LIMIT(rc == 0? D_NET :D_NETERROR, "%s %d bytes to %s%s: rc %d\n",
+                     routing ? (rc == 0 ? "Routed" : "Failed to route") :
+                               (rc == 0 ? "Sent" : "Failed to send"),
+                     nob, libcfs_nid2str(target.nid),
+                     target_is_router ? "(router)" : "", rc);
 
         if (rc != 0) {
                 lnet_msg_t *repmsg = (lnet_msg_t *)ktx->ktx_args[2];
                 int         state = ktx->ktx_state;
-                
+
                 kqswnal_put_idle_tx (ktx);
 
                 if (state == KTX_GETTING && repmsg != NULL) {
index 022432c..57983dd 100644 (file)
@@ -411,9 +411,9 @@ kranal_close_conn_locked (kra_conn_t *conn, int error)
 {
         kra_peer_t        *peer = conn->rac_peer;
 
-        CDEBUG(error == 0 ? D_NET : D_NETERROR,
-               "closing conn to %s: error %d\n", 
-               libcfs_nid2str(peer->rap_nid), error);
+        CDEBUG_LIMIT(error == 0 ? D_NET : D_NETERROR,
+                     "closing conn to %s: error %d\n",
+                     libcfs_nid2str(peer->rap_nid), error);
 
         LASSERT (!in_interrupt());
         LASSERT (conn->rac_state == RANAL_CONN_ESTABLISHED);
@@ -874,8 +874,8 @@ kranal_connect (kra_peer_t *peer)
         if (list_empty(&zombies))
                 return;
 
-        CDEBUG(D_NETERROR, "Dropping packets for %s: connection failed\n",
-               libcfs_nid2str(peer->rap_nid));
+        CNETERR("Dropping packets for %s: connection failed\n",
+                libcfs_nid2str(peer->rap_nid));
 
         do {
                 tx = list_entry(zombies.next, kra_tx_t, tx_list);
index e718351..14b451f 100644 (file)
@@ -414,13 +414,13 @@ ksocknal_txlist_done (lnet_ni_t *ni, struct list_head *txlist, int error)
                 tx = list_entry (txlist->next, ksock_tx_t, tx_list);
 
                 if (error && tx->tx_lnetmsg != NULL) {
-                        CDEBUG (D_NETERROR, "Deleting packet type %d len %d %s->%s\n",
+                        CNETERR("Deleting packet type %d len %d %s->%s\n",
                                 le32_to_cpu (tx->tx_lnetmsg->msg_hdr.type),
                                 le32_to_cpu (tx->tx_lnetmsg->msg_hdr.payload_length),
                                 libcfs_nid2str(le64_to_cpu(tx->tx_lnetmsg->msg_hdr.src_nid)),
                                 libcfs_nid2str(le64_to_cpu(tx->tx_lnetmsg->msg_hdr.dest_nid)));
                 } else if (error) {
-                        CDEBUG (D_NETERROR, "Deleting noop packet\n");
+                        CNETERR("Deleting noop packet\n");
                 }
 
                 list_del (&tx->tx_list);
@@ -912,7 +912,7 @@ ksocknal_launch_packet (lnet_ni_t *ni, ksock_tx_t *tx, lnet_process_id_t id)
         cfs_write_unlock_bh (g_lock);
 
         /* NB Routes may be ignored if connections to them failed recently */
-        CDEBUG(D_NETERROR, "No usable routes to %s\n", libcfs_id2str(id));
+        CNETERR("No usable routes to %s\n", libcfs_id2str(id));
         return (-EHOSTUNREACH);
 }
 
@@ -2179,28 +2179,28 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer)
 
                         switch (error) {
                         case ECONNRESET:
-                                CDEBUG(D_NETERROR, "A connection with %s "
-                                       "(%u.%u.%u.%u:%d) was reset; "
-                                       "it may have rebooted.\n",
-                                       libcfs_id2str(peer->ksnp_id),
-                                       HIPQUAD(conn->ksnc_ipaddr),
-                                       conn->ksnc_port);
+                                CNETERR("A connection with %s "
+                                        "(%u.%u.%u.%u:%d) was reset; "
+                                        "it may have rebooted.\n",
+                                        libcfs_id2str(peer->ksnp_id),
+                                        HIPQUAD(conn->ksnc_ipaddr),
+                                        conn->ksnc_port);
                                 break;
                         case ETIMEDOUT:
-                                CDEBUG(D_NETERROR, "A connection with %s "
-                                       "(%u.%u.%u.%u:%d) timed out; the "
-                                       "network or node may be down.\n",
-                                       libcfs_id2str(peer->ksnp_id),
-                                       HIPQUAD(conn->ksnc_ipaddr),
-                                       conn->ksnc_port);
+                                CNETERR("A connection with %s "
+                                        "(%u.%u.%u.%u:%d) timed out; the "
+                                        "network or node may be down.\n",
+                                        libcfs_id2str(peer->ksnp_id),
+                                        HIPQUAD(conn->ksnc_ipaddr),
+                                        conn->ksnc_port);
                                 break;
                         default:
-                                CDEBUG(D_NETERROR, "An unexpected network error %d "
-                                       "occurred with %s "
-                                       "(%u.%u.%u.%u:%d\n", error,
-                                       libcfs_id2str(peer->ksnp_id),
-                                       HIPQUAD(conn->ksnc_ipaddr),
-                                       conn->ksnc_port);
+                                CNETERR("An unexpected network error %d "
+                                        "occurred with %s "
+                                        "(%u.%u.%u.%u:%d\n", error,
+                                        libcfs_id2str(peer->ksnp_id),
+                                        HIPQUAD(conn->ksnc_ipaddr),
+                                        conn->ksnc_port);
                                 break;
                         }
 
@@ -2212,14 +2212,14 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer)
                                      conn->ksnc_rx_deadline)) {
                         /* Timed out incomplete incoming message */
                         ksocknal_conn_addref(conn);
-                        CDEBUG(D_NETERROR, "Timeout receiving from %s "
-                               "(%u.%u.%u.%u:%d), state %d wanted %d left %d\n",
-                               libcfs_id2str(peer->ksnp_id),
-                               HIPQUAD(conn->ksnc_ipaddr),
-                               conn->ksnc_port,
-                               conn->ksnc_rx_state,
-                               conn->ksnc_rx_nob_wanted,
-                               conn->ksnc_rx_nob_left);
+                        CNETERR("Timeout receiving from %s (%u.%u.%u.%u:%d), "
+                                "state %d wanted %d left %d\n",
+                                libcfs_id2str(peer->ksnp_id),
+                                HIPQUAD(conn->ksnc_ipaddr),
+                                conn->ksnc_port,
+                                conn->ksnc_rx_state,
+                                conn->ksnc_rx_nob_wanted,
+                                conn->ksnc_rx_nob_left);
                         return (conn);
                 }
 
@@ -2230,12 +2230,11 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer)
                         /* Timed out messages queued for sending or
                          * buffered in the socket's send buffer */
                         ksocknal_conn_addref(conn);
-                        CDEBUG(D_NETERROR, "Timeout sending data to %s "
-                               "(%u.%u.%u.%u:%d) the network or that "
-                               "node may be down.\n",
-                               libcfs_id2str(peer->ksnp_id),
-                               HIPQUAD(conn->ksnc_ipaddr),
-                               conn->ksnc_port);
+                        CNETERR("Timeout sending data to %s (%u.%u.%u.%u:%d) "
+                                "the network or that node may be down.\n",
+                                libcfs_id2str(peer->ksnp_id),
+                                HIPQUAD(conn->ksnc_ipaddr),
+                                conn->ksnc_port);
                         return (conn);
                 }
         }
index 20bdc4d..edae09a 100644 (file)
@@ -489,10 +489,10 @@ ksocknal_send_hello_v1 (ksock_conn_t *conn, ksock_hello_msg_t *hello)
         hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype);
         hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation);
 
-        rc = libcfs_sock_write(sock, hdr, sizeof(*hdr), lnet_acceptor_timeout());
+        rc = libcfs_sock_write(sock, hdr, sizeof(*hdr),lnet_acceptor_timeout());
 
         if (rc != 0) {
-                CDEBUG (D_NETERROR, "Error %d sending HELLO hdr to %u.%u.%u.%u/%d\n",
+                CNETERR("Error %d sending HELLO hdr to %u.%u.%u.%u/%d\n",
                         rc, HIPQUAD(conn->ksnc_ipaddr), conn->ksnc_port);
                 goto out;
         }
@@ -508,7 +508,7 @@ ksocknal_send_hello_v1 (ksock_conn_t *conn, ksock_hello_msg_t *hello)
                                hello->kshm_nips * sizeof(__u32),
                                lnet_acceptor_timeout());
         if (rc != 0) {
-                CDEBUG (D_NETERROR, "Error %d sending HELLO payload (%d)"
+                CNETERR("Error %d sending HELLO payload (%d)"
                         " to %u.%u.%u.%u/%d\n", rc, hello->kshm_nips,
                         HIPQUAD(conn->ksnc_ipaddr), conn->ksnc_port);
         }
@@ -541,7 +541,7 @@ ksocknal_send_hello_v2 (ksock_conn_t *conn, ksock_hello_msg_t *hello)
                                lnet_acceptor_timeout());
 
         if (rc != 0) {
-                CDEBUG (D_NETERROR, "Error %d sending HELLO hdr to %u.%u.%u.%u/%d\n",
+                CNETERR("Error %d sending HELLO hdr to %u.%u.%u.%u/%d\n",
                         rc, HIPQUAD(conn->ksnc_ipaddr), conn->ksnc_port);
                 return rc;
         }
@@ -553,7 +553,7 @@ ksocknal_send_hello_v2 (ksock_conn_t *conn, ksock_hello_msg_t *hello)
                                hello->kshm_nips * sizeof(__u32),
                                lnet_acceptor_timeout());
         if (rc != 0) {
-                CDEBUG (D_NETERROR, "Error %d sending HELLO payload (%d)"
+                CNETERR("Error %d sending HELLO payload (%d)"
                         " to %u.%u.%u.%u/%d\n", rc, hello->kshm_nips,
                         HIPQUAD(conn->ksnc_ipaddr), conn->ksnc_port);
         }
index 3fc6376..045ab74 100644 (file)
@@ -1112,7 +1112,7 @@ kibnal_tx_complete (kib_tx_t *tx, vv_comp_status_t vvrc)
         int           failed = (vvrc != vv_comp_status_success);
         int           idle;
 
-        CDEBUG(D_NET, "tx %p conn %p sending %d nwrq %d vvrc %d\n", 
+        CDEBUG(D_NET, "tx %p conn %p sending %d nwrq %d vvrc %d\n",
                tx, conn, tx->tx_sending, tx->tx_nwrq, vvrc);
 
         LASSERT (tx->tx_sending > 0);
@@ -1120,8 +1120,8 @@ kibnal_tx_complete (kib_tx_t *tx, vv_comp_status_t vvrc)
         if (failed &&
             tx->tx_status == 0 &&
             conn->ibc_state == IBNAL_CONN_ESTABLISHED)
-                CDEBUG(D_NETERROR, "tx -> %s type %x cookie "LPX64
-                       "sending %d waiting %d: failed %d\n", 
+                CNETERR("tx -> %s type %x cookie "LPX64
+                       "sending %d waiting %d: failed %d\n",
                        libcfs_nid2str(conn->ibc_peer->ibp_nid),
                        tx->tx_msg->ibm_type, tx->tx_cookie,
                        tx->tx_sending, tx->tx_waiting, vvrc);
@@ -1928,14 +1928,16 @@ kibnal_close_conn_locked (kib_conn_t *conn, int error)
                        libcfs_nid2str(peer->ibp_nid),
                        conn->ibc_txseq, conn->ibc_rxseq);
         } else {
-                CDEBUG(D_NETERROR, "Closing conn to %s: error %d%s%s%s%s"
-                       " rx# "LPD64" tx# "LPD64"\n",
-                       libcfs_nid2str(peer->ibp_nid), error,
-                       list_empty(&conn->ibc_tx_queue) ? "" : "(sending)",
-                       list_empty(&conn->ibc_tx_queue_rsrvd) ? "" : "(sending_rsrvd)",
-                       list_empty(&conn->ibc_tx_queue_nocred) ? "" : "(sending_nocred)",
-                       list_empty(&conn->ibc_active_txs) ? "" : "(waiting)",
-                       conn->ibc_txseq, conn->ibc_rxseq);
+                CNETERR("Closing conn to %s: error %d%s%s%s%s"
+                        " rx# "LPD64" tx# "LPD64"\n",
+                        libcfs_nid2str(peer->ibp_nid), error,
+                        list_empty(&conn->ibc_tx_queue) ? "" : "(sending)",
+                        list_empty(&conn->ibc_tx_queue_rsrvd) ?
+                                "" : "(sending_rsrvd)",
+                        list_empty(&conn->ibc_tx_queue_nocred) ?
+                                "" : "(sending_nocred)",
+                        list_empty(&conn->ibc_active_txs) ? "" : "(waiting)",
+                        conn->ibc_txseq, conn->ibc_rxseq);
         }
 
         list_del (&conn->ibc_list);
@@ -2115,7 +2117,7 @@ kibnal_peer_connect_failed (kib_peer_t *peer, int active, int error)
         if (list_empty (&zombies))
                 return;
 
-        CDEBUG (D_NETERROR, "Deleting messages for %s: connection failed\n",
+        CNETERR("Deleting messages for %s: connection failed\n",
                 libcfs_nid2str(peer->ibp_nid));
 
         kibnal_txlist_done(&zombies, -EHOSTUNREACH);
@@ -3007,17 +3009,17 @@ kibnal_check_connreply (kib_conn_t *conn)
                         kibnal_reconnect(conn, -ESTALE);
                         return;
                 } else {
-                        CDEBUG(D_NETERROR, "conn -> %s rejected: reason %d\n",
-                               libcfs_nid2str(peer->ibp_nid),
-                               cv->cv_conndata.data.reject.reason);
+                        CNETERR("conn -> %s rejected: reason %d\n",
+                                libcfs_nid2str(peer->ibp_nid),
+                                cv->cv_conndata.data.reject.reason);
                         kibnal_connreq_done(conn, 1, -ECONNREFUSED);
                         return;
                 }
                 /* NOT REACHED */
         }
 
-        CDEBUG(D_NETERROR, "conn -> %s failed: %d\n",
-               libcfs_nid2str(peer->ibp_nid), cv->cv_conndata.status);
+        CNETERR("conn -> %s failed: %d\n",
+                libcfs_nid2str(peer->ibp_nid), cv->cv_conndata.status);
         kibnal_connreq_done(conn, 1, -ECONNABORTED);
 }
 
@@ -3038,9 +3040,9 @@ kibnal_arp_done (kib_conn_t *conn)
         LASSERT (peer->ibp_arp_count > 0);
 
         if (cv->cv_arprc != ibat_stat_ok) {
-                CDEBUG(D_NETERROR, "Arp %s @ %u.%u.%u.%u failed: %d\n",
-                       libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip),
-                       cv->cv_arprc);
+                CNETERR("Arp %s @ %u.%u.%u.%u failed: %d\n",
+                        libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip),
+                        cv->cv_arprc);
                 goto failed;
         }
 
@@ -3137,17 +3139,17 @@ kibnal_arp_done (kib_conn_t *conn)
                 /* final ARP attempt failed */
                 write_unlock_irqrestore(&kibnal_data.kib_global_lock,
                                         flags);
-                CDEBUG(D_NETERROR, "Arp %s @ %u.%u.%u.%u failed (final attempt)\n",
-                       libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip));
+                CNETERR("Arp %s @ %u.%u.%u.%u failed (final attempt)\n",
+                        libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip));
         } else {
                 /* Retry ARP: ibp_connecting++ so terminating conn
                  * doesn't end peer's connection attempt */
                 peer->ibp_connecting++;
                 write_unlock_irqrestore(&kibnal_data.kib_global_lock,
                                         flags);
-                CDEBUG(D_NETERROR, "Arp %s @ %u.%u.%u.%u failed (%d attempts left)\n",
-                       libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip),
-                       peer->ibp_arp_count);
+                CNETERR("Arp %s @ %u.%u.%u.%u failed (%d attempts left)\n",
+                        libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip),
+                        peer->ibp_arp_count);
 
                 kibnal_schedule_peer_arp(peer);
         }
@@ -3167,8 +3169,9 @@ kibnal_arp_callback (ibat_stat_t arprc, ibat_arp_data_t *arp_data, void *arg)
         peer = conn->ibc_peer;
 
         if (arprc != ibat_stat_ok)
-                CDEBUG(D_NETERROR, "Arp %s at %u.%u.%u.%u failed: %d\n",
-                       libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip), arprc);
+                CNETERR("Arp %s at %u.%u.%u.%u failed: %d\n",
+                        libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip),
+                        arprc);
         else
                 CDEBUG(D_NET, "Arp %s at %u.%u.%u.%u OK: LID %s PATH %s\n",
                        libcfs_nid2str(peer->ibp_nid), HIPQUAD(peer->ibp_ip),
@@ -3665,8 +3668,8 @@ kibnal_scheduler(void *arg)
                                  * I give a scheduler on another CPU a chance
                                  * to get the final SEND completion, so the tx
                                  * descriptor can get freed as I inspect it. */
-                                CDEBUG(D_NETERROR, "RDMA failed: %d\n",
-                                       wc.completion_status);
+                                CNETERR("RDMA failed: %d\n",
+                                        wc.completion_status);
                                 break;
 
                         default:
index f69d5bf..abf9724 100644 (file)
@@ -700,9 +700,10 @@ libcfs_sock_connect (cfs_socket_t **sockp, int *fatal,
         }
 
         *fatal = !(rc == -EADDRNOTAVAIL || rc == -EADDRINUSE);
-        CDEBUG(*fatal ? D_NETERROR : D_NET,
-               "Error %d connecting %u.%u.%u.%u/%d -> %u.%u.%u.%u/%d\n", rc,
-               HIPQUAD(local_ip), local_port, HIPQUAD(peer_ip), peer_port);
+        CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET,
+                     "Error %d connecting %u.%u.%u.%u/%d -> %u.%u.%u.%u/%d\n",
+                     rc, HIPQUAD(local_ip), local_port, HIPQUAD(peer_ip),
+                     peer_port);
 
         libcfs_sock_release(sock);
         return rc;
@@ -1312,9 +1313,9 @@ libcfs_sock_connect (struct socket **sockp, int *fatal,
         if (rc != 0) {
                 CFS_NET_EX;
                 if (rc != EADDRNOTAVAIL && rc != EADDRINUSE)
-                        CDEBUG(D_NETERROR,
-                               "Error %d connecting %u.%u.%u.%u/%d -> %u.%u.%u.%u/%d\n", rc,
-                               HIPQUAD(local_ip), local_port, HIPQUAD(peer_ip), peer_port);
+                        CNETERR("Error %d connecting %u.%u.%u.%u/%d -> "
+                                "%u.%u.%u.%u/%d\n", rc, HIPQUAD(local_ip),
+                                local_port, HIPQUAD(peer_ip), peer_port);
                 goto out;
         }
         s = splnet();
@@ -1326,9 +1327,9 @@ libcfs_sock_connect (struct socket **sockp, int *fatal,
                 so->so_error = 0;
                 splx(s);
                 CFS_NET_EX;
-                CDEBUG(D_NETERROR,
-                       "Error %d connecting %u.%u.%u.%u/%d -> %u.%u.%u.%u/%d\n", rc,
-                       HIPQUAD(local_ip), local_port, HIPQUAD(peer_ip), peer_port);
+                CNETERR("Error %d connecting %u.%u.%u.%u/%d -> "
+                        "%u.%u.%u.%u/%d\n", rc, HIPQUAD(local_ip),
+                        local_port, HIPQUAD(peer_ip), peer_port);
                 goto out;
         }
         LASSERT(so->so_state & SS_ISCONNECTED);
index 87d5214..fa69117 100644 (file)
@@ -683,9 +683,10 @@ libcfs_sock_connect (struct socket **sockp, int *fatal,
          * port... */
         *fatal = !(rc == -EADDRNOTAVAIL);
 
-        CDEBUG(*fatal ? D_NETERROR : D_NET,
-               "Error %d connecting %u.%u.%u.%u/%d -> %u.%u.%u.%u/%d\n", rc,
-               HIPQUAD(local_ip), local_port, HIPQUAD(peer_ip), peer_port);
+        CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET,
+                     "Error %d connecting %u.%u.%u.%u/%d -> %u.%u.%u.%u/%d\n",
+                     rc, HIPQUAD(local_ip), local_port, HIPQUAD(peer_ip),
+                     peer_port);
 
         sock_release(*sockp);
         return rc;
index 833c8fb..efc4e12 100644 (file)
@@ -81,25 +81,24 @@ lnet_connect_console_error (int rc, lnet_nid_t peer_nid,
         switch (rc) {
         /* "normal" errors */
         case -ECONNREFUSED:
-                CDEBUG(D_NETERROR, "Connection to %s at host %u.%u.%u.%u "
-                       "on port %d was refused: "
-                       "check that Lustre is running on that node.\n",
-                       libcfs_nid2str(peer_nid),
-                       HIPQUAD(peer_ip), peer_port);
+                CNETERR("Connection to %s at host %u.%u.%u.%u on port %d was "
+                        "refused: check that Lustre is running on that node.\n",
+                        libcfs_nid2str(peer_nid),
+                        HIPQUAD(peer_ip), peer_port);
                 break;
         case -EHOSTUNREACH:
         case -ENETUNREACH:
-                CDEBUG(D_NETERROR, "Connection to %s at host %u.%u.%u.%u "
-                       "was unreachable: the network or that node may "
-                       "be down, or Lustre may be misconfigured.\n",
-                       libcfs_nid2str(peer_nid), HIPQUAD(peer_ip));
+                CNETERR("Connection to %s at host %u.%u.%u.%u "
+                        "was unreachable: the network or that node may "
+                        "be down, or Lustre may be misconfigured.\n",
+                        libcfs_nid2str(peer_nid), HIPQUAD(peer_ip));
                 break;
         case -ETIMEDOUT:
-                CDEBUG(D_NETERROR, "Connection to %s at host %u.%u.%u.%u on "
-                       "port %d took too long: that node may be hung "
-                       "or experiencing high load.\n",
-                       libcfs_nid2str(peer_nid),
-                       HIPQUAD(peer_ip), peer_port);
+                CNETERR("Connection to %s at host %u.%u.%u.%u on "
+                        "port %d took too long: that node may be hung "
+                        "or experiencing high load.\n",
+                        libcfs_nid2str(peer_nid),
+                        HIPQUAD(peer_ip), peer_port);
                 break;
         case -ECONNRESET:
                 LCONSOLE_ERROR_MSG(0x11b, "Connection to %s at host %u.%u.%u.%u"
index 8646e3f..43482fa 100644 (file)
@@ -1023,8 +1023,8 @@ lnet_post_send_locked (lnet_msg_t *msg, int do_send)
             lnet_peer_alive_locked(lp) == 0) {
                 LNET_UNLOCK();
 
-                CDEBUG(D_NETERROR, "Dropping message for %s: peer not alive\n",
-                       libcfs_id2str(msg->msg_target));
+                CNETERR("Dropping message for %s: peer not alive\n",
+                        libcfs_id2str(msg->msg_target));
                 if (do_send)
                         lnet_finalize(ni, msg, -EHOSTUNREACH);
 
@@ -1806,12 +1806,11 @@ lnet_parse_put(lnet_ni_t *ni, lnet_msg_t *msg)
                 /* fall through */
 
         case LNET_MATCHMD_DROP:
-                CDEBUG(D_NETERROR,
-                       "Dropping PUT from %s portal %d match "LPU64
-                       " offset %d length %d: %d\n",
-                       libcfs_id2str(src), index,
-                       hdr->msg.put.match_bits,
-                       hdr->msg.put.offset, rlength, rc);
+                CNETERR("Dropping PUT from %s portal %d match "LPU64
+                        " offset %d length %d: %d\n",
+                        libcfs_id2str(src), index,
+                        hdr->msg.put.match_bits,
+                        hdr->msg.put.offset, rlength, rc);
                 LNET_UNLOCK();
 
                 return ENOENT;          /* +ve: OK but no match */
@@ -1843,14 +1842,13 @@ lnet_parse_get(lnet_ni_t *ni, lnet_msg_t *msg, int rdma_get)
                            hdr->msg.get.match_bits, msg,
                            &mlength, &offset, &md);
         if (rc == LNET_MATCHMD_DROP) {
-                CDEBUG(D_NETERROR,
-                       "Dropping GET from %s portal %d match "LPU64
-                       " offset %d length %d\n",
-                       libcfs_id2str(src),
-                       hdr->msg.get.ptl_index,
-                       hdr->msg.get.match_bits,
-                       hdr->msg.get.src_offset,
-                       hdr->msg.get.sink_length);
+                CNETERR("Dropping GET from %s portal %d match "LPU64
+                        " offset %d length %d\n",
+                        libcfs_id2str(src),
+                        hdr->msg.get.ptl_index,
+                        hdr->msg.get.match_bits,
+                        hdr->msg.get.src_offset,
+                        hdr->msg.get.sink_length);
                 LNET_UNLOCK();
                 return ENOENT;                  /* +ve: OK but no match */
         }
@@ -1911,12 +1909,12 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
         /* NB handles only looked up by creator (no flips) */
         md = lnet_wire_handle2md(&hdr->msg.reply.dst_wmd);
         if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) {
-                CDEBUG(D_NETERROR, "%s: Dropping REPLY from %s for %s "
-                       "MD "LPX64"."LPX64"\n", 
-                       libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
-                       (md == NULL) ? "invalid" : "inactive",
-                       hdr->msg.reply.dst_wmd.wh_interface_cookie,
-                       hdr->msg.reply.dst_wmd.wh_object_cookie);
+                CNETERR("%s: Dropping REPLY from %s for %s "
+                        "MD "LPX64"."LPX64"\n",
+                        libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
+                        (md == NULL) ? "invalid" : "inactive",
+                        hdr->msg.reply.dst_wmd.wh_interface_cookie,
+                        hdr->msg.reply.dst_wmd.wh_object_cookie);
                 if (md != NULL && md->md_me != NULL)
                         CERROR("REPLY MD also attached to portal %d\n",
                                md->md_me->me_portal);
@@ -1932,9 +1930,9 @@ lnet_parse_reply(lnet_ni_t *ni, lnet_msg_t *msg)
 
         if (mlength < rlength &&
             (md->md_options & LNET_MD_TRUNCATE) == 0) {
-                CDEBUG(D_NETERROR, "%s: Dropping REPLY from %s length %d "
-                       "for MD "LPX64" would overflow (%d)\n",
-                       libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
+                CNETERR("%s: Dropping REPLY from %s length %d "
+                        "for MD "LPX64" would overflow (%d)\n",
+                        libcfs_nid2str(ni->ni_nid), libcfs_id2str(src),
                         rlength, hdr->msg.reply.dst_wmd.wh_object_cookie,
                         mlength);
                 LNET_UNLOCK();
index bdb58cb..05c2027 100644 (file)
@@ -546,8 +546,8 @@ lnet_router_down_ni(lnet_peer_t *rtr, __u32 net)
         if (info->pi_magic == __swab32(LNET_PROTO_PING_MAGIC)) {
                 lnet_swap_pinginfo(info);
         } else if (info->pi_magic != LNET_PROTO_PING_MAGIC) {
-                CDEBUG(D_NETERROR, "%s: Unexpected magic %08x\n",
-                       libcfs_nid2str(rtr->lp_nid), info->pi_magic);
+                CNETERR("%s: Unexpected magic %08x\n",
+                        libcfs_nid2str(rtr->lp_nid), info->pi_magic);
                 return -EPROTO;
         }
 
@@ -555,8 +555,8 @@ lnet_router_down_ni(lnet_peer_t *rtr, __u32 net)
                 return -ENOENT;  /* v1 doesn't carry NI status info */
 
         if (info->pi_version != LNET_PROTO_PING_VERSION) {
-                CDEBUG(D_NETERROR, "%s: Unexpected version 0x%x\n",
-                       libcfs_nid2str(rtr->lp_nid), info->pi_version);
+                CNETERR("%s: Unexpected version 0x%x\n",
+                        libcfs_nid2str(rtr->lp_nid), info->pi_version);
                 return -EPROTO;
         }
 
@@ -565,8 +565,8 @@ lnet_router_down_ni(lnet_peer_t *rtr, __u32 net)
                 lnet_nid_t        nid = stat->ns_nid;
 
                 if (nid == LNET_NID_ANY) {
-                        CDEBUG(D_NETERROR, "%s: unexpected LNET_NID_ANY\n",
-                               libcfs_nid2str(rtr->lp_nid));
+                        CNETERR("%s: unexpected LNET_NID_ANY\n",
+                                libcfs_nid2str(rtr->lp_nid));
                         return -EPROTO;
                 }
 
@@ -582,8 +582,8 @@ lnet_router_down_ni(lnet_peer_t *rtr, __u32 net)
                 }
 
                 if (stat->ns_status != LNET_NI_STATUS_UP) {
-                        CDEBUG(D_NETERROR, "%s: Unexpected status 0x%x\n",
-                               libcfs_nid2str(rtr->lp_nid), stat->ns_status);
+                        CNETERR("%s: Unexpected status 0x%x\n",
+                                libcfs_nid2str(rtr->lp_nid), stat->ns_status);
                         return -EPROTO;
                 }
 
@@ -1499,9 +1499,9 @@ lnet_router_checker (void)
         if (last != 0 &&
             interval > MAX(live_router_check_interval,
                            dead_router_check_interval))
-                CDEBUG(D_NETERROR, "Checker(%d/%d) not called for %d seconds\n",
-                       live_router_check_interval, dead_router_check_interval,
-                       interval);
+                CNETERR("Checker(%d/%d) not called for %d seconds\n",
+                        live_router_check_interval, dead_router_check_interval,
+                        interval);
 
         LNET_LOCK();
         LASSERT (!running); /* recursion check */
index 0c24de4..70d9112 100644 (file)
@@ -513,8 +513,7 @@ srpc_finish_service (srpc_service_t *sv)
                 if (!list_empty(&sv->sv_active_rpcq)) {
                         rpc = list_entry(sv->sv_active_rpcq.next,
                                          srpc_server_rpc_t, srpc_list);
-                        CDEBUG (D_NETERROR,
-                                "Active RPC %p on shutdown: sv %s, peer %s, "
+                        CNETERR("Active RPC %p on shutdown: sv %s, peer %s, "
                                 "wi %s scheduled %d running %d, "
                                 "ev fired %d type %d status %d lnet %d\n",
                                 rpc, sv->sv_name, libcfs_id2str(rpc->srpc_peer),
@@ -764,10 +763,10 @@ srpc_server_rpc_done (srpc_server_rpc_t *rpc, int status)
 
         rpc->srpc_status = status;
 
-        CDEBUG (status == 0 ? D_NET : D_NETERROR,
-                "Server RPC %p done: service %s, peer %s, status %s:%d\n",
-                rpc, sv->sv_name, libcfs_id2str(rpc->srpc_peer),
-                swi_state2str(rpc->srpc_wi.wi_state), status);
+        CDEBUG_LIMIT(status == 0 ? D_NET : D_NETERROR,
+                     "Server RPC %p done: service %s, peer %s, status %s:%d\n",
+                     rpc, sv->sv_name, libcfs_id2str(rpc->srpc_peer),
+                     swi_state2str(rpc->srpc_wi.wi_state), status);
 
         if (status != 0) {
                 spin_lock(&srpc_data.rpc_glock);
@@ -1006,10 +1005,10 @@ srpc_client_rpc_done (srpc_client_rpc_t *rpc, int status)
 
         srpc_del_client_rpc_timer(rpc);
 
-        CDEBUG ((status == 0) ? D_NET : D_NETERROR,
-                "Client RPC done: service %d, peer %s, status %s:%d:%d\n",
-                rpc->crpc_service, libcfs_id2str(rpc->crpc_dest),
-                swi_state2str(wi->wi_state), rpc->crpc_aborted, status);
+        CDEBUG_LIMIT((status == 0) ? D_NET : D_NETERROR,
+                     "Client RPC done: service %d, peer %s, status %s:%d:%d\n",
+                     rpc->crpc_service, libcfs_id2str(rpc->crpc_dest),
+                     swi_state2str(wi->wi_state), rpc->crpc_aborted, status);
 
         /*
          * No one can schedule me now since:
index 20269b6..4feb1d8 100644 (file)
@@ -437,9 +437,8 @@ static int mds_create_objects(struct ptlrpc_request *req, int offset,
                         int level = D_ERROR;
                         if (rc == -ENOSPC)
                                 level = D_INODE;
-                        CDEBUG(level, "error creating objects for "
-                                      "inode %lu: rc = %d\n",
-                               inode->i_ino, rc);
+                        CDEBUG_LIMIT(level, "error creating objects for "
+                                     "inode %lu: rc = %d\n", inode->i_ino, rc);
                         if (rc > 0) {
                                 CERROR("obd_create returned invalid "
                                        "rc %d\n", rc);