disable Rx packet tracking
authorDerrick Brashear <shadow@dementia.org>
Wed, 15 Sep 2010 08:26:13 +0000 (04:26 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Fri, 17 Sep 2010 11:11:55 +0000 (04:11 -0700)
minimize the impact of Rx packet tracking. in particular, do no
extra queue scans, which means the rest of the state which tracks
where a packet is now isn't of use. make it possible to re-enable.

Change-Id: I5b9ed039a0394edcea48bb46729cd2ce2f71d4b9
Reviewed-on: http://gerrit.openafs.org/2762
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

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

index 5fe0286..8ab0239 100644 (file)
@@ -2123,7 +2123,9 @@ rx_EndCall(struct rx_call *call, afs_int32 rc)
      * kernel version, and may interrupt the macros rx_Read or
      * rx_Write, which run at normal priority for efficiency. */
     if (call->currentPacket) {
+#ifdef RX_TRACK_PACKETS
         call->currentPacket->flags &= ~RX_PKTFLAG_CP;
+#endif
        rxi_FreePacket(call->currentPacket);
        call->currentPacket = (struct rx_packet *)0;
     }
@@ -3472,7 +3474,9 @@ rxi_ReceiveDataPacket(struct rx_call *call,
            /* It's the next packet. Stick it on the receive queue
             * for this call. Set newPackets to make sure we wake
             * the reader once all packets have been processed */
+#ifdef RX_TRACK_PACKETS
            np->flags |= RX_PKTFLAG_RQ;
+#endif
            queue_Prepend(&call->rq, np);
 #ifdef RXDEBUG_PACKET
             call->rqc++;
@@ -3607,7 +3611,9 @@ rxi_ReceiveDataPacket(struct rx_call *call,
             * packet before which to insert the new packet, or at the
             * queue head if the queue is empty or the packet should be
             * appended. */
+#ifdef RX_TRACK_PACKETS
             np->flags |= RX_PKTFLAG_RQ;
+#endif
 #ifdef RXDEBUG_PACKET
             call->rqc++;
 #endif /* RXDEBUG_PACKET */
@@ -3971,7 +3977,9 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np,
 #endif /* AFS_GLOBAL_RXLOCK_KERNEL */
        {
            queue_Remove(tp);
+#ifdef RX_TRACK_PACKETS
            tp->flags &= ~RX_PKTFLAG_TQ;
+#endif
 #ifdef RXDEBUG_PACKET
             call->tqc--;
 #endif /* RXDEBUG_PACKET */
@@ -4890,8 +4898,10 @@ rxi_ResetCall(struct rx_call *call, int newcall)
     /* why init the queue if you just emptied it? queue_Init(&call->rq); */
 
     if (call->currentPacket) {
+#ifdef RX_TRACK_PACKETS
         call->currentPacket->flags &= ~RX_PKTFLAG_CP;
         call->currentPacket->flags |= RX_PKTFLAG_IOVQ;
+#endif
         queue_Prepend(&call->iovq, call->currentPacket);
 #ifdef RXDEBUG_PACKET
         call->iovqc++;
@@ -5608,6 +5618,7 @@ rxi_Start(struct rxevent *event,
                             *(call->callNumber)));
                        break;
                    }
+#ifdef RX_TRACK_PACKETS
                    if ((p->flags & RX_PKTFLAG_FREE)
                        || (!queue_IsEnd(&call->tq, nxp)
                            && (nxp->flags & RX_PKTFLAG_FREE))
@@ -5615,6 +5626,7 @@ rxi_Start(struct rxevent *event,
                        || (nxp == (struct rx_packet *)&rx_freePacketQueue)) {
                        osi_Panic("rxi_Start: xmit queue clobbered");
                    }
+#endif
                    if (p->flags & RX_PKTFLAG_ACKED) {
                        /* Since we may block, don't trust this */
                        usenow.sec = usenow.usec = 0;
@@ -5721,7 +5733,9 @@ rxi_Start(struct rxevent *event,
                        if (p->header.seq < call->tfirst
                            && (p->flags & RX_PKTFLAG_ACKED)) {
                            queue_Remove(p);
+#ifdef RX_TRACK_PACKETS
                            p->flags &= ~RX_PKTFLAG_TQ;
+#endif
 #ifdef RXDEBUG_PACKET
                             call->tqc--;
 #endif
index d546ab2..e5208d2 100644 (file)
@@ -207,6 +207,7 @@ EXT struct rx_ts_info_t * rx_ts_info_init(void);   /* init function for thread-s
  * in which the first tier is thread-specific, and the second tier is
  * a global free packet queue */
 EXT struct rx_queue rx_freePacketQueue;
+#ifdef RX_TRACK_PACKETS
 #define RX_FPQ_MARK_FREE(p) \
     do { \
         if ((p)->flags & RX_PKTFLAG_FREE) \
@@ -223,6 +224,18 @@ EXT struct rx_queue rx_freePacketQueue;
         (p)->flags = 0;                /* clear RX_PKTFLAG_FREE, initialize the rest */ \
         (p)->header.flags = 0; \
     } while(0)
+#else
+#define RX_FPQ_MARK_FREE(p) \
+    do { \
+        (p)->length = 0; \
+        (p)->niovecs = 0; \
+    } while(0)
+#define RX_FPQ_MARK_USED(p) \
+    do { \
+        (p)->flags = 0;                /* clear RX_PKTFLAG_FREE, initialize the rest */ \
+        (p)->header.flags = 0; \
+    } while(0)
+#endif
 #define RX_PACKET_IOV_INIT(p) \
     do { \
        (p)->wirevec[0].iov_base = (char *)((p)->wirehead); \
index af2219e..92aef61 100644 (file)
@@ -603,7 +603,9 @@ rxi_MorePackets(int apackets)
 
     for (e = p + apackets; p < e; p++) {
         RX_PACKET_IOV_INIT(p);
+#ifdef RX_TRACK_PACKETS
        p->flags |= RX_PKTFLAG_FREE;
+#endif
        p->niovecs = 2;
 
        queue_Append(&rx_freePacketQueue, p);
@@ -711,7 +713,9 @@ rxi_MorePacketsNoLock(int apackets)
 
     for (e = p + apackets; p < e; p++) {
         RX_PACKET_IOV_INIT(p);
+#ifdef RX_TRACK_PACKETS
        p->flags |= RX_PKTFLAG_FREE;
+#endif
        p->niovecs = 2;
 
        queue_Append(&rx_freePacketQueue, p);
index afc6e24..ce42472 100644 (file)
  * most part.  These live in rx_packet->flags.
  */
 #define        RX_PKTFLAG_ACKED        0x01
+#ifdef RX_TRACK_PACKETS
 #define        RX_PKTFLAG_FREE         0x02
 #define RX_PKTFLAG_TQ           0x04
 #define RX_PKTFLAG_RQ           0x08
 #define RX_PKTFLAG_IOVQ         0x10
 #define RX_PKTFLAG_CP           0x20
+#endif
 
 /* The rx part of the header of a packet, in host form */
 struct rx_header {
index b1ca619..dc1b9e7 100644 (file)
@@ -137,7 +137,9 @@ rxi_ReadProc(struct rx_call *call, char *buf,
                        afs_int32 error;
                        struct rx_connection *conn = call->conn;
                        queue_Remove(rp);
+#ifdef RX_TRACK_PACKETS
                        rp->flags &= ~RX_PKTFLAG_RQ;
+#endif
 #ifdef RXDEBUG_PACKET
                         call->rqc--;
 #endif /* RXDEBUG_PACKET */
@@ -165,7 +167,9 @@ rxi_ReadProc(struct rx_call *call, char *buf,
                        }
                        call->rnext++;
                        cp = call->currentPacket = rp;
+#ifdef RX_TRACK_PACKETS
                        call->currentPacket->flags |= RX_PKTFLAG_CP;
+#endif
                        call->curvec = 1;       /* 0th vec is always header */
                        /* begin at the beginning [ more or less ], continue
                         * on until the end, then stop. */
@@ -274,7 +278,9 @@ rxi_ReadProc(struct rx_call *call, char *buf,
 
                if (!call->nLeft) {
                    /* out of packet.  Get another one. */
+#ifdef RX_TRACK_PACKETS
                    call->currentPacket->flags &= ~RX_PKTFLAG_CP;
+#endif
                    rxi_FreePacket(cp);
                    cp = call->currentPacket = (struct rx_packet *)0;
                } else if (!call->curlen) {
@@ -282,7 +288,9 @@ rxi_ReadProc(struct rx_call *call, char *buf,
                    if (++call->curvec >= cp->niovecs) {
                        /* current packet is exhausted, get ready for another */
                        /* don't worry about curvec and stuff, they get set somewhere else */
+#ifdef RX_TRACK_PACKETS
                        call->currentPacket->flags &= ~RX_PKTFLAG_CP;
+#endif
                        rxi_FreePacket(cp);
                        cp = call->currentPacket = (struct rx_packet *)0;
                        call->nLeft = 0;
@@ -429,7 +437,9 @@ rxi_FillReadVec(struct rx_call *call, afs_uint32 serial)
                    afs_int32 error;
                    struct rx_connection *conn = call->conn;
                    queue_Remove(rp);
+#ifdef RX_TRACK_PACKETS
                    rp->flags &= ~RX_PKTFLAG_RQ;
+#endif
 #ifdef RXDEBUG_PACKET
                     call->rqc--;
 #endif /* RXDEBUG_PACKET */
@@ -456,7 +466,9 @@ rxi_FillReadVec(struct rx_call *call, afs_uint32 serial)
                    }
                    call->rnext++;
                    curp = call->currentPacket = rp;
+#ifdef RX_TRACK_PACKETS
                    call->currentPacket->flags |= RX_PKTFLAG_CP;
+#endif
                    call->curvec = 1;   /* 0th vec is always header */
                    cur_iov = &curp->wirevec[1];
                    /* begin at the beginning [ more or less ], continue
@@ -511,8 +523,10 @@ rxi_FillReadVec(struct rx_call *call, afs_uint32 serial)
 
            if (!call->nLeft) {
                /* out of packet.  Get another one. */
+#ifdef RX_TRACK_PACKETS
                 curp->flags &= ~RX_PKTFLAG_CP;
                 curp->flags |= RX_PKTFLAG_IOVQ;
+#endif
                queue_Append(&call->iovq, curp);
 #ifdef RXDEBUG_PACKET
                 call->iovqc++;
@@ -523,8 +537,10 @@ rxi_FillReadVec(struct rx_call *call, afs_uint32 serial)
                if (++call->curvec >= curp->niovecs) {
                    /* current packet is exhausted, get ready for another */
                    /* don't worry about curvec and stuff, they get set somewhere else */
+#ifdef RX_TRACK_PACKETS
                    curp->flags &= ~RX_PKTFLAG_CP;
                    curp->flags |= RX_PKTFLAG_IOVQ;
+#endif
                    queue_Append(&call->iovq, curp);
 #ifdef RXDEBUG_PACKET
                     call->iovqc++;
@@ -678,7 +694,9 @@ rxi_WriteProc(struct rx_call *call, char *buf,
            && (call->mode == RX_MODE_RECEIVING)) {
            call->mode = RX_MODE_SENDING;
            if (cp) {
+#ifdef RX_TRACK_PACKETS
                cp->flags &= ~RX_PKTFLAG_CP;
+#endif
                rxi_FreePacket(cp);
                cp = call->currentPacket = (struct rx_packet *)0;
                call->nLeft = 0;
@@ -701,7 +719,9 @@ rxi_WriteProc(struct rx_call *call, char *buf,
                  * the packet we are planning on using
                  * cannot be freed.
                  */
+#ifdef RX_TRACK_PACKETS
                 cp->flags &= ~RX_PKTFLAG_CP;
+#endif
                call->currentPacket = (struct rx_packet *)0;
 #ifdef AFS_GLOBAL_RXLOCK_KERNEL
                /* Wait until TQ_BUSY is reset before adding any
@@ -727,7 +747,9 @@ rxi_WriteProc(struct rx_call *call, char *buf,
                 * conn->securityMaxTrailerSize */
                hadd32(call->bytesSent, cp->length);
                rxi_PrepareSendPacket(call, cp, 0);
+#ifdef RX_TRACK_PACKETS
                cp->flags |= RX_PKTFLAG_TQ;
+#endif
                queue_Append(&call->tq, cp);
 #ifdef RXDEBUG_PACKET
                 call->tqc++;
@@ -740,7 +762,9 @@ rxi_WriteProc(struct rx_call *call, char *buf,
                    rxi_Start(0, call, 0, 0);
                }
            } else if (cp) {
+#ifdef RX_TRACK_PACKETS
                cp->flags &= ~RX_PKTFLAG_CP;
+#endif
                rxi_FreePacket(cp);
                cp = call->currentPacket = (struct rx_packet *)0;
            }
@@ -765,7 +789,9 @@ rxi_WriteProc(struct rx_call *call, char *buf,
 #endif /* RX_ENABLE_LOCKS */
            }
            if ((cp = rxi_AllocSendPacket(call, nbytes))) {
+#ifdef RX_TRACK_PACKETS
                cp->flags |= RX_PKTFLAG_CP;
+#endif
                call->currentPacket = cp;
                call->nFree = cp->length;
                call->curvec = 1;       /* 0th vec is always header */
@@ -779,7 +805,9 @@ rxi_WriteProc(struct rx_call *call, char *buf,
            }
            if (call->error) {
                if (cp) {
+#ifdef RX_TRACK_PACKETS
                    cp->flags &= ~RX_PKTFLAG_CP;
+#endif
                    rxi_FreePacket(cp);
                    call->currentPacket = NULL;
                }
@@ -965,7 +993,9 @@ rxi_WritevAlloc(struct rx_call *call, struct iovec *iov, int *nio, int maxio,
            && (call->mode == RX_MODE_RECEIVING)) {
            call->mode = RX_MODE_SENDING;
            if (cp) {
+#ifdef RX_TRACK_PACKETS
                cp->flags &= ~RX_PKTFLAG_CP;
+#endif
                rxi_FreePacket(cp);
                cp = call->currentPacket = (struct rx_packet *)0;
                call->nLeft = 0;
@@ -992,7 +1022,9 @@ rxi_WritevAlloc(struct rx_call *call, struct iovec *iov, int *nio, int maxio,
                *nio = nextio;
                return requestCount - nbytes;
            }
+#ifdef RX_TRACK_PACKETS
            cp->flags |= RX_PKTFLAG_IOVQ;
+#endif
            queue_Append(&call->iovq, cp);
 #ifdef RXDEBUG_PACKET
             call->iovqc++;
@@ -1074,7 +1106,9 @@ int
 rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
 {
     struct rx_packet *cp = NULL;
+#ifdef RX_TRACK_PACKETS
     struct rx_packet *p, *np;
+#endif
     int nextio;
     int requestCount;
     struct rx_queue tmpq;
@@ -1109,8 +1143,10 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
 
     if (call->error) {
        if (cp) {
+#ifdef RX_TRACK_PACKETS
             cp->flags &= ~RX_PKTFLAG_CP;
             cp->flags |= RX_PKTFLAG_IOVQ;
+#endif
            queue_Prepend(&call->iovq, cp);
 #ifdef RXDEBUG_PACKET
             call->iovqc++;
@@ -1161,11 +1197,15 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
                }
                cp = queue_First(&call->iovq, rx_packet);
                queue_Remove(cp);
+#ifdef RX_TRACK_PACKETS
                 cp->flags &= ~RX_PKTFLAG_IOVQ;
+#endif
 #ifdef RXDEBUG_PACKET
                 call->iovqc--;
 #endif /* RXDEBUG_PACKET */
+#ifdef RX_TRACK_PACKETS
                 cp->flags |= RX_PKTFLAG_CP;
+#endif
                call->currentPacket = cp;
                call->nFree = cp->length;
                call->curvec = 1;
@@ -1183,7 +1223,9 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
                || iov[nextio].iov_len > (int)call->curlen) {
                call->error = RX_PROTOCOL_ERROR;
                if (cp) {
+#ifdef RX_TRACK_PACKETS
                    cp->flags &= ~RX_PKTFLAG_CP;
+#endif
                     queue_Prepend(&tmpq, cp);
 #ifdef RXDEBUG_PACKET
                     tmpqc++;
@@ -1215,10 +1257,12 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
     /* Move the packets from the temporary queue onto the transmit queue.
      * We may end up with more than call->twind packets on the queue. */
 
+#ifdef RX_TRACK_PACKETS
     for (queue_Scan(&tmpq, p, np, rx_packet))
     {
         p->flags |= RX_PKTFLAG_TQ;
     }
+#endif
     queue_SpliceAppend(&call->tq, &tmpq);
 
     if (!(call->flags & (RX_CALL_FAST_RECOVER | RX_CALL_FAST_RECOVER_WAIT))) {
@@ -1242,7 +1286,9 @@ rxi_WritevProc(struct rx_call *call, struct iovec *iov, int nio, int nbytes)
 
     if (call->error) {
        if (cp) {
+#ifdef RX_TRACK_PACKETS
            cp->flags &= ~RX_PKTFLAG_CP;
+#endif
            rxi_FreePacket(cp);
             cp = call->currentPacket = (struct rx_packet *)0;
        }
@@ -1325,7 +1371,9 @@ rxi_FlushWrite(struct rx_call *call)
            /* cp->length is only supposed to be the user's data */
            /* cp->length was already set to (then-current)
             * MaxUserDataSize or less. */
+#ifdef RX_TRACK_PACKETS
            cp->flags &= ~RX_PKTFLAG_CP;
+#endif
            cp->length -= call->nFree;
            call->currentPacket = (struct rx_packet *)0;
            call->nFree = 0;
@@ -1343,7 +1391,9 @@ rxi_FlushWrite(struct rx_call *call)
        /* The 1 specifies that this is the last packet */
        hadd32(call->bytesSent, cp->length);
        rxi_PrepareSendPacket(call, cp, 1);
+#ifdef RX_TRACK_PACKETS
        cp->flags |= RX_PKTFLAG_TQ;
+#endif
        queue_Append(&call->tq, cp);
 #ifdef RXDEBUG_PACKET
         call->tqc++;