aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_bic.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_bic.c')
-rw-r--r--net/ipv4/tcp_bic.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c
index d5de69bc04f5..bb395d46a389 100644
--- a/net/ipv4/tcp_bic.c
+++ b/net/ipv4/tcp_bic.c
@@ -17,7 +17,6 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <net/tcp.h> 18#include <net/tcp.h>
19 19
20
21#define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation 20#define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation
22 * max_cwnd = snd_cwnd * beta 21 * max_cwnd = snd_cwnd * beta
23 */ 22 */
@@ -46,11 +45,10 @@ MODULE_PARM_DESC(initial_ssthresh, "initial value of slow start threshold");
46module_param(smooth_part, int, 0644); 45module_param(smooth_part, int, 0644);
47MODULE_PARM_DESC(smooth_part, "log(B/(B*Smin))/log(B/(B-1))+B, # of RTT from Wmax-B to Wmax"); 46MODULE_PARM_DESC(smooth_part, "log(B/(B*Smin))/log(B/(B-1))+B, # of RTT from Wmax-B to Wmax");
48 47
49
50/* BIC TCP Parameters */ 48/* BIC TCP Parameters */
51struct bictcp { 49struct bictcp {
52 u32 cnt; /* increase cwnd by 1 after ACKs */ 50 u32 cnt; /* increase cwnd by 1 after ACKs */
53 u32 last_max_cwnd; /* last maximum snd_cwnd */ 51 u32 last_max_cwnd; /* last maximum snd_cwnd */
54 u32 loss_cwnd; /* congestion window at last loss */ 52 u32 loss_cwnd; /* congestion window at last loss */
55 u32 last_cwnd; /* the last snd_cwnd */ 53 u32 last_cwnd; /* the last snd_cwnd */
56 u32 last_time; /* time when updated last_cwnd */ 54 u32 last_time; /* time when updated last_cwnd */
@@ -103,7 +101,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
103 101
104 /* binary increase */ 102 /* binary increase */
105 if (cwnd < ca->last_max_cwnd) { 103 if (cwnd < ca->last_max_cwnd) {
106 __u32 dist = (ca->last_max_cwnd - cwnd) 104 __u32 dist = (ca->last_max_cwnd - cwnd)
107 / BICTCP_B; 105 / BICTCP_B;
108 106
109 if (dist > max_increment) 107 if (dist > max_increment)
@@ -154,7 +152,6 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
154 bictcp_update(ca, tp->snd_cwnd); 152 bictcp_update(ca, tp->snd_cwnd);
155 tcp_cong_avoid_ai(tp, ca->cnt); 153 tcp_cong_avoid_ai(tp, ca->cnt);
156 } 154 }
157
158} 155}
159 156
160/* 157/*
@@ -177,7 +174,6 @@ static u32 bictcp_recalc_ssthresh(struct sock *sk)
177 174
178 ca->loss_cwnd = tp->snd_cwnd; 175 ca->loss_cwnd = tp->snd_cwnd;
179 176
180
181 if (tp->snd_cwnd <= low_window) 177 if (tp->snd_cwnd <= low_window)
182 return max(tp->snd_cwnd >> 1U, 2U); 178 return max(tp->snd_cwnd >> 1U, 2U);
183 else 179 else
@@ -188,6 +184,7 @@ static u32 bictcp_undo_cwnd(struct sock *sk)
188{ 184{
189 const struct tcp_sock *tp = tcp_sk(sk); 185 const struct tcp_sock *tp = tcp_sk(sk);
190 const struct bictcp *ca = inet_csk_ca(sk); 186 const struct bictcp *ca = inet_csk_ca(sk);
187
191 return max(tp->snd_cwnd, ca->loss_cwnd); 188 return max(tp->snd_cwnd, ca->loss_cwnd);
192} 189}
193 190
@@ -206,12 +203,12 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt)
206 203
207 if (icsk->icsk_ca_state == TCP_CA_Open) { 204 if (icsk->icsk_ca_state == TCP_CA_Open) {
208 struct bictcp *ca = inet_csk_ca(sk); 205 struct bictcp *ca = inet_csk_ca(sk);
206
209 cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT; 207 cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT;
210 ca->delayed_ack += cnt; 208 ca->delayed_ack += cnt;
211 } 209 }
212} 210}
213 211
214
215static struct tcp_congestion_ops bictcp __read_mostly = { 212static struct tcp_congestion_ops bictcp __read_mostly = {
216 .init = bictcp_init, 213 .init = bictcp_init,
217 .ssthresh = bictcp_recalc_ssthresh, 214 .ssthresh = bictcp_recalc_ssthresh,