From patchwork Fri Apr 26 09:36:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10918933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99B5F1390 for ; Fri, 26 Apr 2019 09:38:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8822928D55 for ; Fri, 26 Apr 2019 09:38:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 797B728D69; Fri, 26 Apr 2019 09:38:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1408E28D55 for ; Fri, 26 Apr 2019 09:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726228AbfDZJiZ (ORCPT ); Fri, 26 Apr 2019 05:38:25 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:33298 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfDZJiZ (ORCPT ); Fri, 26 Apr 2019 05:38:25 -0400 Received: by mail-pl1-f194.google.com with SMTP id y3so452244plp.0 for ; Fri, 26 Apr 2019 02:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nZmw5ywIbzOc8VruWmb764fG6flSNtrbuGspqfBaQaI=; b=K+vaTBFGUnlX4K4uhmTKDVegOJnYeEpBMd9zggxXVqHOQI9x0iytXYEVGUpwBYnLdp WvqSvyfJCV2+kzAcNyIE71xK/XKanYzoB84oHID5Zo1lig/PdHwAdiblWbjJC4i9xtUF kj5U7d3RQV9Mgzlp5JTiTufHdkQzT7ROC8WWE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nZmw5ywIbzOc8VruWmb764fG6flSNtrbuGspqfBaQaI=; b=fpmbxmxeUOQCG3SftZKidqpz6kP9ZFjKXblc4KGyVBY9/TDYaLYuQi926zhOqDNAKE LcBMO7hqNLOKxVJVtQpVDViscyrEhaoXI7KWDUkM7tAOygNKbu8RJySsRguuROp/uZCA x76FLeFHlZF92k9o9LO/fFNnXbgxvzxywBm2m3Q7lx/E7lvYaA6y5Ajg+Zhi3zsgpkrs 8ZWfjRCm43I+eEuWyHfr8LFO8sNN8nRLNGQ5DWFitA1ylvcc2fPE0wCnF7YTdJq8d0cr ghytB7qMvvbIOd84wdBTmSaWnh+cwC+3jttn+G/Fez+Gr/YAohSZdhx7HPeGonXtP8sr FNJg== X-Gm-Message-State: APjAAAXnGkmpKG5KFj4j2gMMA2hCppeq6QSFNRC43TO2HZ6dPz01P8b7 nO7gqVr7K9T/dDil+eBGA7TKbwluJbAWJAGdpWn8lBnoGf72s8ZdGifeNChbVm4XsGaahdlYSVw qaCUiWM6xg33zbB4k4s5aGV9hT5s27lO2tM+Zzvm35RL5xUb/l1E8fnWDpbba8ClxYac6wnCBiB rJAYr5ye8smxQZ2UXNgzPd X-Google-Smtp-Source: APXvYqytm4zJRS8ozDb80kYX4g+H2LIkyy07tFQfnHI4aY/BELiVrlDN/uJj/afYlDHpAPFqY4/6fQ== X-Received: by 2002:a17:902:a988:: with SMTP id bh8mr25932761plb.243.1556271504357; Fri, 26 Apr 2019 02:38:24 -0700 (PDT) Received: from dhcp-135-24-192-142.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r4sm37994649pgl.69.2019.04.26.02.38.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Apr 2019 02:38:23 -0700 (PDT) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, kiran-kumar.kasturi@broadcom.com, sankar.patra@broadcom.com, sasikumar.pc@broadcom.com, chandrakanth.patil@broadcom.com, Shivasharan S Subject: [PATCH 04/21] megaraid_sas: rework code around controller reset Date: Fri, 26 Apr 2019 02:36:58 -0700 Message-Id: <1556271435-27252-5-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1556271435-27252-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP No functional change. This patch reworks code around controller reset path which gets rid of a couple of goto labels. This is in preparation for the next patch which adds PCI config space access locking while controller reset is in progress. Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas.h | 1 + drivers/scsi/megaraid/megaraid_sas_fusion.c | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 6fd57f7f0b1e..902b11b97999 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1571,6 +1571,7 @@ enum FW_BOOT_CONTEXT { #define MFI_IO_TIMEOUT_SECS 180 #define MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF (5 * HZ) #define MEGASAS_OCR_SETTLE_TIME_VF (1000 * 30) +#define MEGASAS_SRIOV_MAX_RESET_TRIES_VF 1 #define MEGASAS_ROUTINE_WAIT_TIME_VF 300 #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index bf1fa963af0b..76bd29c92752 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -4568,6 +4568,8 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) struct scsi_device *sdev; int ret_target_prop = DCMD_FAILED; bool is_target_prop = false; + bool do_adp_reset = true; + int max_reset_tries = MEGASAS_FUSION_MAX_RESET_TRIES; instance = (struct megasas_instance *)shost->hostdata; fusion = instance->ctrl_context; @@ -4686,34 +4688,30 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) /* Let SR-IOV VF & PF sync up if there was a HB failure */ if (instance->requestorId && !reason) { msleep(MEGASAS_OCR_SETTLE_TIME_VF); - goto transition_to_ready; + do_adp_reset = false; + max_reset_tries = MEGASAS_SRIOV_MAX_RESET_TRIES_VF; } /* Now try to reset the chip */ - for (i = 0; i < MEGASAS_FUSION_MAX_RESET_TRIES; i++) { + for (i = 0; i < max_reset_tries; i++) { - if (instance->instancet->adp_reset + if (do_adp_reset && + instance->instancet->adp_reset (instance, instance->reg_set)) continue; -transition_to_ready: + /* Wait for FW to become ready */ if (megasas_transition_to_ready(instance, 1)) { dev_warn(&instance->pdev->dev, "Failed to transition controller to ready for " "scsi%d.\n", instance->host->host_no); - if (instance->requestorId && !reason) - goto fail_kill_adapter; - else - continue; + continue; } megasas_reset_reply_desc(instance); megasas_fusion_update_can_queue(instance, OCR_CONTEXT); if (megasas_ioc_init_fusion(instance)) { - if (instance->requestorId && !reason) - goto fail_kill_adapter; - else - continue; + continue; } if (megasas_get_ctrl_info(instance)) { @@ -4799,7 +4797,6 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) goto out; } -fail_kill_adapter: /* Reset failed, kill the adapter */ dev_warn(&instance->pdev->dev, "Reset failed, killing " "adapter scsi%d.\n", instance->host->host_no);