| 34 | #include "../utils/format.h" |
| 35 | |
| 36 | CommandResponse QueueOut::Init(const bess::pb::QueueOutArg &arg) { |
| 37 | const char *port_name; |
| 38 | int ret; |
| 39 | |
| 40 | if (!arg.port().length()) { |
| 41 | return CommandFailure(EINVAL, "Field 'port' must be specified"); |
| 42 | } |
| 43 | |
| 44 | port_name = arg.port().c_str(); |
| 45 | qid_ = arg.qid(); |
| 46 | |
| 47 | const auto &it = PortBuilder::all_ports().find(port_name); |
| 48 | if (it == PortBuilder::all_ports().end()) { |
| 49 | return CommandFailure(ENODEV, "Port %s not found", port_name); |
| 50 | } |
| 51 | port_ = it->second; |
| 52 | |
| 53 | node_constraints_ = port_->GetNodePlacementConstraint(); |
| 54 | |
| 55 | ret = port_->AcquireQueues(reinterpret_cast<const module *>(this), |
| 56 | PACKET_DIR_OUT, &qid_, 1); |
| 57 | if (ret < 0) { |
| 58 | return CommandFailure(-ret); |
| 59 | } |
| 60 | |
| 61 | return CommandSuccess(); |
| 62 | } |
| 63 | |
| 64 | void QueueOut::DeInit() { |
| 65 | if (port_) { |
nothing calls this directly
no test coverage detected