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

Function cdg_ack_received

freebsd/netinet/cc/cc_cdg.c:566–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564}
565
566static void
567cdg_ack_received(struct cc_var *ccv, uint16_t ack_type)
568{
569 struct cdg *cdg_data;
570 struct ertt *e_t;
571 long qdiff_max, qdiff_min;
572 int congestion, new_measurement, slowstart;
573
574 cdg_data = ccv->cc_data;
575 e_t = (struct ertt *)khelp_get_osd(CCV(ccv, osd), ertt_id);
576 new_measurement = e_t->flags & ERTT_NEW_MEASUREMENT;
577 congestion = 0;
578 cdg_data->maxrtt_in_rtt = imax(e_t->rtt, cdg_data->maxrtt_in_rtt);
579 cdg_data->minrtt_in_rtt = imin(e_t->rtt, cdg_data->minrtt_in_rtt);
580
581 if (new_measurement) {
582 slowstart = (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh));
583 /*
584 * Update smoothed gradient measurements. Since we are only
585 * using one measurement per RTT, use max or min rtt_in_rtt.
586 * This is also less noisy than a sample RTT measurement. Max
587 * RTT measurements can have trouble due to OS issues.
588 */
589 if (cdg_data->maxrtt_in_prevrtt) {
590 qdiff_max = ((long)(cdg_data->maxrtt_in_rtt -
591 cdg_data->maxrtt_in_prevrtt) << D_P_E );
592 qdiff_min = ((long)(cdg_data->minrtt_in_rtt -
593 cdg_data->minrtt_in_prevrtt) << D_P_E );
594
595 if (cdg_data->sample_q_size == 0) {
596 cdg_data->max_qtrend = qdiff_max;
597 cdg_data->min_qtrend = qdiff_min;
598 } else
599 calc_moving_average(cdg_data, qdiff_max, qdiff_min);
600
601 /* Probabilistic backoff with respect to gradient. */
602 if (slowstart && qdiff_min > 0)
603 congestion = prob_backoff(qdiff_min);
604 else if (cdg_data->min_qtrend > 0)
605 congestion = prob_backoff(cdg_data->min_qtrend);
606 else if (slowstart && qdiff_max > 0)
607 congestion = prob_backoff(qdiff_max);
608 else if (cdg_data->max_qtrend > 0)
609 congestion = prob_backoff(cdg_data->max_qtrend);
610
611 /* Update estimate of queue state. */
612 if (cdg_data->min_qtrend > 0 &&
613 cdg_data->max_qtrend <= 0) {
614 cdg_data->queue_state = CDG_Q_FULL;
615 } else if (cdg_data->min_qtrend >= 0 &&
616 cdg_data->max_qtrend < 0) {
617 cdg_data->queue_state = CDG_Q_EMPTY;
618 cdg_data->shadow_w = 0;
619 } else if (cdg_data->min_qtrend > 0 &&
620 cdg_data->max_qtrend > 0) {
621 cdg_data->queue_state = CDG_Q_RISING;
622 } else if (cdg_data->min_qtrend < 0 &&
623 cdg_data->max_qtrend < 0) {

Callers

nothing calls this directly

Calls 8

khelp_get_osdFunction · 0.85
imaxFunction · 0.85
iminFunction · 0.85
calc_moving_averageFunction · 0.85
prob_backoffFunction · 0.85
cdg_cong_signalFunction · 0.85
ulmaxFunction · 0.85
cdg_window_increaseFunction · 0.85

Tested by

no test coverage detected