From aaa47dc1077f0dd5b0040006c831f64cc8a303b5 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. Change-Id: Id129ea93e94612a4b8cce9f8cbddde9c779ff26b Reviewed-on: https://gerrit.openafs.org/12625 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- 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 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 -- 2.39.5