lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1571926881-75524-5-git-send-email-john.garry@huawei.com>
Date:   Thu, 24 Oct 2019 22:21:19 +0800
From:   John Garry <john.garry@...wei.com>
To:     <jejb@...ux.vnet.ibm.com>, <martin.petersen@...cle.com>
CC:     <linux-scsi@...r.kernel.org>, <linuxarm@...wei.com>,
        <linux-kernel@...r.kernel.org>, <hare@...e.com>,
        <ming.lei@...hat.com>, "John Garry" <john.garry@...wei.com>
Subject: [PATCH 4/6] scsi: hisi_sas: Add slot_index_alloc_v3_hw() and slot_index_free_v3_hw()

We will want to make these non-generic in future.

Signed-off-by: John Garry <john.garry@...wei.com>
---
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 27 ++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
index a46717efb870..497bbf6964f6 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
@@ -563,6 +563,31 @@ static int bitmaps_alloc_v3_hw(struct hisi_hba *hisi_hba)
 				 GFP_KERNEL, dev_to_node(hisi_hba->dev));
 }
 
+static int slot_index_alloc_v3_hw(struct hisi_hba *hisi_hba,
+				  struct domain_device *device,
+				  struct scsi_cmnd *scmd)
+{
+	struct sbitmap *slot_index_tags = &hisi_hba->slot_index_tags;
+	int index;
+
+	if (scmd)
+		return scmd->request->tag;
+
+	index = sbitmap_get(slot_index_tags, 0, false);
+	if (index == -1)
+		return index;
+	return index + HISI_SAS_UNRESERVED_IPTT;
+}
+
+static void slot_index_free_v3_hw(struct hisi_hba *hisi_hba, int slot_idx)
+{
+	struct sbitmap *slot_index_tags = &hisi_hba->slot_index_tags;
+
+	if (slot_idx >= HISI_SAS_UNRESERVED_IPTT)
+		sbitmap_clear_bit(slot_index_tags,
+				  slot_idx - HISI_SAS_UNRESERVED_IPTT);
+}
+
 static void init_reg_v3_hw(struct hisi_hba *hisi_hba)
 {
 	int i;
@@ -3090,6 +3115,8 @@ static struct scsi_host_template sht_v3_hw = {
 static const struct hisi_sas_hw hisi_sas_v3_hw = {
 	.hw_init = hisi_sas_v3_init,
 	.setup_itct = setup_itct_v3_hw,
+	.slot_index_alloc = slot_index_alloc_v3_hw,
+	.slot_index_free = slot_index_free_v3_hw,
 	.bitmaps_alloc = bitmaps_alloc_v3_hw,
 	.get_wideport_bitmap = get_wideport_bitmap_v3_hw,
 	.complete_hdr_size = sizeof(struct hisi_sas_complete_v3_hdr),
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