Skip to content

Commit 5ae6a6a

Browse files
ssudhakarpmartinkpetersen
authored andcommitted
scsi: vhost: Notify TCM about the maximum sg entries supported per command
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. Link: https://lore.kernel.org/r/1590166317-953-1-git-send-email-sudhakar.panneerselvam@oracle.com Cc: Michael S. Tsirkin <[email protected]> Cc: Jason Wang <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Stefan Hajnoczi <[email protected]> Reviewed-by: Mike Christie <[email protected]> Signed-off-by: Sudhakar Panneerselvam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ac988c4 commit 5ae6a6a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/vhost/scsi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,6 +2280,7 @@ static struct configfs_attribute *vhost_scsi_wwn_attrs[] = {
22802280
static const struct target_core_fabric_ops vhost_scsi_ops = {
22812281
.module = THIS_MODULE,
22822282
.fabric_name = "vhost",
2283+
.max_data_sg_nents = VHOST_SCSI_PREALLOC_SGLS,
22832284
.tpg_get_wwn = vhost_scsi_get_fabric_wwn,
22842285
.tpg_get_tag = vhost_scsi_get_tpgt,
22852286
.tpg_check_demo_mode = vhost_scsi_check_true,

0 commit comments

Comments
 (0)