rxrpc: Send an immediate ACK if we fill in a hole
authorDavid Howells <dhowells@redhat.com>
Sat, 24 Sep 2016 17:05:27 +0000 (18:05 +0100)
committerDavid Howells <dhowells@redhat.com>
Sat, 24 Sep 2016 22:49:46 +0000 (23:49 +0100)
Send an immediate ACK if we fill in a hole in the buffer left by an
out-of-sequence packet.  This may allow the congestion management in the peer
to avoid a retransmission if packets got reordered on the wire.

Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/input.c

index 349698d87ad1894b5ed57bc6c259a112580e3b5d..757c16f033a074d8c7a23a2d287d21833b322710 100644 (file)
@@ -331,8 +331,16 @@ next_subpacket:
        call->rxtx_annotations[ix] = annotation;
        smp_wmb();
        call->rxtx_buffer[ix] = skb;
-       if (after(seq, call->rx_top))
+       if (after(seq, call->rx_top)) {
                smp_store_release(&call->rx_top, seq);
+       } else if (before(seq, call->rx_top)) {
+               /* Send an immediate ACK if we fill in a hole */
+               if (!ack) {
+                       ack = RXRPC_ACK_DELAY;
+                       ack_serial = serial;
+               }
+               immediate_ack = true;
+       }
        if (flags & RXRPC_LAST_PACKET) {
                set_bit(RXRPC_CALL_RX_LAST, &call->flags);
                trace_rxrpc_receive(call, rxrpc_receive_queue_last, serial, seq);