Skip to content

Commit

Permalink
Drivers: hv: Save and export negotiated vmbus version
Browse files Browse the repository at this point in the history
Export the negotiated vmbus version as this may be useful for
individual drivers.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Jan 17, 2013
1 parent 29423b7 commit 37f7278
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/hv/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/hyperv.h>
#include <linux/export.h>
#include <asm/hyperv.h>
#include "hyperv_vmbus.h"

Expand All @@ -54,6 +55,12 @@ struct vmbus_connection vmbus_connection = {

#define VERSION_INVAL -1

/*
* Negotiated protocol version with the host.
*/
__u32 vmbus_proto_version;
EXPORT_SYMBOL_GPL(vmbus_proto_version);

static __u32 vmbus_get_next_version(__u32 current_version)
{
switch (current_version) {
Expand Down Expand Up @@ -215,6 +222,8 @@ int vmbus_connect(void)
if (version == VERSION_INVAL)
goto cleanup;

vmbus_proto_version = version;
pr_info("Negotiated host information %d\n", version);
kfree(msginfo);
return 0;

Expand Down
6 changes: 6 additions & 0 deletions include/linux/hyperv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1204,5 +1204,11 @@ int hv_kvp_init(struct hv_util_service *);
void hv_kvp_deinit(void);
void hv_kvp_onchannelcallback(void *);

/*
* Negotiated version with the Host.
*/

extern __u32 vmbus_proto_version;

#endif /* __KERNEL__ */
#endif /* _HYPERV_H */

0 comments on commit 37f7278

Please sign in to comment.