]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
tcp: add in_flight to tcp_skb_cb
authorLawrence Brakmo <brakmo@fb.com>
Thu, 9 Jun 2016 04:16:44 +0000 (21:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 11 Jun 2016 06:07:49 +0000 (23:07 -0700)
Add in_flight (bytes in flight when packet was sent) field
to tx component of tcp_skb_cb and make it available to
congestion modules' pkts_acked() function through the
ack_sample function argument.

Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h
net/ipv4/tcp_input.c
net/ipv4/tcp_output.c

index 0bcc70f4e1fb7ed574f787d636afaa9a87628d69..a79894b667265cdf9e3fe793b4757e2f932b378a 100644 (file)
@@ -767,6 +767,7 @@ struct tcp_skb_cb {
        union {
                struct {
                        /* There is space for up to 20 bytes */
+                       __u32 in_flight;/* Bytes in flight when packet sent */
                } tx;   /* only used for outgoing skbs */
                union {
                        struct inet_skb_parm    h4;
@@ -859,6 +860,7 @@ union tcp_cc_info;
 struct ack_sample {
        u32 pkts_acked;
        s32 rtt_us;
+       u32 in_flight;
 };
 
 struct tcp_congestion_ops {
index 89dd8d82826f6e16de784d350d53a636990188f3..94d4aff9752329f7edba340aaed1c405bfa2bd01 100644 (file)
@@ -3115,6 +3115,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
        long ca_rtt_us = -1L;
        struct sk_buff *skb;
        u32 pkts_acked = 0;
+       u32 last_in_flight = 0;
        bool rtt_update;
        int flag = 0;
 
@@ -3154,6 +3155,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
                        if (!first_ackt.v64)
                                first_ackt = last_ackt;
 
+                       last_in_flight = TCP_SKB_CB(skb)->tx.in_flight;
                        reord = min(pkts_acked, reord);
                        if (!after(scb->end_seq, tp->high_seq))
                                flag |= FLAG_ORIG_SACK_ACKED;
@@ -3250,7 +3252,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets,
 
        if (icsk->icsk_ca_ops->pkts_acked) {
                struct ack_sample sample = { .pkts_acked = pkts_acked,
-                                            .rtt_us = ca_rtt_us };
+                                            .rtt_us = ca_rtt_us,
+                                            .in_flight = last_in_flight };
 
                icsk->icsk_ca_ops->pkts_acked(sk, &sample);
        }
index 8bd9911fdd163ab739d2dfda34e053b5e8e0bc03..b1bcba0563f2075da4cf6a1ed78a30341eedf0b8 100644 (file)
@@ -911,9 +911,12 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
        int err;
 
        BUG_ON(!skb || !tcp_skb_pcount(skb));
+       tp = tcp_sk(sk);
 
        if (clone_it) {
                skb_mstamp_get(&skb->skb_mstamp);
+               TCP_SKB_CB(skb)->tx.in_flight = TCP_SKB_CB(skb)->end_seq
+                       - tp->snd_una;
 
                if (unlikely(skb_cloned(skb)))
                        skb = pskb_copy(skb, gfp_mask);
@@ -924,7 +927,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
        }
 
        inet = inet_sk(sk);
-       tp = tcp_sk(sk);
        tcb = TCP_SKB_CB(skb);
        memset(&opts, 0, sizeof(opts));