tcp: track total bytes delivered with ECN CE marks
authorYuchung Cheng <ycheng@google.com>
Wed, 18 Apr 2018 06:18:48 +0000 (23:18 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Apr 2018 17:05:16 +0000 (13:05 -0400)
Introduce a new delivered_ce stat in tcp socket to estimate
number of packets being marked with CE bits. The estimation is
done via ACKs with ECE bit. Depending on the actual receiver
behavior, the estimation could have biases.

Since the TCP sender can't really see the CE bit in the data path,
so the sender is technically counting packets marked delivered with
the "ECE / ECN-Echo" flag set.

With RFC3168 ECN, because the ECE bit is sticky, this count can
drastically overestimate the nummber of CE-marked data packets

With DCTCP-style ECN this should be reasonably precise unless there
is loss in the ACK path, in which case it's not precise.

With AccECN proposal this can be made still more precise, even in
the case some degree of ACK loss.

However this is sender's best estimate of CE information.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/tcp.h
net/ipv4/tcp.c
net/ipv4/tcp_input.c

index 8f4c54986f9745b28b573dbdcf2d5b46d84f45a0..20585d5c4e1c3b64015df4a0339d19f65c03747b 100644 (file)
@@ -281,6 +281,7 @@ struct tcp_sock {
                                 * receiver in Recovery. */
        u32     prr_out;        /* Total number of pkts sent during Recovery. */
        u32     delivered;      /* Total data packets delivered incl. rexmits */
+       u32     delivered_ce;   /* Like the above but only ECE marked packets */
        u32     lost;           /* Total data packets lost incl. rexmits */
        u32     app_limited;    /* limited until "delivered" reaches this val */
        u64     first_tx_mstamp;  /* start of window send phase */
index 438fbca96cd3100d722e1bd8bcc6f49624495a21..5a5ce6da4792b8ce0e90e2a82ff3969b2a0ddde6 100644 (file)
@@ -2559,6 +2559,7 @@ int tcp_disconnect(struct sock *sk, int flags)
        tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
        tp->snd_cwnd_cnt = 0;
        tp->window_clamp = 0;
+       tp->delivered_ce = 0;
        tcp_set_ca_state(sk, TCP_CA_Open);
        tp->is_sack_reneg = 0;
        tcp_clear_retrans(tp);
index 01cce28f90caf58a5759e667befbc2da2c813ab8..b3bff9c206061e0b77f026106c527b7f743f9b1d 100644 (file)
@@ -3503,6 +3503,8 @@ static u32 tcp_newly_delivered(struct sock *sk, u32 prior_delivered, int flag)
        u32 delivered;
 
        delivered = tp->delivered - prior_delivered;
+       if (flag & FLAG_ECE)
+               tp->delivered_ce += delivered;
        return delivered;
 }