/* TCP Westwood structure */ struct westwood {
u32 bw_ns_est; /* first bandwidth estimation..not too smoothed 8) */
u32 bw_est; /* bandwidth estimate */
u32 rtt_win_sx; /* here starts a new evaluation... */
u32 bk;
u32 snd_una; /* used for evaluating the number of acked bytes */
u32 cumul_ack;
u32 accounted;
u32 rtt;
u32 rtt_min; /* minimum observed RTT */
u8 first_ack; /* flag which infers that this is the first ack */
u8 reset_rtt_min; /* Reset RTT min to next RTT sample*/
};
/* *@westwood_do_filter *Low-passfilter.Implementedusingconstantcoefficients.
*/ staticinline u32 westwood_do_filter(u32 a, u32 b)
{ return ((7 * a) + b) >> 3;
}
staticvoid westwood_filter(struct westwood *w, u32 delta)
{ /* If the filter is empty fill it with the first sample of bandwidth */ if (w->bw_ns_est == 0 && w->bw_est == 0) {
w->bw_ns_est = w->bk / delta;
w->bw_est = w->bw_ns_est;
} else {
w->bw_ns_est = westwood_do_filter(w->bw_ns_est, w->bk / delta);
w->bw_est = westwood_do_filter(w->bw_est, w->bw_ns_est);
}
}
/* Initialize w->snd_una with the first acked sequence number in order *tofixmismatchbetweentp->snd_unaandw->snd_unaforthefirst *bandwidthsample
*/ if (w->first_ack) {
w->snd_una = tcp_sk(sk)->snd_una;
w->first_ack = 0;
}
/* If cumul_ack is 0 this is a dupack since it's not moving *tp->snd_una.
*/ if (!w->cumul_ack) {
w->accounted += tp->mss_cache;
w->cumul_ack = tp->mss_cache;
}
switch (event) { case CA_EVENT_COMPLETE_CWR:
tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk);
tcp_snd_cwnd_set(tp, tp->snd_ssthresh); break; case CA_EVENT_LOSS:
tp->snd_ssthresh = tcp_westwood_bw_rttmin(sk); /* Update RTT_min when next ack arrives */
w->reset_rtt_min = 1; break; default: /* don't care */ break;
}
}
/* Extract info for Tcp socket info provided via netlink. */ static size_t tcp_westwood_info(struct sock *sk, u32 ext, int *attr, union tcp_cc_info *info)
{ conststruct westwood *ca = inet_csk_ca(sk);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.