Beispiel #1
0
int pqos_alloc_assign(const unsigned technology,
                      const unsigned *core_array,
                      const unsigned core_num,
                      unsigned *class_id)
{
	int ret;

	_pqos_api_lock();

        ret = _pqos_check_init(1);
        if (ret != PQOS_RETVAL_OK) {
                _pqos_api_unlock();
                return ret;
        }

	ret = hw_alloc_assign(technology, core_array, core_num, class_id);

	_pqos_api_unlock();

	return ret;
}
Beispiel #2
0
int
pqos_alloc_assign(const unsigned technology,
                  const unsigned *core_array,
                  const unsigned core_num,
                  unsigned *class_id)
{
	int ret;
	const int l2_req = ((technology & (1 << PQOS_CAP_TYPE_L2CA)) != 0);
	const int l3_req = ((technology & (1 << PQOS_CAP_TYPE_L3CA)) != 0);
	const int mba_req = ((technology & (1 << PQOS_CAP_TYPE_MBA)) != 0);

        if (core_num == 0 || core_array == NULL || class_id == NULL ||
            !(l2_req || l3_req || mba_req))
                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_alloc_assign(technology, core_array,
                        core_num, class_id);
        else {
#ifdef __linux__
                ret = os_alloc_assign(technology, core_array, core_num,
		                      class_id);
#else
                LOG_INFO("OS interface not supported!\n");
                ret = PQOS_RETVAL_RESOURCE;
#endif
        }
	_pqos_api_unlock();

        return ret;
}