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

Function holb

dpdk/drivers/event/sw/sw_evdev_selftest.c:2774–2888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2772}
2773
2774static int
2775holb(struct test *t) /* test to check we avoid basic head-of-line blocking */
2776{
2777 const struct rte_event new_ev = {
2778 .op = RTE_EVENT_OP_NEW
2779 /* all other fields zero */
2780 };
2781 struct rte_event ev = new_ev;
2782 unsigned int rx_port = 0; /* port we get the first flow on */
2783 char rx_port_used_stat[64];
2784 char rx_port_free_stat[64];
2785 char other_port_used_stat[64];
2786
2787 if (init(t, 1, 2) < 0 ||
2788 create_ports(t, 2) < 0 ||
2789 create_atomic_qids(t, 1) < 0) {
2790 printf("%d: Error initializing device\n", __LINE__);
2791 return -1;
2792 }
2793 int nb_links = rte_event_port_link(evdev, t->port[1], NULL, NULL, 0);
2794 if (rte_event_port_link(evdev, t->port[0], NULL, NULL, 0) != 1 ||
2795 nb_links != 1) {
2796 printf("%d: Error links queue to ports\n", __LINE__);
2797 goto err;
2798 }
2799 if (rte_event_dev_start(evdev) < 0) {
2800 printf("%d: Error with start call\n", __LINE__);
2801 goto err;
2802 }
2803
2804 /* send one packet and see where it goes, port 0 or 1 */
2805 if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) {
2806 printf("%d: Error doing first enqueue\n", __LINE__);
2807 goto err;
2808 }
2809 rte_service_run_iter_on_app_lcore(t->service_id, 1);
2810
2811 if (rte_event_dev_xstats_by_name_get(evdev, "port_0_cq_ring_used", NULL)
2812 != 1)
2813 rx_port = 1;
2814
2815 snprintf(rx_port_used_stat, sizeof(rx_port_used_stat),
2816 "port_%u_cq_ring_used", rx_port);
2817 snprintf(rx_port_free_stat, sizeof(rx_port_free_stat),
2818 "port_%u_cq_ring_free", rx_port);
2819 snprintf(other_port_used_stat, sizeof(other_port_used_stat),
2820 "port_%u_cq_ring_used", rx_port ^ 1);
2821 if (rte_event_dev_xstats_by_name_get(evdev, rx_port_used_stat, NULL)
2822 != 1) {
2823 printf("%d: Error, first event not scheduled\n", __LINE__);
2824 goto err;
2825 }
2826
2827 /* now fill up the rx port's queue with one flow to cause HOLB */
2828 do {
2829 ev = new_ev;
2830 if (rte_event_enqueue_burst(evdev, t->port[0], &ev, 1) != 1) {
2831 printf("%d: Error with enqueue\n", __LINE__);

Callers 1

test_sw_eventdevFunction · 0.85

Calls 12

rte_event_port_linkFunction · 0.85
rte_event_dev_startFunction · 0.85
rte_event_enqueue_burstFunction · 0.85
snprintfFunction · 0.85
rte_event_dev_dumpFunction · 0.85
initFunction · 0.70
create_portsFunction · 0.70
create_atomic_qidsFunction · 0.70
cleanupFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected