summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2012-03-10 15:32:08 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-13 14:35:25 -0700
commite485ceac9ebd43901ef0ce13622385d509e072e7 (patch)
tree74ba59bdaea967ab3dcc53fabd5dc163b2f2411c
parent04bf30115f4ba2beda1efb6cfbae49cdc757f3a9 (diff)
downloadlinux-3.10-e485ceac9ebd43901ef0ce13622385d509e072e7.tar.gz
linux-3.10-e485ceac9ebd43901ef0ce13622385d509e072e7.tar.bz2
linux-3.10-e485ceac9ebd43901ef0ce13622385d509e072e7.zip
Drivers: hv: Add new message types to enhance KVP
Add additional KVP (Key Value Pair) protocol messages to enhance KVP functionality for Linux guests on Hyper-V. As part of this, patch define an explicit version negoitiation message. Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/hv/hv_kvp.c5
-rw-r--r--include/linux/hyperv.h30
-rw-r--r--tools/hv/hv_kvp_daemon.c2
3 files changed, 31 insertions, 6 deletions
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index 0ef4c1f6ca5..779109b6f4f 100644
--- a/drivers/hv/hv_kvp.c
+++ b/drivers/hv/hv_kvp.c
@@ -78,7 +78,7 @@ kvp_register(void)
if (msg) {
kvp_msg = (struct hv_kvp_msg *)msg->data;
- version = kvp_msg->body.kvp_version;
+ version = kvp_msg->body.kvp_register.version;
msg->id.idx = CN_KVP_IDX;
msg->id.val = CN_KVP_VAL;
@@ -122,7 +122,8 @@ kvp_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
* to the host. But first, cancel the timeout.
*/
if (cancel_delayed_work_sync(&kvp_work))
- kvp_respond_to_host(data->data.key, data->data.value,
+ kvp_respond_to_host(data->data.key,
+ data->data.value,
!strlen(data->data.key));
}
}
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index e57a6c6ee0e..a2d8c547f91 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -149,7 +149,11 @@ struct hv_kvp_exchg_msg_value {
__u32 key_size;
__u32 value_size;
__u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
- __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
+ union {
+ __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
+ __u32 value_u32;
+ __u64 value_u64;
+ };
} __attribute__((packed));
struct hv_kvp_msg_enumerate {
@@ -157,11 +161,31 @@ struct hv_kvp_msg_enumerate {
struct hv_kvp_exchg_msg_value data;
} __attribute__((packed));
+struct hv_kvp_msg_get {
+ struct hv_kvp_exchg_msg_value data;
+};
+
+struct hv_kvp_msg_set {
+ struct hv_kvp_exchg_msg_value data;
+};
+
+struct hv_kvp_msg_delete {
+ __u32 key_size;
+ __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
+};
+
+struct hv_kvp_register {
+ __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
+};
+
struct hv_kvp_msg {
struct hv_kvp_hdr kvp_hdr;
union {
- struct hv_kvp_msg_enumerate kvp_enum_data;
- char kvp_version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
+ struct hv_kvp_msg_get kvp_get;
+ struct hv_kvp_msg_set kvp_set;
+ struct hv_kvp_msg_delete kvp_delete;
+ struct hv_kvp_msg_enumerate kvp_enum_data;
+ struct hv_kvp_register kvp_register;
} body;
} __attribute__((packed));
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index 4ebf7038058..00d3f7c099e 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -378,7 +378,7 @@ int main(void)
* Driver is registering with us; stash away the version
* information.
*/
- p = (char *)hv_msg->body.kvp_version;
+ p = (char *)hv_msg->body.kvp_register.version;
lic_version = malloc(strlen(p) + 1);
if (lic_version) {
strcpy(lic_version, p);