tcp: add accessors to read/set tp->snd_cwnd
[platform/kernel/linux-rpi.git] / net / ipv4 / tcp_highspeed.c
index 349069d..c6de5ce 100644 (file)
@@ -127,22 +127,22 @@ static void hstcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
                 *     snd_cwnd <=
                 *     hstcp_aimd_vals[ca->ai].cwnd
                 */
-               if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) {
-                       while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd &&
+               if (tcp_snd_cwnd(tp) > hstcp_aimd_vals[ca->ai].cwnd) {
+                       while (tcp_snd_cwnd(tp) > hstcp_aimd_vals[ca->ai].cwnd &&
                               ca->ai < HSTCP_AIMD_MAX - 1)
                                ca->ai++;
-               } else if (ca->ai && tp->snd_cwnd <= hstcp_aimd_vals[ca->ai-1].cwnd) {
-                       while (ca->ai && tp->snd_cwnd <= hstcp_aimd_vals[ca->ai-1].cwnd)
+               } else if (ca->ai && tcp_snd_cwnd(tp) <= hstcp_aimd_vals[ca->ai-1].cwnd) {
+                       while (ca->ai && tcp_snd_cwnd(tp) <= hstcp_aimd_vals[ca->ai-1].cwnd)
                                ca->ai--;
                }
 
                /* Do additive increase */
-               if (tp->snd_cwnd < tp->snd_cwnd_clamp) {
+               if (tcp_snd_cwnd(tp) < tp->snd_cwnd_clamp) {
                        /* cwnd = cwnd + a(w) / cwnd */
                        tp->snd_cwnd_cnt += ca->ai + 1;
-                       if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
-                               tp->snd_cwnd_cnt -= tp->snd_cwnd;
-                               tp->snd_cwnd++;
+                       if (tp->snd_cwnd_cnt >= tcp_snd_cwnd(tp)) {
+                               tp->snd_cwnd_cnt -= tcp_snd_cwnd(tp);
+                               tcp_snd_cwnd_set(tp, tcp_snd_cwnd(tp) + 1);
                        }
                }
        }
@@ -154,7 +154,7 @@ static u32 hstcp_ssthresh(struct sock *sk)
        struct hstcp *ca = inet_csk_ca(sk);
 
        /* Do multiplicative decrease */
-       return max(tp->snd_cwnd - ((tp->snd_cwnd * hstcp_aimd_vals[ca->ai].md) >> 8), 2U);
+       return max(tcp_snd_cwnd(tp) - ((tcp_snd_cwnd(tp) * hstcp_aimd_vals[ca->ai].md) >> 8), 2U);
 }
 
 static struct tcp_congestion_ops tcp_highspeed __read_mostly = {