From patchwork Thu May 12 11:12:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 12847574 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 851F0C433EF for ; Thu, 12 May 2022 11:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353063AbiELLNF (ORCPT ); Thu, 12 May 2022 07:13:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353014AbiELLM4 (ORCPT ); Thu, 12 May 2022 07:12:56 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C37061608 for ; Thu, 12 May 2022 04:12:47 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4FE9821C75; Thu, 12 May 2022 11:12:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652353966; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZQq5kNpy2rQW2FyJjGBQR7re209Cr0VmNhPoAZZ2+Fw=; b=W/ZNH8t50m1ka+m0u3FF+EJBNRSMlX0COrVNcovZ/Xdid52XVV2RRxZUIZC/RgdxCvBvy8 bt/vG/1PXbHiDbTrnVSWLV0OpY6BGwCRmTFJ5cnxaXOI0dWyXnSm6E2TK/rbttE3mJBZeM 4FnaNu3SIKODfTb8ik8Em7uqQqihemA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652353966; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZQq5kNpy2rQW2FyJjGBQR7re209Cr0VmNhPoAZZ2+Fw=; b=CbpZ79lZLFW+f/Wdae71tfcCvqdxK2F/az227I5S9+c6HoiV7a1R7TRQltw6y9wqGrX/0q h9U0IeQ+6U6vKdAw== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 264DA2C149; Thu, 12 May 2022 11:12:46 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 0330E51943E2; Thu, 12 May 2022 13:12:46 +0200 (CEST) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , linux-scsi@vger.kernel.org, Hannes Reinecke , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH 05/20] mptfc: open-code mptfc_block_error_handler() for bus reset Date: Thu, 12 May 2022 13:12:21 +0200 Message-Id: <20220512111236.109851-6-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20220512111236.109851-1-hare@suse.de> References: <20220512111236.109851-1-hare@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When calling bus_reset we have potentially several ports to be reset, so this patch open-codes the existing mptfc_block_error_handler() to wait for all ports attached to this bus. Signed-off-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- drivers/message/fusion/mptfc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index ea8fc32dacfa..4a621380a4eb 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c @@ -262,12 +262,23 @@ static int mptfc_bus_reset(struct scsi_cmnd *SCpnt) { struct Scsi_Host *shost = SCpnt->device->host; - struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); MPT_SCSI_HOST __maybe_unused *hd = shost_priv(shost); + int channel = SCpnt->device->channel; + struct mptfc_rport_info *ri; int rtn; - rtn = mptfc_block_error_handler(rport); - if (rtn == SUCCESS) { + list_for_each_entry(ri, &hd->ioc->fc_rports, list) { + if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) { + VirtTarget *vtarget = ri->starget->hostdata; + + if (!vtarget || vtarget->channel != channel) + continue; + rtn = fc_block_rport(ri->rport); + if (rtn != 0) + break; + } + } + if (rtn == 0) { dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT "%s.%d: %d:%llu, executing recovery.\n", __func__, hd->ioc->name, shost->host_no,