Re: [PATCH] scsi: core: Cap shost cmd_per_lun at can_queue

From: Bart Van Assche
Date: Thu May 20 2021 - 12:58:33 EST


On 5/20/21 9:41 AM, John Garry wrote:
> On 20/05/2021 16:57, Bart Van Assche wrote:
>> In SCSI header files a mix of int, short and unsigned int is used for
>> cmd_per_lun and can_queue. How about changing the types of these two
>> member variables in include/scsi/*h into u16?
> I don't mind doing that, but is there any requirement for can_queue to
> not be limited to 16b?

Maybe I'm missing something but it is not clear to me why different
structures in the SCSI headers use different data types for can_queue
and cmd_per_lun?

$ git grep -nHEw '(cmd_per_lun|can_queue);' include/scsi
include/scsi/scsi_device.h:318: unsigned int can_queue;
include/scsi/scsi_host.h:372: int can_queue;
include/scsi/scsi_host.h:425: short cmd_per_lun;
include/scsi/scsi_host.h:612: int can_queue;
include/scsi/scsi_host.h:613: short cmd_per_lun;

> It seems intentional that can_queue is int and cmd_per_lun is short.

Intentional? It is not clear to me why? Even high-performance drivers
like iSER and SRP set can_queue by default to a value that fits well in
a 16-bit variable (512 and 64 respectively). The highest value that I
found after a quick search is the following:

#define ISCSI_TOTAL_CMDS_MAX 4096

Thanks,

Bart.