af_rxrpc: Improve ACK production
authorDavid Howells <dhowells@redhat.com>
Fri, 7 Feb 2014 18:58:45 +0000 (18:58 +0000)
committerDavid Howells <dhowells@redhat.com>
Wed, 26 Feb 2014 17:25:07 +0000 (17:25 +0000)
Improve ACK production by the following means:

 (1) Don't send an ACK_REQUESTED ack immediately even if the RXRPC_MORE_PACKETS
     flag isn't set on a data packet that has also has RXRPC_REQUEST_ACK set.

     MORE_PACKETS just means that the sender just emptied its Tx data buffer.
     More data will be forthcoming unless RXRPC_LAST_PACKET is also flagged.

     It is possible to see runs of DATA packets with MORE_PACKETS unset that
     aren't waiting for an ACK.

     It is therefore better to wait a small instant to see if we can combine an
     ACK for several packets.

 (2) Don't send an ACK_IDLE ack immediately unless we're responding to the
     terminal data packet of a call.

     Whilst sending an ACK_IDLE mid-call serves to let the other side know
     that we won't be asking it to resend certain Tx buffers and that it can
     discard them, spamming it with loads of acks just because we've
     temporarily run out of data just distracts it.

 (3) Put the ACK_IDLE ack generation timeout up to half a second rather than a
     single jiffy.  Just because we haven't been given more data immediately
     doesn't mean that more isn't forthcoming.  The other side may be busily
     finding the data to send to us.

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

index 732b82f540c562e5ded730748ac2f99063800fe9..1a490d976e7ed9a7a2ff1b9276ef0401f7245fa9 100644 (file)
@@ -41,7 +41,7 @@ unsigned rxrpc_soft_ack_delay = 1 * HZ;
  * further packets aren't immediately received to decide when to send an IDLE
  * ACK let the other end know that it can free up its Tx buffer space.
  */
-unsigned rxrpc_idle_ack_delay = 1;
+unsigned rxrpc_idle_ack_delay = 0.5 * HZ;
 
 static const char *rxrpc_acks(u8 reason)
 {
index 540c03d338c9c6a362ea72c25994637d2ffb9427..e449c675c36a283cc76411c071a19ec0aa446858 100644 (file)
@@ -347,8 +347,7 @@ void rxrpc_fast_process_packet(struct rxrpc_call *call, struct sk_buff *skb)
         * it */
        if (sp->hdr.flags & RXRPC_REQUEST_ACK) {
                _proto("ACK Requested on %%%u", serial);
-               rxrpc_propose_ACK(call, RXRPC_ACK_REQUESTED, sp->hdr.serial,
-                                 !(sp->hdr.flags & RXRPC_MORE_PACKETS));
+               rxrpc_propose_ACK(call, RXRPC_ACK_REQUESTED, sp->hdr.serial, false);
        }
 
        switch (sp->hdr.type) {
index af9f4fd2a365cd50ce16bd81e4ff1992c37331e4..4cfab49e329dbba1a2cfa05c1faeff66fd016031 100644 (file)
@@ -90,7 +90,7 @@ static void rxrpc_hard_ACK_data(struct rxrpc_call *call,
                 */
                _debug("send Rx idle ACK");
                __rxrpc_propose_ACK(call, RXRPC_ACK_IDLE, sp->hdr.serial,
-                                   true);
+                                   false);
        }
 
        spin_unlock_bh(&call->lock);