From patchwork Thu Aug 19 09:19:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 500080 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D4B2C432BE for ; Thu, 19 Aug 2021 09:19:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 209F7610A6 for ; Thu, 19 Aug 2021 09:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232676AbhHSJUB (ORCPT ); Thu, 19 Aug 2021 05:20:01 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60720 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbhHSJUA (ORCPT ); Thu, 19 Aug 2021 05:20:00 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 48E9E220B4; Thu, 19 Aug 2021 09:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1629364764; 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=T/sqV+nQxqbJIMMRrsdw8yQaLaaKoJ2csMtVAjuKcDo=; b=gLN30aKljpTigl1o5yTkLd2UCivj1gMqjLSE/Wikf6HpxjyEdHKNDHJ/1K++TUlS/yP3/o cVunjj5XxqYgMGbFb70gGAhzp4hoNt/EB0iFV/JVkZQJ1FH5qqnUR4mt73Kdt7cn67o0bg UOLikrJDK4tQciMJEqd4dvMtAHTHvrg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1629364764; 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=T/sqV+nQxqbJIMMRrsdw8yQaLaaKoJ2csMtVAjuKcDo=; b=I0dBzR0/GnQ7ePkTQUjMdYbswjgKeQ1VNN6WHHmXUeloyqPVncRbzA8bsYoiDpMbjQ2bDc 5CDW7jfQskXdrhAw== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 85D10A3B9F; Thu, 19 Aug 2021 09:19:14 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 30ECE518D298; Thu, 19 Aug 2021 11:19:24 +0200 (CEST) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , Nilesh Javali , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 1/3] qla2xxx: Do not call fc_block_scsi_eh() during bus reset Date: Thu, 19 Aug 2021 11:19:11 +0200 Message-Id: <20210819091913.94436-2-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210819091913.94436-1-hare@suse.de> References: <20210819091913.94436-1-hare@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When calling bus reset the driver will be doing a full SAN resync anyway, so there is no need to wait for any pending RSCNs; they'll be re-issued during resync anyway. Signed-off-by: Hannes Reinecke Cc: Nilesh Javali Reviewed-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_os.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 868037c7d608..54254bd3a7d7 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1499,7 +1499,6 @@ static int qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) { scsi_qla_host_t *vha = shost_priv(cmd->device->host); - fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; int ret = FAILED; unsigned int id; uint64_t lun; @@ -1515,15 +1514,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd) id = cmd->device->id; lun = cmd->device->lun; - if (!fcport) { - return ret; - } - - ret = fc_block_scsi_eh(cmd); - if (ret != 0) - return ret; - ret = FAILED; - if (qla2x00_chip_is_down(vha)) return ret; From patchwork Thu Aug 19 09:16:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 500081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DBA8C4338F for ; Thu, 19 Aug 2021 09:17:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EC5461100 for ; Thu, 19 Aug 2021 09:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237562AbhHSJRn (ORCPT ); Thu, 19 Aug 2021 05:17:43 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60592 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237121AbhHSJRR (ORCPT ); Thu, 19 Aug 2021 05:17:17 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 188AA220C3; Thu, 19 Aug 2021 09:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1629364600; 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=STixL47ffdF9sySPgG+6VmdgUgsejDsntDn0lQaiB/U=; b=QkzFlAhv+bdJaiBxHYJcqcLo23w3tkdEJrw/t3kYYiM7T4G4jaifKIL1jX6WoTh4fGxqL8 IQyl8sk7V334S1cmHa3iQaUau6/KmeN2F6nLYMT3I2M4LYynkAMhZrtdvrl7sLPYRpjMMC jnFCizwfWAqdlTEWu033cz5g/hG/Sws= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1629364600; 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=STixL47ffdF9sySPgG+6VmdgUgsejDsntDn0lQaiB/U=; b=XN+gTjT9Z1wHa9kmGnE+rCctYqAREHgXUQbD0bLWMCpAdEO3Q/rVKZ7XqL36VB76q7aFxw xk+PDiNfz1RPf4Dw== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 54B00A3BA1; Thu, 19 Aug 2021 09:16:30 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 05567518D292; Thu, 19 Aug 2021 11:16:40 +0200 (CEST) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 2/3] megaraid: rename megaraid_abort_and_reset() to __megaraid_abort() Date: Thu, 19 Aug 2021 11:16:35 +0200 Message-Id: <20210819091636.94311-3-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210819091636.94311-1-hare@suse.de> References: <20210819091636.94311-1-hare@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org megaraid_abort_and_reset() now only tries to abort / complete a single command, so rename it to __megaraid_abort() to signal the change in functionality. Signed-off-by: Hannes Reinecke --- drivers/scsi/megaraid.c | 26 ++++++++------------------ drivers/scsi/megaraid.h | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 10c1793d4b6d..b213ad62639d 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -1870,7 +1870,7 @@ megaraid_abort(struct scsi_cmnd *cmd) adapter = (adapter_t *)cmd->device->host->hostdata; - rval = megaraid_abort_and_reset(adapter, cmd, SCB_ABORT); + rval = __megaraid_abort(adapter, cmd); /* * This is required here to complete any completed requests @@ -1949,22 +1949,20 @@ megaraid_reset(struct scsi_cmnd *cmd) } /** - * megaraid_abort_and_reset() + * __megaraid_abort() * @adapter: megaraid soft state * @cmd: scsi command to be aborted or reset - * @aor: abort or reset flag * * Try to locate the scsi command in the pending queue. If found and is not * issued to the controller, abort/reset it. Otherwise return failure */ static int -megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor) +__megaraid_abort(adapter_t *adapter, struct scsi_cmnd *cmd) { struct list_head *pos, *next; scb_t *scb; - dev_warn(&adapter->dev->dev, "%s cmd=%x \n", - (aor == SCB_ABORT)? "ABORTING":"RESET", + dev_warn(&adapter->dev->dev, "ABORTING cmd=%x \n", cmd->cmnd[0], cmd->device->channel, cmd->device->id, (u32)cmd->device->lun); @@ -1977,7 +1975,7 @@ megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor) if (scb->cmd == cmd) { /* Found command */ - scb->state |= aor; + scb->state |= SCB_ABORT; /* * Check if this command has firmware ownership. If @@ -1988,8 +1986,7 @@ megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor) if( scb->state & SCB_ISSUED ) { dev_warn(&adapter->dev->dev, - "%s[%x], fw owner\n", - (aor==SCB_ABORT) ? "ABORTING":"RESET", + "ABORTING[%x], fw owner\n", scb->idx); return FAILED; @@ -2001,18 +1998,11 @@ megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor) * list */ dev_warn(&adapter->dev->dev, - "%s-[%x], driver owner\n", - (aor==SCB_ABORT) ? "ABORTING":"RESET", + "ABORTING[%x], driver owner\n", scb->idx); mega_free_scb(adapter, scb); - - if( aor == SCB_ABORT ) { - cmd->result = (DID_ABORT << 16); - } - else { - cmd->result = (DID_RESET << 16); - } + cmd->result = (DID_ABORT << 16); list_add_tail(SCSI_LIST(cmd), &adapter->completed_list); diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h index cce23a086fbe..8188c7f90faf 100644 --- a/drivers/scsi/megaraid.h +++ b/drivers/scsi/megaraid.h @@ -953,7 +953,7 @@ static void mega_free_scb(adapter_t *, scb_t *); static int megaraid_abort(struct scsi_cmnd *); static int megaraid_reset(struct scsi_cmnd *); -static int megaraid_abort_and_reset(adapter_t *, struct scsi_cmnd *, int); +static int __megaraid_abort(adapter_t *, struct scsi_cmnd *); static int megaraid_biosparam(struct scsi_device *, struct block_device *, sector_t, int []); From patchwork Thu Aug 19 09:19:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 500079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3474BC43214 for ; Thu, 19 Aug 2021 09:19:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A42761100 for ; Thu, 19 Aug 2021 09:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233192AbhHSJUD (ORCPT ); Thu, 19 Aug 2021 05:20:03 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:60742 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232453AbhHSJUB (ORCPT ); Thu, 19 Aug 2021 05:20:01 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4E2A0220C4; Thu, 19 Aug 2021 09:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1629364764; 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=SzdRI3i/ZZX7zfPKC+RwdzU5N22XOOUpC4VfI+Pkmeo=; b=K4L2nl7jdUE+sYoRICMzf7m3tgAy/JP8SuAGnuwUY9pJL2fHoJv0zUfxqxZQxeV4agyU8b dNeOxCwOLX5L7qj+bLBRDs+v69LKQzDj1fxr32Pn93ciP2U8DHYdfEba4ekzmkRgdzwyEE kTZg7OVH5kRD20HXoDQAibimAtCAz/c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1629364764; 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=SzdRI3i/ZZX7zfPKC+RwdzU5N22XOOUpC4VfI+Pkmeo=; b=zJwZbhzB/miE3BcB2qXoPLQEHg+wekAn9VgLGlO1LIIZNh72W1GVlwHN7Y4rYNM+Ip5wfy hWEITqVr+C+PQ3DQ== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 8B2FDA3BA2; Thu, 19 Aug 2021 09:19:14 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 3CE0B518D29C; Thu, 19 Aug 2021 11:19:24 +0200 (CEST) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , Nilesh Javali , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 3/3] qla2xxx: Open-code qla2xxx_eh_device_reset() Date: Thu, 19 Aug 2021 11:19:13 +0200 Message-Id: <20210819091913.94436-4-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210819091913.94436-1-hare@suse.de> References: <20210819091913.94436-1-hare@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Device reset and target reset will be using different calling sequences, so open-code __qla2xxx_eh_generic_reset() in qla2xxx_eh_device_reset(), and remove the now obsolete function __qla2xxx_eh_generic_reset(). No functional changes. Signed-off-by: Hannes Reinecke Cc: Nilesh Javali Reviewed-by: Nilesh Javali --- drivers/scsi/qla2xxx/qla_os.c | 54 +++++++++++++++-------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 7786af46224a..ea804dc69b6f 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1388,18 +1388,27 @@ static char *reset_errors[] = { }; static int -__qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, - struct scsi_cmnd *cmd, int (*do_reset)(struct fc_port *, uint64_t, int)) +qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) { - scsi_qla_host_t *vha = shost_priv(cmd->device->host); - fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; + struct scsi_device *sdev = cmd->device; + scsi_qla_host_t *vha = shost_priv(sdev->host); + struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); + fc_port_t *fcport = (struct fc_port *) sdev->hostdata; + struct qla_hw_data *ha = vha->hw; int err; + if (qla2x00_isp_reg_stat(ha)) { + ql_log(ql_log_info, vha, 0x803e, + "PCI/Register disconnect, exiting.\n"); + qla_pci_set_eeh_busy(vha); + return FAILED; + } + if (!fcport) { return FAILED; } - err = fc_block_scsi_eh(cmd); + err = fc_block_rport(rport); if (err != 0) return err; @@ -1407,8 +1416,8 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, return SUCCESS; ql_log(ql_log_info, vha, 0x8009, - "%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no, - cmd->device->id, cmd->device->lun, cmd); + "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no, + sdev->id, sdev->lun, cmd); err = 0; if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) { @@ -1417,52 +1426,35 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, goto eh_reset_failed; } err = 2; - if (do_reset(fcport, cmd->device->lun, 1) + if (ha->isp_ops->lun_reset(fcport, sdev->lun, 1) != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x800c, "do_reset failed for cmd=%p.\n", cmd); goto eh_reset_failed; } err = 3; - if (qla2x00_eh_wait_for_pending_commands(vha, cmd->device->id, - cmd->device->lun, type) != QLA_SUCCESS) { + if (qla2x00_eh_wait_for_pending_commands(vha, sdev->id, + sdev->lun, WAIT_LUN) != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x800d, "wait for pending cmds failed for cmd=%p.\n", cmd); goto eh_reset_failed; } ql_log(ql_log_info, vha, 0x800e, - "%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n", name, - vha->host_no, cmd->device->id, cmd->device->lun, cmd); + "DEVICE RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n", + vha->host_no, sdev->id, sdev->lun, cmd); return SUCCESS; eh_reset_failed: ql_log(ql_log_info, vha, 0x800f, - "%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n", name, - reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, + "DEVICE RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n", + reset_errors[err], vha->host_no, sdev->id, sdev->lun, cmd); vha->reset_cmd_err_cnt++; return FAILED; } -static int -qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) -{ - scsi_qla_host_t *vha = shost_priv(cmd->device->host); - struct qla_hw_data *ha = vha->hw; - - if (qla2x00_isp_reg_stat(ha)) { - ql_log(ql_log_info, vha, 0x803e, - "PCI/Register disconnect, exiting.\n"); - qla_pci_set_eeh_busy(vha); - return FAILED; - } - - return __qla2xxx_eh_generic_reset("DEVICE", WAIT_LUN, cmd, - ha->isp_ops->lun_reset); -} - static int qla2xxx_eh_target_reset(struct scsi_cmnd *cmd) {