module_param(alpha, int, 0644);
MODULE_PARM_DESC(alpha, "lower bound of packets in network");
module_param(beta, int, 0644);
MODULE_PARM_DESC(beta, "upper bound of packets in network");
module_param(gamma, int, 0644);
MODULE_PARM_DESC(gamma, "limit on increase (scale by 2)");
/* There are several situations when we must "re-start" Vegas: * *owhenaconnectionisestablished *oafteranRTO *oafterfastrecovery *owhenwesendapacketandthereisnooutstanding *unacknowledgeddata(restartinganidleconnection) * *InthesecircumstanceswecannotdoaVegascalculationatthe *endofthefirstRTT,becauseanycalculationwedoisusing *staleinfo--boththesavedcwndandcongestionfeedbackare *stale. * *InsteadwemustwaituntilthecompletionofanRTTduring *whichweactuallyreceiveACKs.
*/ staticvoid vegas_enable(struct sock *sk)
{ conststruct tcp_sock *tp = tcp_sk(sk); struct vegas *vegas = inet_csk_ca(sk);
/* Begin taking Vegas samples next time we send something. */
vegas->doing_vegas_now = 1;
/* Set the beginning of the next send window. */
vegas->beg_snd_nxt = tp->snd_nxt;
/* Never allow zero rtt or baseRTT */
vrtt = sample->rtt_us + 1;
/* Filter to find propagation delay: */ if (vrtt < vegas->baseRTT)
vegas->baseRTT = vrtt;
/* Find the min RTT during the last RTT to find *thecurrentprop.delay+queuingdelay:
*/
vegas->minRTT = min(vegas->minRTT, vrtt);
vegas->cntRTT++;
}
EXPORT_SYMBOL_GPL(tcp_vegas_pkts_acked);
if (!vegas->doing_vegas_now) {
tcp_reno_cong_avoid(sk, ack, acked); return;
}
if (after(ack, vegas->beg_snd_nxt)) { /* Do the Vegas once-per-RTT cwnd adjustment. */
/* Save the extent of the current window so we can use this *attheendofthenextRTT.
*/
vegas->beg_snd_nxt = tp->snd_nxt;
/* We do the Vegas calculations only if we got enough RTT *samplesthatwecanbereasonablysurethatwegot *atleastoneRTTsamplethatwasn'tfromadelayedACK. *Ifweonlyhad2samplestotal, *thenthatmeanswe'regettingonly1ACKperRTT,which *meansthey'realmostcertainlydelayedACKs. *Ifwehave3samples,weshouldbeOK.
*/
if (vegas->cntRTT <= 2) { /* We don't have enough RTT samples to do the Vegas *calculation,sowe'llbehavelikeReno.
*/
tcp_reno_cong_avoid(sk, ack, acked);
} else {
u32 rtt, diff;
u64 target_cwnd;
/* We have enough RTT samples, so, using the Vegas *algorithm,wedetermineifweshouldincreaseor *decreasecwnd,andbyhowmuch.
*/
/* Pluck out the RTT we are using for the Vegas *calculations.ThisistheminRTTseenduringthe *lastRTT.Takingtheminfiltersouttheeffects *ofdelayedACKs,atthecostofnoticingcongestion *abitlater.
*/
rtt = vegas->minRTT;
/* Calculate the cwnd we should have, if we weren't *goingtoofast. * *Thisis: *(actualrateinsegments)*baseRTT
*/
target_cwnd = (u64)tcp_snd_cwnd(tp) * vegas->baseRTT;
do_div(target_cwnd, rtt);
/* Calculate the difference between the window we had, *andthewindowwewouldliketohave.Thisquantity *isthe"Diff"fromtheArizonaVegaspapers.
*/
diff = tcp_snd_cwnd(tp) * (rtt-vegas->baseRTT) / vegas->baseRTT;
if (diff > gamma && tcp_in_slow_start(tp)) { /* Going too fast. Time to slow down *andswitchtocongestionavoidance.
*/
/* Set cwnd to match the actual rate *exactly: *cwnd=(actualrate)*baseRTT *Thenweadd1becausetheinteger *truncationrobsusoffulllink *utilization.
*/
tcp_snd_cwnd_set(tp, min(tcp_snd_cwnd(tp),
(u32)target_cwnd + 1));
tp->snd_ssthresh = tcp_vegas_ssthresh(tp);
/* Figure out where we would like cwnd *tobe.
*/ if (diff > beta) { /* The old window was too fast, so *weslowdown.
*/
tcp_snd_cwnd_set(tp, tcp_snd_cwnd(tp) - 1);
tp->snd_ssthresh
= tcp_vegas_ssthresh(tp);
} elseif (diff < alpha) { /* We don't have enough extra packets *inthenetwork,sospeedup.
*/
tcp_snd_cwnd_set(tp, tcp_snd_cwnd(tp) + 1);
} else { /* Sending just as fast as we *shouldbe.
*/
}
}
/* Wipe the slate clean for the next RTT. */
vegas->cntRTT = 0;
vegas->minRTT = 0x7fffffff;
} /* Use normal slow start */ elseif (tcp_in_slow_start(tp))
tcp_slow_start(tp, acked);
}
/* Extract info for Tcp socket info provided via netlink. */
size_t tcp_vegas_get_info(struct sock *sk, u32 ext, int *attr, union tcp_cc_info *info)
{ conststruct vegas *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.