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

Method ProcessBatch

core/modules/port_out.cc:88–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void PortOut::ProcessBatch(Context *ctx, bess::PacketBatch *batch) {
89 Port *p = port_;
90
91 const queue_t qid = worker_queues_[ctx->wid];
92
93 uint64_t sent_bytes = 0;
94 int sent_pkts = 0;
95
96 if (likely(qid < port_->num_queues[PACKET_DIR_OUT]) && p->conf().admin_up) {
97 sent_pkts = p->SendPackets(qid, batch->pkts(), batch->cnt());
98 }
99
100 if (!(p->GetFlags() & DRIVER_FLAG_SELF_OUT_STATS)) {
101 const packet_dir_t dir = PACKET_DIR_OUT;
102
103 for (int i = 0; i < sent_pkts; i++) {
104 sent_bytes += batch->pkts()[i]->total_len();
105 }
106
107 p->queue_stats[dir][qid].packets += sent_pkts;
108 p->queue_stats[dir][qid].dropped += (batch->cnt() - sent_pkts);
109 p->queue_stats[dir][qid].bytes += sent_bytes;
110 }
111
112 if (sent_pkts < batch->cnt()) {
113 bess::Packet::Free(batch->pkts() + sent_pkts, batch->cnt() - sent_pkts);
114 }
115}
116
117int PortOut::OnEvent(bess::Event e) {
118 if (e != bess::Event::PreResume) {

Callers

nothing calls this directly

Calls 5

total_lenMethod · 0.80
SendPacketsMethod · 0.45
pktsMethod · 0.45
cntMethod · 0.45
GetFlagsMethod · 0.45

Tested by

no test coverage detected