mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] scsi: ufs: mcq: Limit the amount of inflight requests
@ 2023-03-31  7:46 Avri Altman
  2023-03-31  8:04 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Avri Altman @ 2023-03-31  7:46 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen
  Cc: Asutosh Das, quic_cang, linux-scsi, linux-kernel,
	Johannes Thumshirn, Bart Van Assche, Avri Altman

in UFS, each request is designated via the triplet <iid, lun, task tag>.

In UFS4.0 the Initiator ID field is 8 bits wide, comprised of the
EXT_IID and IID fields. Together with the task tag (single byte), they
limit the driver's hw queues capacity.

---
v1 -> v2:
Attend Johannes's and Bart's comments

Signed-off-by: Avri Altman <avri.altman@wdc.com>
---
 drivers/ufs/core/ufshcd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 35a3bd95c5e4..cac7c9918c5b 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8468,6 +8468,11 @@ static int ufshcd_alloc_mcq(struct ufs_hba *hba)
 	if (ret)
 		goto err;
 
+	if (hba->nutrs * hba->nr_hw_queues > SZ_64K - 1) {
+		dev_info(hba->dev, "there can be at most 64K inflight requests\n");
+		goto err;
+	}
+
 	/*
 	 * Previously allocated memory for nutrs may not be enough in MCQ mode.
 	 * Number of supported tags in MCQ mode may be larger than SDB mode.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-20 10:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31  7:46 [PATCH v2] scsi: ufs: mcq: Limit the amount of inflight requests Avri Altman
2023-03-31  8:04 ` Johannes Thumshirn
2023-04-03  6:11 ` Dan Carpenter
2023-04-20  9:59   ` Avri Altman
2023-04-03  8:52 ` John Garry
2023-04-20 10:06   ` Avri Altman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®