Re: [PATCH 17/24] snic: reserve tag for TMF

Bart Van Assche
2022-05-03T20:09:42Z

On 5/3/22 11:31, Hannes Reinecke wrote:
> On 5/3/22 09:18, Bart Van Assche wrote:
>> On 5/2/22 14:38, Hannes Reinecke wrote:
>>> diff --git a/drivers/scsi/snic/snic_main.c
>>> b/drivers/scsi/snic/snic_main.c
>>> index 29d56396058c..f344cbc27923 100644
>>> --- a/drivers/scsi/snic/snic_main.c
>>> +++ b/drivers/scsi/snic/snic_main.c
>>> @@ -512,6 +512,9 @@ snic_probe(struct pci_dev *pdev, const struct
>>> pci_device_id *ent)
>>>                        max_t(u32, SNIC_MIN_IO_REQ, max_ios));
>>>       snic->max_tag_id = shost->can_queue;
>>> +    /* Reserve one reset command */
>>> +    shost->can_queue--;
>>> +    snic->tmf_tag_id = shost->can_queue;
>>>       shost->max_lun = snic->config.luns_per_tgt;
>>>       shost->max_id = SNIC_MAX_TARGET;
>>
>> Hmm ... shouldn't cmd_per_lun also be decreased?
>>
> Shudder. No. Why?

I found the answer. The following code from scsi_add_host_with_dma()
reduces cmd_per_lun so it is not necessary to do that from inside
snic_probe():

shost->cmd_per_lun = min_t(int, shost->cmd_per_lun,
shost->can_queue);

Bart.