Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp908944rdb; Fri, 1 Sep 2023 07:34:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMG6rfOBDoYdCnFRzEVCAvzdb74ZOJs6boTeuZSE8G8nJiNRuesIX34N4ZGn4Zydy4aT+I X-Received: by 2002:a05:6a20:7b03:b0:133:be9d:a8d3 with SMTP id s3-20020a056a207b0300b00133be9da8d3mr2269629pzh.14.1693578881737; Fri, 01 Sep 2023 07:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693578881; cv=none; d=google.com; s=arc-20160816; b=SJJq4CnvZ2BbBFvXuZzA3/8g9c/iPwc0bCAxkcdS0gTf4a+l63AT0hwhbbW5+T30y/ wOsLmqaPauBIwQD/M71OovLj23sV9mZE74hQAW+uF6ERejPlORq/Sl2eI31ny/yWekzC rUQEuASXhj4GHJXXreDyGhema0wtyAOKHVGFXTsZ0iEsGZL/J7g8yCHsuMYTv3DWh7/M BtpqMrPsltLI+uYHZ1IpEX9wcU9pXrX3Xc1/2P5PCiowNpulpAPDcMn8vAZNMMQmp0hs K9PyRtiagjgLcd7+rpaTdzvzHg/iAPcxpUube1X31X1X7EtGtUltLNt5AOaF9J8k5jEa qlVg== 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=FNBIGzjiQ2psGaGyb5j5Mtc/ZziWuXMSZEqIiyjo5nA=; fh=U8QwZ5xHaU2/8ln497S/E2sKzHGkM9mdrpYdmq3DJOs=; b=U6DxfQwCila9D/cjfQVdUYe1z1dWokeMMFYTChAym5zR9IPlopTXg4O3zdPFuW0VFA mr0IgPMZGSQWSvnDiLBOZHdE2TUidYTX5M8E+v/t8etA2BjFAZEdom0FzSlEaGGlv7Nk qLnWHPCgO6aKt4NjG33NBwmHSfkyl5e5V0scCkM1hDf5NAaeHHQvYD3VrI5NyW0NB2Ah pjzIywxdeNl+h3MoJarbDDls0mmL/IIQyx36ILDp32M6lC2MUDy3y6MJHyAo7AMKo6w4 QZyJ5+vbjnxfOtSwJmzG1WsxXK2U4kMC8jZ0NRgi2KgE3garo2ZQ+EazOG2nPvhuWaIK qW5Q== 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 ch13-20020a056a00288d00b0068bf30dfd93si2875942pfb.76.2023.09.01.07.34.24; Fri, 01 Sep 2023 07:34:41 -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 S1349052AbjIAJnB (ORCPT + 99 others); Fri, 1 Sep 2023 05:43:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349000AbjIAJmo (ORCPT ); Fri, 1 Sep 2023 05:42:44 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB72A10FB; Fri, 1 Sep 2023 02:42:10 -0700 (PDT) Received: from kwepemm600012.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RcY163FHTzrSKP; Fri, 1 Sep 2023 17:40:26 +0800 (CST) Received: from build.huawei.com (10.175.101.6) by kwepemm600012.china.huawei.com (7.193.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 1 Sep 2023 17:42:07 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , CC: Hannes Reinecke , , , , Wenchao Hao Subject: [RFC PATCH v2 15/19] scsi: mpt3sas: Add param to control target based error handle Date: Fri, 1 Sep 2023 17:41:23 +0800 Message-ID: <20230901094127.2010873-16-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230901094127.2010873-1-haowenchao2@huawei.com> References: <20230901094127.2010873-1-haowenchao2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600012.china.huawei.com (7.193.23.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 Add new module param target_eh to control if enable target based error handle, since mpt3sas defined callback eh_host_reset, so make it fallback to further recover when target based recovery can not recover all error commands. Signed-off-by: Wenchao Hao --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 7a48e89c3e5d..6170d8a772d4 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -178,6 +178,10 @@ static bool lun_eh; module_param(lun_eh, bool, 0444); MODULE_PARM_DESC(lun_eh, "LUN based error handle (def=0)"); +static bool target_eh; +module_param(target_eh, bool, 0444); +MODULE_PARM_DESC(target_eh, "target based error handle (def=0)"); + /* raid transport support */ static struct raid_template *mpt3sas_raid_template; static struct raid_template *mpt2sas_raid_template; @@ -1879,6 +1883,13 @@ scsih_target_alloc(struct scsi_target *starget) struct _pcie_device *pcie_device; unsigned long flags; struct sas_rphy *rphy; + int ret = 0; + + if (target_eh) { + ret = scsi_target_setup_eh(starget, 1); + if (ret) + return ret; + } sas_target_priv_data = kzalloc(sizeof(*sas_target_priv_data), GFP_KERNEL); @@ -1969,6 +1980,9 @@ scsih_target_destroy(struct scsi_target *starget) struct _pcie_device *pcie_device; unsigned long flags; + if (target_eh) + scsi_target_clear_eh(starget); + sas_target_priv_data = starget->hostdata; if (!sas_target_priv_data) return; -- 2.35.3