examples/power: increase allowed number of clients

Now that we're handling host policies, containers and virtual machines,
we'll rename MAX_VMS to MAX_CLIENTS, and increase from 4 to 64

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
This commit is contained in:
David Hunt 2018-10-17 14:05:30 +01:00 committed by Thomas Monjalon
parent 3618326f6c
commit 90a774c479
2 changed files with 7 additions and 7 deletions

View File

@ -37,7 +37,7 @@ struct sockaddr_un _sockaddr_un;
#define UNIX_PATH_MAX sizeof(_sockaddr_un.sun_path) #define UNIX_PATH_MAX sizeof(_sockaddr_un.sun_path)
#endif #endif
#define MAX_VMS 4 #define MAX_CLIENTS 64
#define MAX_VCPUS 20 #define MAX_VCPUS 20
@ -47,7 +47,7 @@ struct libvirt_vm_info {
uint8_t num_cpus; uint8_t num_cpus;
}; };
struct libvirt_vm_info lvm_info[MAX_VMS]; struct libvirt_vm_info lvm_info[MAX_CLIENTS];
/* Communication Channel Status */ /* Communication Channel Status */
enum channel_status { CHANNEL_MGR_CHANNEL_DISCONNECTED = 0, enum channel_status { CHANNEL_MGR_CHANNEL_DISCONNECTED = 0,
CHANNEL_MGR_CHANNEL_CONNECTED, CHANNEL_MGR_CHANNEL_CONNECTED,

View File

@ -41,7 +41,7 @@ static volatile unsigned run_loop = 1;
static int global_event_fd; static int global_event_fd;
static unsigned int policy_is_set; static unsigned int policy_is_set;
static struct epoll_event *global_events_list; static struct epoll_event *global_events_list;
static struct policy policies[MAX_VMS]; static struct policy policies[MAX_CLIENTS];
void channel_monitor_exit(void) void channel_monitor_exit(void)
{ {
@ -199,7 +199,7 @@ update_policy(struct channel_packet *pkt)
RTE_LOG(INFO, CHANNEL_MONITOR, RTE_LOG(INFO, CHANNEL_MONITOR,
"Applying policy for %s\n", pkt->vm_name); "Applying policy for %s\n", pkt->vm_name);
for (i = 0; i < MAX_VMS; i++) { for (i = 0; i < MAX_CLIENTS; i++) {
if (strcmp(policies[i].pkt.vm_name, pkt->vm_name) == 0) { if (strcmp(policies[i].pkt.vm_name, pkt->vm_name) == 0) {
/* Copy the contents of *pkt into the policy.pkt */ /* Copy the contents of *pkt into the policy.pkt */
policies[i].pkt = *pkt; policies[i].pkt = *pkt;
@ -214,7 +214,7 @@ update_policy(struct channel_packet *pkt)
} }
} }
if (!updated) { if (!updated) {
for (i = 0; i < MAX_VMS; i++) { for (i = 0; i < MAX_CLIENTS; i++) {
if (policies[i].enabled == 0) { if (policies[i].enabled == 0) {
policies[i].pkt = *pkt; policies[i].pkt = *pkt;
get_pcpu_to_control(&policies[i]); get_pcpu_to_control(&policies[i]);
@ -238,7 +238,7 @@ remove_policy(struct channel_packet *pkt __rte_unused)
* Disabling the policy is simply a case of setting * Disabling the policy is simply a case of setting
* enabled to 0 * enabled to 0
*/ */
for (i = 0; i < MAX_VMS; i++) { for (i = 0; i < MAX_CLIENTS; i++) {
if (strcmp(policies[i].pkt.vm_name, pkt->vm_name) == 0) { if (strcmp(policies[i].pkt.vm_name, pkt->vm_name) == 0) {
policies[i].enabled = 0; policies[i].enabled = 0;
return 0; return 0;
@ -609,7 +609,7 @@ run_channel_monitor(void)
if (policy_is_set) { if (policy_is_set) {
int j; int j;
for (j = 0; j < MAX_VMS; j++) { for (j = 0; j < MAX_CLIENTS; j++) {
if (policies[j].enabled == 1) if (policies[j].enabled == 1)
apply_policy(&policies[j]); apply_policy(&policies[j]);
} }