linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Bart Van Assche <bvanassche@acm.org>, <jejb@linux.ibm.com>,
	<martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<ming.lei@redhat.com>
Subject: Re: [PATCH] scsi: core: Cap shost cmd_per_lun at can_queue
Date: Thu, 20 May 2021 18:24:02 +0100	[thread overview]
Message-ID: <457d23a9-deb0-4ee1-fe7f-5a63605d9686@huawei.com> (raw)
In-Reply-To: <439c6fb8-3799-bfae-7f44-9f8c26a7bf79@acm.org>

On 20/05/2021 17:57, Bart Van Assche wrote:
>> 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?

For cmd_per_lun, is it related to SCSI task tag limit? SAM-3 says upto 
64b for task tag, but then SAS uses 16b for TMF tag, so not sure.

Someone with more SCSI spec knowledge than we can clarify this.

> 
> $ 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

I guess int was used for can_queue as an arbitrarily big number.

And if we try to use 16b for can_queue, reducing size of 
variables/structure members sometimes breaks things, from my experience.

Thanks,
John




  reply	other threads:[~2021-05-20 17:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 14:31 [PATCH] scsi: core: Cap shost cmd_per_lun at can_queue John Garry
2021-05-20  1:24 ` Ming Lei
2021-05-20 15:57 ` Bart Van Assche
2021-05-20 16:41   ` John Garry
2021-05-20 16:57     ` Bart Van Assche
2021-05-20 17:24       ` John Garry [this message]
2021-05-22  4:28     ` Martin K. Petersen
2021-05-22  4:35 ` Martin K. Petersen
2021-05-26  4:07 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=457d23a9-deb0-4ee1-fe7f-5a63605d9686@huawei.com \
    --to=john.garry@huawei.com \
    --cc=bvanassche@acm.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).