*/
struct virtual_machine_info {
char name[CHANNEL_MGR_MAX_NAME_LEN];
- uint16_t pcpu_map[CHANNEL_CMDS_MAX_CPUS];
- struct channel_info *channels[CHANNEL_CMDS_MAX_VM_CHANNELS];
- char channel_mask[POWER_MGR_MAX_CPUS];
+ uint16_t pcpu_map[RTE_MAX_LCORE];
+ struct channel_info *channels[RTE_MAX_LCORE];
+ char channel_mask[RTE_MAX_LCORE];
uint8_t num_channels;
enum vm_status status;
virDomainPtr domainPtr;
unsigned i, j;
int n_vcpus;
- memset(global_cpumaps, 0, CHANNEL_CMDS_MAX_CPUS*global_maplen);
+ memset(global_cpumaps, 0, RTE_MAX_LCORE*global_maplen);
if (!virDomainIsActive(vm_info->domainPtr)) {
n_vcpus = virDomainGetVcpuPinInfo(vm_info->domainPtr,
}
memset(global_vircpuinfo, 0, sizeof(*global_vircpuinfo)*
- CHANNEL_CMDS_MAX_CPUS);
+ RTE_MAX_LCORE);
cpuinfo = global_vircpuinfo;
n_vcpus = virDomainGetVcpus(vm_info->domainPtr, cpuinfo,
- CHANNEL_CMDS_MAX_CPUS, global_cpumaps, global_maplen);
+ RTE_MAX_LCORE, global_cpumaps, global_maplen);
if (n_vcpus < 0) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Error getting vCPU info for "
"active VM '%s'\n", vm_info->name);
return -1;
}
update_pcpus:
- if (n_vcpus >= CHANNEL_CMDS_MAX_CPUS) {
+ if (n_vcpus >= RTE_MAX_LCORE) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Number of vCPUS(%u) is out of range "
- "0...%d\n", n_vcpus, CHANNEL_CMDS_MAX_CPUS-1);
+ "0...%d\n", n_vcpus, RTE_MAX_LCORE-1);
return -1;
}
if (n_vcpus != vm_info->info.nrVirtCpu) {
int flags = VIR_DOMAIN_AFFECT_LIVE|VIR_DOMAIN_AFFECT_CONFIG;
struct virtual_machine_info *vm_info;
- if (vcpu >= CHANNEL_CMDS_MAX_CPUS) {
+ if (vcpu >= RTE_MAX_LCORE) {
RTE_LOG(ERR, CHANNEL_MANAGER, "vCPU(%u) exceeds max allowable(%d)\n",
- vcpu, CHANNEL_CMDS_MAX_CPUS-1);
+ vcpu, RTE_MAX_LCORE-1);
return -1;
}
"vCPUs(%u)\n", vcpu, vm_info->info.nrVirtCpu);
return -1;
}
- memset(global_cpumaps, 0 , CHANNEL_CMDS_MAX_CPUS * global_maplen);
+ memset(global_cpumaps, 0, RTE_MAX_LCORE * global_maplen);
VIR_USE_CPU(global_cpumaps, pcpu);
dir->d_name);
continue;
}
- if (channel_num >= CHANNEL_CMDS_MAX_VM_CHANNELS) {
+ if (channel_num >= RTE_MAX_LCORE) {
RTE_LOG(WARNING, CHANNEL_MANAGER, "Channel number(%u) is "
"greater than max allowable: %d, skipping '%s%s'\n",
- channel_num, CHANNEL_CMDS_MAX_VM_CHANNELS-1,
+ channel_num, RTE_MAX_LCORE-1,
CHANNEL_MGR_SOCKET_PATH, dir->d_name);
continue;
}
for (i = 0; i < len_channel_list; i++) {
- if (channel_list[i] >= CHANNEL_CMDS_MAX_VM_CHANNELS) {
+ if (channel_list[i] >= RTE_MAX_LCORE) {
RTE_LOG(INFO, CHANNEL_MANAGER, "Channel(%u) is out of range "
"0...%d\n", channel_list[i],
- CHANNEL_CMDS_MAX_VM_CHANNELS-1);
+ RTE_MAX_LCORE-1);
continue;
}
if (channel_exists(vm_info, channel_list[i])) {
{
struct virtual_machine_info *vm_info;
unsigned i;
- char mask[POWER_MGR_MAX_CPUS];
+ char mask[RTE_MAX_LCORE];
int num_channels_changed = 0;
if (!(status == CHANNEL_MGR_CHANNEL_CONNECTED ||
}
rte_spinlock_lock(&(vm_info->config_spinlock));
- memcpy(mask, (char *)vm_info->channel_mask, POWER_MGR_MAX_CPUS);
- for (i = 0; i < POWER_MGR_MAX_CPUS; i++) {
+ memcpy(mask, (char *)vm_info->channel_mask, RTE_MAX_LCORE);
+ for (i = 0; i < RTE_MAX_LCORE; i++) {
if (mask[i] != 1)
continue;
vm_info->channels[i]->status = status;
if (!global_hypervisor_available)
return;
- memset(global_cpumaps, 0, CHANNEL_CMDS_MAX_CPUS*global_maplen);
+ memset(global_cpumaps, 0, RTE_MAX_LCORE*global_maplen);
if (virNodeGetInfo(global_vir_conn_ptr, &node_info)) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Unable to retrieve node Info\n");
return;
{
struct virtual_machine_info *vm_info;
unsigned i, channel_num = 0;
- char mask[POWER_MGR_MAX_CPUS];
+ char mask[RTE_MAX_LCORE];
vm_info = find_domain_by_name(vm_name);
if (vm_info == NULL) {
rte_spinlock_lock(&(vm_info->config_spinlock));
- memcpy(mask, (char *)vm_info->channel_mask, POWER_MGR_MAX_CPUS);
- for (i = 0; i < POWER_MGR_MAX_CPUS; i++) {
+ memcpy(mask, (char *)vm_info->channel_mask, RTE_MAX_LCORE);
+ for (i = 0; i < RTE_MAX_LCORE; i++) {
if (mask[i] != 1)
continue;
info->channels[channel_num].channel_num = i;
rte_free(new_domain);
return -1;
}
- if (new_domain->info.nrVirtCpu > CHANNEL_CMDS_MAX_CPUS) {
+ if (new_domain->info.nrVirtCpu > RTE_MAX_LCORE) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Error the number of virtual CPUs(%u) is "
"greater than allowable(%d)\n", new_domain->info.nrVirtCpu,
- CHANNEL_CMDS_MAX_CPUS);
+ RTE_MAX_LCORE);
rte_free(new_domain);
return -1;
}
- for (i = 0; i < CHANNEL_CMDS_MAX_CPUS; i++) {
+ for (i = 0; i < RTE_MAX_LCORE; i++)
new_domain->pcpu_map[i] = 0;
- }
+
if (update_pcpus_mask(new_domain) < 0) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Error getting physical CPU pinning\n");
rte_free(new_domain);
}
strncpy(new_domain->name, vm_name, sizeof(new_domain->name));
new_domain->name[sizeof(new_domain->name) - 1] = '\0';
- memset(new_domain->channel_mask, 0, POWER_MGR_MAX_CPUS);
+ memset(new_domain->channel_mask, 0, RTE_MAX_LCORE);
new_domain->num_channels = 0;
if (!virDomainIsActive(dom_ptr))
} else {
global_hypervisor_available = 1;
- global_maplen = VIR_CPU_MAPLEN(CHANNEL_CMDS_MAX_CPUS);
+ global_maplen = VIR_CPU_MAPLEN(RTE_MAX_LCORE);
global_vircpuinfo = rte_zmalloc(NULL,
sizeof(*global_vircpuinfo) *
- CHANNEL_CMDS_MAX_CPUS, RTE_CACHE_LINE_SIZE);
+ RTE_MAX_LCORE, RTE_CACHE_LINE_SIZE);
if (global_vircpuinfo == NULL) {
RTE_LOG(ERR, CHANNEL_MANAGER, "Error allocating memory for CPU Info\n");
goto error;
}
global_cpumaps = rte_zmalloc(NULL,
- CHANNEL_CMDS_MAX_CPUS * global_maplen,
+ RTE_MAX_LCORE * global_maplen,
RTE_CACHE_LINE_SIZE);
if (global_cpumaps == NULL)
goto error;
- if (global_n_host_cpus > CHANNEL_CMDS_MAX_CPUS) {
+ if (global_n_host_cpus > RTE_MAX_LCORE) {
RTE_LOG(WARNING, CHANNEL_MANAGER, "The number of host CPUs(%u) exceeds the "
"maximum of %u. No cores over %u should be used.\n",
- global_n_host_cpus, CHANNEL_CMDS_MAX_CPUS,
- CHANNEL_CMDS_MAX_CPUS - 1);
- global_n_host_cpus = CHANNEL_CMDS_MAX_CPUS;
+ global_n_host_cpus, RTE_MAX_LCORE,
+ RTE_MAX_LCORE - 1);
+ global_n_host_cpus = RTE_MAX_LCORE;
}
return 0;
channel_manager_exit(void)
{
unsigned i;
- char mask[POWER_MGR_MAX_CPUS];
+ char mask[RTE_MAX_LCORE];
struct virtual_machine_info *vm_info;
LIST_FOREACH(vm_info, &vm_list_head, vms_info) {
rte_spinlock_lock(&(vm_info->config_spinlock));
- memcpy(mask, (char *)vm_info->channel_mask, POWER_MGR_MAX_CPUS);
- for (i = 0; i < POWER_MGR_MAX_CPUS; i++) {
+ memcpy(mask, (char *)vm_info->channel_mask, RTE_MAX_LCORE);
+ for (i = 0; i < RTE_MAX_LCORE; i++) {
if (mask[i] != 1)
continue;
remove_channel_from_monitor(
{
unsigned num_channels = 0, channel_num, i;
int channels_added;
- unsigned channel_list[CHANNEL_CMDS_MAX_VM_CHANNELS];
+ unsigned int channel_list[RTE_MAX_LCORE];
char *token, *remaining, *tail_ptr;
struct cmd_channels_op_result *res = parsed_result;
if ((errno != 0) || tail_ptr == NULL || (*tail_ptr != '\0'))
break;
- if (channel_num == CHANNEL_CMDS_MAX_VM_CHANNELS) {
+ if (channel_num == RTE_MAX_LCORE) {
cmdline_printf(cl, "Channel number '%u' exceeds the maximum number "
"of allowable channels(%u) for VM '%s'\n", channel_num,
- CHANNEL_CMDS_MAX_VM_CHANNELS, res->vm_name);
+ RTE_MAX_LCORE, res->vm_name);
return;
}
channel_list[num_channels++] = channel_num;
{
unsigned num_channels = 0, channel_num;
int changed;
- unsigned channel_list[CHANNEL_CMDS_MAX_VM_CHANNELS];
+ unsigned int channel_list[RTE_MAX_LCORE];
char *token, *remaining, *tail_ptr;
struct cmd_channels_status_op_result *res = parsed_result;
enum channel_status status;
if ((errno != 0) || tail_ptr == NULL || (*tail_ptr != '\0'))
break;
- if (channel_num == CHANNEL_CMDS_MAX_VM_CHANNELS) {
+ if (channel_num == RTE_MAX_LCORE) {
cmdline_printf(cl, "%u exceeds the maximum number of allowable "
"channels(%u) for VM '%s'\n", channel_num,
- CHANNEL_CMDS_MAX_VM_CHANNELS, res->vm_name);
+ RTE_MAX_LCORE, res->vm_name);
return;
}
channel_list[num_channels++] = channel_num;