X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvm_power_manager%2Fchannel_manager.h;h=a2a2f2bba06d6f49c1481220d437f2e1cb48dc6e;hb=96d3d532f9f2e42cf8b620ad3ba9da1f04ccb3f0;hp=5e050ed8d41e0933c8f002d7e0487046205d45d5;hpb=5776b7a371d1635aea5f15dd5f79fdc0cafdb63d;p=dpdk.git diff --git a/examples/vm_power_manager/channel_manager.h b/examples/vm_power_manager/channel_manager.h index 5e050ed8d4..a2a2f2bba0 100644 --- a/examples/vm_power_manager/channel_manager.h +++ b/examples/vm_power_manager/channel_manager.h @@ -12,26 +12,20 @@ extern "C" { #include #include #include - -/* Maximum number of CPUs */ -#define CHANNEL_CMDS_MAX_CPUS 64 -#if CHANNEL_CMDS_MAX_CPUS > 64 -#error Maximum number of cores is 64, overflow is guaranteed to \ - cause problems with VM Power Management -#endif +#include /* Maximum name length including '\0' terminator */ #define CHANNEL_MGR_MAX_NAME_LEN 64 -/* Maximum number of channels to each Virtual Machine */ -#define CHANNEL_MGR_MAX_CHANNELS 64 - /* Hypervisor Path for libvirt(qemu/KVM) */ #define CHANNEL_MGR_DEFAULT_HV_PATH "qemu:///system" /* File socket directory */ #define CHANNEL_MGR_SOCKET_PATH "/tmp/powermonitor/" +/* FIFO file name template */ +#define CHANNEL_MGR_FIFO_PATTERN_NAME "fifo" + #ifndef UNIX_PATH_MAX struct sockaddr_un _sockaddr_un; #define UNIX_PATH_MAX sizeof(_sockaddr_un.sun_path) @@ -47,7 +41,7 @@ struct libvirt_vm_info { uint8_t num_cpus; }; -struct libvirt_vm_info lvm_info[MAX_CLIENTS]; +extern struct libvirt_vm_info lvm_info[MAX_CLIENTS]; /* Communication Channel Status */ enum channel_status { CHANNEL_MGR_CHANNEL_DISCONNECTED = 0, CHANNEL_MGR_CHANNEL_CONNECTED, @@ -82,10 +76,11 @@ struct channel_info { struct vm_info { char name[CHANNEL_MGR_MAX_NAME_LEN]; /**< VM name */ enum vm_status status; /**< libvirt status */ - uint16_t pcpu_map[CHANNEL_CMDS_MAX_CPUS]; /**< pCPU map to vCPU */ + uint16_t pcpu_map[RTE_MAX_LCORE]; /**< pCPU map to vCPU */ unsigned num_vcpus; /**< number of vCPUS */ - struct channel_info channels[CHANNEL_MGR_MAX_CHANNELS]; /**< Array of channel_info */ + struct channel_info channels[RTE_MAX_LCORE]; /**< channel_info array */ unsigned num_channels; /**< Number of channels */ + int allow_query; /**< is query allowed */ }; /** @@ -150,6 +145,22 @@ uint16_t get_pcpu(struct channel_info *chan_info, unsigned int vcpu); */ int set_pcpu(char *vm_name, unsigned int vcpu, unsigned int pcpu); +/** + * Allow or disallow queries for specified VM. + * It is thread-safe. + * + * @param name + * Virtual Machine name to lookup. + * + * @param allow_query + * Query status to be set. + * + * @return + * - 0 on success. + * - Negative on error. + */ +int set_query_status(char *vm_name, bool allow_query); + /** * Add a VM as specified by name to the Channel Manager. The name must * correspond to a valid libvirt domain name. @@ -216,13 +227,13 @@ int add_channels(const char *vm_name, unsigned *channel_list, unsigned num_channels); /** - * Set up a fifo by which host applications can send command an policies + * Set up fifos by which host applications can send command an policies * through a fifo to the vm_power_manager * * @return * - 0 for success */ -int add_host_channel(void); +int add_host_channels(void); /** * Remove a channel definition from the channel manager. This must only be