All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: storvsc: Enabling WRITE_SAME
@ 2022-05-30  8:39 Saurabh Sengar
  2022-05-31 13:18 ` Michael Kelley (LINUX)
  0 siblings, 1 reply; 2+ messages in thread
From: Saurabh Sengar @ 2022-05-30  8:39 UTC (permalink / raw)
  To: kys, haiyangz, sthemmin, wei.liu, decui, martin.petersen, jejb,
	linux-hyperv, linux-kernel, ssengar, mikelley

This driver already has code logic for WRITE_SAME, but was never working
because of a bug where WRITE_SAME is disabled at scsi controller level.
Apparently if WRITE_SAME is disabled at scsi controller level it takes
precedence over disk level setting. This patch fixes this bug, and enables
this feature only for VMSTOR protocol version 10.0 and above.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
---
 drivers/scsi/storvsc_drv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index ca35309..3e55687 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -50,6 +50,7 @@
  * Win8: 5.1
  * Win8.1: 6.0
  * Win10: 6.2
+ * Win10.1: 10.0
  */
 
 #define VMSTOR_PROTO_VERSION(MAJOR_, MINOR_)	((((MAJOR_) & 0xff) << 8) | \
@@ -59,6 +60,7 @@
 #define VMSTOR_PROTO_VERSION_WIN8	VMSTOR_PROTO_VERSION(5, 1)
 #define VMSTOR_PROTO_VERSION_WIN8_1	VMSTOR_PROTO_VERSION(6, 0)
 #define VMSTOR_PROTO_VERSION_WIN10	VMSTOR_PROTO_VERSION(6, 2)
+#define VMSTOR_PROTO_VERSION_WIN10_1	VMSTOR_PROTO_VERSION(10, 0)
 
 /*  Packet structure describing virtual storage requests. */
 enum vstor_packet_operation {
@@ -205,6 +207,7 @@ struct vmscsi_request {
  */
 
 static const int protocol_version[] = {
+		VMSTOR_PROTO_VERSION_WIN10_1,
 		VMSTOR_PROTO_VERSION_WIN10,
 		VMSTOR_PROTO_VERSION_WIN8_1,
 		VMSTOR_PROTO_VERSION_WIN8,
@@ -1558,7 +1561,7 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
 			break;
 		}
 
-		if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN10)
+		if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN10_1)
 			sdevice->no_write_same = 0;
 	}
 
@@ -1845,7 +1848,6 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
 	.this_id =		-1,
 	/* Ensure there are no gaps in presented sgls */
 	.virt_boundary_mask =	PAGE_SIZE-1,
-	.no_write_same =	1,
 	.track_queue_depth =	1,
 	.change_queue_depth =	storvsc_change_queue_depth,
 };
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] scsi: storvsc: Enabling WRITE_SAME
  2022-05-30  8:39 [PATCH] scsi: storvsc: Enabling WRITE_SAME Saurabh Sengar
@ 2022-05-31 13:18 ` Michael Kelley (LINUX)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kelley (LINUX) @ 2022-05-31 13:18 UTC (permalink / raw)
  To: Saurabh Sengar, KY Srinivasan, Haiyang Zhang, Stephen Hemminger,
	wei.liu, Dexuan Cui, martin.petersen, jejb, linux-hyperv,
	linux-kernel, Saurabh Singh Sengar

From: Saurabh Sengar <ssengar@linux.microsoft.com>
> 
> This driver already has code logic for WRITE_SAME, but was never working
> because of a bug where WRITE_SAME is disabled at scsi controller level.
> Apparently if WRITE_SAME is disabled at scsi controller level it takes
> precedence over disk level setting. This patch fixes this bug, and enables
> this feature only for VMSTOR protocol version 10.0 and above.
> 
> Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
> ---
>  drivers/scsi/storvsc_drv.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
> index ca35309..3e55687 100644
> --- a/drivers/scsi/storvsc_drv.c
> +++ b/drivers/scsi/storvsc_drv.c
> @@ -50,6 +50,7 @@
>   * Win8: 5.1
>   * Win8.1: 6.0
>   * Win10: 6.2
> + * Win10.1: 10.0
>   */
> 
>  #define VMSTOR_PROTO_VERSION(MAJOR_, MINOR_)	((((MAJOR_) & 0xff) << 8) | \
> @@ -59,6 +60,7 @@
>  #define VMSTOR_PROTO_VERSION_WIN8	VMSTOR_PROTO_VERSION(5, 1)
>  #define VMSTOR_PROTO_VERSION_WIN8_1	VMSTOR_PROTO_VERSION(6, 0)
>  #define VMSTOR_PROTO_VERSION_WIN10	VMSTOR_PROTO_VERSION(6, 2)
> +#define VMSTOR_PROTO_VERSION_WIN10_1	VMSTOR_PROTO_VERSION(10, 0)

As you and I discussed offline, it's a bit weird that Hyper-V is using version 10.0
here instead of the expected 6.3, or even 7.0.  I'd like to hold off on this patch
until we can clarify with the Hyper-V team whether this is as expected.

Michael

> 
>  /*  Packet structure describing virtual storage requests. */
>  enum vstor_packet_operation {
> @@ -205,6 +207,7 @@ struct vmscsi_request {
>   */
> 
>  static const int protocol_version[] = {
> +		VMSTOR_PROTO_VERSION_WIN10_1,
>  		VMSTOR_PROTO_VERSION_WIN10,
>  		VMSTOR_PROTO_VERSION_WIN8_1,
>  		VMSTOR_PROTO_VERSION_WIN8,
> @@ -1558,7 +1561,7 @@ static int storvsc_device_configure(struct scsi_device *sdevice)
>  			break;
>  		}
> 
> -		if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN10)
> +		if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN10_1)
>  			sdevice->no_write_same = 0;
>  	}
> 
> @@ -1845,7 +1848,6 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
>  	.this_id =		-1,
>  	/* Ensure there are no gaps in presented sgls */
>  	.virt_boundary_mask =	PAGE_SIZE-1,
> -	.no_write_same =	1,
>  	.track_queue_depth =	1,
>  	.change_queue_depth =	storvsc_change_queue_depth,
>  };
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-31 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30  8:39 [PATCH] scsi: storvsc: Enabling WRITE_SAME Saurabh Sengar
2022-05-31 13:18 ` Michael Kelley (LINUX)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.