| 2619 | } |
| 2620 | |
| 2621 | static inline int |
| 2622 | grinder_next_pipe(struct rte_sched_port *port, |
| 2623 | struct rte_sched_subport *subport, uint32_t pos) |
| 2624 | { |
| 2625 | struct rte_sched_grinder *grinder = subport->grinder + pos; |
| 2626 | uint32_t pipe_qindex; |
| 2627 | uint16_t pipe_qmask; |
| 2628 | |
| 2629 | if (grinder->pcache_r < grinder->pcache_w) { |
| 2630 | pipe_qmask = grinder->pcache_qmask[grinder->pcache_r]; |
| 2631 | pipe_qindex = grinder->pcache_qindex[grinder->pcache_r]; |
| 2632 | grinder->pcache_r++; |
| 2633 | } else { |
| 2634 | uint64_t bmp_slab = 0; |
| 2635 | uint32_t bmp_pos = 0; |
| 2636 | |
| 2637 | /* Get another non-empty pipe group */ |
| 2638 | if (unlikely(rte_bitmap_scan(subport->bmp, &bmp_pos, &bmp_slab) <= 0)) |
| 2639 | return 0; |
| 2640 | |
| 2641 | #ifdef RTE_SCHED_DEBUG |
| 2642 | debug_check_queue_slab(subport, bmp_pos, bmp_slab); |
| 2643 | #endif |
| 2644 | |
| 2645 | /* Return if pipe group already in one of the other grinders */ |
| 2646 | subport->grinder_base_bmp_pos[pos] = RTE_SCHED_BMP_POS_INVALID; |
| 2647 | if (unlikely(grinder_pipe_exists(subport, bmp_pos))) |
| 2648 | return 0; |
| 2649 | |
| 2650 | subport->grinder_base_bmp_pos[pos] = bmp_pos; |
| 2651 | |
| 2652 | /* Install new pipe group into grinder's pipe cache */ |
| 2653 | grinder_pcache_populate(subport, pos, bmp_pos, bmp_slab); |
| 2654 | |
| 2655 | pipe_qmask = grinder->pcache_qmask[0]; |
| 2656 | pipe_qindex = grinder->pcache_qindex[0]; |
| 2657 | grinder->pcache_r = 1; |
| 2658 | } |
| 2659 | |
| 2660 | /* Install new pipe in the grinder */ |
| 2661 | grinder->pindex = pipe_qindex >> 4; |
| 2662 | grinder->subport = subport; |
| 2663 | grinder->pipe = subport->pipe + grinder->pindex; |
| 2664 | grinder->pipe_params = NULL; /* to be set after the pipe structure is prefetched */ |
| 2665 | grinder->productive = 0; |
| 2666 | |
| 2667 | grinder_tccache_populate(subport, pos, pipe_qindex, pipe_qmask); |
| 2668 | grinder_next_tc(port, subport, pos); |
| 2669 | |
| 2670 | /* Check for pipe exhaustion */ |
| 2671 | if (grinder->pindex == subport->pipe_loop) { |
| 2672 | subport->pipe_exhaustion = 1; |
| 2673 | subport->pipe_loop = RTE_SCHED_PIPE_INVALID; |
| 2674 | } |
| 2675 | |
| 2676 | return 1; |
| 2677 | } |
| 2678 |
no test coverage detected