public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <jejb@linux.ibm.com>, <martin.petersen@oracle.com>,
	<jinpu.wang@cloud.ionos.com>, <damien.lemoal@wdc.com>
Cc: <hare@suse.de>, <linux-scsi@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>,
	<ipylypiv@google.com>, <changyuanl@google.com>,
	John Garry <john.garry@huawei.com>
Subject: [PATCH v4 3/7] scsi: hisi_sas: Put reserved tags in lower region of tagset
Date: Tue, 18 Oct 2022 19:15:59 +0800	[thread overview]
Message-ID: <1666091763-11023-4-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1666091763-11023-1-git-send-email-john.garry@huawei.com>

To be consistent with blk-mq, put the reserved tags in the lower region of
the tagset. Eventually we hope to get rid of all this reserved tag
management.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 26e474b0f53f..54860d252466 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -183,16 +183,16 @@ static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba,
 	void *bitmap = hisi_hba->slot_index_tags;
 
 	if (rq)
-		return rq->tag;
+		return rq->tag + HISI_SAS_RESERVED_IPTT;
 
 	spin_lock(&hisi_hba->lock);
-	index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
+	index = find_next_zero_bit(bitmap, HISI_SAS_RESERVED_IPTT,
 				   hisi_hba->last_slot_index + 1);
-	if (index >= hisi_hba->slot_index_count) {
+	if (index >= HISI_SAS_RESERVED_IPTT) {
 		index = find_next_zero_bit(bitmap,
-				hisi_hba->slot_index_count,
-				HISI_SAS_UNRESERVED_IPTT);
-		if (index >= hisi_hba->slot_index_count) {
+				HISI_SAS_RESERVED_IPTT,
+				0);
+		if (index >= HISI_SAS_RESERVED_IPTT) {
 			spin_unlock(&hisi_hba->lock);
 			return -SAS_QUEUE_FULL;
 		}
@@ -2216,7 +2216,7 @@ int hisi_sas_alloc(struct hisi_hba *hisi_hba)
 	if (!hisi_hba->sata_breakpoint)
 		goto err_out;
 
-	hisi_hba->last_slot_index = HISI_SAS_UNRESERVED_IPTT;
+	hisi_hba->last_slot_index = 0;
 
 	hisi_hba->wq = create_singlethread_workqueue(dev_name(dev));
 	if (!hisi_hba->wq) {
-- 
2.35.3


  parent reply	other threads:[~2022-10-18 10:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 11:15 [PATCH v4 0/7] scsi: libsas: Use request tag in more drivers John Garry
2022-10-18 11:15 ` [PATCH v4 1/7] scsi: libsas: Add sas_task_find_rq() John Garry
2022-10-18 11:15 ` [PATCH v4 2/7] scsi: hisi_sas: Use sas_task_find_rq() John Garry
2022-10-18 11:15 ` John Garry [this message]
2022-10-18 12:02   ` [PATCH v4 3/7] scsi: hisi_sas: Put reserved tags in lower region of tagset Hannes Reinecke
2022-10-18 11:16 ` [PATCH v4 4/7] scsi: pm8001: Remove pm8001_tag_init() John Garry
2022-10-18 11:16 ` [PATCH v4 5/7] scsi: pm8001: Use sas_task_find_rq() for tagging John Garry
2022-10-18 12:03   ` Hannes Reinecke
2022-10-18 11:16 ` [PATCH v4 6/7] scsi: mvsas: Delete mvs_tag_init() John Garry
2022-10-18 11:16 ` [PATCH v4 7/7] scsi: mvsas: Use sas_task_find_rq() for tagging John Garry
2022-10-22  3:05 ` [PATCH v4 0/7] scsi: libsas: Use request tag in more drivers Martin K. Petersen
2022-10-27  2:58 ` 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=1666091763-11023-4-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=changyuanl@google.com \
    --cc=damien.lemoal@wdc.com \
    --cc=hare@suse.de \
    --cc=ipylypiv@google.com \
    --cc=jejb@linux.ibm.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=martin.petersen@oracle.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