Note: the caller must ensure that count <= iq_count() */
| 103 | |
| 104 | /* Note: the caller must ensure that count <= iq_count() */ |
| 105 | static __rte_always_inline uint16_t |
| 106 | iq_dequeue_burst(struct sw_evdev *sw, |
| 107 | struct sw_iq *iq, |
| 108 | struct rte_event *ev, |
| 109 | uint16_t count) |
| 110 | { |
| 111 | struct sw_queue_chunk *current; |
| 112 | uint16_t total, index; |
| 113 | |
| 114 | count = RTE_MIN(count, iq_count(iq)); |
| 115 | |
| 116 | current = iq->head; |
| 117 | index = iq->head_idx; |
| 118 | total = 0; |
| 119 | |
| 120 | /* Loop over the chunks */ |
| 121 | while (1) { |
| 122 | struct sw_queue_chunk *next; |
| 123 | for (; index < SW_EVS_PER_Q_CHUNK;) { |
| 124 | ev[total++] = current->events[index++]; |
| 125 | |
| 126 | if (unlikely(total == count)) |
| 127 | goto done; |
| 128 | } |
| 129 | |
| 130 | /* Move to the next chunk */ |
| 131 | next = current->next; |
| 132 | iq_free_chunk(sw, current); |
| 133 | current = next; |
| 134 | index = 0; |
| 135 | } |
| 136 | |
| 137 | done: |
| 138 | if (unlikely(index == SW_EVS_PER_Q_CHUNK)) { |
| 139 | struct sw_queue_chunk *next = current->next; |
| 140 | iq_free_chunk(sw, current); |
| 141 | iq->head = next; |
| 142 | iq->head_idx = 0; |
| 143 | } else { |
| 144 | iq->head = current; |
| 145 | iq->head_idx = index; |
| 146 | } |
| 147 | |
| 148 | iq->count -= total; |
| 149 | |
| 150 | return total; |
| 151 | } |
| 152 | |
| 153 | static __rte_always_inline void |
| 154 | iq_put_back(struct sw_evdev *sw, |
no test coverage detected