From 3b4cad3b78ec5df7253067c70e19c066552d7145 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 19 Sep 2010 19:48:57 -0700 Subject: [PATCH] Rx: Only backoff the peer timeout once 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 Tested-by: Derrick Brashear --- src/rx/rx.c | 8 +++++--- src/rx/rx.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 8ca6f0012..6e892a3a2 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -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))); } diff --git a/src/rx/rx.h b/src/rx/rx.h index f75103037..e7c10e88d 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -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 */ -- 2.39.5