| 98 | } |
| 99 | |
| 100 | CommandResponse HashLB::CommandSetGates( |
| 101 | const bess::pb::HashLBCommandSetGatesArg &arg) { |
| 102 | if (static_cast<size_t>(arg.gates_size()) > kMaxGates) { |
| 103 | return CommandFailure(EINVAL, "HashLB can have at most %zu ogates", |
| 104 | kMaxGates); |
| 105 | } |
| 106 | |
| 107 | for (int i = 0; i < arg.gates_size(); i++) { |
| 108 | gates_[i] = arg.gates(i); |
| 109 | if (!is_valid_gate(gates_[i])) { |
| 110 | return CommandFailure(EINVAL, "Invalid ogate %d", gates_[i]); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | num_gates_ = arg.gates_size(); |
| 115 | return CommandSuccess(); |
| 116 | } |
| 117 | |
| 118 | CommandResponse HashLB::Init(const bess::pb::HashLBArg &arg) { |
| 119 | bess::pb::HashLBCommandSetGatesArg gates_arg; |
nothing calls this directly
no test coverage detected