From patchwork Tue Oct 18 11:15:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 4081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1886227wrs; Tue, 18 Oct 2022 03:49:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66a2mp5XaIzbGFdSn5YgQIMKM1LSPLJobv+liNAhkxYQCz6OjAn3VrNppuStdR1p5HuKEt X-Received: by 2002:a17:90b:4ac1:b0:20a:de32:3650 with SMTP id mh1-20020a17090b4ac100b0020ade323650mr37790865pjb.142.1666090149965; Tue, 18 Oct 2022 03:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666090149; cv=none; d=google.com; s=arc-20160816; b=XsxTC0SeR01eRVBScCZ8E+GpGb59UVS2MeEyMJ6I7D9IEs2oiNbDyMSmQ9EMAjej9q 2CaA4/SyQpW2ZkvdUIwF3RmglYxJAHBPxgIr2wV/NWS5IjSR/L+eJNQD96Qk0feClf3c TUIyAuUIUHSc6w5ejZxf9Kwr4fu217075WBy//WoAMH9Cr4qOYK3dIwVLSMBcAt96HDe LjLLU0ng05Otge5GE8S0wYwSpA/71I/iDSPRf9RjF8oxvPHvxiRs4vPEjOlnHMan+lE6 WItA7wuS+eEGnmyN/i1cI7jtP7Ir5bZgMrOotp9LUJsZrrcWUhFaDEqeW2wbYTwTzZl7 gU+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=gZHt4flWMRkjqDa495gQTZ9FOpvtFe92vSClPH0C6dg=; b=L+KjrFiSX/5876OqMmq21y4+Yv+4azF2E6EO3Ilt6A2kPwOy1FwL6vKSqHW0tfDr3y n31liqmdfRUBaVz1FgjTUcTnobZpIFCIQOGs+sN4TNPzC7x0kObFvUM1hu2JZTc35E+n PHjmtAtbYHCdtj9OnkDsxohG0Nx7OJAYqxA6uEiX2kRZ5vYMdtPrjTNEgOanlyR3ULAy FqWMqTwafzbwVoKbHTfyhl3UO/Wq/t/Zq8rXu05ub+f1Os1ijNMxawLqMKAKQHAjIy1w YK9ao416rdtZSUFPi70MaWrXKHZQlKKAmGDU3kfob51vcsj8NzzR7LyFDrktqFpEg1tF qeEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a170902cec800b0016641a8abcfsi16626509plg.549.2022.10.18.03.48.56; Tue, 18 Oct 2022 03:49:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230007AbiJRKqF (ORCPT + 99 others); Tue, 18 Oct 2022 06:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbiJRKpx (ORCPT ); Tue, 18 Oct 2022 06:45:53 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE1C6B48B6; Tue, 18 Oct 2022 03:45:49 -0700 (PDT) Received: from fraeml713-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Ms9V56fvlz689QP; Tue, 18 Oct 2022 18:44:45 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml713-chm.china.huawei.com (10.206.15.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 18 Oct 2022 12:45:47 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 18 Oct 2022 11:45:44 +0100 From: John Garry To: , , , CC: , , , , , , John Garry 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 Message-ID: <1666091763-11023-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1666091763-11023-1-git-send-email-john.garry@huawei.com> References: <1666091763-11023-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747022145050734584?= X-GMAIL-MSGID: =?utf-8?q?1747022145050734584?= 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 Reviewed-by: Hannes Reinecke --- 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) {