| 119 | void Attach(bess::LeafTrafficClass *c); |
| 120 | |
| 121 | void AddToRun(bess::IGate *ig, bess::PacketBatch *batch) const { |
| 122 | if (next_gate_ == nullptr && |
| 123 | !ig->mergeable()) { // optimization for chained |
| 124 | next_gate_ = ig; |
| 125 | next_batch_ = batch; |
| 126 | } else { |
| 127 | bess::PacketBatch *ibatch = get_gate_batch(ig); |
| 128 | if (ibatch && (static_cast<size_t>(ibatch->cnt() + batch->cnt()) <= |
| 129 | bess::PacketBatch::kMaxBurst)) { |
| 130 | // merge two batches |
| 131 | ibatch->add(batch); |
| 132 | } else { |
| 133 | // set the input as new batch |
| 134 | set_gate_batch(ig, batch); |
| 135 | igates_to_run_.emplace(ig, batch); |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | // Do not track used/unsued for efficiency |
| 141 | bess::PacketBatch *AllocPacketBatch() const { |
no test coverage detected