From patchwork Thu Feb 14 05:46:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suganath Prabu S X-Patchwork-Id: 10811829 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 66A2D13A4 for ; Thu, 14 Feb 2019 05:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5573B2D38C for ; Thu, 14 Feb 2019 05:46:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4999D2D3AE; Thu, 14 Feb 2019 05:46:33 +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 DF9642D38C for ; Thu, 14 Feb 2019 05:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391265AbfBNFqc (ORCPT ); Thu, 14 Feb 2019 00:46:32 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:45135 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfBNFqc (ORCPT ); Thu, 14 Feb 2019 00:46:32 -0500 Received: by mail-ed1-f67.google.com with SMTP id d9so3965783edh.12 for ; Wed, 13 Feb 2019 21:46:31 -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=LEd7pzhb3Qyzh2tAUBqKJkeSUbMBgDoqQjg3OAcFZKU=; b=h0CCNtrGIZ2O11wegm7zGl2l0ylE1hi7W/ud2uH9iBqkd6vYskeUpI13dJmBOkZ+TE 4dOEyi0ASHFh+HlRyTolIEBSlCBYr/ZwQ3zxQZ5kgAwZpsyV9F6TIgnChQ0ZH6Lad5gy svpH+ZpCh/YJJnNdcNkJFhVKyDA1zEFob1Zqk= 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=LEd7pzhb3Qyzh2tAUBqKJkeSUbMBgDoqQjg3OAcFZKU=; b=OWfsAUF1MUOKcQD+XBdlTmeJja67zocQ6Dc2nor4T68UvRrer6kL9yYsSFx9fZupZk 0kfW3TnULCLkiLjsvuwYmAiG9tGirfVsQdNIO3GbypFbtjSgOfT5Y9NztcKEKnn57e8q 2nvz4FNGKfVEjlbNqLfAobrh9hvgGGkf/E6lqB3ckJhe+8EVJYOVLzdwJ5I0AAYs/sRK PHPFeiYodGk/SBEz++sa2Pbylmm/GuygP7CW/E8cuyyhhacX+nMVl6V8My7fhGNYAHWj ynh8HnvDRBAVIi1+P2/m2WfhAyhSKRmnGwie87mEU6g0zBLt+qAbD2TGbSycBQm58uTZ RShA== X-Gm-Message-State: AHQUAuYlTl0APvwQ75dFYPVLWjxYjY1hYCLihh906NkHdT6nG9/jNrZ6 fcAaflg9i+uMXnTQdNLcp4Guz7EPqcskwBDSGDnpZ8i6+aI6CgF7j8Huj8qvJCIvYSTMOVj/N50 LpT4QyDrI6j4PUCTDZVuufXLmvHdpyofKkfGw4o7y6UDLoBbHB2TYDyl1OdBYWTZBajSsLyBnHi fLYxWykJy3FgiteYlQNxoC X-Google-Smtp-Source: AHgI3IbRtoCE0sBZH5b4a3d8JkAQvOvo4feLI1W+09ZPkggdnQwgFcWP4MOZkcp3IDM4Lcvb6pITaw== X-Received: by 2002:a50:9189:: with SMTP id g9mr1663606eda.32.1550123190005; Wed, 13 Feb 2019 21:46:30 -0800 (PST) Received: from dhcp-10-123-20-72.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id h1sm311791ejx.41.2019.02.13.21.46.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 21:46:29 -0800 (PST) From: Suganath Prabu To: linux-scsi@vger.kernel.org Cc: Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com, Suganath Prabu Subject: [PATCH 2/6] mpt3sas: simplify interrupt handler. Date: Thu, 14 Feb 2019 00:46:07 -0500 Message-Id: <1550123171-15993-3-git-send-email-suganath-prabu.subramani@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1550123171-15993-1-git-send-email-suganath-prabu.subramani@broadcom.com> References: <1550123171-15993-1-git-send-email-suganath-prabu.subramani@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 Separate out processing of reply descriptor post queue from _base_interrupt to _base_process_reply_queue. Signed-off-by: Suganath Prabu --- drivers/scsi/mpt3sas/mpt3sas_base.c | 49 +++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 4184d96..076428d 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1383,16 +1383,16 @@ union reply_descriptor { }; /** - * _base_interrupt - MPT adapter (IOC) specific interrupt handler. - * @irq: irq number (not used) - * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure + * _base_process_reply_queue - Process reply descriptors from reply + * descriptor post queue. + * @reply_q: per IRQ's reply queue object. * - * Return: IRQ_HANDLED if processed, else IRQ_NONE. + * Return: number of reply descriptors processed from reply + * descriptor queue. */ -static irqreturn_t -_base_interrupt(int irq, void *bus_id) +static int +_base_process_reply_queue(struct adapter_reply_queue *reply_q) { - struct adapter_reply_queue *reply_q = bus_id; union reply_descriptor rd; u32 completed_cmds; u8 request_descript_type; @@ -1404,21 +1404,18 @@ _base_interrupt(int irq, void *bus_id) Mpi2ReplyDescriptorsUnion_t *rpf; u8 rc; - if (ioc->mask_interrupts) - return IRQ_NONE; - + completed_cmds = 0; if (!atomic_add_unless(&reply_q->busy, 1, 1)) - return IRQ_NONE; + return completed_cmds; rpf = &reply_q->reply_post_free[reply_q->reply_post_host_index]; request_descript_type = rpf->Default.ReplyFlags & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK; if (request_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) { atomic_dec(&reply_q->busy); - return IRQ_NONE; + return completed_cmds; } - completed_cmds = 0; cb_idx = 0xFF; do { rd.word = le64_to_cpu(rpf->Words); @@ -1521,14 +1518,14 @@ _base_interrupt(int irq, void *bus_id) if (!completed_cmds) { atomic_dec(&reply_q->busy); - return IRQ_NONE; + return completed_cmds; } if (ioc->is_warpdrive) { writel(reply_q->reply_post_host_index, ioc->reply_post_host_index[msix_index]); atomic_dec(&reply_q->busy); - return IRQ_HANDLED; + return completed_cmds; } /* Update Reply Post Host Index. @@ -1555,7 +1552,27 @@ _base_interrupt(int irq, void *bus_id) MPI2_RPHI_MSIX_INDEX_SHIFT), &ioc->chip->ReplyPostHostIndex); atomic_dec(&reply_q->busy); - return IRQ_HANDLED; + return completed_cmds; +} + +/** + * _base_interrupt - MPT adapter (IOC) specific interrupt handler. + * @irq: irq number (not used) + * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure + * + * Return: IRQ_HANDLED if processed, else IRQ_NONE. + */ +static irqreturn_t +_base_interrupt(int irq, void *bus_id) +{ + struct adapter_reply_queue *reply_q = bus_id; + struct MPT3SAS_ADAPTER *ioc = reply_q->ioc; + + if (ioc->mask_interrupts) + return IRQ_NONE; + + return ((_base_process_reply_queue(reply_q) > 0) ? + IRQ_HANDLED : IRQ_NONE); } /**