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

Method ProcessBatch

core/modules/drr.cc:123–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123void DRR::ProcessBatch(Context *, bess::PacketBatch *batch) {
124 int err = 0;
125
126 // insert packets in the batch into their corresponding flows
127 int cnt = batch->cnt();
128 for (int i = 0; i < cnt; i++) {
129 bess::Packet *pkt = batch->pkts()[i];
130
131 // TODO(joshua): Add support for fragmented packets.
132 FlowId id = GetId(pkt);
133 auto it = flows_.Find(id);
134
135 // if the Flow doesn't exist create one
136 // and add the packet to the new Flow
137 if (it == nullptr) {
138 if (llring_full(flow_ring_)) {
139 bess::Packet::Free(pkt);
140 } else {
141 AddNewFlow(pkt, id, &err);
142 assert(err == 0);
143 }
144 } else {
145 Enqueue(it->second, pkt, &err);
146 assert(err == 0);
147 }
148 }
149}
150
151struct task_result DRR::RunTask(Context *ctx, bess::PacketBatch *batch,
152 void *) {

Callers

nothing calls this directly

Calls 4

llring_fullFunction · 0.85
cntMethod · 0.45
pktsMethod · 0.45
FindMethod · 0.45

Tested by

no test coverage detected