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

Function cubic_ssthresh_update

freebsd/netinet/cc/cc_cubic.c:452–484  ·  view source on GitHub ↗

* Update the ssthresh in the event of congestion. */

Source from the content-addressed store, hash-verified

450 * Update the ssthresh in the event of congestion.
451 */
452static void
453cubic_ssthresh_update(struct cc_var *ccv, uint32_t maxseg)
454{
455 struct cubic *cubic_data;
456 uint32_t ssthresh;
457 uint32_t cwnd;
458
459 cubic_data = ccv->cc_data;
460 cwnd = CCV(ccv, snd_cwnd);
461
462 /* Fast convergence heuristic. */
463 if (cwnd < cubic_data->max_cwnd) {
464 cwnd = ((uint64_t)cwnd * CUBIC_FC_FACTOR) >> CUBIC_SHIFT;
465 }
466 cubic_data->prev_max_cwnd = cubic_data->max_cwnd;
467 cubic_data->max_cwnd = cwnd;
468
469 /*
470 * On the first congestion event, set ssthresh to cwnd * 0.5
471 * and reduce max_cwnd to cwnd * beta. This aligns the cubic concave
472 * region appropriately. On subsequent congestion events, set
473 * ssthresh to cwnd * beta.
474 */
475 if ((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) {
476 ssthresh = cwnd >> 1;
477 cubic_data->max_cwnd = ((uint64_t)cwnd *
478 CUBIC_BETA) >> CUBIC_SHIFT;
479 } else {
480 ssthresh = ((uint64_t)cwnd *
481 CUBIC_BETA) >> CUBIC_SHIFT;
482 }
483 CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * maxseg);
484}
485
486DECLARE_CC_MODULE(cubic, &cubic_cc_algo);
487MODULE_VERSION(cubic, 1);

Callers 1

cubic_cong_signalFunction · 0.85

Calls 1

maxFunction · 0.85

Tested by

no test coverage detected