All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <axboe@kernel.dk>, <damien.lemoal@opensource.wdc.com>,
	<bvanassche@acm.org>, <jejb@linux.ibm.com>,
	<martin.petersen@oracle.com>, <hch@lst.de>, <ming.lei@redhat.com>,
	<hare@suse.de>
Cc: <chenxiang66@hisilicon.com>, <linux-block@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-ide@vger.kernel.org>,
	<linux-scsi@vger.kernel.org>, <dm-devel@redhat.com>,
	<beanhuo@micron.com>, John Garry <john.garry@huawei.com>
Subject: [PATCH 11/11] scsi: hisi_sas: Remove private tag management
Date: Tue, 22 Mar 2022 18:39:45 +0800	[thread overview]
Message-ID: <1647945585-197349-12-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1647945585-197349-1-git-send-email-john.garry@huawei.com>

Now every sas_task which the driver sees has a SCSI command and also
request associated, so drop the internal tag management.

No reserved tags have been set aside in the tagset yet, but this is simple
to do.

For v2 HW we need to continue to allocate the tag internally as the HW is
so broken and we need to use special rules for tag allocation, see
slot_index_alloc_quirk_v2_hw()

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

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index b3e03c229cb5..19c9ed169c91 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -169,41 +169,6 @@ static void hisi_sas_slot_index_free(struct hisi_hba *hisi_hba, int slot_idx)
 	}
 }
 
-static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx)
-{
-	void *bitmap = hisi_hba->slot_index_tags;
-
-	__set_bit(slot_idx, bitmap);
-}
-
-static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba,
-				     struct sas_task *task)
-{
-	int index;
-	void *bitmap = hisi_hba->slot_index_tags;
-
-	if (task)
-		return sas_task_to_unique_tag(task);
-
-	spin_lock(&hisi_hba->lock);
-	index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
-				   hisi_hba->last_slot_index + 1);
-	if (index >= hisi_hba->slot_index_count) {
-		index = find_next_zero_bit(bitmap,
-				hisi_hba->slot_index_count,
-				HISI_SAS_UNRESERVED_IPTT);
-		if (index >= hisi_hba->slot_index_count) {
-			spin_unlock(&hisi_hba->lock);
-			return -SAS_QUEUE_FULL;
-		}
-	}
-	hisi_sas_slot_index_set(hisi_hba, index);
-	hisi_hba->last_slot_index = index;
-	spin_unlock(&hisi_hba->lock);
-
-	return index;
-}
-
 void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task,
 			     struct hisi_sas_slot *slot)
 {
@@ -556,7 +521,7 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags)
 	if (!internal_abort && hisi_hba->hw->slot_index_alloc)
 		rc = hisi_hba->hw->slot_index_alloc(hisi_hba, device);
 	else
-		rc = hisi_sas_slot_index_alloc(hisi_hba, task);
+		rc = sas_task_to_unique_tag(task);
 
 	if (rc < 0)
 		goto err_out_dif_dma_unmap;
-- 
2.26.2


WARNING: multiple messages have this Message-ID (diff)
From: John Garry <john.garry@huawei.com>
To: <axboe@kernel.dk>, <damien.lemoal@opensource.wdc.com>,
	<bvanassche@acm.org>, <jejb@linux.ibm.com>,
	<martin.petersen@oracle.com>, <hch@lst.de>, <ming.lei@redhat.com>,
	<hare@suse.de>
Cc: linux-scsi@vger.kernel.org, chenxiang66@hisilicon.com,
	John Garry <john.garry@huawei.com>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-ide@vger.kernel.org, dm-devel@redhat.com,
	beanhuo@micron.com
Subject: [dm-devel] [PATCH 11/11] scsi: hisi_sas: Remove private tag management
Date: Tue, 22 Mar 2022 18:39:45 +0800	[thread overview]
Message-ID: <1647945585-197349-12-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1647945585-197349-1-git-send-email-john.garry@huawei.com>

Now every sas_task which the driver sees has a SCSI command and also
request associated, so drop the internal tag management.

No reserved tags have been set aside in the tagset yet, but this is simple
to do.

For v2 HW we need to continue to allocate the tag internally as the HW is
so broken and we need to use special rules for tag allocation, see
slot_index_alloc_quirk_v2_hw()

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

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index b3e03c229cb5..19c9ed169c91 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -169,41 +169,6 @@ static void hisi_sas_slot_index_free(struct hisi_hba *hisi_hba, int slot_idx)
 	}
 }
 
