| 3291 | } |
| 3292 | |
| 3293 | static inline int |
| 3294 | dlb2_dequeue_wait(struct dlb2_eventdev *dlb2, |
| 3295 | struct dlb2_eventdev_port *ev_port, |
| 3296 | struct dlb2_port *qm_port, |
| 3297 | uint64_t timeout, |
| 3298 | uint64_t start_ticks) |
| 3299 | { |
| 3300 | struct process_local_port_data *port_data; |
| 3301 | uint64_t elapsed_ticks; |
| 3302 | |
| 3303 | port_data = &dlb2_port[qm_port->id][PORT_TYPE(qm_port)]; |
| 3304 | |
| 3305 | elapsed_ticks = rte_get_timer_cycles() - start_ticks; |
| 3306 | |
| 3307 | /* Wait/poll time expired */ |
| 3308 | if (elapsed_ticks >= timeout) { |
| 3309 | return 1; |
| 3310 | } else if (dlb2->umwait_allowed) { |
| 3311 | struct rte_power_monitor_cond pmc; |
| 3312 | volatile struct dlb2_dequeue_qe *cq_base; |
| 3313 | union { |
| 3314 | uint64_t raw_qe[2]; |
| 3315 | struct dlb2_dequeue_qe qe; |
| 3316 | } qe_mask; |
| 3317 | uint64_t expected_value; |
| 3318 | volatile uint64_t *monitor_addr; |
| 3319 | |
| 3320 | qe_mask.qe.cq_gen = 1; /* set mask */ |
| 3321 | |
| 3322 | cq_base = port_data->cq_base; |
| 3323 | monitor_addr = (volatile uint64_t *)(volatile void *) |
| 3324 | &cq_base[qm_port->cq_idx]; |
| 3325 | monitor_addr++; /* cq_gen bit is in second 64bit location */ |
| 3326 | |
| 3327 | if (qm_port->gen_bit) |
| 3328 | expected_value = qe_mask.raw_qe[1]; |
| 3329 | else |
| 3330 | expected_value = 0; |
| 3331 | |
| 3332 | pmc.addr = monitor_addr; |
| 3333 | /* store expected value and comparison mask in opaque data */ |
| 3334 | pmc.opaque[CLB_VAL_IDX] = expected_value; |
| 3335 | pmc.opaque[CLB_MASK_IDX] = qe_mask.raw_qe[1]; |
| 3336 | /* set up callback */ |
| 3337 | pmc.fn = dlb2_monitor_callback; |
| 3338 | pmc.size = sizeof(uint64_t); |
| 3339 | |
| 3340 | rte_power_monitor(&pmc, timeout + start_ticks); |
| 3341 | |
| 3342 | DLB2_INC_STAT(ev_port->stats.traffic.rx_umonitor_umwait, 1); |
| 3343 | } else { |
| 3344 | uint64_t poll_interval = dlb2->poll_interval; |
| 3345 | uint64_t curr_ticks = rte_get_timer_cycles(); |
| 3346 | uint64_t init_ticks = curr_ticks; |
| 3347 | |
| 3348 | while ((curr_ticks - start_ticks < timeout) && |
| 3349 | (curr_ticks - init_ticks < poll_interval)) |
| 3350 | curr_ticks = rte_get_timer_cycles(); |
no test coverage detected