X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Fipv4%2Ftcp_westwood.c;h=e61e09dd513ed55c618ce5e7582ead8c9b99a4e1;hb=9f5577d8158d8190174d95cbf21713251cc8a044;hp=4247da1384bfb25487b51add257cb8d852ec8327;hpb=c0897856553d45aee1780bed455b7c2e888dd64b;p=linux-2.6-omap-h63xx.git diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c index 4247da1384b..e61e09dd513 100644 --- a/net/ipv4/tcp_westwood.c +++ b/net/ipv4/tcp_westwood.c @@ -21,7 +21,6 @@ * ssthresh after packet loss. The probing phase is as the original Reno. */ -#include #include #include #include @@ -64,10 +63,10 @@ static void tcp_westwood_init(struct sock *sk) struct westwood *w = inet_csk_ca(sk); w->bk = 0; - w->bw_ns_est = 0; - w->bw_est = 0; - w->accounted = 0; - w->cumul_ack = 0; + w->bw_ns_est = 0; + w->bw_est = 0; + w->accounted = 0; + w->cumul_ack = 0; w->reset_rtt_min = 1; w->rtt_min = w->rtt = TCP_WESTWOOD_INIT_RTT; w->rtt_win_sx = tcp_time_stamp; @@ -101,7 +100,7 @@ static void westwood_filter(struct westwood *w, u32 delta) * Called after processing group of packets. * but all westwood needs is the last sample of srtt. */ -static void tcp_westwood_pkts_acked(struct sock *sk, u32 cnt) +static void tcp_westwood_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) { struct westwood *w = inet_csk_ca(sk); if (cnt > 0) @@ -122,7 +121,7 @@ static void westwood_update_window(struct sock *sk) * to fix mismatch between tp->snd_una and w->snd_una for the first * bandwidth sample */ - if (w->first_ack) { + if (w->first_ack) { w->snd_una = tcp_sk(sk)->snd_una; w->first_ack = 0; } @@ -148,7 +147,7 @@ static inline void update_rtt_min(struct westwood *w) { if (w->reset_rtt_min) { w->rtt_min = w->rtt; - w->reset_rtt_min = 0; + w->reset_rtt_min = 0; } else w->rtt_min = min(w->rtt, w->rtt_min); } @@ -184,15 +183,15 @@ static inline u32 westwood_acked_count(struct sock *sk) w->cumul_ack = tp->snd_una - w->snd_una; - /* If cumul_ack is 0 this is a dupack since it's not moving - * tp->snd_una. - */ - if (!w->cumul_ack) { + /* If cumul_ack is 0 this is a dupack since it's not moving + * tp->snd_una. + */ + if (!w->cumul_ack) { w->accounted += tp->mss_cache; w->cumul_ack = tp->mss_cache; } - if (w->cumul_ack > tp->mss_cache) { + if (w->cumul_ack > tp->mss_cache) { /* Partial or delayed ack */ if (w->accounted >= w->cumul_ack) { w->accounted -= w->cumul_ack; @@ -227,7 +226,7 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event) struct tcp_sock *tp = tcp_sk(sk); struct westwood *w = inet_csk_ca(sk); - switch(event) { + switch (event) { case CA_EVENT_FAST_ACK: westwood_fast_bw(sk); break; @@ -238,7 +237,7 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event) case CA_EVENT_FRTO: tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk); - /* Update RTT_min when next ack arrives */ + /* Update RTT_min when next ack arrives */ w->reset_rtt_min = 1; break; @@ -261,16 +260,13 @@ static void tcp_westwood_info(struct sock *sk, u32 ext, { const struct westwood *ca = inet_csk_ca(sk); if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) { - struct rtattr *rta; - struct tcpvegas_info *info; - - rta = __RTA_PUT(skb, INET_DIAG_VEGASINFO, sizeof(*info)); - info = RTA_DATA(rta); - info->tcpv_enabled = 1; - info->tcpv_rttcnt = 0; - info->tcpv_rtt = jiffies_to_usecs(ca->rtt); - info->tcpv_minrtt = jiffies_to_usecs(ca->rtt_min); - rtattr_failure: ; + struct tcpvegas_info info = { + .tcpv_enabled = 1, + .tcpv_rtt = jiffies_to_usecs(ca->rtt), + .tcpv_minrtt = jiffies_to_usecs(ca->rtt_min), + }; + + nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info); } } @@ -290,7 +286,7 @@ static struct tcp_congestion_ops tcp_westwood = { static int __init tcp_westwood_register(void) { - BUG_ON(sizeof(struct westwood) > ICSK_CA_PRIV_SIZE); + BUILD_BUG_ON(sizeof(struct westwood) > ICSK_CA_PRIV_SIZE); return tcp_register_congestion_control(&tcp_westwood); }