Commit 688d1945 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

tcp: whitespace fixes

Fix places where there is space before tab, long lines, and
awkward if(){, double spacing etc. Add blank line after declaration/initialization.
Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d09d3038
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <net/tcp.h> #include <net/tcp.h>
#define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation
* max_cwnd = snd_cwnd * beta * max_cwnd = snd_cwnd * beta
*/ */
...@@ -46,11 +45,10 @@ MODULE_PARM_DESC(initial_ssthresh, "initial value of slow start threshold"); ...@@ -46,11 +45,10 @@ MODULE_PARM_DESC(initial_ssthresh, "initial value of slow start threshold");
module_param(smooth_part, int, 0644); module_param(smooth_part, int, 0644);
MODULE_PARM_DESC(smooth_part, "log(B/(B*Smin))/log(B/(B-1))+B, # of RTT from Wmax-B to Wmax"); MODULE_PARM_DESC(smooth_part, "log(B/(B*Smin))/log(B/(B-1))+B, # of RTT from Wmax-B to Wmax");
/* BIC TCP Parameters */ /* BIC TCP Parameters */
struct bictcp { struct bictcp {
u32 cnt; /* increase cwnd by 1 after ACKs */ u32 cnt; /* increase cwnd by 1 after ACKs */
u32 last_max_cwnd; /* last maximum snd_cwnd */ u32 last_max_cwnd; /* last maximum snd_cwnd */
u32 loss_cwnd; /* congestion window at last loss */ u32 loss_cwnd; /* congestion window at last loss */
u32 last_cwnd; /* the last snd_cwnd */ u32 last_cwnd; /* the last snd_cwnd */
u32 last_time; /* time when updated last_cwnd */ u32 last_time; /* time when updated last_cwnd */
...@@ -103,7 +101,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) ...@@ -103,7 +101,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
/* binary increase */ /* binary increase */
if (cwnd < ca->last_max_cwnd) { if (cwnd < ca->last_max_cwnd) {
__u32 dist = (ca->last_max_cwnd - cwnd) __u32 dist = (ca->last_max_cwnd - cwnd)
/ BICTCP_B; / BICTCP_B;
if (dist > max_increment) if (dist > max_increment)
...@@ -154,7 +152,6 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -154,7 +152,6 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
bictcp_update(ca, tp->snd_cwnd); bictcp_update(ca, tp->snd_cwnd);
tcp_cong_avoid_ai(tp, ca->cnt); tcp_cong_avoid_ai(tp, ca->cnt);
} }
} }
/* /*
...@@ -177,7 +174,6 @@ static u32 bictcp_recalc_ssthresh(struct sock *sk) ...@@ -177,7 +174,6 @@ static u32 bictcp_recalc_ssthresh(struct sock *sk)
ca->loss_cwnd = tp->snd_cwnd; ca->loss_cwnd = tp->snd_cwnd;
if (tp->snd_cwnd <= low_window) if (tp->snd_cwnd <= low_window)
return max(tp->snd_cwnd >> 1U, 2U); return max(tp->snd_cwnd >> 1U, 2U);
else else
...@@ -188,6 +184,7 @@ static u32 bictcp_undo_cwnd(struct sock *sk) ...@@ -188,6 +184,7 @@ static u32 bictcp_undo_cwnd(struct sock *sk)
{ {
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
const struct bictcp *ca = inet_csk_ca(sk); const struct bictcp *ca = inet_csk_ca(sk);
return max(tp->snd_cwnd, ca->loss_cwnd); return max(tp->snd_cwnd, ca->loss_cwnd);
} }
...@@ -206,12 +203,12 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt) ...@@ -206,12 +203,12 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt)
if (icsk->icsk_ca_state == TCP_CA_Open) { if (icsk->icsk_ca_state == TCP_CA_Open) {
struct bictcp *ca = inet_csk_ca(sk); struct bictcp *ca = inet_csk_ca(sk);
cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT; cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT;
ca->delayed_ack += cnt; ca->delayed_ack += cnt;
} }
} }
static struct tcp_congestion_ops bictcp __read_mostly = { static struct tcp_congestion_ops bictcp __read_mostly = {
.init = bictcp_init, .init = bictcp_init,
.ssthresh = bictcp_recalc_ssthresh, .ssthresh = bictcp_recalc_ssthresh,
......
...@@ -142,7 +142,6 @@ static int __init tcp_congestion_default(void) ...@@ -142,7 +142,6 @@ static int __init tcp_congestion_default(void)
} }
late_initcall(tcp_congestion_default); late_initcall(tcp_congestion_default);
/* Build string with list of available congestion control values */ /* Build string with list of available congestion control values */
void tcp_get_available_congestion_control(char *buf, size_t maxlen) void tcp_get_available_congestion_control(char *buf, size_t maxlen)
{ {
...@@ -154,7 +153,6 @@ void tcp_get_available_congestion_control(char *buf, size_t maxlen) ...@@ -154,7 +153,6 @@ void tcp_get_available_congestion_control(char *buf, size_t maxlen)
offs += snprintf(buf + offs, maxlen - offs, offs += snprintf(buf + offs, maxlen - offs,
"%s%s", "%s%s",
offs == 0 ? "" : " ", ca->name); offs == 0 ? "" : " ", ca->name);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -186,7 +184,6 @@ void tcp_get_allowed_congestion_control(char *buf, size_t maxlen) ...@@ -186,7 +184,6 @@ void tcp_get_allowed_congestion_control(char *buf, size_t maxlen)
offs += snprintf(buf + offs, maxlen - offs, offs += snprintf(buf + offs, maxlen - offs,
"%s%s", "%s%s",
offs == 0 ? "" : " ", ca->name); offs == 0 ? "" : " ", ca->name);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -230,7 +227,6 @@ int tcp_set_allowed_congestion_control(char *val) ...@@ -230,7 +227,6 @@ int tcp_set_allowed_congestion_control(char *val)
return ret; return ret;
} }
/* Change congestion control for socket */ /* Change congestion control for socket */
int tcp_set_congestion_control(struct sock *sk, const char *name) int tcp_set_congestion_control(struct sock *sk, const char *name)
{ {
...@@ -337,6 +333,7 @@ EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid); ...@@ -337,6 +333,7 @@ EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid);
u32 tcp_reno_ssthresh(struct sock *sk) u32 tcp_reno_ssthresh(struct sock *sk)
{ {
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
return max(tp->snd_cwnd >> 1U, 2U); return max(tp->snd_cwnd >> 1U, 2U);
} }
EXPORT_SYMBOL_GPL(tcp_reno_ssthresh); EXPORT_SYMBOL_GPL(tcp_reno_ssthresh);
......
...@@ -82,12 +82,13 @@ MODULE_PARM_DESC(hystart_ack_delta, "spacing between ack's indicating train (mse ...@@ -82,12 +82,13 @@ MODULE_PARM_DESC(hystart_ack_delta, "spacing between ack's indicating train (mse
/* BIC TCP Parameters */ /* BIC TCP Parameters */
struct bictcp { struct bictcp {
u32 cnt; /* increase cwnd by 1 after ACKs */ u32 cnt; /* increase cwnd by 1 after ACKs */
u32 last_max_cwnd; /* last maximum snd_cwnd */ u32 last_max_cwnd; /* last maximum snd_cwnd */
u32 loss_cwnd; /* congestion window at last loss */ u32 loss_cwnd; /* congestion window at last loss */
u32 last_cwnd; /* the last snd_cwnd */ u32 last_cwnd; /* the last snd_cwnd */
u32 last_time; /* time when updated last_cwnd */ u32 last_time; /* time when updated last_cwnd */
u32 bic_origin_point;/* origin point of bic function */ u32 bic_origin_point;/* origin point of bic function */
u32 bic_K; /* time to origin point from the beginning of the current epoch */ u32 bic_K; /* time to origin point
from the beginning of the current epoch */
u32 delay_min; /* min delay (msec << 3) */ u32 delay_min; /* min delay (msec << 3) */
u32 epoch_start; /* beginning of an epoch */ u32 epoch_start; /* beginning of an epoch */
u32 ack_cnt; /* number of acks */ u32 ack_cnt; /* number of acks */
...@@ -219,7 +220,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) ...@@ -219,7 +220,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
ca->last_time = tcp_time_stamp; ca->last_time = tcp_time_stamp;
if (ca->epoch_start == 0) { if (ca->epoch_start == 0) {
ca->epoch_start = tcp_time_stamp; /* record the beginning of an epoch */ ca->epoch_start = tcp_time_stamp; /* record beginning */
ca->ack_cnt = 1; /* start counting */ ca->ack_cnt = 1; /* start counting */
ca->tcp_cwnd = cwnd; /* syn with cubic */ ca->tcp_cwnd = cwnd; /* syn with cubic */
...@@ -263,9 +264,9 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) ...@@ -263,9 +264,9 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
/* c/rtt * (t-K)^3 */ /* c/rtt * (t-K)^3 */
delta = (cube_rtt_scale * offs * offs * offs) >> (10+3*BICTCP_HZ); delta = (cube_rtt_scale * offs * offs * offs) >> (10+3*BICTCP_HZ);
if (t < ca->bic_K) /* below origin*/ if (t < ca->bic_K) /* below origin*/
bic_target = ca->bic_origin_point - delta; bic_target = ca->bic_origin_point - delta;
else /* above origin*/ else /* above origin*/
bic_target = ca->bic_origin_point + delta; bic_target = ca->bic_origin_point + delta;
/* cubic function - calc bictcp_cnt*/ /* cubic function - calc bictcp_cnt*/
...@@ -285,13 +286,14 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) ...@@ -285,13 +286,14 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
/* TCP Friendly */ /* TCP Friendly */
if (tcp_friendliness) { if (tcp_friendliness) {
u32 scale = beta_scale; u32 scale = beta_scale;
delta = (cwnd * scale) >> 3; delta = (cwnd * scale) >> 3;
while (ca->ack_cnt > delta) { /* update tcp cwnd */ while (ca->ack_cnt > delta) { /* update tcp cwnd */
ca->ack_cnt -= delta; ca->ack_cnt -= delta;
ca->tcp_cwnd++; ca->tcp_cwnd++;
} }
if (ca->tcp_cwnd > cwnd){ /* if bic is slower than tcp */ if (ca->tcp_cwnd > cwnd) { /* if bic is slower than tcp */
delta = ca->tcp_cwnd - cwnd; delta = ca->tcp_cwnd - cwnd;
max_cnt = cwnd / delta; max_cnt = cwnd / delta;
if (ca->cnt > max_cnt) if (ca->cnt > max_cnt)
...@@ -320,7 +322,6 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -320,7 +322,6 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
bictcp_update(ca, tp->snd_cwnd); bictcp_update(ca, tp->snd_cwnd);
tcp_cong_avoid_ai(tp, ca->cnt); tcp_cong_avoid_ai(tp, ca->cnt);
} }
} }
static u32 bictcp_recalc_ssthresh(struct sock *sk) static u32 bictcp_recalc_ssthresh(struct sock *sk)
...@@ -452,7 +453,8 @@ static int __init cubictcp_register(void) ...@@ -452,7 +453,8 @@ static int __init cubictcp_register(void)
* based on SRTT of 100ms * based on SRTT of 100ms
*/ */
beta_scale = 8*(BICTCP_BETA_SCALE+beta)/ 3 / (BICTCP_BETA_SCALE - beta); beta_scale = 8*(BICTCP_BETA_SCALE+beta) / 3
/ (BICTCP_BETA_SCALE - beta);
cube_rtt_scale = (bic_scale * 10); /* 1024*c/rtt */ cube_rtt_scale = (bic_scale * 10); /* 1024*c/rtt */
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/inet_diag.h> #include <linux/inet_diag.h>
...@@ -35,13 +34,13 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, ...@@ -35,13 +34,13 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
} }
static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, static void tcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
struct inet_diag_req_v2 *r, struct nlattr *bc) struct inet_diag_req_v2 *r, struct nlattr *bc)
{ {
inet_diag_dump_icsk(&tcp_hashinfo, skb, cb, r, bc); inet_diag_dump_icsk(&tcp_hashinfo, skb, cb, r, bc);
} }
static int tcp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh, static int tcp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
struct inet_diag_req_v2 *req) struct inet_diag_req_v2 *req)
{ {
return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req); return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req);
} }
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <net/tcp.h> #include <net/tcp.h>
/* From AIMD tables from RFC 3649 appendix B, /* From AIMD tables from RFC 3649 appendix B,
* with fixed-point MD scaled <<8. * with fixed-point MD scaled <<8.
*/ */
...@@ -17,78 +16,78 @@ static const struct hstcp_aimd_val { ...@@ -17,78 +16,78 @@ static const struct hstcp_aimd_val {
unsigned int cwnd; unsigned int cwnd;
unsigned int md; unsigned int md;
} hstcp_aimd_vals[] = { } hstcp_aimd_vals[] = {
{ 38, 128, /* 0.50 */ }, { 38, 128, /* 0.50 */ },
{ 118, 112, /* 0.44 */ }, { 118, 112, /* 0.44 */ },
{ 221, 104, /* 0.41 */ }, { 221, 104, /* 0.41 */ },
{ 347, 98, /* 0.38 */ }, { 347, 98, /* 0.38 */ },
{ 495, 93, /* 0.37 */ }, { 495, 93, /* 0.37 */ },
{ 663, 89, /* 0.35 */ }, { 663, 89, /* 0.35 */ },
{ 851, 86, /* 0.34 */ }, { 851, 86, /* 0.34 */ },
{ 1058, 83, /* 0.33 */ }, { 1058, 83, /* 0.33 */ },
{ 1284, 81, /* 0.32 */ }, { 1284, 81, /* 0.32 */ },
{ 1529, 78, /* 0.31 */ }, { 1529, 78, /* 0.31 */ },
{ 1793, 76, /* 0.30 */ }, { 1793, 76, /* 0.30 */ },
{ 2076, 74, /* 0.29 */ }, { 2076, 74, /* 0.29 */ },
{ 2378, 72, /* 0.28 */ }, { 2378, 72, /* 0.28 */ },
{ 2699, 71, /* 0.28 */ }, { 2699, 71, /* 0.28 */ },
{ 3039, 69, /* 0.27 */ }, { 3039, 69, /* 0.27 */ },
{ 3399, 68, /* 0.27 */ }, { 3399, 68, /* 0.27 */ },
{ 3778, 66, /* 0.26 */ }, { 3778, 66, /* 0.26 */ },
{ 4177, 65, /* 0.26 */ }, { 4177, 65, /* 0.26 */ },
{ 4596, 64, /* 0.25 */ }, { 4596, 64, /* 0.25 */ },
{ 5036, 62, /* 0.25 */ }, { 5036, 62, /* 0.25 */ },
{ 5497, 61, /* 0.24 */ }, { 5497, 61, /* 0.24 */ },
{ 5979, 60, /* 0.24 */ }, { 5979, 60, /* 0.24 */ },
{ 6483, 59, /* 0.23 */ }, { 6483, 59, /* 0.23 */ },
{ 7009, 58, /* 0.23 */ }, { 7009, 58, /* 0.23 */ },
{ 7558, 57, /* 0.22 */ }, { 7558, 57, /* 0.22 */ },
{ 8130, 56, /* 0.22 */ }, { 8130, 56, /* 0.22 */ },
{ 8726, 55, /* 0.22 */ }, { 8726, 55, /* 0.22 */ },
{ 9346, 54, /* 0.21 */ }, { 9346, 54, /* 0.21 */ },
{ 9991, 53, /* 0.21 */ }, { 9991, 53, /* 0.21 */ },
{ 10661, 52, /* 0.21 */ }, { 10661, 52, /* 0.21 */ },
{ 11358, 52, /* 0.20 */ }, { 11358, 52, /* 0.20 */ },
{ 12082, 51, /* 0.20 */ }, { 12082, 51, /* 0.20 */ },
{ 12834, 50, /* 0.20 */ }, { 12834, 50, /* 0.20 */ },
{ 13614, 49, /* 0.19 */ }, { 13614, 49, /* 0.19 */ },
{ 14424, 48, /* 0.19 */ }, { 14424, 48, /* 0.19 */ },
{ 15265, 48, /* 0.19 */ }, { 15265, 48, /* 0.19 */ },
{ 16137, 47, /* 0.19 */ }, { 16137, 47, /* 0.19 */ },
{ 17042, 46, /* 0.18 */ }, { 17042, 46, /* 0.18 */ },
{ 17981, 45, /* 0.18 */ }, { 17981, 45, /* 0.18 */ },
{ 18955, 45, /* 0.18 */ }, { 18955, 45, /* 0.18 */ },
{ 19965, 44, /* 0.17 */ }, { 19965, 44, /* 0.17 */ },
{ 21013, 43, /* 0.17 */ }, { 21013, 43, /* 0.17 */ },
{ 22101, 43, /* 0.17 */ }, { 22101, 43, /* 0.17 */ },
{ 23230, 42, /* 0.17 */ }, { 23230, 42, /* 0.17 */ },
{ 24402, 41, /* 0.16 */ }, { 24402, 41, /* 0.16 */ },
{ 25618, 41, /* 0.16 */ }, { 25618, 41, /* 0.16 */ },
{ 26881, 40, /* 0.16 */ }, { 26881, 40, /* 0.16 */ },
{ 28193, 39, /* 0.16 */ }, { 28193, 39, /* 0.16 */ },
{ 29557, 39, /* 0.15 */ }, { 29557, 39, /* 0.15 */ },
{ 30975, 38, /* 0.15 */ }, { 30975, 38, /* 0.15 */ },
{ 32450, 38, /* 0.15 */ }, { 32450, 38, /* 0.15 */ },
{ 33986, 37, /* 0.15 */ }, { 33986, 37, /* 0.15 */ },
{ 35586, 36, /* 0.14 */ }, { 35586, 36, /* 0.14 */ },
{ 37253, 36, /* 0.14 */ }, { 37253, 36, /* 0.14 */ },
{ 38992, 35, /* 0.14 */ }, { 38992, 35, /* 0.14 */ },
{ 40808, 35, /* 0.14 */ }, { 40808, 35, /* 0.14 */ },
{ 42707, 34, /* 0.13 */ }, { 42707, 34, /* 0.13 */ },
{ 44694, 33, /* 0.13 */ }, { 44694, 33, /* 0.13 */ },
{ 46776, 33, /* 0.13 */ }, { 46776, 33, /* 0.13 */ },
{ 48961, 32, /* 0.13 */ }, { 48961, 32, /* 0.13 */ },
{ 51258, 32, /* 0.13 */ }, { 51258, 32, /* 0.13 */ },
{ 53677, 31, /* 0.12 */ }, { 53677, 31, /* 0.12 */ },
{ 56230, 30, /* 0.12 */ }, { 56230, 30, /* 0.12 */ },
{ 58932, 30, /* 0.12 */ }, { 58932, 30, /* 0.12 */ },
{ 61799, 29, /* 0.12 */ }, { 61799, 29, /* 0.12 */ },
{ 64851, 28, /* 0.11 */ }, { 64851, 28, /* 0.11 */ },
{ 68113, 28, /* 0.11 */ }, { 68113, 28, /* 0.11 */ },
{ 71617, 27, /* 0.11 */ }, { 71617, 27, /* 0.11 */ },
{ 75401, 26, /* 0.10 */ }, { 75401, 26, /* 0.10 */ },
{ 79517, 26, /* 0.10 */ }, { 79517, 26, /* 0.10 */ },
{ 84035, 25, /* 0.10 */ }, { 84035, 25, /* 0.10 */ },
{ 89053, 24, /* 0.10 */ }, { 89053, 24, /* 0.10 */ },
}; };
#define HSTCP_AIMD_MAX ARRAY_SIZE(hstcp_aimd_vals) #define HSTCP_AIMD_MAX ARRAY_SIZE(hstcp_aimd_vals)
......
...@@ -98,7 +98,8 @@ static inline void measure_rtt(struct sock *sk, u32 srtt) ...@@ -98,7 +98,8 @@ static inline void measure_rtt(struct sock *sk, u32 srtt)
} }
} }
static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, s32 rtt) static void measure_achieved_throughput(struct sock *sk,
u32 pkts_acked, s32 rtt)
{ {
const struct inet_connection_sock *icsk = inet_csk(sk); const struct inet_connection_sock *icsk = inet_csk(sk);
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
...@@ -148,8 +149,8 @@ static inline void htcp_beta_update(struct htcp *ca, u32 minRTT, u32 maxRTT) ...@@ -148,8 +149,8 @@ static inline void htcp_beta_update(struct htcp *ca, u32 minRTT, u32 maxRTT)
if (use_bandwidth_switch) { if (use_bandwidth_switch) {
u32 maxB = ca->maxB; u32 maxB = ca->maxB;
u32 old_maxB = ca->old_maxB; u32 old_maxB = ca->old_maxB;
ca->old_maxB = ca->maxB;
ca->old_maxB = ca->maxB;
if (!between(5 * maxB, 4 * old_maxB, 6 * old_maxB)) { if (!between(5 * maxB, 4 * old_maxB, 6 * old_maxB)) {
ca->beta = BETA_MIN; ca->beta = BETA_MIN;
ca->modeswitch = 0; ca->modeswitch = 0;
...@@ -270,6 +271,7 @@ static void htcp_state(struct sock *sk, u8 new_state) ...@@ -270,6 +271,7 @@ static void htcp_state(struct sock *sk, u8 new_state)
case TCP_CA_Open: case TCP_CA_Open:
{ {
struct htcp *ca = inet_csk_ca(sk); struct htcp *ca = inet_csk_ca(sk);
if (ca->undo_last_cong) { if (ca->undo_last_cong) {
ca->last_cong = jiffies; ca->last_cong = jiffies;
ca->undo_last_cong = 0; ca->undo_last_cong = 0;
......
...@@ -29,7 +29,6 @@ static int rtt0 = 25; ...@@ -29,7 +29,6 @@ static int rtt0 = 25;
module_param(rtt0, int, 0644); module_param(rtt0, int, 0644);
MODULE_PARM_DESC(rtt0, "reference rout trip time (ms)"); MODULE_PARM_DESC(rtt0, "reference rout trip time (ms)");
/* This is called to refresh values for hybla parameters */ /* This is called to refresh values for hybla parameters */
static inline void hybla_recalc_param (struct sock *sk) static inline void hybla_recalc_param (struct sock *sk)
{ {
......
...@@ -284,7 +284,7 @@ static void tcp_illinois_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -284,7 +284,7 @@ static void tcp_illinois_cong_avoid(struct sock *sk, u32 ack, u32 acked)
delta = (tp->snd_cwnd_cnt * ca->alpha) >> ALPHA_SHIFT; delta = (tp->snd_cwnd_cnt * ca->alpha) >> ALPHA_SHIFT;
if (delta >= tp->snd_cwnd) { if (delta >= tp->snd_cwnd) {
tp->snd_cwnd = min(tp->snd_cwnd + delta / tp->snd_cwnd, tp->snd_cwnd = min(tp->snd_cwnd + delta / tp->snd_cwnd,
(u32) tp->snd_cwnd_clamp); (u32)tp->snd_cwnd_clamp);
tp->snd_cwnd_cnt = 0; tp->snd_cwnd_cnt = 0;
} }
} }
...@@ -299,7 +299,6 @@ static u32 tcp_illinois_ssthresh(struct sock *sk) ...@@ -299,7 +299,6 @@ static u32 tcp_illinois_ssthresh(struct sock *sk)
return max(tp->snd_cwnd - ((tp->snd_cwnd * ca->beta) >> BETA_SHIFT), 2U); return max(tp->snd_cwnd - ((tp->snd_cwnd * ca->beta) >> BETA_SHIFT), 2U);
} }
/* Extract info for Tcp socket info provided via netlink. */ /* Extract info for Tcp socket info provided via netlink. */
static void tcp_illinois_info(struct sock *sk, u32 ext, static void tcp_illinois_info(struct sock *sk, u32 ext,
struct sk_buff *skb) struct sk_buff *skb)
......
...@@ -90,7 +90,6 @@ int sysctl_tcp_tw_reuse __read_mostly; ...@@ -90,7 +90,6 @@ int sysctl_tcp_tw_reuse __read_mostly;
int sysctl_tcp_low_latency __read_mostly; int sysctl_tcp_low_latency __read_mostly;
EXPORT_SYMBOL(sysctl_tcp_low_latency); EXPORT_SYMBOL(sysctl_tcp_low_latency);
#ifdef CONFIG_TCP_MD5SIG #ifdef CONFIG_TCP_MD5SIG
static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key, static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
__be32 daddr, __be32 saddr, const struct tcphdr *th); __be32 daddr, __be32 saddr, const struct tcphdr *th);
...@@ -1269,7 +1268,7 @@ struct request_sock_ops tcp_request_sock_ops __read_mostly = { ...@@ -1269,7 +1268,7 @@ struct request_sock_ops tcp_request_sock_ops __read_mostly = {
.send_ack = tcp_v4_reqsk_send_ack, .send_ack = tcp_v4_reqsk_send_ack,
.destructor = tcp_v4_reqsk_destructor, .destructor = tcp_v4_reqsk_destructor,
.send_reset = tcp_v4_send_reset, .send_reset = tcp_v4_send_reset,
.syn_ack_timeout = tcp_syn_ack_timeout, .syn_ack_timeout = tcp_syn_ack_timeout,
}; };
static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = { static const struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = {
...@@ -2183,7 +2182,7 @@ int tcp_seq_open(struct inode *inode, struct file *file) ...@@ -2183,7 +2182,7 @@ int tcp_seq_open(struct inode *inode, struct file *file)
s = ((struct seq_file *)file->private_data)->private; s = ((struct seq_file *)file->private_data)->private;
s->family = afinfo->family; s->family = afinfo->family;
s->last_pos = 0; s->last_pos = 0;
return 0; return 0;
} }
EXPORT_SYMBOL(tcp_seq_open); EXPORT_SYMBOL(tcp_seq_open);
......
...@@ -83,7 +83,6 @@ static struct { ...@@ -83,7 +83,6 @@ static struct {
struct tcp_log *log; struct tcp_log *log;
} tcp_probe; } tcp_probe;
static inline int tcp_probe_used(void) static inline int tcp_probe_used(void)
{ {
return (tcp_probe.head - tcp_probe.tail) & (bufsize - 1); return (tcp_probe.head - tcp_probe.tail) & (bufsize - 1);
...@@ -101,7 +100,6 @@ static inline int tcp_probe_avail(void) ...@@ -101,7 +100,6 @@ static inline int tcp_probe_avail(void)
si4.sin_addr.s_addr = inet->inet_##mem##addr; \ si4.sin_addr.s_addr = inet->inet_##mem##addr; \
} while (0) \ } while (0) \
/* /*
* Hook inserted to be called before each receive packet. * Hook inserted to be called before each receive packet.
* Note: arguments must match tcp_rcv_established()! * Note: arguments must match tcp_rcv_established()!
...@@ -194,8 +192,8 @@ static int tcpprobe_sprint(char *tbuf, int n) ...@@ -194,8 +192,8 @@ static int tcpprobe_sprint(char *tbuf, int n)
return scnprintf(tbuf, n, return scnprintf(tbuf, n,
"%lu.%09lu %pISpc %pISpc %d %#x %#x %u %u %u %u %u\n", "%lu.%09lu %pISpc %pISpc %d %#x %#x %u %u %u %u %u\n",
(unsigned long) tv.tv_sec, (unsigned long)tv.tv_sec,
(unsigned long) tv.tv_nsec, (unsigned long)tv.tv_nsec,
&p->src, &p->dst, p->length, p->snd_nxt, p->snd_una, &p->src, &p->dst, p->length, p->snd_nxt, p->snd_una,
p->snd_cwnd, p->ssthresh, p->snd_wnd, p->srtt, p->rcv_wnd); p->snd_cwnd, p->ssthresh, p->snd_wnd, p->srtt, p->rcv_wnd);
} }
......
...@@ -31,10 +31,10 @@ static void tcp_scalable_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -31,10 +31,10 @@ static void tcp_scalable_cong_avoid(struct sock *sk, u32 ack, u32 acked)
static u32 tcp_scalable_ssthresh(struct sock *sk) static u32 tcp_scalable_ssthresh(struct sock *sk)
{ {
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
return max(tp->snd_cwnd - (tp->snd_cwnd>>TCP_SCALABLE_MD_SCALE), 2U); return max(tp->snd_cwnd - (tp->snd_cwnd>>TCP_SCALABLE_MD_SCALE), 2U);
} }
static struct tcp_congestion_ops tcp_scalable __read_mostly = { static struct tcp_congestion_ops tcp_scalable __read_mostly = {
.ssthresh = tcp_scalable_ssthresh, .ssthresh = tcp_scalable_ssthresh,
.cong_avoid = tcp_scalable_cong_avoid, .cong_avoid = tcp_scalable_cong_avoid,
......
...@@ -51,7 +51,6 @@ MODULE_PARM_DESC(beta, "upper bound of packets in network"); ...@@ -51,7 +51,6 @@ MODULE_PARM_DESC(beta, "upper bound of packets in network");
module_param(gamma, int, 0644); module_param(gamma, int, 0644);
MODULE_PARM_DESC(gamma, "limit on increase (scale by 2)"); MODULE_PARM_DESC(gamma, "limit on increase (scale by 2)");
/* There are several situations when we must "re-start" Vegas: /* There are several situations when we must "re-start" Vegas:
* *
* o when a connection is established * o when a connection is established
...@@ -133,7 +132,6 @@ EXPORT_SYMBOL_GPL(tcp_vegas_pkts_acked); ...@@ -133,7 +132,6 @@ EXPORT_SYMBOL_GPL(tcp_vegas_pkts_acked);
void tcp_vegas_state(struct sock *sk, u8 ca_state) void tcp_vegas_state(struct sock *sk, u8 ca_state)
{ {
if (ca_state == TCP_CA_Open) if (ca_state == TCP_CA_Open)
vegas_enable(sk); vegas_enable(sk);
else else
...@@ -285,7 +283,6 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -285,7 +283,6 @@ static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack, u32 acked)
/* Use normal slow start */ /* Use normal slow start */
else if (tp->snd_cwnd <= tp->snd_ssthresh) else if (tp->snd_cwnd <= tp->snd_ssthresh)
tcp_slow_start(tp, acked); tcp_slow_start(tp, acked);
} }
/* Extract info for Tcp socket info provided via netlink. */ /* Extract info for Tcp socket info provided via netlink. */
......
...@@ -175,7 +175,6 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -175,7 +175,6 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked)
} else } else
tp->snd_cwnd_cnt++; tp->snd_cwnd_cnt++;
} }
} }
if (tp->snd_cwnd < 2) if (tp->snd_cwnd < 2)
tp->snd_cwnd = 2; tp->snd_cwnd = 2;
......
...@@ -42,7 +42,6 @@ struct westwood { ...@@ -42,7 +42,6 @@ struct westwood {
u8 reset_rtt_min; /* Reset RTT min to next RTT sample*/ u8 reset_rtt_min; /* Reset RTT min to next RTT sample*/
}; };
/* TCP Westwood functions and constants */ /* TCP Westwood functions and constants */
#define TCP_WESTWOOD_RTT_MIN (HZ/20) /* 50ms */ #define TCP_WESTWOOD_RTT_MIN (HZ/20) /* 50ms */
#define TCP_WESTWOOD_INIT_RTT (20*HZ) /* maybe too conservative?! */ #define TCP_WESTWOOD_INIT_RTT (20*HZ) /* maybe too conservative?! */
...@@ -153,7 +152,6 @@ static inline void update_rtt_min(struct westwood *w) ...@@ -153,7 +152,6 @@ static inline void update_rtt_min(struct westwood *w)
w->rtt_min = min(w->rtt, w->rtt_min); w->rtt_min = min(w->rtt, w->rtt_min);
} }
/* /*
* @westwood_fast_bw * @westwood_fast_bw
* It is called when we are in fast path. In particular it is called when * It is called when we are in fast path. In particular it is called when
...@@ -208,7 +206,6 @@ static inline u32 westwood_acked_count(struct sock *sk) ...@@ -208,7 +206,6 @@ static inline u32 westwood_acked_count(struct sock *sk)
return w->cumul_ack; return w->cumul_ack;
} }
/* /*
* TCP Westwood * TCP Westwood
* Here limit is evaluated as Bw estimation*RTTmin (for obtaining it * Here limit is evaluated as Bw estimation*RTTmin (for obtaining it
...@@ -219,6 +216,7 @@ static u32 tcp_westwood_bw_rttmin(const struct sock *sk) ...@@ -219,6 +216,7 @@ static u32 tcp_westwood_bw_rttmin(const struct sock *sk)
{ {
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
const struct westwood *w = inet_csk_ca(sk); const struct westwood *w = inet_csk_ca(sk);
return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2); return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2);
} }
...@@ -254,12 +252,12 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event) ...@@ -254,12 +252,12 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event)
} }
} }
/* Extract info for Tcp socket info provided via netlink. */ /* Extract info for Tcp socket info provided via netlink. */
static void tcp_westwood_info(struct sock *sk, u32 ext, static void tcp_westwood_info(struct sock *sk, u32 ext,
struct sk_buff *skb) struct sk_buff *skb)
{ {
const struct westwood *ca = inet_csk_ca(sk); const struct westwood *ca = inet_csk_ca(sk);
if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
struct tcpvegas_info info = { struct tcpvegas_info info = {
.tcpv_enabled = 1, .tcpv_enabled = 1,
...@@ -271,7 +269,6 @@ static void tcp_westwood_info(struct sock *sk, u32 ext, ...@@ -271,7 +269,6 @@ static void tcp_westwood_info(struct sock *sk, u32 ext,
} }
} }
static struct tcp_congestion_ops tcp_westwood __read_mostly = { static struct tcp_congestion_ops tcp_westwood __read_mostly = {
.init = tcp_westwood_init, .init = tcp_westwood_init,
.ssthresh = tcp_reno_ssthresh, .ssthresh = tcp_reno_ssthresh,
......
...@@ -54,10 +54,8 @@ static void tcp_yeah_init(struct sock *sk) ...@@ -54,10 +54,8 @@ static void tcp_yeah_init(struct sock *sk)
/* Ensure the MD arithmetic works. This is somewhat pedantic, /* Ensure the MD arithmetic works. This is somewhat pedantic,
* since I don't think we will see a cwnd this large. :) */ * since I don't think we will see a cwnd this large. :) */
tp->snd_cwnd_clamp = min_t(u32, tp->snd_cwnd_clamp, 0xffffffff/128); tp->snd_cwnd_clamp = min_t(u32, tp->snd_cwnd_clamp, 0xffffffff/128);
} }
static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, s32 rtt_us) static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, s32 rtt_us)
{ {
const struct inet_connection_sock *icsk = inet_csk(sk); const struct inet_connection_sock *icsk = inet_csk(sk);
...@@ -84,7 +82,7 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -84,7 +82,7 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked)
/* Scalable */ /* Scalable */
tp->snd_cwnd_cnt += yeah->pkts_acked; tp->snd_cwnd_cnt += yeah->pkts_acked;
if (tp->snd_cwnd_cnt > min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT)){ if (tp->snd_cwnd_cnt > min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT)) {
if (tp->snd_cwnd < tp->snd_cwnd_clamp) if (tp->snd_cwnd < tp->snd_cwnd_clamp)
tp->snd_cwnd++; tp->snd_cwnd++;
tp->snd_cwnd_cnt = 0; tp->snd_cwnd_cnt = 0;
...@@ -120,7 +118,6 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -120,7 +118,6 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked)
*/ */
if (after(ack, yeah->vegas.beg_snd_nxt)) { if (after(ack, yeah->vegas.beg_snd_nxt)) {
/* We do the Vegas calculations only if we got enough RTT /* We do the Vegas calculations only if we got enough RTT
* samples that we can be reasonably sure that we got * samples that we can be reasonably sure that we got
* at least one RTT sample that wasn't from a delayed ACK. * at least one RTT sample that wasn't from a delayed ACK.
...@@ -189,7 +186,6 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -189,7 +186,6 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked)
} }
yeah->lastQ = queue; yeah->lastQ = queue;
} }
/* Save the extent of the current window so we can use this /* Save the extent of the current window so we can use this
...@@ -205,7 +201,8 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked) ...@@ -205,7 +201,8 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked)
} }
} }
static u32 tcp_yeah_ssthresh(struct sock *sk) { static u32 tcp_yeah_ssthresh(struct sock *sk)
{
const struct tcp_sock *tp = tcp_sk(sk); const struct tcp_sock *tp = tcp_sk(sk);
struct yeah *yeah = inet_csk_ca(sk); struct yeah *yeah = inet_csk_ca(sk);
u32 reduction; u32 reduction;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment