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

Method Enqueue

core/modules/drr.cc:358–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358void DRR::Enqueue(Flow *f, bess::Packet *newpkt, int *err) {
359 // if the queue is full. drop the packet.
360 if (llring_count(f->queue) >= max_queue_size_) {
361 bess::Packet::Free(newpkt);
362 return;
363 }
364
365 // creates a new queue if there is not enough space for the new packet
366 // in the old queue
367 if (llring_full(f->queue)) {
368 uint32_t slots =
369 RoundToPowerTwo(llring_count(f->queue) * kQueueGrowthFactor);
370 f->queue = ResizeQueue(f->queue, slots, err);
371 if (*err != 0) {
372 bess::Packet::Free(newpkt);
373 return;
374 }
375 }
376
377 *err = llring_enqueue(f->queue, reinterpret_cast<void *>(newpkt));
378 if (*err == 0) {
379 f->timer = get_epoch_time();
380 } else {
381 bess::Packet::Free(newpkt);
382 }
383}
384
385llring *DRR::ResizeQueue(llring *old_queue, uint32_t new_size, int *err) {
386 llring *new_queue = AddQueue(new_size, err);

Callers

nothing calls this directly

Calls 5

llring_countFunction · 0.85
llring_fullFunction · 0.85
RoundToPowerTwoFunction · 0.85
llring_enqueueFunction · 0.85
get_epoch_timeFunction · 0.85

Tested by

no test coverage detected