From patchwork Mon Feb 22 13:24:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 385781 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp1276453jap; Mon, 22 Feb 2021 05:34:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxr9PqUE4gaVj/lUhKWYiOkQL4R5w39lQOX02RSeGUCvK2AAKALIXvSDihVVf5SDpjwt3W X-Received: by 2002:a05:6402:b9a:: with SMTP id cf26mr7568022edb.183.1614000856087; Mon, 22 Feb 2021 05:34:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614000856; cv=none; d=google.com; s=arc-20160816; b=tMdxs8SGdYBW1aim4m/DG8trfkH2VOKk6etOtXinKkYLIF6UQ+zNDzf1oKFbXaGDYq TAMvjjwlSN0X9A5Kjtr4u962x37bS0gG6VrdLVrX0ZP/eTHU+1JVgufMAuZV120YvYDw eAFqIqlkIHkxpGrrXy+2dBvFtDsw+oWMI56p0p9RMKReQPpbZWyljnOYK5+qpbFAbkgG krd0UlwHyNLoodrri2KakkcqRTAkTKihb5vf5h/63buWc7zE2D4vgyb6TPUByigKEJI3 l27eb1oaZvFekN7qUdsJO96+aiWIUCrRUHKT0nze9ZfxGN58jmO3p43EL/+46Vze20Sq ++9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/1LC63b/J89nrbdF2vYTJdLsZjNdmnyDk/C9qRxzcvQ=; b=X3UjRAwfbZxiLRNPpd2I9Jji6BCUqX/I2B6H4gqutky58zIy8ZkZC/H9vo/2qLdKR1 AKaPx0zx+DXy5+57GFLqqM4R1QFxGO1exylKijTWKwFu+RdvSisUJUhFIsBHbeaI6mmK yE6+p2ylmKAsoIwmKrjU5wCzBq7vl9rBc086xEHMQ8B7wd0JaSYT19EDV0I6U4xeafW5 zfq8dCcIXD7npHkc0Xozzy6/3RVbQtmiLvSAu/OeBQi3MM+SNGdIvKW6qM8idK9UX9ga Aq4qwn5XRCT88SCNDsqnLAxUaECtZnxtw07OtiaAbsKKUploTxyh4v9QQNsXz1mjVaCG AK9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e17si12685682edz.241.2021.02.22.05.34.15 for ; Mon, 22 Feb 2021 05:34:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231262AbhBVNcn (ORCPT ); Mon, 22 Feb 2021 08:32:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:48680 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231602AbhBVN2n (ORCPT ); Mon, 22 Feb 2021 08:28:43 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9261AB113; Mon, 22 Feb 2021 13:24:16 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , John Garry , linux-scsi@vger.kernel.org Subject: [PATCH 28/31] scsi: hisi_sas: Use libsas slow task SCSI command Date: Mon, 22 Feb 2021 14:24:02 +0100 Message-Id: <20210222132405.91369-29-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210222132405.91369-1-hare@suse.de> References: <20210222132405.91369-1-hare@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: John Garry Now that a SCSI command can be allocated for a libsas slow tasks, make the task prep code use it. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 17 ++++++++++------- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 5 +++-- 2 files changed, 13 insertions(+), 9 deletions(-) -- 2.29.2 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 6a69a90a1b82..af653f4393ea 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -179,15 +179,11 @@ static void hisi_sas_slot_index_set(struct hisi_hba *hisi_hba, int slot_idx) set_bit(slot_idx, bitmap); } -static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba, - struct scsi_cmnd *scsi_cmnd) +static int hisi_sas_slot_index_alloc(struct hisi_hba *hisi_hba) { int index; void *bitmap = hisi_hba->slot_index_tags; - if (scsi_cmnd) - return scsi_cmnd->request->tag; - spin_lock(&hisi_hba->lock); index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count, hisi_hba->last_slot_index + 1); @@ -444,6 +440,8 @@ static int hisi_sas_task_prep(struct sas_task *task, } else { scmd = task->uldd_task; } + } else { + scmd = task->slow_task->scmd; } if (scmd) { @@ -484,8 +482,10 @@ static int hisi_sas_task_prep(struct sas_task *task, if (hisi_hba->hw->slot_index_alloc) rc = hisi_hba->hw->slot_index_alloc(hisi_hba, device); + else if (scmd) + rc = scmd->request->tag; else - rc = hisi_sas_slot_index_alloc(hisi_hba, scmd); + rc = hisi_sas_slot_index_alloc(hisi_hba); if (rc < 0) goto err_out_dif_dma_unmap; @@ -1975,7 +1975,9 @@ hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, port = to_hisi_sas_port(sas_port); /* simply get a slot and send abort command */ - rc = hisi_sas_slot_index_alloc(hisi_hba, NULL); + rc = = task->tag; + if (rc < 0) + rc = hisi_sas_slot_index_alloc(hisi_hba); if (rc < 0) goto err_out; @@ -2683,6 +2685,7 @@ int hisi_sas_probe(struct platform_device *pdev, } else { shost->can_queue = HISI_SAS_UNRESERVED_IPTT; shost->cmd_per_lun = HISI_SAS_UNRESERVED_IPTT; + shost->nr_reserved_cmds = HISI_SAS_RESERVED_IPTT; } sha->sas_ha_name = DRV_NAME; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 4580e081e489..c728c782e21a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -4720,8 +4720,9 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) shost->max_lun = ~0; shost->max_channel = 1; shost->max_cmd_len = 16; - shost->can_queue = HISI_SAS_UNRESERVED_IPTT; - shost->cmd_per_lun = HISI_SAS_UNRESERVED_IPTT; + shost->can_queue = HISI_SAS_MAX_COMMANDS; + shost->cmd_per_lun = HISI_SAS_MAX_COMMANDS; + shost->nr_reserved_cmds = HISI_SAS_RESERVED_IPTT; sha->sas_ha_name = DRV_NAME; sha->dev = dev;