From patchwork Fri Jan 5 13:27:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivasharan Srikanteshwara X-Patchwork-Id: 10146571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD35F601A1 for ; Fri, 5 Jan 2018 13:29:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CCD8287CD for ; Fri, 5 Jan 2018 13:29:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91DA5287D3; Fri, 5 Jan 2018 13:29:17 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 2DC72287CD for ; Fri, 5 Jan 2018 13:29:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751728AbeAEN3Q (ORCPT ); Fri, 5 Jan 2018 08:29:16 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:39802 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751720AbeAEN3P (ORCPT ); Fri, 5 Jan 2018 08:29:15 -0500 Received: by mail-pl0-f68.google.com with SMTP id bi12so3039727plb.6 for ; Fri, 05 Jan 2018 05:29:15 -0800 (PST) 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=5ykHuuRAzLgC2ipTAb0XlwkOPRwZR03cFjdapNNG4V4=; b=C22xikhtsXPrXVH6RmXNdC8+kSYgZb7XUJiswvthmXywz4smYB6F1T0XMa5KBuQpxw 6ZYHxZGDvh8irP5m7Dl949xEB8IyjizeD1CGTlXJjmHlpV316XTo2orMuG800ZPruI04 vXQMz3BJWBRK5FvC4NV/Tx7ft8ZiKrUUvSGHE= 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=5ykHuuRAzLgC2ipTAb0XlwkOPRwZR03cFjdapNNG4V4=; b=tKUz9JalIQnmaFXhNlFlbYO10/tYXHdoP/oNkfzHySkvRVJPZaJaPTzbWIfl6Nl7um F/h8G/iLFXBXAhuu8u0QpEVUoxOI50+Q82iiiOYZjMIlkKZQfoAeVRrGp+ONQOLnxfZL 24ZuyBRIFoF4nTToA4zkwYSvUtd5McyY5hjowmx6ljhSknAqFfN+z+brYCJgp+u87nl/ xU2nEsBCpVrVIj/OVMVaEFeaYx1Jp+D774KT8yjPv6k9SI1R6sNINn0yGPeyd2lGtiow UyB51J1dxXd5fv53nOf3k2hHCbEvpjcJ1PZ5OgAiF7Hxj+bNgtV4NGQLbhSeUXKcaAf1 BaqQ== X-Gm-Message-State: AKGB3mKAU2ri49Y5TUtm4lYmhHqvPGR4B5PmAgnpyGCftaAlm+brBh/R dIwWl7j+eLaifRAKnMt43MJLy8s4 X-Google-Smtp-Source: ACJfBos4py/5pMO7Q81WPMnD8mWelACOpKGUXPJFRmU21QSrhrEWmoBCD30JpOBbAHf5d1PQysB/Ug== X-Received: by 10.159.244.131 with SMTP id y3mr3080336plr.235.1515158955096; Fri, 05 Jan 2018 05:29:15 -0800 (PST) Received: from dhcp-135-24-192-142.localdomain ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id 68sm12588733pfx.186.2018.01.05.05.29.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 05:29:14 -0800 (PST) From: Shivasharan S To: linux-scsi@vger.kernel.org Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, Shivasharan S Subject: [PATCH 03/14] megaraid_sas: Return the DCMD status from megasas_get_seq_num Date: Fri, 5 Jan 2018 05:27:38 -0800 Message-Id: <1515158869-26693-4-git-send-email-shivasharan.srikanteshwara@broadcom.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1515158869-26693-1-git-send-email-shivasharan.srikanteshwara@broadcom.com> References: <1515158869-26693-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 In megasas_get_seq_num, the status of the DCMD fired to FW is not returned, always success is returned. We could end up registering AEN request with incorrect sequence number if the DCMD failed. Return the DCMD status back to caller. This was discovered during code review and very rare to see issue in field to see AEN request failed bt FW. Signed-off-by: Shivasharan S --- drivers/scsi/megaraid/megaraid_sas_base.c | 32 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index ed106cbd4440..38120917c609 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5581,6 +5581,7 @@ megasas_get_seq_num(struct megasas_instance *instance, struct megasas_dcmd_frame *dcmd; struct megasas_evt_log_info *el_info; dma_addr_t el_info_h = 0; + int ret; cmd = megasas_get_cmd(instance); @@ -5613,26 +5614,29 @@ megasas_get_seq_num(struct megasas_instance *instance, megasas_set_dma_settings(instance, dcmd, el_info_h, sizeof(struct megasas_evt_log_info)); - if (megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS) == - DCMD_SUCCESS) { - /* - * Copy the data back into callers buffer - */ - eli->newest_seq_num = el_info->newest_seq_num; - eli->oldest_seq_num = el_info->oldest_seq_num; - eli->clear_seq_num = el_info->clear_seq_num; - eli->shutdown_seq_num = el_info->shutdown_seq_num; - eli->boot_seq_num = el_info->boot_seq_num; - } else - dev_err(&instance->pdev->dev, "DCMD failed " - "from %s\n", __func__); + ret = megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS); + if (ret != DCMD_SUCCESS) { + dev_err(&instance->pdev->dev, "Failed from %s %d\n", + __func__, __LINE__); + goto dcmd_failed; + } + + /* + * Copy the data back into callers buffer + */ + eli->newest_seq_num = el_info->newest_seq_num; + eli->oldest_seq_num = el_info->oldest_seq_num; + eli->clear_seq_num = el_info->clear_seq_num; + eli->shutdown_seq_num = el_info->shutdown_seq_num; + eli->boot_seq_num = el_info->boot_seq_num; +dcmd_failed: pci_free_consistent(instance->pdev, sizeof(struct megasas_evt_log_info), el_info, el_info_h); megasas_return_cmd(instance, cmd); - return 0; + return ret; } /**