Lines Matching refs:cdg_data
296 struct cdg *cdg_data; in cdg_cb_init() local
300 cdg_data = malloc(sizeof(struct cdg), M_CC_MEM, M_NOWAIT); in cdg_cb_init()
301 if (cdg_data == NULL) in cdg_cb_init()
304 cdg_data = ptr; in cdg_cb_init()
306 cdg_data->shadow_w = 0; in cdg_cb_init()
307 cdg_data->max_qtrend = 0; in cdg_cb_init()
308 cdg_data->min_qtrend = 0; in cdg_cb_init()
309 cdg_data->queue_state = CDG_Q_UNKNOWN; in cdg_cb_init()
310 cdg_data->maxrtt_in_rtt = 0; in cdg_cb_init()
311 cdg_data->maxrtt_in_prevrtt = 0; in cdg_cb_init()
312 cdg_data->minrtt_in_rtt = INT_MAX; in cdg_cb_init()
313 cdg_data->minrtt_in_prevrtt = 0; in cdg_cb_init()
314 cdg_data->window_incr = 0; in cdg_cb_init()
315 cdg_data->rtt_count = 0; in cdg_cb_init()
316 cdg_data->consec_cong_cnt = 0; in cdg_cb_init()
317 cdg_data->sample_q_size = V_cdg_smoothing_factor; in cdg_cb_init()
318 cdg_data->num_samples = 0; in cdg_cb_init()
319 STAILQ_INIT(&cdg_data->qdiffmin_q); in cdg_cb_init()
320 STAILQ_INIT(&cdg_data->qdiffmax_q); in cdg_cb_init()
322 ccv->cc_data = cdg_data; in cdg_cb_init()
330 struct cdg *cdg_data = ccv->cc_data; in cdg_conn_init() local
336 cdg_data->shadow_w = CCV(ccv, snd_cwnd); in cdg_conn_init()
342 struct cdg *cdg_data; in cdg_cb_destroy() local
345 cdg_data = ccv->cc_data; in cdg_cb_destroy()
347 qds = STAILQ_FIRST(&cdg_data->qdiffmin_q); in cdg_cb_destroy()
354 qds = STAILQ_FIRST(&cdg_data->qdiffmax_q); in cdg_cb_destroy()
417 struct cdg *cdg_data; in cdg_window_increase() local
421 cdg_data = ccv->cc_data; in cdg_window_increase()
428 cdg_data->window_incr = cdg_data->rtt_count = 0; in cdg_window_increase()
436 if (++cdg_data->rtt_count >= V_cdg_alpha_inc) { in cdg_window_increase()
437 cdg_data->window_incr++; in cdg_window_increase()
438 cdg_data->rtt_count = 0; in cdg_window_increase()
441 cdg_data->window_incr; in cdg_window_increase()
446 if (cdg_data->shadow_w > 0) in cdg_window_increase()
447 cdg_data->shadow_w = ulmin(cdg_data->shadow_w + s_w_incr, in cdg_window_increase()
457 struct cdg *cdg_data = ccv->cc_data; in cdg_cong_signal() local
465 cdg_data->window_incr = cdg_data->rtt_count = 0; in cdg_cong_signal()
474 cdg_data->queue_state < CDG_Q_FULL) { in cdg_cong_signal()
483 if (cdg_data->shadow_w > 0) in cdg_cong_signal()
484 cdg_data->shadow_w = cdg_window_decrease(ccv, in cdg_cong_signal()
485 cdg_data->shadow_w, RENO_BETA); in cdg_cong_signal()
487 CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w, in cdg_cong_signal()
491 cdg_data->window_incr = cdg_data->rtt_count = 0; in cdg_cong_signal()
533 calc_moving_average(struct cdg *cdg_data, long qdiff_max, long qdiff_min) in calc_moving_average() argument
537 ++cdg_data->num_samples; in calc_moving_average()
538 if (cdg_data->num_samples > cdg_data->sample_q_size) { in calc_moving_average()
540 qds = STAILQ_FIRST(&cdg_data->qdiffmin_q); in calc_moving_average()
541 cdg_data->min_qtrend = cdg_data->min_qtrend + in calc_moving_average()
542 (qdiff_min - qds->qdiff) / cdg_data->sample_q_size; in calc_moving_average()
543 STAILQ_REMOVE_HEAD(&cdg_data->qdiffmin_q, qdiff_lnk); in calc_moving_average()
545 STAILQ_INSERT_TAIL(&cdg_data->qdiffmin_q, qds, qdiff_lnk); in calc_moving_average()
548 qds = STAILQ_FIRST(&cdg_data->qdiffmax_q); in calc_moving_average()
549 cdg_data->max_qtrend = cdg_data->max_qtrend + in calc_moving_average()
550 (qdiff_max - qds->qdiff) / cdg_data->sample_q_size; in calc_moving_average()
551 STAILQ_REMOVE_HEAD(&cdg_data->qdiffmax_q, qdiff_lnk); in calc_moving_average()
553 STAILQ_INSERT_TAIL(&cdg_data->qdiffmax_q, qds, qdiff_lnk); in calc_moving_average()
554 --cdg_data->num_samples; in calc_moving_average()
558 cdg_data->min_qtrend = cdg_data->min_qtrend + in calc_moving_average()
559 qdiff_min / cdg_data->sample_q_size; in calc_moving_average()
561 STAILQ_INSERT_TAIL(&cdg_data->qdiffmin_q, qds, in calc_moving_average()
567 cdg_data->max_qtrend = cdg_data->max_qtrend + in calc_moving_average()
568 qdiff_max / cdg_data->sample_q_size; in calc_moving_average()
570 STAILQ_INSERT_TAIL(&cdg_data->qdiffmax_q, qds, in calc_moving_average()
579 struct cdg *cdg_data; in cdg_ack_received() local
584 cdg_data = ccv->cc_data; in cdg_ack_received()
588 cdg_data->maxrtt_in_rtt = imax(e_t->rtt, cdg_data->maxrtt_in_rtt); in cdg_ack_received()
589 cdg_data->minrtt_in_rtt = imin(e_t->rtt, cdg_data->minrtt_in_rtt); in cdg_ack_received()
599 if (cdg_data->maxrtt_in_prevrtt) { in cdg_ack_received()
600 qdiff_max = ((long)(cdg_data->maxrtt_in_rtt - in cdg_ack_received()
601 cdg_data->maxrtt_in_prevrtt) << D_P_E ); in cdg_ack_received()
602 qdiff_min = ((long)(cdg_data->minrtt_in_rtt - in cdg_ack_received()
603 cdg_data->minrtt_in_prevrtt) << D_P_E ); in cdg_ack_received()
605 if (cdg_data->sample_q_size == 0) { in cdg_ack_received()
606 cdg_data->max_qtrend = qdiff_max; in cdg_ack_received()
607 cdg_data->min_qtrend = qdiff_min; in cdg_ack_received()
609 calc_moving_average(cdg_data, qdiff_max, qdiff_min); in cdg_ack_received()
614 else if (cdg_data->min_qtrend > 0) in cdg_ack_received()
615 congestion = prob_backoff(cdg_data->min_qtrend); in cdg_ack_received()
618 else if (cdg_data->max_qtrend > 0) in cdg_ack_received()
619 congestion = prob_backoff(cdg_data->max_qtrend); in cdg_ack_received()
622 if (cdg_data->min_qtrend > 0 && in cdg_ack_received()
623 cdg_data->max_qtrend <= 0) { in cdg_ack_received()
624 cdg_data->queue_state = CDG_Q_FULL; in cdg_ack_received()
625 } else if (cdg_data->min_qtrend >= 0 && in cdg_ack_received()
626 cdg_data->max_qtrend < 0) { in cdg_ack_received()
627 cdg_data->queue_state = CDG_Q_EMPTY; in cdg_ack_received()
628 cdg_data->shadow_w = 0; in cdg_ack_received()
629 } else if (cdg_data->min_qtrend > 0 && in cdg_ack_received()
630 cdg_data->max_qtrend > 0) { in cdg_ack_received()
631 cdg_data->queue_state = CDG_Q_RISING; in cdg_ack_received()
632 } else if (cdg_data->min_qtrend < 0 && in cdg_ack_received()
633 cdg_data->max_qtrend < 0) { in cdg_ack_received()
634 cdg_data->queue_state = CDG_Q_FALLING; in cdg_ack_received()
637 if (cdg_data->min_qtrend < 0 || in cdg_ack_received()
638 cdg_data->max_qtrend < 0) in cdg_ack_received()
639 cdg_data->consec_cong_cnt = 0; in cdg_ack_received()
642 cdg_data->minrtt_in_prevrtt = cdg_data->minrtt_in_rtt; in cdg_ack_received()
643 cdg_data->minrtt_in_rtt = INT_MAX; in cdg_ack_received()
644 cdg_data->maxrtt_in_prevrtt = cdg_data->maxrtt_in_rtt; in cdg_ack_received()
645 cdg_data->maxrtt_in_rtt = 0; in cdg_ack_received()
650 cdg_data->consec_cong_cnt++; in cdg_ack_received()
652 if (cdg_data->consec_cong_cnt <= V_cdg_consec_cong) in cdg_ack_received()
661 if (cdg_data->consec_cong_cnt >= in cdg_ack_received()
663 cdg_data->consec_cong_cnt = 0; in cdg_ack_received()
666 cdg_data->maxrtt_in_prevrtt = 0; in cdg_ack_received()
671 cdg_data->shadow_w = ulmax(CCV(ccv, snd_cwnd), in cdg_ack_received()
672 cdg_data->shadow_w); in cdg_ack_received()