| 3086 | } |
| 3087 | |
| 3088 | static int |
| 3089 | worker_loopback_worker_fn(void *arg) |
| 3090 | { |
| 3091 | struct test *t = arg; |
| 3092 | uint8_t port = t->port[1]; |
| 3093 | int count = 0; |
| 3094 | int enqd; |
| 3095 | |
| 3096 | /* |
| 3097 | * Takes packets from the input port and then loops them back through |
| 3098 | * the Eventdev. Each packet gets looped through QIDs 0-8, 16 times |
| 3099 | * so each packet goes through 8*16 = 128 times. |
| 3100 | */ |
| 3101 | printf("%d: \tWorker function started\n", __LINE__); |
| 3102 | while (count < NUM_PACKETS) { |
| 3103 | #define BURST_SIZE 32 |
| 3104 | struct rte_event ev[BURST_SIZE]; |
| 3105 | uint16_t i, nb_rx = rte_event_dequeue_burst(evdev, port, ev, |
| 3106 | BURST_SIZE, 0); |
| 3107 | if (nb_rx == 0) { |
| 3108 | rte_pause(); |
| 3109 | continue; |
| 3110 | } |
| 3111 | |
| 3112 | for (i = 0; i < nb_rx; i++) { |
| 3113 | ev[i].queue_id++; |
| 3114 | if (ev[i].queue_id != 8) { |
| 3115 | ev[i].op = RTE_EVENT_OP_FORWARD; |
| 3116 | enqd = rte_event_enqueue_burst(evdev, port, |
| 3117 | &ev[i], 1); |
| 3118 | if (enqd != 1) { |
| 3119 | printf("%d: Can't enqueue FWD!!\n", |
| 3120 | __LINE__); |
| 3121 | return -1; |
| 3122 | } |
| 3123 | continue; |
| 3124 | } |
| 3125 | |
| 3126 | ev[i].queue_id = 0; |
| 3127 | (*counter_field(ev[i].mbuf))++; |
| 3128 | if (*counter_field(ev[i].mbuf) != 16) { |
| 3129 | ev[i].op = RTE_EVENT_OP_FORWARD; |
| 3130 | enqd = rte_event_enqueue_burst(evdev, port, |
| 3131 | &ev[i], 1); |
| 3132 | if (enqd != 1) { |
| 3133 | printf("%d: Can't enqueue FWD!!\n", |
| 3134 | __LINE__); |
| 3135 | return -1; |
| 3136 | } |
| 3137 | continue; |
| 3138 | } |
| 3139 | /* we have hit 16 iterations through system - drop */ |
| 3140 | rte_pktmbuf_free(ev[i].mbuf); |
| 3141 | count++; |
| 3142 | ev[i].op = RTE_EVENT_OP_RELEASE; |
| 3143 | enqd = rte_event_enqueue_burst(evdev, port, &ev[i], 1); |
| 3144 | if (enqd != 1) { |
| 3145 | printf("%d drop enqueue failed\n", __LINE__); |
nothing calls this directly
no test coverage detected