Rx: Only backoff the peer timeout once
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 20 Sep 2010 02:48:57 +0000 (19:48 -0700)
committerDerrick Brashear <shadow@dementia.org>
Mon, 20 Sep 2010 08:53:26 +0000 (01:53 -0700)
If a packet is missing, the peer timeout is backed off to provide
a new starting point for timeout computation.  The backoff state
must be stored in the peer object to ensure that multiple failures
do not result in more than one backoff before a successfully received
packet is available for recomputation.

Change-Id: I6794b3a020801ff421e4ed776afb581962b111a9
Reviewed-on: http://gerrit.openafs.org/2787
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/rx/rx.c
src/rx/rx.h

index 8ca6f00..6e892a3 100644 (file)
@@ -3823,7 +3823,6 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np,
     afs_uint32 skew = 0;
     int nbytes;
     int missing;
-    int backedOff = 0;
     int acked;
     int nNacked = 0;
     int newAckCount = 0;
@@ -4056,14 +4055,14 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np,
          * timeout value for future packets until a successful response
          * is received for an initial transmission.
          */
-        if (missing && !backedOff) {
+        if (missing && !peer->backedOff) {
             struct clock c = peer->timeout;
             struct clock max_to = {3, 0};
 
             clock_Add(&peer->timeout, &c);
             if (clock_Gt(&peer->timeout, &max_to))
                 peer->timeout = max_to;
-            backedOff = 1;
+            peer->backedOff = 1;
         }
 
        /* If packet isn't yet acked, and it has been transmitted at least
@@ -6484,6 +6483,9 @@ rxi_ComputeRoundTripTime(struct rx_packet *p,
     clock_Zero(&(peer->timeout));
     clock_Addmsec(&(peer->timeout), rtt_timeout);
 
+    /* Reset the backedOff flag since we just computed a new timeout value */
+    peer->backedOff = 0;
+
     dpf(("rxi_ComputeRoundTripTime(call=%d packet=%"AFS_PTR_FMT" rtt=%d ms, srtt=%d ms, rtt_dev=%d ms, timeout=%d.%06d sec)\n",
           p->header.callNumber, p, MSEC(rttp), peer->rtt >> 3, peer->rtt_dev >> 2, (peer->timeout.sec), (peer->timeout.usec)));
 }
index f751030..e7c10e8 100644 (file)
@@ -401,6 +401,7 @@ struct rx_peer {
     int rtt;                   /* Smoothed round trip time, measured in milliseconds/8 */
     int rtt_dev;               /* Smoothed rtt mean difference, in milliseconds/4 */
     struct clock timeout;      /* Current retransmission delay */
+    int backedOff;              /* Has the timeout been backed off due to a missing packet? */
     int nSent;                 /* Total number of distinct data packets sent, not including retransmissions */
     int reSends;               /* Total number of retransmissions for this peer, since this structure was created */