From: "K. Y. Srinivasan" <kys@microsoft.com>
To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
ohering@suse.com
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Subject: [PATCH 1/4] Drivers: hv: Add new message types to enhance KVP
Date: Sat, 10 Mar 2012 15:32:08 -0800 [thread overview]
Message-ID: <1331422331-4381-1-git-send-email-kys@microsoft.com> (raw)
In-Reply-To: <1331422300-4330-1-git-send-email-kys@microsoft.com>
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.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
---
drivers/hv/hv_kvp.c | 5 +++--
include/linux/hyperv.h | 30 +++++++++++++++++++++++++++---
tools/hv/hv_kvp_daemon.c | 2 +-
3 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c
index 0ef4c1f..779109b 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 e57a6c6..a2d8c54 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 4ebf703..00d3f7c 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);
--
1.7.4.1
next prev parent reply other threads:[~2012-03-10 23:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-10 23:31 [PATCH 0000/0004] drivers: hv K. Y. Srinivasan
2012-03-10 23:32 ` K. Y. Srinivasan [this message]
2012-03-10 23:32 ` [PATCH 2/4] Drivers: hv: Support the newly introduced KVP messages in the driver K. Y. Srinivasan
2012-03-11 10:42 ` Dan Carpenter
2012-03-11 16:01 ` Alan Stern
2012-03-11 16:56 ` KY Srinivasan
2012-03-11 18:49 ` Dan Carpenter
2012-03-11 20:53 ` KY Srinivasan
2012-03-12 5:22 ` Dan Carpenter
2012-03-12 12:36 ` KY Srinivasan
2012-03-12 13:03 ` Dan Carpenter
2012-03-15 23:36 ` KY Srinivasan
2012-03-16 5:38 ` Dan Carpenter
2012-03-16 5:43 ` KY Srinivasan
2012-03-10 23:32 ` [PATCH 3/4] Tools: hv: Fully support the new KVP verbs in the user level daemon K. Y. Srinivasan
2012-03-10 23:32 ` [PATCH 4/4] Tools: hv: Support enumeration from all the pools K. Y. Srinivasan
2012-03-13 21:50 ` [PATCH 0000/0004] drivers: hv Greg KH
2012-03-15 23:26 ` KY Srinivasan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331422331-4381-1-git-send-email-kys@microsoft.com \
--to=kys@microsoft.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ohering@suse.com \
--cc=virtualization@lists.osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox