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

Function func_test2

dpdk/app/test/test_red.c:574–646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572};
573
574static enum test_result func_test2(struct test_config *tcfg)
575{
576 enum test_result result = PASS;
577 double prev_drop_rate = 1.0;
578 uint32_t i = 0;
579
580 printf("%s", tcfg->msg);
581
582 if (test_rte_red_init(tcfg) != PASS) {
583 result = FAIL;
584 goto out;
585 }
586 rte_red_rt_data_init(tcfg->tqueue->rdata);
587
588 if (increase_actual_qsize(tcfg->tconfig->rconfig,
589 tcfg->tqueue->rdata,
590 tcfg->tqueue->q,
591 *tcfg->tlevel,
592 tcfg->tqueue->q_ramp_up) != 0) {
593 result = FAIL;
594 goto out;
595 }
596
597 if (increase_average_qsize(tcfg->tconfig->rconfig,
598 tcfg->tqueue->rdata,
599 tcfg->tqueue->q,
600 *tcfg->tlevel,
601 tcfg->tqueue->avg_ramp_up) != 0) {
602 result = FAIL;
603 goto out;
604 }
605 printf("%s", tcfg->htxt);
606
607 for (i = 0; i < tcfg->tconfig->num_cfg; i++) {
608 uint32_t avg = 0;
609 double drop_rate = 0.0;
610 double drop_prob = 0.0;
611 double diff = 0.0;
612
613 *tcfg->tvar->dropped = 0;
614 *tcfg->tvar->enqueued = 0;
615
616 enqueue_dequeue_func(&tcfg->tconfig->rconfig[i],
617 tcfg->tqueue->rdata,
618 tcfg->tqueue->q,
619 tcfg->tvar->num_ops,
620 tcfg->tvar->enqueued,
621 tcfg->tvar->dropped);
622
623 avg = rte_red_get_avg_int(&tcfg->tconfig->rconfig[i], tcfg->tqueue->rdata);
624 if (avg != *tcfg->tlevel)
625 result = FAIL;
626
627 drop_rate = calc_drop_rate(*tcfg->tvar->enqueued, *tcfg->tvar->dropped);
628 drop_prob = calc_drop_prob(tcfg->tconfig->min_th, tcfg->tconfig->max_th,
629 tcfg->tconfig->maxp_inv[i], *tcfg->tlevel);
630 if (!check_drop_rate(&diff, drop_rate, drop_prob, (double)tcfg->tqueue->drop_tolerance))
631 result = FAIL;

Callers

nothing calls this directly

Calls 10

test_rte_red_initFunction · 0.85
rte_red_rt_data_initFunction · 0.85
increase_actual_qsizeFunction · 0.85
increase_average_qsizeFunction · 0.85
rte_red_get_avg_intFunction · 0.85
calc_drop_probFunction · 0.85
enqueue_dequeue_funcFunction · 0.70
calc_drop_rateFunction · 0.70
check_drop_rateFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected