From: Jeffrey Altman Date: Sat, 27 May 2017 18:59:04 +0000 (-0400) Subject: rx: wake up send after 'twind' has been updated X-Git-Tag: upstream/1.8.0_pre2^3~38 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=aaa47dc1077f0dd5b0040006c831f64cc8a303b5;p=packages%2Fo%2Fopenafs.git 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. Change-Id: Id129ea93e94612a4b8cce9f8cbddde9c779ff26b Reviewed-on: https://gerrit.openafs.org/12625 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- diff --git a/src/rx/rx.c b/src/rx/rx.c index be9949bac..97faa434f 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -4420,24 +4420,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)) { @@ -4544,6 +4526,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