MCPcopy Create free account
hub / github.com/NetSys/bess / AddWorker

Method AddWorker

core/bessctl.cc:558–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556 }
557
558 Status AddWorker(ServerContext*, const AddWorkerRequest* request,
559 EmptyResponse* response) override {
560 std::lock_guard<std::recursive_mutex> lock(mutex_);
561
562 uint64_t wid = request->wid();
563 if (wid >= Worker::kMaxWorkers) {
564 return return_with_error(response, EINVAL, "Invalid worker id");
565 }
566 uint64_t core = request->core();
567 if (!is_cpu_present(core)) {
568 return return_with_error(response, EINVAL, "Invalid core %d", core);
569 }
570 if (is_worker_active(wid)) {
571 return return_with_error(response, EEXIST, "worker:%d is already active",
572 wid);
573 }
574 const std::string& scheduler = request->scheduler();
575 if (scheduler != "" && scheduler != "experimental") {
576 return return_with_error(response, EINVAL, "Invalid scheduler %s",
577 scheduler.c_str());
578 }
579
580 launch_worker(wid, core, scheduler);
581 return Status::OK;
582 }
583
584 Status DestroyWorker(ServerContext*, const DestroyWorkerRequest* request,
585 EmptyResponse* response) override {

Callers

nothing calls this directly

Calls 7

return_with_errorFunction · 0.85
is_cpu_presentFunction · 0.85
is_worker_activeFunction · 0.85
launch_workerFunction · 0.85
widMethod · 0.80
coreMethod · 0.80
schedulerMethod · 0.80

Tested by

no test coverage detected