MCPcopy Create free account
hub / github.com/NetSys/bess / RunTask

Method RunTask

core/modules/queue.cc:159–201  ·  view source on GitHub ↗

to downstream */

Source from the content-addressed store, hash-verified

157
158/* to downstream */
159struct 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
203CommandResponse Queue::CommandSetBurst(
204 const bess::pb::QueueCommandSetBurstArg &arg) {

Callers

nothing calls this directly

Calls 6

llring_sc_dequeue_burstFunction · 0.85
llring_countFunction · 0.85
set_cntMethod · 0.80
total_lenMethod · 0.80
head_dataMethod · 0.80
pktsMethod · 0.45

Tested by

no test coverage detected