From patchwork Tue Oct 25 10:18:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 10666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp907817wru; Tue, 25 Oct 2022 02:52:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tVpxq2ySK9WUefn7aU58rk+G+dxcE20cykHTMn4o07YT76md1shn1yD+0x1LlNNCBFiLz X-Received: by 2002:a05:6402:190e:b0:45c:d10a:4c1a with SMTP id e14-20020a056402190e00b0045cd10a4c1amr35109453edz.345.1666691536068; Tue, 25 Oct 2022 02:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666691536; cv=none; d=google.com; s=arc-20160816; b=cUu8CHI0nOF+2ChkFJF+kOPw5ChM0dnyjgsFVl8zmWbzAsIN5eQrp4435437C8HgyN 1ZtsM48rHI5NgA/sMOJ+BvCoqBoUWlSRVwLjXmjJu3+lIQooZbVJFJlBUqxAd16WZY3m hImmsG4TMZRj6EwbCHuUceSNQhiuhbK1QnQeMXvvniskpht0waQJHUZah3KtISZfyDLe 6k+CZC3UkFxmG+td00+FGt25gdo6yveZK4Vbtvu6uccPP4qWOZq19M+FYHch/bQZAmXj xijjSUkDFdZSdWoaVbezr7yumEw2Zo/WjY/5C1OIqbWM7v8udFTNKLFuKJ3x2JHkdPqH Fbiw== 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=xGPXYlqD8pXe6yDaFI0uF0Z/RpxJUHfZnbyqt50nP0U=; b=OkYVrpBnM4bMFGZDaeiCIPwCVkBEEm5S2dYM9AYkuHm79hYydQshIFJjVGcEOeG0Ko Fug4QEHMNsu3PnR4INZIzu+XMDzCDnhxzfmJNi7pvTU/VQzVvvoPCgrS3yvTGwnUd4yr oNOvto+gRH+IziKZr0p3/m5znXruyctkkPd24AclkYKEbeY5yj9O5QFgpdmx+z7LDj3E 1bIObqNP+56tVEZ5aGJBgrobZcSlqHWSr2gm79SYJD9hnOXz9lPrW7r40e2ZZLl2k2c2 vP1dgzS5rOLmLMUT9+uZuQm7+VH90hCH3LYlFE7ah2LvP68847NzPRepfDhXf9B6nU4G f9eA== 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 hs21-20020a1709073e9500b0073d81935416si1739189ejc.749.2022.10.25.02.51.52; Tue, 25 Oct 2022 02:52:16 -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 S231609AbiJYJud (ORCPT + 99 others); Tue, 25 Oct 2022 05:50:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231468AbiJYJtU (ORCPT ); Tue, 25 Oct 2022 05:49:20 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C39AC14D8D6; Tue, 25 Oct 2022 02:48:29 -0700 (PDT) Received: from frapeml500006.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MxRsk3Wldz688p7; Tue, 25 Oct 2022 17:46:34 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by frapeml500006.china.huawei.com (7.182.85.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 25 Oct 2022 11:48:27 +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, 25 Oct 2022 10:48:22 +0100 From: John Garry To: , , , , , , , , , CC: , , , , , John Garry Subject: [PATCH RFC v3 08/22] scsi: scsi_transport_sas: Alloc sdev for expander Date: Tue, 25 Oct 2022 18:18:02 +0800 Message-ID: <1666693096-180008-9-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1666693096-180008-1-git-send-email-john.garry@huawei.com> References: <1666693096-180008-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) 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?1747652744221802674?= X-GMAIL-MSGID: =?utf-8?q?1747652744221802674?= Allocate a scsi device for an expander for sending SMP commands on the expander sdev request queue. Use channel=1 to not conflict with scsi target devices. Signed-off-by: John Garry --- drivers/scsi/scsi_transport_sas.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 2f88c61216ee..da075dfc7cd0 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -1548,6 +1548,11 @@ int sas_rphy_add(struct sas_rphy *rphy) scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, SCSI_SCAN_INITIAL); + } else if (identify->device_type == SAS_EDGE_EXPANDER_DEVICE || + identify->device_type == SAS_FANOUT_EXPANDER_DEVICE) { + + if (!scsi_get_dev(&rphy->dev, 1, rphy->scsi_target_id, 0)) + return -ENODEV; } return 0; @@ -1627,6 +1632,7 @@ sas_rphy_remove(struct sas_rphy *rphy) case SAS_EDGE_EXPANDER_DEVICE: case SAS_FANOUT_EXPANDER_DEVICE: sas_remove_children(dev); + scsi_remove_target(dev); break; default: break;