-static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx)
-{
-	void *bitmap = hisi_hba->slot_index_tags;
-
-	__set_bit(slot_idx, bitmap);
-}
-
-static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba,
-				     struct sas_task *task)
-{
-	int index;
-	void *bitmap = hisi_hba->slot_index_tags;
-
-	if (task)
-		return sas_task_to_unique_tag(task);
-
-	spin_lock(&hisi_hba->lock);
-	index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
-				   hisi_hba->last_slot_index + 1);
-	if (index >= hisi_hba->slot_index_count) {
-		index = find_next_zero_bit(bitmap,
-				hisi_hba->slot_index_count,
-				HISI_SAS_UNRESERVED_IPTT);
-		if (index >= hisi_hba->slot_index_count) {
-			spin_unlock(&hisi_hba->lock);
-			return -SAS_QUEUE_FULL;
-		}
-	}
-	hisi_sas_slot_index_set(hisi_hba, index);
-	hisi_hba->last_slot_index = index;
-	spin_unlock(&hisi_hba->lock);
-
-	return index;
-}
-
 void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba, struct sas_task *task,
 			     struct hisi_sas_slot *slot)
 {
@@ -556,7 +521,7 @@ static int hisi_sas_queue_command(struct sas_task *task, gfp_t gfp_flags)
 	if (!internal_abort && hisi_hba->hw->slot_index_alloc)
 		rc = hisi_hba->hw->slot_index_alloc(hisi_hba, device);
 	else
-		rc = hisi_sas_slot_index_alloc(hisi_hba, task);
+		rc = sas_task_to_unique_tag(task);
 
 	if (rc < 0)
 		goto err_out_dif_dma_unmap;
-- 
2.26.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2022-03-22 10:47 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 10:39 [PATCH RFC 00/11] blk-mq/libata/scsi: SCSI driver tagging improvements John Garry
2022-03-22 10:39 ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 01/11] blk-mq: Add blk_mq_init_queue_ops() John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 11:18   ` Christoph Hellwig
2022-03-22 11:18     ` [dm-devel] " Christoph Hellwig
2022-03-22 11:33     ` John Garry
2022-03-22 11:33       ` [dm-devel] " John Garry
2022-03-22 12:16       ` Hannes Reinecke
2022-03-22 12:16         ` [dm-devel] " Hannes Reinecke
2022-03-22 12:30         ` John Garry
2022-03-22 12:30           ` [dm-devel] " John Garry
2022-03-22 14:03           ` Hannes Reinecke
2022-03-22 14:03             ` [dm-devel] " Hannes Reinecke
2022-03-22 15:17             ` John Garry
2022-03-22 15:17               ` [dm-devel] " John Garry
2022-03-22 15:31               ` Hannes Reinecke
2022-03-22 15:31                 ` [dm-devel] " Hannes Reinecke
2022-03-23  2:57   ` Bart Van Assche
2022-03-23  2:57     ` [dm-devel] " Bart Van Assche
2022-03-23  9:01     ` John Garry
2022-03-23  9:01       ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 02/11] scsi: core: Add SUBMITTED_BY_SCSI_CUSTOM_OPS John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 11:20   ` Christoph Hellwig
2022-03-22 11:20     ` [dm-devel] " Christoph Hellwig
2022-03-22 10:39 ` [PATCH 03/11] libata: Send internal commands through the block layer John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 11:20   ` Christoph Hellwig
2022-03-22 11:20     ` [dm-devel] " Christoph Hellwig
2022-03-22 11:36     ` John Garry
2022-03-22 11:36       ` [dm-devel] " John Garry
2022-04-07 14:32     ` John Garry
2022-04-07 14:32       ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 04/11] scsi: libsas: Send SMP " John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 11:23   ` Christoph Hellwig
2022-03-22 11:23     ` [dm-devel] " Christoph Hellwig
2022-03-22 14:37     ` John Garry
2022-03-22 14:37       ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 05/11] scsi: libsas: Send TMF " John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 06/11] scsi: core: Add scsi_alloc_request_hwq() John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 07/11] scsi: libsas: Send internal abort commands through the block layer John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 08/11] scsi: libsas: Change ATA support to deal with each qc having a SCSI command John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 09/11] scsi: libsas: Add sas_task_to_unique_tag() John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 10:39 ` [PATCH 10/11] scsi: libsas: Add sas_task_to_hwq() John Garry
2022-03-22 10:39   ` [dm-devel] " John Garry
2022-03-22 10:39 ` John Garry [this message]
2022-03-22 10:39   ` [dm-devel] [PATCH 11/11] scsi: hisi_sas: Remove private tag management John Garry
2022-03-22 11:30 ` [PATCH RFC 00/11] blk-mq/libata/scsi: SCSI driver tagging improvements Hannes Reinecke
2022-03-22 11:30   ` [dm-devel] " Hannes Reinecke
2022-03-22 12:17   ` John Garry
2022-03-22 12:17     ` [dm-devel] " John Garry

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=1647945585-197349-12-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=chenxiang66@hisilicon.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=dm-devel@redhat.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.