to downstream */
| 157 | |
| 158 | /* to downstream */ |
| 159 | struct task_result Queue::RunTask(Context *ctx, bess::PacketBatch *batch, |
| 160 | void *) { |
| 161 | if (children_overload_ > 0) { |
| 162 | return { |
| 163 | .block = true, .packets = 0, .bits = 0, |
| 164 | }; |
| 165 | } |
| 166 | |
| 167 | const int burst = ACCESS_ONCE(burst_); |
| 168 | const int pkt_overhead = 24; |
| 169 | |
| 170 | uint64_t total_bytes = 0; |
| 171 | |
| 172 | uint32_t cnt = llring_sc_dequeue_burst(queue_, (void **)batch->pkts(), burst); |
| 173 | |
| 174 | if (cnt == 0) { |
| 175 | return {.block = true, .packets = 0, .bits = 0}; |
| 176 | } |
| 177 | |
| 178 | stats_.dequeued += cnt; |
| 179 | batch->set_cnt(cnt); |
| 180 | |
| 181 | if (prefetch_) { |
| 182 | for (uint32_t i = 0; i < cnt; i++) { |
| 183 | total_bytes += batch->pkts()[i]->total_len(); |
| 184 | rte_prefetch0(batch->pkts()[i]->head_data()); |
| 185 | } |
| 186 | } else { |
| 187 | for (uint32_t i = 0; i < cnt; i++) { |
| 188 | total_bytes += batch->pkts()[i]->total_len(); |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | RunNextModule(ctx, batch); |
| 193 | |
| 194 | if (backpressure_ && llring_count(queue_) < low_water_) { |
| 195 | SignalUnderload(); |
| 196 | } |
| 197 | |
| 198 | return {.block = false, |
| 199 | .packets = cnt, |
| 200 | .bits = (total_bytes + cnt * pkt_overhead) * 8}; |
| 201 | } |
| 202 | |
| 203 | CommandResponse Queue::CommandSetBurst( |
| 204 | const bess::pb::QueueCommandSetBurstArg &arg) { |
nothing calls this directly
no test coverage detected