linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] vhost: scsi: notify TCM about the maximum sg entries supported per command.
@ 2020-05-22 16:51 Sudhakar Panneerselvam
  2020-05-23 19:05 ` Mike Christie
  2020-05-27  2:13 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Sudhakar Panneerselvam @ 2020-05-22 16:51 UTC (permalink / raw)
  To: martin.petersen, target-devel, linux-scsi
  Cc: mst, jasowang, pbonzini, stefanha, shirley.ma

vhost-scsi pre-allocates the maximum sg entries per command and if a
command requires more than VHOST_SCSI_PREALLOC_SGLS entries, then that
command is failed by it. This patch lets vhost communicate the max sg limit
when it registers vhost_scsi_ops with TCM. With this change, TCM would
report the max sg entries through "Block Limits" VPD page which will be
typically queried by the SCSI initiator during device discovery. By knowing
this limit, the initiator could ensure the maximum transfer length is less
than or equal to what is reported by vhost-scsi.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Sudhakar Panneerselvam <sudhakar.panneerselvam@oracle.com>
---
 drivers/vhost/scsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index c39952243fd3..8b104f76f324 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -2280,6 +2280,7 @@ static void vhost_scsi_drop_tport(struct se_wwn *wwn)
 static const struct target_core_fabric_ops vhost_scsi_ops = {
 	.module				= THIS_MODULE,
 	.fabric_name			= "vhost",
+	.max_data_sg_nents		= VHOST_SCSI_PREALLOC_SGLS,
 	.tpg_get_wwn			= vhost_scsi_get_fabric_wwn,
 	.tpg_get_tag			= vhost_scsi_get_tpgt,
 	.tpg_check_demo_mode		= vhost_scsi_check_true,
-- 
1.8.3.1


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

* Re: [PATCH 1/1] vhost: scsi: notify TCM about the maximum sg entries supported per command.
  2020-05-22 16:51 [PATCH 1/1] vhost: scsi: notify TCM about the maximum sg entries supported per command Sudhakar Panneerselvam
@ 2020-05-23 19:05 ` Mike Christie
  2020-05-27  2:13 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Christie @ 2020-05-23 19:05 UTC (permalink / raw)
  To: Sudhakar Panneerselvam, martin.petersen, target-devel, linux-scsi
  Cc: mst, jasowang, pbonzini, stefanha, shirley.ma

On 5/22/20 11:51 AM, Sudhakar Panneerselvam wrote:
> vhost-scsi pre-allocates the maximum sg entries per command and if a
> command requires more than VHOST_SCSI_PREALLOC_SGLS entries, then that
> command is failed by it. This patch lets vhost communicate the max sg limit
> when it registers vhost_scsi_ops with TCM. With this change, TCM would
> report the max sg entries through "Block Limits" VPD page which will be
> typically queried by the SCSI initiator during device discovery. By knowing
> this limit, the initiator could ensure the maximum transfer length is less
> than or equal to what is reported by vhost-scsi.
> 
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Sudhakar Panneerselvam <sudhakar.panneerselvam@oracle.com>
> ---
>  drivers/vhost/scsi.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index c39952243fd3..8b104f76f324 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -2280,6 +2280,7 @@ static void vhost_scsi_drop_tport(struct se_wwn *wwn)
>  static const struct target_core_fabric_ops vhost_scsi_ops = {
>  	.module				= THIS_MODULE,
>  	.fabric_name			= "vhost",
> +	.max_data_sg_nents		= VHOST_SCSI_PREALLOC_SGLS,
>  	.tpg_get_wwn			= vhost_scsi_get_fabric_wwn,
>  	.tpg_get_tag			= vhost_scsi_get_tpgt,
>  	.tpg_check_demo_mode		= vhost_scsi_check_true,
> 

Looks ok to me.

Reviewed-by: Mike Christie <mchristi@redhat.com>


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

* Re: [PATCH 1/1] vhost: scsi: notify TCM about the maximum sg entries supported per command.
  2020-05-22 16:51 [PATCH 1/1] vhost: scsi: notify TCM about the maximum sg entries supported per command Sudhakar Panneerselvam
  2020-05-23 19:05 ` Mike Christie
@ 2020-05-27  2:13 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2020-05-27  2:13 UTC (permalink / raw)
  To: Sudhakar Panneerselvam, linux-scsi, target-devel
  Cc: Martin K . Petersen, jasowang, shirley.ma, mst, pbonzini, stefanha

On Fri, 22 May 2020 16:51:57 +0000, Sudhakar Panneerselvam wrote:

> vhost-scsi pre-allocates the maximum sg entries per command and if a
> command requires more than VHOST_SCSI_PREALLOC_SGLS entries, then that
> command is failed by it. This patch lets vhost communicate the max sg limit
> when it registers vhost_scsi_ops with TCM. With this change, TCM would
> report the max sg entries through "Block Limits" VPD page which will be
> typically queried by the SCSI initiator during device discovery. By knowing
> this limit, the initiator could ensure the maximum transfer length is less
> than or equal to what is reported by vhost-scsi.

Applied to 5.8/scsi-queue, thanks!

[1/1] scsi: vhost: Notify TCM about the maximum sg entries supported per command
      https://git.kernel.org/mkp/scsi/c/5ae6a6a91503

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-05-27  2:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 16:51 [PATCH 1/1] vhost: scsi: notify TCM about the maximum sg entries supported per command Sudhakar Panneerselvam
2020-05-23 19:05 ` Mike Christie
2020-05-27  2:13 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).