rxrpc: Reduce the number of PING ACKs sent
authorDavid Howells <dhowells@redhat.com>
Wed, 21 Sep 2016 23:29:32 +0000 (00:29 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 22 Sep 2016 07:49:22 +0000 (08:49 +0100)
We don't want to send a PING ACK for every new incoming call as that just
adds to the network traffic.  Instead, we send a PING ACK to the first
three that we receive and then once per second thereafter.

This could probably be made adjustable in future.

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

index adb2ec61e21f16643ae7caf5533514d1d7d9de5b..6e2ea8f4ae7532162252f84a60509f34ff8a0f81 100644 (file)
@@ -142,7 +142,7 @@ static void rxrpc_resend(struct rxrpc_call *call)
        struct rxrpc_skb_priv *sp;
        struct sk_buff *skb;
        rxrpc_seq_t cursor, seq, top;
-       ktime_t now = ktime_get_real(), max_age, oldest, resend_at;
+       ktime_t now = ktime_get_real(), max_age, oldest,  resend_at;
        int ix;
        u8 annotation, anno_type;
 
index c121949de3c80dbc160122377d4bbe4d9d379af3..cbb5d53f09d770f1db9f23fbec3f5bcde235d7e5 100644 (file)
@@ -44,9 +44,12 @@ static void rxrpc_send_ping(struct rxrpc_call *call, struct sk_buff *skb,
                            int skew)
 {
        struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+       ktime_t now = skb->tstamp;
 
-       rxrpc_propose_ACK(call, RXRPC_ACK_PING, skew, sp->hdr.serial,
-                         true, true);
+       if (call->peer->rtt_usage < 3 ||
+           ktime_before(ktime_add_ms(call->peer->rtt_last_req, 1000), now))
+               rxrpc_propose_ACK(call, RXRPC_ACK_PING, skew, sp->hdr.serial,
+                                 true, true);
 }
 
 /*