int pqos_l3ca_set(const unsigned socket, const unsigned num_cos, const struct pqos_l3ca *ca) { int ret; unsigned i; if (ca == NULL || num_cos == 0) return PQOS_RETVAL_PARAM; _pqos_api_lock(); ret = _pqos_check_init(1); if (ret != PQOS_RETVAL_OK) { _pqos_api_unlock(); return ret; } /** * Check if class bitmasks are contiguous. */ for (i = 0; i < num_cos; i++) { int is_contig = 0; if (ca[i].cdp) { is_contig = is_contiguous(ca[i].u.s.data_mask) && is_contiguous(ca[i].u.s.code_mask); } else is_contig = is_contiguous(ca[i].u.ways_mask); if (!is_contig) { LOG_ERROR("L3 COS%u bit mask is not contiguous!\n", ca[i].class_id); _pqos_api_unlock(); return PQOS_RETVAL_PARAM; } } if (m_interface == PQOS_INTER_MSR) ret = hw_l3ca_set(socket, num_cos, ca); else { #ifdef __linux__ ret = os_l3ca_set(socket, num_cos, ca); #else LOG_INFO("OS interface not supported!\n"); ret = PQOS_RETVAL_RESOURCE; #endif } _pqos_api_unlock(); return ret; }
int pqos_l3ca_set(const unsigned socket, const unsigned num_cos, const struct pqos_l3ca *ca) { int ret; _pqos_api_lock(); ret = _pqos_check_init(1); if (ret != PQOS_RETVAL_OK) { _pqos_api_unlock(); return ret; } ret = hw_l3ca_set(socket, num_cos, ca); _pqos_api_unlock(); return ret; }