MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cubic_record_rtt

Function cubic_record_rtt

freebsd/netinet/cc/cc_cubic.c:409–447  ·  view source on GitHub ↗

* Record the min RTT and sum samples for the epoch average RTT calculation. */

Source from the content-addressed store, hash-verified

407 * Record the min RTT and sum samples for the epoch average RTT calculation.
408 */
409static void
410cubic_record_rtt(struct cc_var *ccv)
411{
412 struct cubic *cubic_data;
413 int t_srtt_ticks;
414
415 /* Ignore srtt until a min number of samples have been taken. */
416 if (CCV(ccv, t_rttupdated) >= CUBIC_MIN_RTT_SAMPLES) {
417 cubic_data = ccv->cc_data;
418 t_srtt_ticks = CCV(ccv, t_srtt) / TCP_RTT_SCALE;
419
420 /*
421 * Record the current SRTT as our minrtt if it's the smallest
422 * we've seen or minrtt is currently equal to its initialised
423 * value.
424 *
425 * XXXLAS: Should there be some hysteresis for minrtt?
426 */
427 if ((t_srtt_ticks < cubic_data->min_rtt_ticks ||
428 cubic_data->min_rtt_ticks == TCPTV_SRTTBASE)) {
429 cubic_data->min_rtt_ticks = max(1, t_srtt_ticks);
430
431 /*
432 * If the connection is within its first congestion
433 * epoch, ensure we prime mean_rtt_ticks with a
434 * reasonable value until the epoch average RTT is
435 * calculated in cubic_post_recovery().
436 */
437 if (cubic_data->min_rtt_ticks >
438 cubic_data->mean_rtt_ticks)
439 cubic_data->mean_rtt_ticks =
440 cubic_data->min_rtt_ticks;
441 }
442
443 /* Sum samples for epoch average RTT calculation. */
444 cubic_data->sum_rtt_ticks += t_srtt_ticks;
445 cubic_data->epoch_ack_count++;
446 }
447}
448
449/*
450 * Update the ssthresh in the event of congestion.

Callers 1

cubic_ack_receivedFunction · 0.85

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected