Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9f4fbaf authored by Jiri Kosina's avatar Jiri Kosina Committed by David S. Miller
Browse files

tcp: cleanup of cwnd initialization in tcp_init_metrics()



Commit 86bcebaf ("tcp: fix >2 iw selection") fixed a case
when congestion window initialization has been mistakenly omitted
by introducing cwnd label and putting backwards goto from the
end of the function.

This makes the code unnecessarily tricky to read and understand
on a first sight.

Shuffle the code around a little bit to make it more obvious.

Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f622691c
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
@@ -916,14 +916,7 @@ static void tcp_init_metrics(struct sock *sk)
		tp->mdev_max = tp->rttvar = max(tp->mdev, tcp_rto_min(sk));
	}
	tcp_set_rto(sk);
	if (inet_csk(sk)->icsk_rto < TCP_TIMEOUT_INIT && !tp->rx_opt.saw_tstamp)
		goto reset;

cwnd:
	tp->snd_cwnd = tcp_init_cwnd(tp, dst);
	tp->snd_cwnd_stamp = tcp_time_stamp;
	return;

	if (inet_csk(sk)->icsk_rto < TCP_TIMEOUT_INIT && !tp->rx_opt.saw_tstamp) {
reset:
		/* Play conservative. If timestamps are not
		 * supported, TCP will fail to recalculate correct
@@ -934,7 +927,9 @@ reset:
			tp->mdev = tp->mdev_max = tp->rttvar = TCP_TIMEOUT_INIT;
			inet_csk(sk)->icsk_rto = TCP_TIMEOUT_INIT;
		}
	goto cwnd;
	}
	tp->snd_cwnd = tcp_init_cwnd(tp, dst);
	tp->snd_cwnd_stamp = tcp_time_stamp;
}

static void tcp_update_reordering(struct sock *sk, const int metric,