* [PATCH 0000/0003] drivers: hv: util @ 2012-05-12 20:44 K. Y. Srinivasan 2012-05-12 20:41 ` KY Srinivasan 2012-05-12 20:44 ` [PATCH 1/2] Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp() K. Y. Srinivasan 0 siblings, 2 replies; 6+ messages in thread From: K. Y. Srinivasan @ 2012-05-12 20:44 UTC (permalink / raw) To: gregkh, linux-kernel, devel, virtualization, ohering Fix-up the version negotiation code for the util drivers. Regards, K. Y ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 0000/0003] drivers: hv: util 2012-05-12 20:44 [PATCH 0000/0003] drivers: hv: util K. Y. Srinivasan @ 2012-05-12 20:41 ` KY Srinivasan 2012-05-12 23:16 ` gregkh 2012-05-12 20:44 ` [PATCH 1/2] Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp() K. Y. Srinivasan 1 sibling, 1 reply; 6+ messages in thread From: KY Srinivasan @ 2012-05-12 20:41 UTC (permalink / raw) To: KY Srinivasan, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, virtualization@lists.osdl.org, ohering@suse.com > -----Original Message----- > From: K. Y. Srinivasan [mailto:kys@microsoft.com] > Sent: Saturday, May 12, 2012 4:44 PM > To: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; > devel@linuxdriverproject.org; virtualization@lists.osdl.org; ohering@suse.com > Cc: KY Srinivasan > Subject: [PATCH 0000/0003] drivers: hv: util There are only two patches following this mail; sorry for the typo in the subject line. Regards, K. Y ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0000/0003] drivers: hv: util 2012-05-12 20:41 ` KY Srinivasan @ 2012-05-12 23:16 ` gregkh 2012-05-14 14:04 ` KY Srinivasan 0 siblings, 1 reply; 6+ messages in thread From: gregkh @ 2012-05-12 23:16 UTC (permalink / raw) To: KY Srinivasan Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, virtualization@lists.osdl.org, ohering@suse.com On Sat, May 12, 2012 at 08:41:06PM +0000, KY Srinivasan wrote: > > > > -----Original Message----- > > From: K. Y. Srinivasan [mailto:kys@microsoft.com] > > Sent: Saturday, May 12, 2012 4:44 PM > > To: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; > > devel@linuxdriverproject.org; virtualization@lists.osdl.org; ohering@suse.com > > Cc: KY Srinivasan > > Subject: [PATCH 0000/0003] drivers: hv: util > > There are only two patches following this mail; sorry for the typo in the subject line. What's with the 0000 stuff as well? You do know that git send-mail can handle all of that for you properly, right? ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 0000/0003] drivers: hv: util 2012-05-12 23:16 ` gregkh @ 2012-05-14 14:04 ` KY Srinivasan 0 siblings, 0 replies; 6+ messages in thread From: KY Srinivasan @ 2012-05-14 14:04 UTC (permalink / raw) To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, virtualization@lists.osdl.org, ohering@suse.com > -----Original Message----- > From: gregkh@linuxfoundation.org [mailto:gregkh@linuxfoundation.org] > Sent: Saturday, May 12, 2012 7:17 PM > To: KY Srinivasan > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org; > virtualization@lists.osdl.org; ohering@suse.com > Subject: Re: [PATCH 0000/0003] drivers: hv: util > > On Sat, May 12, 2012 at 08:41:06PM +0000, KY Srinivasan wrote: > > > > > > > -----Original Message----- > > > From: K. Y. Srinivasan [mailto:kys@microsoft.com] > > > Sent: Saturday, May 12, 2012 4:44 PM > > > To: gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org; > > > devel@linuxdriverproject.org; virtualization@lists.osdl.org; > ohering@suse.com > > > Cc: KY Srinivasan > > > Subject: [PATCH 0000/0003] drivers: hv: util > > > > There are only two patches following this mail; sorry for the typo in the subject > line. > > What's with the 0000 stuff as well? You do know that git send-mail can > handle all of that for you properly, right? I am aware of the compose option; in this instance I hand edited the summary patch. Regards, K. Y ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp() 2012-05-12 20:44 [PATCH 0000/0003] drivers: hv: util K. Y. Srinivasan 2012-05-12 20:41 ` KY Srinivasan @ 2012-05-12 20:44 ` K. Y. Srinivasan 2012-05-12 20:44 ` [PATCH 2/2] Drivers: hv: util: Properly handle version negotiations K. Y. Srinivasan 1 sibling, 1 reply; 6+ messages in thread From: K. Y. Srinivasan @ 2012-05-12 20:44 UTC (permalink / raw) To: gregkh, linux-kernel, devel, virtualization, ohering The vmbus_prep_negotiate_resp() is only invoked when we are negotiating the version; so the current check in vmbus_prep_negotiate_resp() is unnecessary. Get rid of it. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> --- drivers/hv/channel_mgmt.c | 39 +++++++++++++++++++-------------------- 1 files changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 9ffbfc5..6c8c4d3 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -56,30 +56,29 @@ struct vmbus_channel_message_table_entry { void vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, struct icmsg_negotiate *negop, u8 *buf) { - if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { - icmsghdrp->icmsgsize = 0x10; - - negop = (struct icmsg_negotiate *)&buf[ - sizeof(struct vmbuspipe_hdr) + - sizeof(struct icmsg_hdr)]; - - if (negop->icframe_vercnt == 2 && - negop->icversion_data[1].major == 3) { - negop->icversion_data[0].major = 3; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = 3; - negop->icversion_data[1].minor = 0; - } else { - negop->icversion_data[0].major = 1; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = 1; - negop->icversion_data[1].minor = 0; - } - - negop->icframe_vercnt = 1; - negop->icmsg_vercnt = 1; + icmsghdrp->icmsgsize = 0x10; + + negop = (struct icmsg_negotiate *)&buf[ + sizeof(struct vmbuspipe_hdr) + + sizeof(struct icmsg_hdr)]; + + if (negop->icframe_vercnt == 2 && + negop->icversion_data[1].major == 3) { + negop->icversion_data[0].major = 3; + negop->icversion_data[0].minor = 0; + negop->icversion_data[1].major = 3; + negop->icversion_data[1].minor = 0; + } else { + negop->icversion_data[0].major = 1; + negop->icversion_data[0].minor = 0; + negop->icversion_data[1].major = 1; + negop->icversion_data[1].minor = 0; } + + negop->icframe_vercnt = 1; + negop->icmsg_vercnt = 1; } + EXPORT_SYMBOL_GPL(vmbus_prep_negotiate_resp); /* -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Drivers: hv: util: Properly handle version negotiations. 2012-05-12 20:44 ` [PATCH 1/2] Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp() K. Y. Srinivasan @ 2012-05-12 20:44 ` K. Y. Srinivasan 0 siblings, 0 replies; 6+ messages in thread From: K. Y. Srinivasan @ 2012-05-12 20:44 UTC (permalink / raw) To: gregkh, linux-kernel, devel, virtualization, ohering The current version negotiation code is not "future proof". Fix this by allowing each service the flexibility to either specify the highest version it can support or it can support the highest version number the host is offering. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> --- drivers/hv/channel_mgmt.c | 54 +++++++++++++++++++++++++++++++------------- drivers/hv/hv_kvp.c | 3 +- drivers/hv/hv_util.c | 9 +++++-- include/linux/hyperv.h | 4 ++- 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 6c8c4d3..2b8b8d4 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -46,37 +46,59 @@ struct vmbus_channel_message_table_entry { * * @icmsghdrp is of type &struct icmsg_hdr. * @negop is of type &struct icmsg_negotiate. - * Set up and fill in default negotiate response message. This response can - * come from both the vmbus driver and the hv_utils driver. The current api - * will respond properly to both Windows 2008 and Windows 2008-R2 operating - * systems. + * Set up and fill in default negotiate response message. + * + * The max_fw_version specifies the maximum framework version that + * we can support and max _srv_version specifies the maximum service + * version we can support. A special value MAX_SRV_VER can be + * specified to indicate that we can handle the maximum version + * exposed by the host. * * Mainly used by Hyper-V drivers. */ void vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, - struct icmsg_negotiate *negop, u8 *buf) + struct icmsg_negotiate *negop, u8 *buf, + int max_fw_version, int max_srv_version) { + int icframe_vercnt; + int icmsg_vercnt; + int i; + icmsghdrp->icmsgsize = 0x10; negop = (struct icmsg_negotiate *)&buf[ sizeof(struct vmbuspipe_hdr) + sizeof(struct icmsg_hdr)]; - if (negop->icframe_vercnt == 2 && - negop->icversion_data[1].major == 3) { - negop->icversion_data[0].major = 3; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = 3; - negop->icversion_data[1].minor = 0; - } else { - negop->icversion_data[0].major = 1; - negop->icversion_data[0].minor = 0; - negop->icversion_data[1].major = 1; - negop->icversion_data[1].minor = 0; + icframe_vercnt = negop->icframe_vercnt; + icmsg_vercnt = negop->icmsg_vercnt; + + /* + * Select the framework version number we will + * support. + */ + + for (i = 0; i < negop->icframe_vercnt; i++) { + if (negop->icversion_data[i].major <= max_fw_version) + icframe_vercnt = negop->icversion_data[i].major; + } + + for (i = negop->icframe_vercnt; + (i < negop->icframe_vercnt + negop->icmsg_vercnt); i++) { + if (negop->icversion_data[i].major <= max_srv_version) + icmsg_vercnt = negop->icversion_data[i].major; } + /* + * Respond with the maximum framework and service + * version numbers we can support. + */ negop->icframe_vercnt = 1; negop->icmsg_vercnt = 1; + negop->icversion_data[0].major = icframe_vercnt; + negop->icversion_data[0].minor = 0; + negop->icversion_data[1].major = icmsg_vercnt; + negop->icversion_data[1].minor = 0; } EXPORT_SYMBOL_GPL(vmbus_prep_negotiate_resp); diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index 6186025..0012eed 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c @@ -394,7 +394,8 @@ void hv_kvp_onchannelcallback(void *context) sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { - vmbus_prep_negotiate_resp(icmsghdrp, negop, recv_buffer); + vmbus_prep_negotiate_resp(icmsghdrp, negop, + recv_buffer, MAX_SRV_VER, MAX_SRV_VER); } else { kvp_msg = (struct hv_kvp_msg *)&recv_buffer[ sizeof(struct vmbuspipe_hdr) + diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index dbb8b8e..d3ac6a4 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c @@ -70,7 +70,8 @@ static void shutdown_onchannelcallback(void *context) sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { - vmbus_prep_negotiate_resp(icmsghdrp, negop, shut_txf_buf); + vmbus_prep_negotiate_resp(icmsghdrp, negop, + shut_txf_buf, MAX_SRV_VER, MAX_SRV_VER); } else { shutdown_msg = (struct shutdown_msg_data *)&shut_txf_buf[ @@ -195,7 +196,8 @@ static void timesync_onchannelcallback(void *context) sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { - vmbus_prep_negotiate_resp(icmsghdrp, NULL, time_txf_buf); + vmbus_prep_negotiate_resp(icmsghdrp, NULL, time_txf_buf, + MAX_SRV_VER, MAX_SRV_VER); } else { timedatap = (struct ictimesync_data *)&time_txf_buf[ sizeof(struct vmbuspipe_hdr) + @@ -234,7 +236,8 @@ static void heartbeat_onchannelcallback(void *context) sizeof(struct vmbuspipe_hdr)]; if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) { - vmbus_prep_negotiate_resp(icmsghdrp, NULL, hbeat_txf_buf); + vmbus_prep_negotiate_resp(icmsghdrp, NULL, + hbeat_txf_buf, MAX_SRV_VER, MAX_SRV_VER); } else { heartbeat_msg = (struct heartbeat_msg_data *)&hbeat_txf_buf[ diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 6af8738..68ed7f7 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1062,8 +1062,10 @@ struct hyperv_service_callback { void (*callback) (void *context); }; +#define MAX_SRV_VER 0x7ffffff extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, - struct icmsg_negotiate *, u8 *); + struct icmsg_negotiate *, u8 *, int, + int); int hv_kvp_init(struct hv_util_service *); void hv_kvp_deinit(void); -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-14 14:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-05-12 20:44 [PATCH 0000/0003] drivers: hv: util K. Y. Srinivasan 2012-05-12 20:41 ` KY Srinivasan 2012-05-12 23:16 ` gregkh 2012-05-14 14:04 ` KY Srinivasan 2012-05-12 20:44 ` [PATCH 1/2] Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp() K. Y. Srinivasan 2012-05-12 20:44 ` [PATCH 2/2] Drivers: hv: util: Properly handle version negotiations K. Y. Srinivasan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox