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

Commit 7faffa1c authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller
Browse files

[TCP]: add tcp_slow_start helper



Move all the code that does linear TCP slowstart to one
inline function to ease later patch to add ABC support.

Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d2abbab
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -765,6 +765,16 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
			    (tp->snd_cwnd >> 2)));
}

/*
 * Linear increase during slow start
 */
static inline void tcp_slow_start(struct tcp_sock *tp)
{
	if (tp->snd_cwnd < tp->snd_cwnd_clamp)
		tp->snd_cwnd++;
}


static inline void tcp_sync_left_out(struct tcp_sock *tp)
{
	if (tp->rx_opt.sack_ok &&
+4 −6
Original line number Diff line number Diff line
@@ -220,11 +220,9 @@ static void bictcp_cong_avoid(struct sock *sk, u32 ack,
	if (!tcp_is_cwnd_limited(sk, in_flight))
		return;

	if (tp->snd_cwnd <= tp->snd_ssthresh) {
		/* In "safe" area, increase. */
		if (tp->snd_cwnd < tp->snd_cwnd_clamp)
			tp->snd_cwnd++;
	} else {
	if (tp->snd_cwnd <= tp->snd_ssthresh)
		tcp_slow_start(tp);
	else {
		bictcp_update(ca, tp->snd_cwnd);

		/* In dangerous area, increase slowly.
+5 −6
Original line number Diff line number Diff line
@@ -189,11 +189,10 @@ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 rtt, u32 in_flight,
	if (!tcp_is_cwnd_limited(sk, in_flight))
		return;

        if (tp->snd_cwnd <= tp->snd_ssthresh) {
	/* In "safe" area, increase. */
		if (tp->snd_cwnd < tp->snd_cwnd_clamp)
			tp->snd_cwnd++;
	} else {
        if (tp->snd_cwnd <= tp->snd_ssthresh)
		tcp_slow_start(tp);
	else {
		/* In dangerous area, increase slowly.
		 * In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd
		 */
+3 −4
Original line number Diff line number Diff line
@@ -119,10 +119,9 @@ static void hstcp_cong_avoid(struct sock *sk, u32 adk, u32 rtt,
	if (!tcp_is_cwnd_limited(sk, in_flight))
		return;

	if (tp->snd_cwnd <= tp->snd_ssthresh) {
		if (tp->snd_cwnd < tp->snd_cwnd_clamp)
			tp->snd_cwnd++;
	} else {
	if (tp->snd_cwnd <= tp->snd_ssthresh)
		tcp_slow_start(tp);
	else {
		/* Update AIMD parameters */
		if (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd) {
			while (tp->snd_cwnd > hstcp_aimd_vals[ca->ai].cwnd &&
+5 −6
Original line number Diff line number Diff line
@@ -210,11 +210,10 @@ static void htcp_cong_avoid(struct sock *sk, u32 ack, u32 rtt,
	if (!tcp_is_cwnd_limited(sk, in_flight))
		return;

        if (tp->snd_cwnd <= tp->snd_ssthresh) {
                /* In "safe" area, increase. */
		if (tp->snd_cwnd < tp->snd_cwnd_clamp)
			tp->snd_cwnd++;
	} else {
        if (tp->snd_cwnd <= tp->snd_ssthresh)
		tcp_slow_start(tp);
	else {

		measure_rtt(sk);

		/* keep track of number of round-trip times since last backoff event */
Loading