Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5755037rwi; Tue, 18 Oct 2022 03:49:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qPPn5AZHbFdKZE6Ods8wBbwqH9No2ijqG3H2dRziTnTHCgg9Cbgto9ouiw+tEbTD8NXlM X-Received: by 2002:a17:902:f710:b0:178:a692:b1f7 with SMTP id h16-20020a170902f71000b00178a692b1f7mr2613573plo.112.1666090173944; Tue, 18 Oct 2022 03:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666090173; cv=none; d=google.com; s=arc-20160816; b=KgYnwt762CdUjIxGGPGDOR11KISHVpkl3JbC4+bxLSOqeeqp7Z42Vnbke1IaY58V6s fDRaEP4F1XPPAmHvXJz4r/wc/OPVSZoNl+X9McwcQ4vm+4i9aVQkyK16JPYdOkqIY7U1 /6bGQftUmKFOqpiCWYKx9wvlEm3wvMcmT4V9WNIiwFE/QkdBsRBEenncRuXpggXw15rd zVJTPpLOCttq501pyFN/znwQ2PNt7akziV1YNJns16ZCY5naOrDtOwndpmc8rw/wI7ia bq4B6S6RrHuBrlMj2ySUI0mpoOXR2wUB/ha6ed69ryhyC/Vm0v8wwaLhx8iKgn6EmdUR Dkng== 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 Return-Path: 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.49.22; Tue, 18 Oct 2022 03:49:33 -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 Content-Type: text/plain 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 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 --- 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