Commit 562d6b23 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[TCP]: BIC tcp congestion calculation timestamp

Small change to bictcp based on the BIC 1.1 patches for web100.
Keep track of last time congestion was computed, and recompute
if cwnd changes or every 1/32 of a second.

Also changes the initialization location for the parameters.
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent 7ce6d8be
......@@ -420,6 +420,7 @@ struct tcp_opt {
__u32 cnt; /* increase cwnd by 1 after this number of ACKs */
__u32 last_max_cwnd; /* last maximium snd_cwnd */
__u32 last_cwnd; /* the last snd_cwnd */
__u32 last_stamp; /* time when updated last_cwnd */
} bictcp;
};
......
......@@ -330,6 +330,15 @@ static void tcp_init_buffer_space(struct sock *sk)
tp->snd_cwnd_stamp = tcp_time_stamp;
}
static void init_bictcp(struct tcp_opt *tp)
{
tp->bictcp.cnt = 0;
tp->bictcp.last_max_cwnd = 0;
tp->bictcp.last_cwnd = 0;
tp->bictcp.last_stamp = 0;
}
/* 5. Recalculate window clamp after socket hit its memory bounds. */
static void tcp_clamp_window(struct sock *sk, struct tcp_opt *tp)
{
......@@ -1233,6 +1242,8 @@ static void tcp_enter_frto_loss(struct sock *sk)
tcp_set_ca_state(tp, TCP_CA_Loss);
tp->high_seq = tp->frto_highmark;
TCP_ECN_queue_cwr(tp);
init_bictcp(tp);
}
void tcp_clear_retrans(struct tcp_opt *tp)
......@@ -2011,10 +2022,12 @@ static inline __u32 bictcp_cwnd(struct tcp_opt *tp)
if (!sysctl_tcp_bic)
return tp->snd_cwnd;
if (tp->bictcp.last_cwnd == tp->snd_cwnd)
return tp->bictcp.cnt; /* same cwnd, no update */
if (tp->bictcp.last_cwnd == tp->snd_cwnd &&
(s32)(tcp_time_stamp - tp->bictcp.last_stamp) <= (HZ>>5))
return tp->bictcp.cnt;
tp->bictcp.last_cwnd = tp->snd_cwnd;
tp->bictcp.last_stamp = tcp_time_stamp;
/* start off normal */
if (tp->snd_cwnd <= sysctl_tcp_bic_low_window)
......@@ -4612,6 +4625,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
return 1;
init_westwood(sk);
init_bictcp(tp);
/* Now we have several options: In theory there is
* nothing else in the frame. KA9Q has an option to
......@@ -4635,6 +4649,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
case TCP_SYN_SENT:
init_westwood(sk);
init_bictcp(tp);
queued = tcp_rcv_synsent_state_process(sk, skb, th, len);
if (queued >= 0)
......
......@@ -767,9 +767,6 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req,
newtp->snd_cwnd = 2;
newtp->snd_cwnd_cnt = 0;
newtp->bictcp.cnt = 0;
newtp->bictcp.last_max_cwnd = newtp->bictcp.last_cwnd = 0;
newtp->frto_counter = 0;
newtp->frto_highmark = 0;
......
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