int pqos_mba_set(const unsigned socket, const unsigned num_cos, const struct pqos_mba *requested, struct pqos_mba *actual) { int ret; unsigned i; if (requested == NULL || num_cos == 0) return PQOS_RETVAL_PARAM; /** * Check if MBA rate is within allowed range */ for (i = 0; i < num_cos; i++) if (requested[i].ctrl == 0 && (requested[i].mb_max == 0 || requested[i].mb_max > 100)) { LOG_ERROR("MBA COS%u rate out of range (from 1-100)!\n", requested[i].class_id); return PQOS_RETVAL_PARAM; } _pqos_api_lock(); ret = _pqos_check_init(1); if (ret != PQOS_RETVAL_OK) { _pqos_api_unlock(); return ret; } if (m_interface == PQOS_INTER_MSR) ret = hw_mba_set(socket, num_cos, requested, actual); else { #ifdef __linux__ ret = os_mba_set(socket, num_cos, requested, actual); #else LOG_INFO("OS interface not supported!\n"); ret = PQOS_RETVAL_RESOURCE; #endif } _pqos_api_unlock(); return ret; }
int pqos_mba_set(const unsigned socket, const unsigned num_cos, const struct pqos_mba *requested, struct pqos_mba *actual) { int ret; _pqos_api_lock(); ret = _pqos_check_init(1); if (ret != PQOS_RETVAL_OK) { _pqos_api_unlock(); return ret; } ret = hw_mba_set(socket, num_cos, requested, actual); _pqos_api_unlock(); return ret; }