revert android-tegra-2.6.36-honeycomb-mr1-9001adc to v2.6.36
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / tcp_output.c
index 7abecf73add94b1f29ff8f79031b64562a65871b..de3bd84585881f99f8a23eb28fa9f380516d087c 100644 (file)
@@ -237,10 +237,11 @@ void tcp_select_initial_window(int __space, __u32 mss,
                /* when initializing use the value from init_rcv_wnd
                 * rather than the default from above
                 */
-               if (init_rcv_wnd)
-                       *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
-               else
-                       *rcv_wnd = min(*rcv_wnd, init_cwnd * mss);
+               if (init_rcv_wnd &&
+                   (*rcv_wnd > init_rcv_wnd * mss))
+                       *rcv_wnd = init_rcv_wnd * mss;
+               else if (*rcv_wnd > init_cwnd * mss)
+                       *rcv_wnd = init_cwnd * mss;
        }
 
        /* Set the clamp no higher than max representable value */
@@ -391,30 +392,27 @@ struct tcp_out_options {
  */
 static u8 tcp_cookie_size_check(u8 desired)
 {
-       int cookie_size;
-
-       if (desired > 0)
+       if (desired > 0) {
                /* previously specified */
                return desired;
-
-       cookie_size = ACCESS_ONCE(sysctl_tcp_cookie_size);
-       if (cookie_size <= 0)
+       }
+       if (sysctl_tcp_cookie_size <= 0) {
                /* no default specified */
                return 0;
-
-       if (cookie_size <= TCP_COOKIE_MIN)
+       }
+       if (sysctl_tcp_cookie_size <= TCP_COOKIE_MIN) {
                /* value too small, specify minimum */
                return TCP_COOKIE_MIN;
-
-       if (cookie_size >= TCP_COOKIE_MAX)
+       }
+       if (sysctl_tcp_cookie_size >= TCP_COOKIE_MAX) {
                /* value too large, specify maximum */
                return TCP_COOKIE_MAX;
-
-       if (cookie_size & 1)
+       }
+       if (0x1 & sysctl_tcp_cookie_size) {
                /* 8-bit multiple, illegal, fix it */
-               cookie_size++;
-
-       return (u8)cookie_size;
+               return (u8)(sysctl_tcp_cookie_size + 0x1);
+       }
+       return (u8)sysctl_tcp_cookie_size;
 }
 
 /* Write previously computed TCP options to the packet.
@@ -1521,7 +1519,6 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)
        struct tcp_sock *tp = tcp_sk(sk);
        const struct inet_connection_sock *icsk = inet_csk(sk);
        u32 send_win, cong_win, limit, in_flight;
-       int win_divisor;
 
        if (TCP_SKB_CB(skb)->flags & TCPHDR_FIN)
                goto send_now;
@@ -1553,14 +1550,13 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb)
        if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len))
                goto send_now;
 
-       win_divisor = ACCESS_ONCE(sysctl_tcp_tso_win_divisor);
-       if (win_divisor) {
+       if (sysctl_tcp_tso_win_divisor) {
                u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache);
 
                /* If at least some fraction of a window is available,
                 * just use it.
                 */
-               chunk /= win_divisor;
+               chunk /= sysctl_tcp_tso_win_divisor;
                if (limit >= chunk)
                        goto send_now;
        } else {