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

Method CheckModuleConstraints

core/module.cc:209–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209CheckConstraintResult Module::CheckModuleConstraints() const {
210 int active_workers = num_active_workers();
211 CheckConstraintResult valid = CHECK_OK;
212 if (active_workers < min_allowed_workers_ ||
213 active_workers > max_allowed_workers_) {
214 LOG(ERROR) << "Mismatch in number of workers for module " << name_
215 << " min required " << min_allowed_workers_ << " max allowed "
216 << max_allowed_workers_ << " attached workers "
217 << active_workers;
218 if (active_workers > max_allowed_workers_) {
219 LOG(ERROR) << "Violates thread safety, returning fatal error";
220 return CHECK_FATAL_ERROR;
221 }
222 }
223
224 for (int wid = 0; wid < Worker::kMaxWorkers; wid++) {
225 if (active_workers_[wid]) {
226 placement_constraint socket = 1ull << workers[wid]->socket();
227 if ((socket & node_constraints_) == 0) {
228 LOG(ERROR) << "Worker wid " << wid
229 << " does not meet placement constraints for module "
230 << name_;
231 valid = CHECK_NONFATAL_ERROR;
232 }
233 }
234 }
235 return valid;
236}
237
238int Module::AddMetadataAttr(const std::string &name, size_t size,
239 bess::metadata::Attribute::AccessMode mode) {

Callers 1

Calls 1

socketMethod · 0.80

Tested by

no test coverage detected