]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/ipv4/tcp_output.c
Merge tag 'for-linus-20180906' of git://git.kernel.dk/linux-block
[linux.git] / net / ipv4 / tcp_output.c
index c4172c1fb198d4bcd1fcaace00308b3f86b0a843..597dbd749f05dc72e53962a5821861fc218774d6 100644 (file)
@@ -977,17 +977,6 @@ enum hrtimer_restart tcp_pace_kick(struct hrtimer *timer)
        return HRTIMER_NORESTART;
 }
 
-/* BBR congestion control needs pacing.
- * Same remark for SO_MAX_PACING_RATE.
- * sch_fq packet scheduler is efficiently handling pacing,
- * but is not always installed/used.
- * Return true if TCP stack should pace packets itself.
- */
-static bool tcp_needs_internal_pacing(const struct sock *sk)
-{
-       return smp_load_acquire(&sk->sk_pacing_status) == SK_PACING_NEEDED;
-}
-
 static void tcp_internal_pacing(struct sock *sk, const struct sk_buff *skb)
 {
        u64 len_ns;
@@ -999,9 +988,6 @@ static void tcp_internal_pacing(struct sock *sk, const struct sk_buff *skb)
        if (!rate || rate == ~0U)
                return;
 
-       /* Should account for header sizes as sch_fq does,
-        * but lets make things simple.
-        */
        len_ns = (u64)skb->len * NSEC_PER_SEC;
        do_div(len_ns, rate);
        hrtimer_start(&tcp_sk(sk)->pacing_timer,
@@ -1150,6 +1136,7 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
        if (skb->len != tcp_header_size) {
                tcp_event_data_sent(tp, sk);
                tp->data_segs_out += tcp_skb_pcount(skb);
+               tp->bytes_sent += skb->len - tcp_header_size;
                tcp_internal_pacing(sk, skb);
        }
 
@@ -2711,9 +2698,8 @@ static bool tcp_collapse_retrans(struct sock *sk, struct sk_buff *skb)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        struct sk_buff *next_skb = skb_rb_next(skb);
-       int skb_size, next_skb_size;
+       int next_skb_size;
 
-       skb_size = skb->len;
        next_skb_size = next_skb->len;
 
        BUG_ON(tcp_skb_pcount(skb) != 1 || tcp_skb_pcount(next_skb) != 1);
@@ -2884,6 +2870,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
        if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)
                __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS);
        tp->total_retrans += segs;
+       tp->bytes_retrans += skb->len;
 
        /* make sure skb->data is aligned on arches that require it
         * and check if ack-trimming & collapsing extended the headroom