rx-packet-count-debugging-20090104
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 5 Jan 2009 00:00:08 +0000 (00:00 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 5 Jan 2009 00:00:08 +0000 (00:00 +0000)
LICENSE MIT

change C preprocessor symbol required for packet count debugging
to RXDEBUG_PACKET

src/rx/rx.c
src/rx/rx.h
src/rx/rx_packet.c
src/rx/rx_packet.h
src/rx/rx_rdwr.c

index 6f42483..d61d45a 100644 (file)
@@ -2067,9 +2067,9 @@ rx_EndCall(register struct rx_call *call, afs_int32 rc)
     call->nLeft = call->nFree = call->curlen = 0;
 
     /* Free any packets from the last call to ReadvProc/WritevProc */
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
     call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
         rxi_FreePackets(0, &call->iovq);
 
     CALL_RELE(call, RX_CALL_REFCOUNT_BEGIN);
@@ -2249,11 +2249,11 @@ rxi_NewCall(register struct rx_connection *conn, register int channel)
     } else {
 
        call = (struct rx_call *)rxi_Alloc(sizeof(struct rx_call));
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->allNextp = rx_allCallsp;
         rx_allCallsp = call;
         call->call_id = 
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rx_MutexIncrement(rx_stats.nCallStructs, rx_stats_mutex);
         
         MUTEX_EXIT(&rx_freeCallQueue_lock);
@@ -2267,9 +2267,9 @@ rxi_NewCall(register struct rx_connection *conn, register int channel)
        queue_Init(&call->tq);
        queue_Init(&call->rq);
        queue_Init(&call->iovq);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->rqc = call->tqc = call->iovqc = 0;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
        /* Bind the call to its connection structure (prereq for reset) */
        call->conn = conn;
        rxi_ResetCall(call, 1);
@@ -3317,9 +3317,9 @@ rxi_ReceiveDataPacket(register struct rx_call *call,
             * the reader once all packets have been processed */
            np->flags |= RX_PKTFLAG_RQ;
            queue_Prepend(&call->rq, np);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
             call->rqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
            call->nSoftAcks++;
            np = NULL;          /* We can't use this anymore */
            newPackets = 1;
@@ -3449,9 +3449,9 @@ rxi_ReceiveDataPacket(register struct rx_call *call,
             * queue head if the queue is empty or the packet should be
             * appended. */
             np->flags |= RX_PKTFLAG_RQ;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
             call->rqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
            queue_InsertBefore(tp, np);
            call->nSoftAcks++;
            np = NULL;
@@ -3770,9 +3770,9 @@ rxi_ReceiveAckPacket(register struct rx_call *call, struct rx_packet *np,
        {
            queue_Remove(tp);
            tp->flags &= ~RX_PKTFLAG_TQ;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
             call->tqc--;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
            rxi_FreePacket(tp); /* rxi_FreePacket mustn't wake up anyone, preemptively. */
        }
     }
@@ -4384,9 +4384,9 @@ rxi_ClearTransmitQueue(register struct rx_call *call, register int force)
        }
     } else {
 #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->tqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->tq);
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
        call->flags &= ~RX_CALL_TQ_CLEARME;
@@ -4416,7 +4416,7 @@ rxi_ClearReceiveQueue(register struct rx_call *call)
         
         count = rxi_FreePackets(0, &call->rq);
        rx_packetReclaims += count;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->rqc -= count;
         if ( call->rqc != 0 ) 
             dpf(("rxi_ClearReceiveQueue call %x rqc %u != 0", call, call->rqc));
@@ -4680,14 +4680,14 @@ rxi_ResetCall(register struct rx_call *call, register int newcall)
         call->currentPacket->flags &= ~RX_PKTFLAG_CP;
         call->currentPacket->flags |= RX_PKTFLAG_IOVQ;
         queue_Prepend(&call->iovq, call->currentPacket);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
         call->currentPacket = (struct rx_packet *)0;
     }
     call->curlen = call->nLeft = call->nFree = 0;
 
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
     call->iovqc -= 
 #endif
         rxi_FreePackets(0, &call->iovq);
@@ -5459,7 +5459,7 @@ rxi_Start(struct rxevent *event,
                            && (p->flags & RX_PKTFLAG_ACKED)) {
                            queue_Remove(p);
                            p->flags &= ~RX_PKTFLAG_TQ;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                             call->tqc--;
 #endif
                            rxi_FreePacket(p);
@@ -8016,7 +8016,7 @@ DllMain(HINSTANCE dllInstHandle,  /* instance handle for this DLL module */
 #ifdef AFS_NT40_ENV
 int rx_DumpCalls(FILE *outputFile, char *cookie)
 {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
     int zilch;
 #ifdef KDUMP_RX_LOCK
     struct rx_call_rx_lock *c;
@@ -8069,7 +8069,7 @@ int rx_DumpCalls(FILE *outputFile, char *cookie)
     }
     sprintf(output, "%s - End dumping all Rx Calls\r\n", cookie);
     WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
     return 0;
 }
 #endif /* AFS_NT40_ENV */
index 95c4089..2a3dd09 100644 (file)
@@ -596,7 +596,7 @@ struct rx_call {
     afs_hyper_t bytesRcvd;     /* Number bytes received */
     u_short tqWaiters;
 
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
     u_short tqc;                /* packet count in tq */
     u_short rqc;                /* packet count in rq */
     u_short iovqc;              /* packet count in iovq */
index aabd633..eef2904 100644 (file)
@@ -96,7 +96,7 @@ RCSID
 static int rxdb_fileID = RXDB_FILE_RX_PACKET;
 #endif /* RX_LOCKS_DB */
 static struct rx_packet *rx_mallocedP = 0;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
 static afs_uint32       rx_packet_id = 0;
 #endif
 
@@ -562,10 +562,10 @@ rxi_MorePackets(int apackets)
 
         NETPRI;
         MUTEX_ENTER(&rx_freePktQ_lock);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         p->packetId = rx_packet_id++;
         p->allNextp = rx_mallocedP;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
         rx_mallocedP = p;
         MUTEX_EXIT(&rx_freePktQ_lock);
         USERPRI;
@@ -607,10 +607,10 @@ rxi_MorePackets(int apackets)
        p->niovecs = 2;
 
        queue_Append(&rx_freePacketQueue, p);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         p->packetId = rx_packet_id++;
         p->allNextp = rx_mallocedP;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
        rx_mallocedP = p;
     }
 
@@ -653,10 +653,10 @@ rxi_MorePacketsTSFPQ(int apackets, int flush_global, int num_keep_local)
        
         NETPRI;
         MUTEX_ENTER(&rx_freePktQ_lock);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         p->packetId = rx_packet_id++;
         p->allNextp = rx_mallocedP;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
         rx_mallocedP = p;
         MUTEX_EXIT(&rx_freePktQ_lock);
         USERPRI;
@@ -714,10 +714,10 @@ rxi_MorePacketsNoLock(int apackets)
        p->niovecs = 2;
 
        queue_Append(&rx_freePacketQueue, p);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         p->packetId = rx_packet_id++;
         p->allNextp = rx_mallocedP;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
        rx_mallocedP = p;
     }
 
@@ -2747,7 +2747,7 @@ rxi_AdjustDgramPackets(int frags, int mtu)
  */
 int rx_DumpPackets(FILE *outputFile, char *cookie)
 {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
     int zilch;
     struct rx_packet *p;
     char output[2048];
@@ -2772,7 +2772,7 @@ int rx_DumpPackets(FILE *outputFile, char *cookie)
 
     MUTEX_EXIT(&rx_freePktQ_lock);
     USERPRI;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
     return 0;
 }
 #endif /* AFS_NT40_ENV */
index 8e539a4..1bee7ee 100644 (file)
@@ -271,7 +271,7 @@ struct rx_packet {
     afs_uint32 wirehead[RX_HEADER_SIZE / sizeof(afs_int32)];
     afs_uint32 localdata[RX_CBUFFERSIZE / sizeof(afs_int32)];
     afs_uint32 extradata[RX_EXTRABUFFERSIZE / sizeof(afs_int32)];
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
     /* For debugging */
     struct rx_packet *allNextp; /* A list of all packets */
     afs_uint32  packetId;       /* An unique id number for debugging */
index 5758def..f346618 100644 (file)
@@ -116,9 +116,9 @@ rxi_ReadProc(register struct rx_call *call, register char *buf,
 
     /* Free any packets from the last call to ReadvProc/WritevProc */
     if (queue_IsNotEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -143,9 +143,9 @@ rxi_ReadProc(register struct rx_call *call, register char *buf,
                        register struct rx_connection *conn = call->conn;
                        queue_Remove(rp);
                        rp->flags &= ~RX_PKTFLAG_RQ;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                         call->rqc--;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
 
                        /* RXS_CheckPacket called to undo RXS_PreparePacket's
                         * work.  It may reduce the length of the packet by up
@@ -319,9 +319,9 @@ rx_ReadProc(struct rx_call *call, char *buf, int nbytes)
      * ReadvProc/WritevProc.
      */
     if (!queue_IsEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -379,9 +379,9 @@ rx_ReadProc32(struct rx_call *call, afs_int32 * value)
      * ReadvProc/WritevProc.
      */
     if (!queue_IsEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -455,9 +455,9 @@ rxi_FillReadVec(struct rx_call *call, afs_uint32 serial)
                    register struct rx_connection *conn = call->conn;
                    queue_Remove(rp);
                    rp->flags &= ~RX_PKTFLAG_RQ;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                     call->rqc--;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
 
                    /* RXS_CheckPacket called to undo RXS_PreparePacket's
                     * work.  It may reduce the length of the packet by up
@@ -539,9 +539,9 @@ rxi_FillReadVec(struct rx_call *call, afs_uint32 serial)
                 curp->flags &= ~RX_PKTFLAG_CP;
                 curp->flags |= RX_PKTFLAG_IOVQ;
                queue_Append(&call->iovq, curp);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                 call->iovqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
                curp = call->currentPacket = (struct rx_packet *)0;
            } else if (!call->curlen) {
                /* need to get another struct iov */
@@ -551,9 +551,9 @@ rxi_FillReadVec(struct rx_call *call, afs_uint32 serial)
                    curp->flags &= ~RX_PKTFLAG_CP;
                    curp->flags |= RX_PKTFLAG_IOVQ;
                    queue_Append(&call->iovq, curp);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                     call->iovqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
                    curp = call->currentPacket = (struct rx_packet *)0;
                    call->nLeft = 0;
                } else {
@@ -613,9 +613,9 @@ rxi_ReadvProc(struct rx_call *call, struct iovec *iov, int *nio, int maxio,
 
     /* Free any packets from the last call to ReadvProc/WritevProc */
     if (queue_IsNotEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -698,9 +698,9 @@ rxi_WriteProc(register struct rx_call *call, register char *buf,
 
     /* Free any packets from the last call to ReadvProc/WritevProc */
     if (queue_IsNotEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -756,9 +756,9 @@ rxi_WriteProc(register struct rx_call *call, register char *buf,
                rxi_PrepareSendPacket(call, cp, 0);
                cp->flags |= RX_PKTFLAG_TQ;
                queue_Append(&call->tq, cp);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                 call->tqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
                 cp = (struct rx_packet *)0;
                if (!
                    (call->
@@ -886,9 +886,9 @@ rx_WriteProc(struct rx_call *call, char *buf, int nbytes)
      * ReadvProc/WritevProc.
      */
     if (queue_IsNotEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -936,9 +936,9 @@ rx_WriteProc32(register struct rx_call *call, register afs_int32 * value)
      * ReadvProc/WritevProc.
      */
     if (queue_IsNotEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -999,9 +999,9 @@ rxi_WritevAlloc(struct rx_call *call, struct iovec *iov, int *nio, int maxio,
 
     /* Free any packets from the last call to ReadvProc/WritevProc */
     if (queue_IsNotEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -1039,9 +1039,9 @@ rxi_WritevAlloc(struct rx_call *call, struct iovec *iov, int *nio, int maxio,
            }
            cp->flags |= RX_PKTFLAG_IOVQ;
            queue_Append(&call->iovq, cp);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
             call->iovqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
            tnFree = cp->length;
            tcurvec = 1;
            tcurpos =
@@ -1123,7 +1123,7 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
     int nextio;
     int requestCount;
     struct rx_queue tmpq;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
     u_short tmpqc;
 #endif
 
@@ -1151,14 +1151,14 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
             cp->flags &= ~RX_PKTFLAG_CP;
             cp->flags |= RX_PKTFLAG_IOVQ;
            queue_Prepend(&call->iovq, cp);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
             call->iovqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
            cp = call->currentPacket = (struct rx_packet *)0;
        }
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
        return 0;
     }
@@ -1170,9 +1170,9 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
      * a zero length write will push a short packet. */
     nextio = 0;
     queue_Init(&tmpq);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
     tmpqc = 0;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
     do {
        if (call->nFree == 0 && cp) {
            clock_NewTime();    /* Bogus:  need new time package */
@@ -1183,27 +1183,27 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
            hadd32(call->bytesSent, cp->length);
            rxi_PrepareSendPacket(call, cp, 0);
            queue_Append(&tmpq, cp);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
             tmpqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             cp = call->currentPacket = (struct rx_packet *)0;
 
            /* The head of the iovq is now the current packet */
            if (nbytes) {
                if (queue_IsEmpty(&call->iovq)) {
                    call->error = RX_PROTOCOL_ERROR;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                     tmpqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
                         rxi_FreePackets(0, &tmpq);
                    return 0;
                }
                cp = queue_First(&call->iovq, rx_packet);
                queue_Remove(cp);
                 cp->flags &= ~RX_PKTFLAG_IOVQ;
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                 call->iovqc--;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
                 cp->flags |= RX_PKTFLAG_CP;
                call->currentPacket = cp;
                call->nFree = cp->length;
@@ -1224,14 +1224,14 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
                if (cp) {
                    cp->flags &= ~RX_PKTFLAG_CP;
                     queue_Prepend(&tmpq, cp);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                     tmpqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
                     cp = call->currentPacket = (struct rx_packet *)0;
                }
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
                 tmpqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
                     rxi_FreePackets(0, &tmpq);
                return 0;
            }
@@ -1316,9 +1316,9 @@ rxi_FlushWrite(register struct rx_call *call)
 
     /* Free any packets from the last call to ReadvProc/WritevProc */
     if (queue_IsNotEmpty(&call->iovq)) {
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->iovqc -=
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
             rxi_FreePackets(0, &call->iovq);
     }
 
@@ -1379,9 +1379,9 @@ rxi_FlushWrite(register struct rx_call *call)
        rxi_PrepareSendPacket(call, cp, 1);
        cp->flags |= RX_PKTFLAG_TQ;
        queue_Append(&call->tq, cp);
-#ifdef DEBUG
+#ifdef RXDEBUG_PACKET
         call->tqc++;
-#endif /* DEBUG */
+#endif /* RXDEBUG_PACKET */
        if (!
            (call->
             flags & (RX_CALL_FAST_RECOVER | RX_CALL_FAST_RECOVER_WAIT))) {