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

Method ProcessBatch

core/modules/l2_forward.cc:587–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585}
586
587void L2Forward::ProcessBatch(Context *ctx, bess::PacketBatch *batch) {
588 gate_idx_t default_gate = ACCESS_ONCE(default_gate_);
589
590 int cnt = batch->cnt();
591 for (int i = 0; i < cnt; i++) {
592 bess::Packet *snb = batch->pkts()[i];
593
594 gate_idx_t out_gate;
595 // read destination MAC address (first 6 bytes)
596 // NOTE: assumes little endian
597 int ret = l2_find(&l2_table_,
598 *(snb->head_data<uint64_t *>()) & 0x0000ffffffffffff,
599 &out_gate);
600 if (ret != 0) {
601 EmitPacket(ctx, snb, default_gate);
602 } else {
603 EmitPacket(ctx, snb, out_gate);
604 }
605 }
606}
607
608CommandResponse L2Forward::CommandAdd(
609 const bess::pb::L2ForwardCommandAddArg &arg) {

Callers

nothing calls this directly

Calls 3

l2_findFunction · 0.85
cntMethod · 0.45
pktsMethod · 0.45

Tested by

no test coverage detected