summaryrefslogtreecommitdiffstats
path: root/drivers/ufs/core/ufs-mcq.c
diff options
context:
space:
mode:
authorAsutosh Das <quic_asutoshd@quicinc.com>2023-01-13 12:48:48 -0800
committerMartin K. Petersen <martin.petersen@oracle.com>2023-01-13 21:03:37 -0500
commit854f84e7feebc0c5a63e4c1f29ddf201fd2a57bc (patch)
treef108af0523983902f47181ab278dc9d2a6d07bfe /drivers/ufs/core/ufs-mcq.c
parent22a2d563de1425ea294e9abfa104dbf20c83a28a (diff)
downloadlinux-stable-854f84e7feebc0c5a63e4c1f29ddf201fd2a57bc.tar.gz
linux-stable-854f84e7feebc0c5a63e4c1f29ddf201fd2a57bc.tar.bz2
linux-stable-854f84e7feebc0c5a63e4c1f29ddf201fd2a57bc.zip
scsi: ufs: core: mcq: Find hardware queue to queue request
Add support to find the hardware queue on which the request would be queued. Since the very first queue is to serve device commands, an offset of 1 is added to the index of the hardware queue. Co-developed-by: Can Guo <quic_cang@quicinc.com> Signed-off-by: Can Guo <quic_cang@quicinc.com> Signed-off-by: Asutosh Das <quic_asutoshd@quicinc.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/ufs/core/ufs-mcq.c')
-rw-r--r--drivers/ufs/core/ufs-mcq.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 68158259b223..be84bcef2044 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -93,6 +93,25 @@ void ufshcd_mcq_config_mac(struct ufs_hba *hba, u32 max_active_cmds)
}
/**
+ * ufshcd_mcq_req_to_hwq - find the hardware queue on which the
+ * request would be issued.
+ * @hba - per adapter instance
+ * @req - pointer to the request to be issued
+ *
+ * Returns the hardware queue instance on which the request would
+ * be queued.
+ */
+struct ufs_hw_queue *ufshcd_mcq_req_to_hwq(struct ufs_hba *hba,
+ struct request *req)
+{
+ u32 utag = blk_mq_unique_tag(req);
+ u32 hwq = blk_mq_unique_tag_to_hwq(utag);
+
+ /* uhq[0] is used to serve device commands */
+ return &hba->uhq[hwq + UFSHCD_MCQ_IO_QUEUE_OFFSET];
+}
+
+/**
* ufshcd_mcq_decide_queue_depth - decide the queue depth
* @hba - per adapter instance
*