| 39 | } |
| 40 | |
| 41 | CommandResponse WorkerSplit::CommandReset(const bess::pb::WorkerSplitArg &arg) { |
| 42 | if (arg.worker_gates().empty()) { |
| 43 | for (int i = 0; i < Worker::kMaxWorkers; i++) { |
| 44 | gates_[i] = i; |
| 45 | } |
| 46 | return CommandSuccess(); |
| 47 | } |
| 48 | |
| 49 | for (size_t i = 0; i < Worker::kMaxWorkers; i++) { |
| 50 | gates_[i] = -1; |
| 51 | } |
| 52 | |
| 53 | for (auto it : arg.worker_gates()) { |
| 54 | gate_idx_t ogate = it.second; |
| 55 | if (ogate >= MAX_GATES) { |
| 56 | return CommandFailure(EINVAL, "output gate must be less than %" PRIu16, |
| 57 | MAX_GATES); |
| 58 | } |
| 59 | gates_[it.first] = ogate; |
| 60 | } |
| 61 | |
| 62 | return CommandSuccess(); |
| 63 | } |
| 64 | |
| 65 | void WorkerSplit::ProcessBatch(Context *ctx, bess::PacketBatch *batch) { |
| 66 | int gate = gates_[ctx->wid]; |
nothing calls this directly
no test coverage detected