Lines Matching refs:cdg_data
292 struct cdg *cdg_data; in cdg_cb_init() local
294 cdg_data = malloc(sizeof(struct cdg), M_CDG, M_NOWAIT); in cdg_cb_init()
295 if (cdg_data == NULL) in cdg_cb_init()
298 cdg_data->shadow_w = 0; in cdg_cb_init()
299 cdg_data->max_qtrend = 0; in cdg_cb_init()
300 cdg_data->min_qtrend = 0; in cdg_cb_init()
301 cdg_data->queue_state = CDG_Q_UNKNOWN; in cdg_cb_init()
302 cdg_data->maxrtt_in_rtt = 0; in cdg_cb_init()
303 cdg_data->maxrtt_in_prevrtt = 0; in cdg_cb_init()
304 cdg_data->minrtt_in_rtt = INT_MAX; in cdg_cb_init()
305 cdg_data->minrtt_in_prevrtt = 0; in cdg_cb_init()
306 cdg_data->window_incr = 0; in cdg_cb_init()
307 cdg_data->rtt_count = 0; in cdg_cb_init()
308 cdg_data->consec_cong_cnt = 0; in cdg_cb_init()
309 cdg_data->sample_q_size = V_cdg_smoothing_factor; in cdg_cb_init()
310 cdg_data->num_samples = 0; in cdg_cb_init()
311 STAILQ_INIT(&cdg_data->qdiffmin_q); in cdg_cb_init()
312 STAILQ_INIT(&cdg_data->qdiffmax_q); in cdg_cb_init()
314 ccv->cc_data = cdg_data; in cdg_cb_init()
322 struct cdg *cdg_data = ccv->cc_data; in cdg_conn_init() local
328 cdg_data->shadow_w = CCV(ccv, snd_cwnd); in cdg_conn_init()
334 struct cdg *cdg_data; in cdg_cb_destroy() local
337 cdg_data = ccv->cc_data; in cdg_cb_destroy()
339 qds = STAILQ_FIRST(&cdg_data->qdiffmin_q); in cdg_cb_destroy()
346 qds = STAILQ_FIRST(&cdg_data->qdiffmax_q); in cdg_cb_destroy()
409 struct cdg *cdg_data; in cdg_window_increase() local
412 cdg_data = ccv->cc_data; in cdg_window_increase()
419 cdg_data->window_incr = cdg_data->rtt_count = 0; in cdg_window_increase()
427 if (++cdg_data->rtt_count >= V_cdg_alpha_inc) { in cdg_window_increase()
428 cdg_data->window_incr++; in cdg_window_increase()
429 cdg_data->rtt_count = 0; in cdg_window_increase()
432 cdg_data->window_incr; in cdg_window_increase()
437 if (cdg_data->shadow_w > 0) in cdg_window_increase()
438 cdg_data->shadow_w = ulmin(cdg_data->shadow_w + s_w_incr, in cdg_window_increase()
448 struct cdg *cdg_data = ccv->cc_data; in cdg_cong_signal() local
456 cdg_data->window_incr = cdg_data->rtt_count = 0; in cdg_cong_signal()
465 cdg_data->queue_state < CDG_Q_FULL) { in cdg_cong_signal()
474 if (cdg_data->shadow_w > 0) in cdg_cong_signal()
475 cdg_data->shadow_w = cdg_window_decrease(ccv, in cdg_cong_signal()
476 cdg_data->shadow_w, RENO_BETA); in cdg_cong_signal()
478 CCV(ccv, snd_ssthresh) = max(cdg_data->shadow_w, in cdg_cong_signal()
482 cdg_data->window_incr = cdg_data->rtt_count = 0; in cdg_cong_signal()
523 calc_moving_average(struct cdg *cdg_data, long qdiff_max, long qdiff_min) in calc_moving_average() argument
527 ++cdg_data->num_samples; in calc_moving_average()
528 if (cdg_data->num_samples > cdg_data->sample_q_size) { in calc_moving_average()
530 qds = STAILQ_FIRST(&cdg_data->qdiffmin_q); in calc_moving_average()
531 cdg_data->min_qtrend = cdg_data->min_qtrend + in calc_moving_average()
532 (qdiff_min - qds->qdiff) / cdg_data->sample_q_size; in calc_moving_average()
533 STAILQ_REMOVE_HEAD(&cdg_data->qdiffmin_q, qdiff_lnk); in calc_moving_average()
535 STAILQ_INSERT_TAIL(&cdg_data->qdiffmin_q, qds, qdiff_lnk); in calc_moving_average()
538 qds = STAILQ_FIRST(&cdg_data->qdiffmax_q); in calc_moving_average()
539 cdg_data->max_qtrend = cdg_data->max_qtrend + in calc_moving_average()
540 (qdiff_max - qds->qdiff) / cdg_data->sample_q_size; in calc_moving_average()
541 STAILQ_REMOVE_HEAD(&cdg_data->qdiffmax_q, qdiff_lnk); in calc_moving_average()
543 STAILQ_INSERT_TAIL(&cdg_data->qdiffmax_q, qds, qdiff_lnk); in calc_moving_average()
544 --cdg_data->num_samples; in calc_moving_average()
548 cdg_data->min_qtrend = cdg_data->min_qtrend + in calc_moving_average()
549 qdiff_min / cdg_data->sample_q_size; in calc_moving_average()
551 STAILQ_INSERT_TAIL(&cdg_data->qdiffmin_q, qds, in calc_moving_average()
557 cdg_data->max_qtrend = cdg_data->max_qtrend + in calc_moving_average()
558 qdiff_max / cdg_data->sample_q_size; in calc_moving_average()
560 STAILQ_INSERT_TAIL(&cdg_data->qdiffmax_q, qds, in calc_moving_average()
569 struct cdg *cdg_data; in cdg_ack_received() local
574 cdg_data = ccv->cc_data; in cdg_ack_received()
578 cdg_data->maxrtt_in_rtt = imax(e_t->rtt, cdg_data->maxrtt_in_rtt); in cdg_ack_received()
579 cdg_data->minrtt_in_rtt = imin(e_t->rtt, cdg_data->minrtt_in_rtt); in cdg_ack_received()
589 if (cdg_data->maxrtt_in_prevrtt) { in cdg_ack_received()
590 qdiff_max = ((long)(cdg_data->maxrtt_in_rtt - in cdg_ack_received()
591 cdg_data->maxrtt_in_prevrtt) << D_P_E ); in cdg_ack_received()
592 qdiff_min = ((long)(cdg_data->minrtt_in_rtt - in cdg_ack_received()
593 cdg_data->minrtt_in_prevrtt) << D_P_E ); in cdg_ack_received()
595 if (cdg_data->sample_q_size == 0) { in cdg_ack_received()
596 cdg_data->max_qtrend = qdiff_max; in cdg_ack_received()
597 cdg_data->min_qtrend = qdiff_min; in cdg_ack_received()
599 calc_moving_average(cdg_data, qdiff_max, qdiff_min); in cdg_ack_received()
604 else if (cdg_data->min_qtrend > 0) in cdg_ack_received()
605 congestion = prob_backoff(cdg_data->min_qtrend); in cdg_ack_received()
608 else if (cdg_data->max_qtrend > 0) in cdg_ack_received()
609 congestion = prob_backoff(cdg_data->max_qtrend); in cdg_ack_received()
612 if (cdg_data->min_qtrend > 0 && in cdg_ack_received()
613 cdg_data->max_qtrend <= 0) { in cdg_ack_received()
614 cdg_data->queue_state = CDG_Q_FULL; in cdg_ack_received()
615 } else if (cdg_data->min_qtrend >= 0 && in cdg_ack_received()
616 cdg_data->max_qtrend < 0) { in cdg_ack_received()
617 cdg_data->queue_state = CDG_Q_EMPTY; in cdg_ack_received()
618 cdg_data->shadow_w = 0; in cdg_ack_received()
619 } else if (cdg_data->min_qtrend > 0 && in cdg_ack_received()
620 cdg_data->max_qtrend > 0) { in cdg_ack_received()
621 cdg_data->queue_state = CDG_Q_RISING; in cdg_ack_received()
622 } else 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_FALLING; in cdg_ack_received()
627 if (cdg_data->min_qtrend < 0 || in cdg_ack_received()
628 cdg_data->max_qtrend < 0) in cdg_ack_received()
629 cdg_data->consec_cong_cnt = 0; in cdg_ack_received()
632 cdg_data->minrtt_in_prevrtt = cdg_data->minrtt_in_rtt; in cdg_ack_received()
633 cdg_data->minrtt_in_rtt = INT_MAX; in cdg_ack_received()
634 cdg_data->maxrtt_in_prevrtt = cdg_data->maxrtt_in_rtt; in cdg_ack_received()
635 cdg_data->maxrtt_in_rtt = 0; in cdg_ack_received()
640 cdg_data->consec_cong_cnt++; in cdg_ack_received()
642 if (cdg_data->consec_cong_cnt <= V_cdg_consec_cong) in cdg_ack_received()
651 if (cdg_data->consec_cong_cnt >= in cdg_ack_received()
653 cdg_data->consec_cong_cnt = 0; in cdg_ack_received()
656 cdg_data->maxrtt_in_prevrtt = 0; in cdg_ack_received()
661 cdg_data->shadow_w = ulmax(CCV(ccv, snd_cwnd), in cdg_ack_received()
662 cdg_data->shadow_w); in cdg_ack_received()