Re: [RFC PATCH 2/5] scsi: ufs: Add UFS-feature layer

Bart Van Assche
2020-06-12T04:28:41Z

On 2020-06-11 19:27, Daejun Park wrote:
>>> @@ -2525,6 +2525,8 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
>>>
>>> ufshcd_comp_scsi_upiu(hba, lrbp);
>>>
>>> + ufsf_ops_prep_fn(hba, lrbp);
>>> +
>>> err = ufshcd_map_sg(hba, lrbp);
>>> if (err) {
>>> lrbp->cmd = NULL;
>
>> What happens if a SCSI command is retried and hence ufsf_ops_prep_fn()
>> is called multiple times for the same SCSI command?
>
> Developers of UFS features should implement it so that prep_fn does not have
> any problems even if it processes the same SCSI command multiple times.
> In HPB feature, prep_fn modifies only upiu structure. So it is ok to call
> it multiple times because the upiu is rebuilt from ufshcd_comp_scsi_upiu().

Please make sure that this expectation is documented somewhere.

Thanks,

Bart.