- 论坛徽章:
- 0
|
本帖最后由 xiongweixie 于 2011-04-06 10:12 编辑
回复 157# ynchnluiti
谢谢你。我看明白那个公式怎么来的了。根据下面这个函数。化简得 delayed_ack = 15/16*delayed_ack + cnt;
由于 ratio = delayed_ack/ 16; 所以 ratio = 15/16 * ratio + cnt / 16;
/*
* ratio = (15*ratio + sample) / 16
*/
static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt)
{
const struct inet_connection_sock *icsk = inet_csk(sk);
if (icsk->icsk_ca_state == TCP_CA_Open) {
struct bictcp *ca = inet_csk_ca(sk);
cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT; /// ACK_RATIO_SHIFT = 4
ca->delayed_ack += cnt;
}
}
///////////******************************************************************//////////////////////////////////////
还有个问题,
/*
* behave like Reno until low_window is reached,
* then increase congestion window slowly
*/
static u32 bictcp_recalc_ssthresh(struct sock *sk)
{
const struct tcp_sock *tp = tcp_sk(sk);
struct bictcp *ca = inet_csk_ca(sk);
ca->epoch_start = 0; /* end of epoch */
/* Wmax and fast convergence */
if (tp->snd_cwnd < ca->last_max_cwnd && fast_convergence)
ca->last_max_cwnd = (tp->snd_cwnd * (BICTCP_BETA_SCALE + beta))
/ (2 * BICTCP_BETA_SCALE); ///更改last_max_cwnd 的值 = snd_cwnd*(1+ 0.8 )/2
else
ca->last_max_cwnd = tp->snd_cwnd; ///否则 把最大拥塞窗口设为 当前snd_cwnd
ca->loss_cwnd = tp->snd_cwnd;
if (tp->snd_cwnd <= low_window) ///snd_cwnd 小于 low_window,返回 2 或者snd_cwnd/2 中的大值, 常规方法
return max(tp->snd_cwnd >> 1U, 2U);
else
return max((tp->snd_cwnd * beta) / BICTCP_BETA_SCALE, 2U);
}
这个函数是在发生拥塞时调用的吧。是么?
static u32 bictcp_undo_cwnd(struct sock *sk)
{
const struct tcp_sock *tp = tcp_sk(sk);
const struct bictcp *ca = inet_csk_ca(sk);
return max(tp->snd_cwnd, ca->last_max_cwnd);
} //这个也是拥塞时 在bictcp_recalc_ssthresh调用后调用的吧。
那我就有疑问了,bictcp_recalc_ssthresh 将last_max_cwnd置为snd_cwnd 或者 0.9*snd_cwnd。 那么这里的返回max中是不是就永远是返回snd_cwnd了。还是我把调用顺序搞错了。
请你指点一下。谢谢 |
评分
-
查看全部评分
|