tcp: add accessors to read/set tp->snd_cwnd
[platform/kernel/linux-rpi.git] / net / ipv4 / tcp_cubic.c
index 8d2d4d6..af4fc06 100644 (file)
@@ -332,7 +332,7 @@ static void cubictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
                if (!acked)
                        return;
        }
-       bictcp_update(ca, tp->snd_cwnd, acked);
+       bictcp_update(ca, tcp_snd_cwnd(tp), acked);
        tcp_cong_avoid_ai(tp, ca->cnt, acked);
 }
 
@@ -344,13 +344,13 @@ static u32 cubictcp_recalc_ssthresh(struct sock *sk)
        ca->epoch_start = 0;    /* end of epoch */
 
        /* Wmax and fast convergence */
-       if (tp->snd_cwnd < ca->last_max_cwnd && fast_convergence)
-               ca->last_max_cwnd = (tp->snd_cwnd * (BICTCP_BETA_SCALE + beta))
+       if (tcp_snd_cwnd(tp) < ca->last_max_cwnd && fast_convergence)
+               ca->last_max_cwnd = (tcp_snd_cwnd(tp) * (BICTCP_BETA_SCALE + beta))
                        / (2 * BICTCP_BETA_SCALE);
        else
-               ca->last_max_cwnd = tp->snd_cwnd;
+               ca->last_max_cwnd = tcp_snd_cwnd(tp);
 
-       return max((tp->snd_cwnd * beta) / BICTCP_BETA_SCALE, 2U);
+       return max((tcp_snd_cwnd(tp) * beta) / BICTCP_BETA_SCALE, 2U);
 }
 
 static void cubictcp_state(struct sock *sk, u8 new_state)
@@ -411,13 +411,13 @@ static void hystart_update(struct sock *sk, u32 delay)
                                ca->found = 1;
                                pr_debug("hystart_ack_train (%u > %u) delay_min %u (+ ack_delay %u) cwnd %u\n",
                                         now - ca->round_start, threshold,
-                                        ca->delay_min, hystart_ack_delay(sk), tp->snd_cwnd);
+                                        ca->delay_min, hystart_ack_delay(sk), tcp_snd_cwnd(tp));
                                NET_INC_STATS(sock_net(sk),
                                              LINUX_MIB_TCPHYSTARTTRAINDETECT);
                                NET_ADD_STATS(sock_net(sk),
                                              LINUX_MIB_TCPHYSTARTTRAINCWND,
-                                             tp->snd_cwnd);
-                               tp->snd_ssthresh = tp->snd_cwnd;
+                                             tcp_snd_cwnd(tp));
+                               tp->snd_ssthresh = tcp_snd_cwnd(tp);
                        }
                }
        }
@@ -436,8 +436,8 @@ static void hystart_update(struct sock *sk, u32 delay)
                                              LINUX_MIB_TCPHYSTARTDELAYDETECT);
                                NET_ADD_STATS(sock_net(sk),
                                              LINUX_MIB_TCPHYSTARTDELAYCWND,
-                                             tp->snd_cwnd);
-                               tp->snd_ssthresh = tp->snd_cwnd;
+                                             tcp_snd_cwnd(tp));
+                               tp->snd_ssthresh = tcp_snd_cwnd(tp);
                        }
                }
        }
@@ -467,7 +467,7 @@ static void cubictcp_acked(struct sock *sk, const struct ack_sample *sample)
 
        /* hystart triggers when cwnd is larger than some threshold */
        if (!ca->found && tcp_in_slow_start(tp) && hystart &&
-           tp->snd_cwnd >= hystart_low_window)
+           tcp_snd_cwnd(tp) >= hystart_low_window)
                hystart_update(sk, delay);
 }