| 86 | } |
| 87 | |
| 88 | void 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 | |
| 117 | int PortOut::OnEvent(bess::Event e) { |
| 118 | if (e != bess::Event::PreResume) { |
nothing calls this directly
no test coverage detected