| 121 | } |
| 122 | |
| 123 | void 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 | |
| 151 | struct task_result DRR::RunTask(Context *ctx, bess::PacketBatch *batch, |
| 152 | void *) { |
nothing calls this directly
no test coverage detected