47
47
* @icmsghdrp is of type &struct icmsg_hdr.
48
48
* @negop is of type &struct icmsg_negotiate.
49
* Set up and fill in default negotiate response message. This response can
50
* come from both the vmbus driver and the hv_utils driver. The current api
51
* will respond properly to both Windows 2008 and Windows 2008-R2 operating
49
* Set up and fill in default negotiate response message.
51
* The max_fw_version specifies the maximum framework version that
52
* we can support and max _srv_version specifies the maximum service
53
* version we can support. A special value MAX_SRV_VER can be
54
* specified to indicate that we can handle the maximum version
55
* exposed by the host.
54
57
* Mainly used by Hyper-V drivers.
56
59
void vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp,
57
struct icmsg_negotiate *negop, u8 *buf)
60
struct icmsg_negotiate *negop, u8 *buf,
61
int max_fw_version, int max_srv_version)
59
if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {
60
icmsghdrp->icmsgsize = 0x10;
62
negop = (struct icmsg_negotiate *)&buf[
63
sizeof(struct vmbuspipe_hdr) +
64
sizeof(struct icmsg_hdr)];
66
if (negop->icframe_vercnt == 2 &&
67
negop->icversion_data[1].major == 3) {
68
negop->icversion_data[0].major = 3;
69
negop->icversion_data[0].minor = 0;
70
negop->icversion_data[1].major = 3;
71
negop->icversion_data[1].minor = 0;
73
negop->icversion_data[0].major = 1;
74
negop->icversion_data[0].minor = 0;
75
negop->icversion_data[1].major = 1;
76
negop->icversion_data[1].minor = 0;
79
negop->icframe_vercnt = 1;
80
negop->icmsg_vercnt = 1;
67
icmsghdrp->icmsgsize = 0x10;
69
negop = (struct icmsg_negotiate *)&buf[
70
sizeof(struct vmbuspipe_hdr) +
71
sizeof(struct icmsg_hdr)];
73
icframe_vercnt = negop->icframe_vercnt;
74
icmsg_vercnt = negop->icmsg_vercnt;
77
* Select the framework version number we will
81
for (i = 0; i < negop->icframe_vercnt; i++) {
82
if (negop->icversion_data[i].major <= max_fw_version)
83
icframe_vercnt = negop->icversion_data[i].major;
86
for (i = negop->icframe_vercnt;
87
(i < negop->icframe_vercnt + negop->icmsg_vercnt); i++) {
88
if (negop->icversion_data[i].major <= max_srv_version)
89
icmsg_vercnt = negop->icversion_data[i].major;
93
* Respond with the maximum framework and service
94
* version numbers we can support.
96
negop->icframe_vercnt = 1;
97
negop->icmsg_vercnt = 1;
98
negop->icversion_data[0].major = icframe_vercnt;
99
negop->icversion_data[0].minor = 0;
100
negop->icversion_data[1].major = icmsg_vercnt;
101
negop->icversion_data[1].minor = 0;
83
104
EXPORT_SYMBOL_GPL(vmbus_prep_negotiate_resp);