From 04102d7fa7f492d004f62b3e56f856014a1ad92a Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 27 May 2017 14:59:04 -0400 Subject: [PATCH] rx: wake up send after 'twind' has been updated Beginning in AFS 3.4 and 3.5 the ack trailer includes the size of the peer's receive window. This value is used to update the sender's transmit window (twind). When the twind is increased the application thread is signaled to indicate that more packets can be sent. This change wakes the application thread after twind is updated by the peer's receive window instead of beforehand. Failure to do so can result in 100ms transmit delays when the receive window transitions from closed to open. Reviewed-on: https://gerrit.openafs.org/12625 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit aaa47dc1077f0dd5b0040006c831f64cc8a303b5) Change-Id: Icfbe10f93a34adfb14f5c34198f78b67aa043c53 Reviewed-on: https://gerrit.openafs.org/12627 Tested-by: Stephan Wiesand Reviewed-by: Benjamin Kaduk Reviewed-by: Mark Vitale Reviewed-by: Stephan Wiesand --- src/rx/rx.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 977018076..148106cf1 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -4533,24 +4533,6 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np, * queue - they're not addressed by the contents of this ACK packet. */ - /* If the window has been extended by this acknowledge packet, - * then wakeup a sender waiting in alloc for window space, or try - * sending packets now, if he's been sitting on packets due to - * lack of window space */ - if (call->tnext < (call->tfirst + call->twind)) { -#ifdef RX_ENABLE_LOCKS - CV_SIGNAL(&call->cv_twind); -#else - if (call->flags & RX_CALL_WAIT_WINDOW_ALLOC) { - call->flags &= ~RX_CALL_WAIT_WINDOW_ALLOC; - osi_rxWakeup(&call->twind); - } -#endif - if (call->flags & RX_CALL_WAIT_WINDOW_SEND) { - call->flags &= ~RX_CALL_WAIT_WINDOW_SEND; - } - } - /* if the ack packet has a receivelen field hanging off it, * update our state */ if (np->length >= rx_AckDataSize(ap->nAcks) + 2 * sizeof(afs_int32)) { @@ -4657,6 +4639,24 @@ rxi_ReceiveAckPacket(struct rx_call *call, struct rx_packet *np, call->MTU = OLD_MAX_PACKET_SIZE; } + /* If the window has been extended by this acknowledge packet, + * then wakeup a sender waiting in alloc for window space, or try + * sending packets now, if he's been sitting on packets due to + * lack of window space */ + if (call->tnext < (call->tfirst + call->twind)) { +#ifdef RX_ENABLE_LOCKS + CV_SIGNAL(&call->cv_twind); +#else + if (call->flags & RX_CALL_WAIT_WINDOW_ALLOC) { + call->flags &= ~RX_CALL_WAIT_WINDOW_ALLOC; + osi_rxWakeup(&call->twind); + } +#endif + if (call->flags & RX_CALL_WAIT_WINDOW_SEND) { + call->flags &= ~RX_CALL_WAIT_WINDOW_SEND; + } + } + if (nNacked) { /* * Calculate how many datagrams were successfully received after -- 2.39.5