diff options
author | Keith Mange <keith.mange@microsoft.com> | 2015-08-13 11:43:47 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Odin.com> | 2015-08-27 01:41:34 -0400 |
commit | 2492fd7a60270b81b7ed491745fd595a26841a45 (patch) | |
tree | 299a6375d8b27acf23532ec2fd6a3a47e00f6505 | |
parent | 6ee5c61535a2df807069145970d3e7fa492a3fac (diff) |
storvsc: Use a single value to track protocol versions
Use a single value to track protocol versions to simplify
comparisons and to be consistent with vmbus version tracking.
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: Keith Mange <keith.mange@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r-- | drivers/scsi/storvsc_drv.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 05f6f970826e..367f66cc1f07 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c | |||
@@ -58,12 +58,11 @@ | |||
58 | * Win8: 5.1 | 58 | * Win8: 5.1 |
59 | */ | 59 | */ |
60 | 60 | ||
61 | #define VMSTOR_PROTO_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \ | ||
62 | (((MINOR_) & 0xff))) | ||
61 | 63 | ||
62 | #define VMSTOR_WIN7_MAJOR 4 | 64 | #define VMSTOR_PROTO_VERSION_WIN7 VMSTOR_PROTO_VERSION(4, 2) |
63 | #define VMSTOR_WIN7_MINOR 2 | 65 | #define VMSTOR_PROTO_VERSION_WIN8 VMSTOR_PROTO_VERSION(5, 1) |
64 | |||
65 | #define VMSTOR_WIN8_MAJOR 5 | ||
66 | #define VMSTOR_WIN8_MINOR 1 | ||
67 | 66 | ||
68 | 67 | ||
69 | /* Packet structure describing virtual storage requests. */ | 68 | /* Packet structure describing virtual storage requests. */ |
@@ -161,8 +160,7 @@ static int sense_buffer_size; | |||
161 | */ | 160 | */ |
162 | 161 | ||
163 | static int vmscsi_size_delta; | 162 | static int vmscsi_size_delta; |
164 | static int vmstor_current_major; | 163 | static int vmstor_proto_version; |
165 | static int vmstor_current_minor; | ||
166 | 164 | ||
167 | struct vmscsi_win8_extension { | 165 | struct vmscsi_win8_extension { |
168 | /* | 166 | /* |
@@ -474,18 +472,6 @@ done: | |||
474 | kfree(wrk); | 472 | kfree(wrk); |
475 | } | 473 | } |
476 | 474 | ||
477 | /* | ||
478 | * Major/minor macros. Minor version is in LSB, meaning that earlier flat | ||
479 | * version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1). | ||
480 | */ | ||
481 | |||
482 | static inline u16 storvsc_get_version(u8 major, u8 minor) | ||
483 | { | ||
484 | u16 version; | ||
485 | |||
486 | version = ((major << 8) | minor); | ||
487 | return version; | ||
488 | } | ||
489 | 475 | ||
490 | /* | 476 | /* |
491 | * We can get incoming messages from the host that are not in response to | 477 | * We can get incoming messages from the host that are not in response to |
@@ -923,8 +909,7 @@ static int storvsc_channel_init(struct hv_device *device) | |||
923 | vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; | 909 | vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; |
924 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; | 910 | vstor_packet->flags = REQUEST_COMPLETION_FLAG; |
925 | 911 | ||
926 | vstor_packet->version.major_minor = | 912 | vstor_packet->version.major_minor = vmstor_proto_version; |
927 | storvsc_get_version(vmstor_current_major, vmstor_current_minor); | ||
928 | 913 | ||
929 | /* | 914 | /* |
930 | * The revision number is only used in Windows; set it to 0. | 915 | * The revision number is only used in Windows; set it to 0. |
@@ -1555,7 +1540,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) | |||
1555 | u32 payload_sz; | 1540 | u32 payload_sz; |
1556 | u32 length; | 1541 | u32 length; |
1557 | 1542 | ||
1558 | if (vmstor_current_major <= VMSTOR_WIN8_MAJOR) { | 1543 | if (vmstor_proto_version <= VMSTOR_PROTO_VERSION_WIN8) { |
1559 | /* | 1544 | /* |
1560 | * On legacy hosts filter unimplemented commands. | 1545 | * On legacy hosts filter unimplemented commands. |
1561 | * Future hosts are expected to correctly handle | 1546 | * Future hosts are expected to correctly handle |
@@ -1761,16 +1746,14 @@ static int storvsc_probe(struct hv_device *device, | |||
1761 | if (vmbus_proto_version < VERSION_WIN8) { | 1746 | if (vmbus_proto_version < VERSION_WIN8) { |
1762 | sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; | 1747 | sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; |
1763 | vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); | 1748 | vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); |
1764 | vmstor_current_major = VMSTOR_WIN7_MAJOR; | 1749 | vmstor_proto_version = VMSTOR_PROTO_VERSION_WIN7; |
1765 | vmstor_current_minor = VMSTOR_WIN7_MINOR; | ||
1766 | max_luns_per_target = STORVSC_IDE_MAX_LUNS_PER_TARGET; | 1750 | max_luns_per_target = STORVSC_IDE_MAX_LUNS_PER_TARGET; |
1767 | max_targets = STORVSC_IDE_MAX_TARGETS; | 1751 | max_targets = STORVSC_IDE_MAX_TARGETS; |
1768 | max_channels = STORVSC_IDE_MAX_CHANNELS; | 1752 | max_channels = STORVSC_IDE_MAX_CHANNELS; |
1769 | } else { | 1753 | } else { |
1770 | sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; | 1754 | sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; |
1771 | vmscsi_size_delta = 0; | 1755 | vmscsi_size_delta = 0; |
1772 | vmstor_current_major = VMSTOR_WIN8_MAJOR; | 1756 | vmstor_proto_version = VMSTOR_PROTO_VERSION_WIN8; |
1773 | vmstor_current_minor = VMSTOR_WIN8_MINOR; | ||
1774 | max_luns_per_target = STORVSC_MAX_LUNS_PER_TARGET; | 1757 | max_luns_per_target = STORVSC_MAX_LUNS_PER_TARGET; |
1775 | max_targets = STORVSC_MAX_TARGETS; | 1758 | max_targets = STORVSC_MAX_TARGETS; |
1776 | max_channels = STORVSC_MAX_CHANNELS; | 1759 | max_channels = STORVSC_MAX_CHANNELS; |