tcp: whitespace fixes
Subsystems (3)
PATCH v2 1/1 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 Stephen Hemminger <[email protected]>
---
v2 get rid of unnecessary double spacing
net/ipv4/tcp_bic.c | 11 +-- net/ipv4/tcp_cong.c | 5 - net/ipv4/tcp_cubic.c | 18 +++-- net/ipv4/tcp_diag.c | 5 - net/ipv4/tcp_highspeed.c | 145 +++++++++++++++++++++++------------------------ net/ipv4/tcp_htcp.c | 6 + net/ipv4/tcp_hybla.c | 1 net/ipv4/tcp_illinois.c | 3 net/ipv4/tcp_ipv4.c | 5 - net/ipv4/tcp_probe.c | 6 - net/ipv4/tcp_scalable.c | 2 net/ipv4/tcp_vegas.c | 3 net/ipv4/tcp_veno.c | 1 net/ipv4/tcp_westwood.c | 7 -- net/ipv4/tcp_yeah.c | 9 -- 15 files changed, 104 insertions(+), 123 deletions(-)
net/ipv4/tcp_bic.c +4 -7
@@ -17,7 +17,6 @@#include <linux/module.h> #include <net/tcp.h> -#define BICTCP_BETA_SCALE 1024/* Scale factor beta calculation * max_cwnd = snd_cwnd * beta */
@@ -46,11 +45,10 @@ MODULE_PARM_DESC(initial_ssthresh, "initmodule_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" ); -/* BIC TCP Parameters */ struct bictcp {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 last_cwnd;/* the last snd_cwnd */ u32 last_time;/* time when updated last_cwnd */
@@ -103,7 +101,7 @@ static inline void bictcp_update(struct/* binary increase */ if (cwnd < ca->last_max_cwnd) { -__u32 dist = (ca->last_max_cwnd - cwnd) +__u32 dist = (ca->last_max_cwnd - cwnd) /BICTCP_B ;if (dist > max_increment)
@@ -154,7 +152,6 @@ static void bictcp_cong_avoid(struct socbictcp_update (ca, tp->snd_cwnd);tcp_cong_avoid_ai (tp, ca->cnt); } - }/*
@@ -177,7 +174,6 @@ static u32 bictcp_recalc_ssthresh(struct ca->loss_cwnd = tp->snd_cwnd; -if (tp->snd_cwnd <= low_window)return max (tp->snd_cwnd >>1U ,2U );else
@@ -188,6 +184,7 @@ static u32 bictcp_undo_cwnd(struct sock {const struct tcp_sock *tp =tcp_sk (sk);const struct bictcp *ca =inet_csk_ca (sk); +return max (tp->snd_cwnd, ca->loss_cwnd); }
@@ -206,12 +203,12 @@ static void bictcp_acked(struct sock *skif (icsk->icsk_ca_state == TCP_CA_Open) {struct bictcp *ca =inet_csk_ca (sk); + cnt -= ca->delayed_ack >>ACK_RATIO_SHIFT ; ca->delayed_ack += cnt; } } -static struct tcp_congestion_ops bictcp__read_mostly = { .init = bictcp_init, .ssthresh = bictcp_recalc_ssthresh,
net/ipv4/tcp_cubic.c +10 -8
@@ -82,12 +82,13 @@ MODULE_PARM_DESC(hystart_ack_delta, "spa/* BIC TCP Parameters */ struct bictcp {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 last_cwnd;/* the last snd_cwnd */ u32 last_time;/* time when updated last_cwnd */ 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 epoch_start;/* beginning of an epoch */ u32 ack_cnt;/* number of acks */
@@ -219,7 +220,7 @@ static inline void bictcp_update(struct ca->last_time = tcp_time_stamp;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->tcp_cwnd = cwnd;/* syn with cubic */
@@ -263,9 +264,9 @@ static inline void bictcp_update(struct/* c/rtt * (t-K)^3 */ 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; -else /* above origin*/ +else /* above origin*/ bic_target = ca->bic_origin_point + delta;/* cubic function - calc bictcp_cnt*/
@@ -285,13 +286,14 @@ static inline void bictcp_update(struct/* TCP Friendly */ if (tcp_friendliness) {u32 scale = beta_scale; + delta = (cwnd * scale) >>3 ;while (ca->ack_cnt > delta) {/* update tcp cwnd */ ca->ack_cnt -= delta; 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; max_cnt = cwnd / delta;if (ca->cnt > max_cnt)
@@ -320,7 +322,6 @@ static void bictcp_cong_avoid(struct socbictcp_update (ca, tp->snd_cwnd);tcp_cong_avoid_ai (tp, ca->cnt); } - }static u32 bictcp_recalc_ssthresh (struct sock *sk)
@@ -452,7 +453,8 @@ static int __init cubictcp_register(void* 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 */
net/ipv4/tcp_yeah.c +3 -6
@@ -54,10 +54,8 @@ static void tcp_yeah_init(struct sock *s/* Ensure the MD arithmetic works. This is somewhat pedantic, * 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 ); - } -static void tcp_yeah_pkts_acked (struct sock *sk,u32 pkts_acked,s32 rtt_us) {const struct inet_connection_sock *icsk =inet_csk (sk);
@@ -84,7 +82,7 @@ static void tcp_yeah_cong_avoid(struct s/* Scalable */ 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) tp->snd_cwnd++; tp->snd_cwnd_cnt =0 ;
@@ -120,7 +118,6 @@ static void tcp_yeah_cong_avoid(struct s*/ if (after (ack, yeah->vegas.beg_snd_nxt)) { -/* We do the Vegas calculations only if we got enough RTT * samples that we can be reasonably sure that we got * at least one RTT sample that wasn't from a delayed ACK.
@@ -189,7 +186,6 @@ static void tcp_yeah_cong_avoid(struct s } yeah->lastQ = queue; - }/* Save the extent of the current window so we can use this
@@ -205,7 +201,8 @@ static void tcp_yeah_cong_avoid(struct s } } -static u32 tcp_yeah_ssthresh (struct sock *sk) { +static u32 tcp_yeah_ssthresh (struct sock *sk) +{const struct tcp_sock *tp =tcp_sk (sk);struct yeah *yeah =inet_csk_ca (sk);u32 reduction;
net/ipv4/tcp_cong.c +1 -4
@@ -142,7 +142,6 @@ static int __init tcp_congestion_default }late_initcall (tcp_congestion_default); -/* Build string with list of available congestion control values */ void tcp_get_available_congestion_control (char *buf,size_t maxlen) {
@@ -154,7 +153,6 @@ void tcp_get_available_congestion_contro offs +=snprintf (buf + offs, maxlen - offs,"%s%s" , offs ==0 ?"" :" " , ca->name); - }rcu_read_unlock (); }
@@ -186,7 +184,6 @@ void tcp_get_allowed_congestion_control( offs +=snprintf (buf + offs, maxlen - offs,"%s%s" , offs ==0 ?"" :" " , ca->name); - }rcu_read_unlock (); }
@@ -230,7 +227,6 @@ out:return ret; } -/* Change congestion control for socket */ int tcp_set_congestion_control (struct sock *sk,const char *name) {
@@ -337,6 +333,7 @@ EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid);u32 tcp_reno_ssthresh (struct sock *sk) {const struct tcp_sock *tp =tcp_sk (sk); +return max (tp->snd_cwnd >>1U ,2U ); }EXPORT_SYMBOL_GPL (tcp_reno_ssthresh);
net/ipv4/tcp_diag.c +2 -3
@@ -9,7 +9,6 @@* 2 of the License, or (at your option) any later version. */ -#include <linux/module.h> #include <linux/inet_diag.h>
@@ -35,13 +34,13 @@ static void tcp_diag_get_info(struct soc }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); }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); }
net/ipv4/tcp_highspeed.c +72 -73
157 lines not on this page · raw message
net/ipv4/tcp_htcp.c +4 -2
@@ -98,7 +98,8 @@ static inline void measure_rtt(struct so } } -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 tcp_sock *tp =tcp_sk (sk);
@@ -148,8 +149,8 @@ static inline void htcp_beta_update(struif (use_bandwidth_switch) {u32 maxB = ca->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)) { ca->beta =BETA_MIN ; ca->modeswitch =0 ;
@@ -270,6 +271,7 @@ static void htcp_state(struct sock *sk,case TCP_CA_Open: {struct htcp *ca =inet_csk_ca (sk); +if (ca->undo_last_cong) { ca->last_cong = jiffies; ca->undo_last_cong =0 ;
net/ipv4/tcp_hybla.c +0 -1
@@ -29,7 +29,6 @@ static int rtt0 = 25;module_param (rtt0, int,0644 );MODULE_PARM_DESC (rtt0,"reference rout trip time (ms)" ); -/* This is called to refresh values for hybla parameters */ static inline void hybla_recalc_param (struct sock *sk) {
net/ipv4/tcp_illinois.c +1 -2
@@ -284,7 +284,7 @@ static void tcp_illinois_cong_avoid(stru delta = (tp->snd_cwnd_cnt * ca->alpha) >>ALPHA_SHIFT ;if (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 ; } }
@@ -299,7 +299,6 @@ static u32 tcp_illinois_ssthresh(structreturn max (tp->snd_cwnd - ((tp->snd_cwnd * ca->beta) >>BETA_SHIFT ),2U ); } -/* Extract info for Tcp socket info provided via netlink. */ static void tcp_illinois_info (struct sock *sk,u32 ext,struct sk_buff *skb)
net/ipv4/tcp_ipv4.c +2 -3
@@ -90,7 +90,6 @@ int sysctl_tcp_tw_reuse __read_mostly;int sysctl_tcp_low_latency__read_mostly ;EXPORT_SYMBOL (sysctl_tcp_low_latency); -#ifdef CONFIG_TCP_MD5SIG static int tcp_v4_md5_hash_hdr (char *md5_hash,const struct tcp_md5sig_key *key,__be32 daddr,__be32 saddr,const struct tcphdr *th);
@@ -1269,7 +1268,7 @@ struct request_sock_ops tcp_request_sock .send_ack = tcp_v4_reqsk_send_ack, .destructor = tcp_v4_reqsk_destructor, .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 = {
@@ -2183,7 +2182,7 @@ int tcp_seq_open(struct inode *inode, st s = ((struct seq_file *)file->private_data)->private; s->family = afinfo->family; - s->last_pos =0 ; + s->last_pos =0 ;return 0 ; }EXPORT_SYMBOL (tcp_seq_open);
net/ipv4/tcp_probe.c +2 -4
@@ -83,7 +83,6 @@ static struct {struct tcp_log *log; } tcp_probe; -static inline int tcp_probe_used (void ) {return (tcp_probe.head - tcp_probe.tail) & (bufsize -1 );
@@ -101,7 +100,6 @@ static inline int tcp_probe_avail(void) si4.sin_addr.s_addr = inet->inet_##mem##addr; \ }while (0 ) \ -/* * Hook inserted to be called before each receive packet. * Note: arguments must match tcp_rcv_established()!
@@ -194,8 +192,8 @@ static int tcpprobe_sprint(char *tbuf, ireturn scnprintf (tbuf, n,"%lu.%09lu %pISpc %pISpc %d %#x %#x %u %u %u %u %u\n" , - (unsigned long ) tv.tv_sec, - (unsigned long ) tv.tv_nsec, + (unsigned long )tv.tv_sec, + (unsigned long )tv.tv_nsec, &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); }
net/ipv4/tcp_scalable.c +1 -1
@@ -31,10 +31,10 @@ static void tcp_scalable_cong_avoid(strustatic u32 tcp_scalable_ssthresh (struct sock *sk) {const struct tcp_sock *tp =tcp_sk (sk); +return max (tp->snd_cwnd - (tp->snd_cwnd>>TCP_SCALABLE_MD_SCALE ),2U ); } -static struct tcp_congestion_ops tcp_scalable__read_mostly = { .ssthresh = tcp_scalable_ssthresh, .cong_avoid = tcp_scalable_cong_avoid,
net/ipv4/tcp_westwood.c +2 -5
@@ -42,7 +42,6 @@ struct westwood {u8 reset_rtt_min;/* Reset RTT min to next RTT sample*/ }; -/* TCP Westwood functions and constants */ #define TCP_WESTWOOD_RTT_MIN (HZ/20)/* 50ms */ #define TCP_WESTWOOD_INIT_RTT (20*HZ)/* maybe too conservative?! */
@@ -153,7 +152,6 @@ static inline void update_rtt_min(struct w->rtt_min =min (w->rtt, w->rtt_min); } -/* * @westwood_fast_bw * 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(sreturn w->cumul_ack; } -/* * TCP Westwood * Here limit is evaluated as Bw estimation*RTTmin (for obtaining it
@@ -219,6 +216,7 @@ static u32 tcp_westwood_bw_rttmin(const {const struct tcp_sock *tp =tcp_sk (sk);const struct westwood *w =inet_csk_ca (sk); +return max_t (u32, (w->bw_est * w->rtt_min) / tp->mss_cache,2 ); }
@@ -254,12 +252,12 @@ static void tcp_westwood_event(struct so } } -/* Extract info for Tcp socket info provided via netlink. */ static void tcp_westwood_info (struct sock *sk,u32 ext,struct sk_buff *skb) {const struct westwood *ca =inet_csk_ca (sk); +if (ext & (1 << (INET_DIAG_VEGASINFO -1 ))) {struct tcpvegas_info info = { .tcpv_enabled = 1,
@@ -271,7 +269,6 @@ static void tcp_westwood_info(struct soc } } -static struct tcp_congestion_ops tcp_westwood__read_mostly = { .init = tcp_westwood_init, .ssthresh = tcp_reno_ssthresh,
net/ipv4/tcp_vegas.c +0 -3
@@ -51,7 +51,6 @@ MODULE_PARM_DESC(beta, "upper bound of pmodule_param (gamma, int,0644 );MODULE_PARM_DESC (gamma,"limit on increase (scale by 2)" ); -/* There are several situations when we must "re-start" Vegas: * * o when a connection is established
@@ -133,7 +132,6 @@ EXPORT_SYMBOL_GPL(tcp_vegas_pkts_acked);void tcp_vegas_state (struct sock *sk,u8 ca_state) { -if (ca_state == TCP_CA_Open)vegas_enable (sk);else
@@ -285,7 +283,6 @@ static void tcp_vegas_cong_avoid(struct/* Use normal slow start */ else if (tp->snd_cwnd <= tp->snd_ssthresh) tcp_slow_start(tp, acked); - }/* Extract info for Tcp socket info provided via netlink. */
net/ipv4/tcp_veno.c +0 -1
@@ -175,7 +175,6 @@ static void tcp_veno_cong_avoid(struct s }else tp->snd_cwnd_cnt++; } - }if (tp->snd_cwnd <2 ) tp->snd_cwnd =2 ;
From: Stephen Hemminger <[email protected]>
Date: Fri, 29 Aug 2014 23:32:05 -0700
Quoted 7 lines
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 Stephen Hemminger <[email protected]>---
v2 get rid of unnecessary double spacing
Applied, thanks Stephen.