From patchwork Fri Feb 15 07:40:25 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: 10814269 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 6B2E313BF for ; Fri, 15 Feb 2019 07:41:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43F0A2EB13 for ; Fri, 15 Feb 2019 07:40:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 384862EB7C; Fri, 15 Feb 2019 07:40:58 +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 C06B22EB29 for ; Fri, 15 Feb 2019 07:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390213AbfBOHk5 (ORCPT ); Fri, 15 Feb 2019 02:40:57 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:37441 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728823AbfBOHk5 (ORCPT ); Fri, 15 Feb 2019 02:40:57 -0500 Received: by mail-yw1-f67.google.com with SMTP id k14so3373401ywe.4 for ; Thu, 14 Feb 2019 23:40:56 -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=MhS8to/j10uATxwcbgA8hUYYDKUd4sqfn7D3JsqgtAVG7Bv95Pl3ib82issB2i+NkR O2ZRzR1I2gd6HDhrVjPF3wJVuVMPp38GiiJqqZYSYp3aqQOrm0FY/8YkHMXKuL8UZtNu 9MZeoVc3mvQOiJAXC1ZiiFNqE2sV26T7QfmIE= 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=qLyJF/4p+Q2dA/aj/xZpeKyKgrZaWzczH0b3C8o6DS78AWRKOSMmGc6yGiPGR6Y05U wa74x/1oJYltiNaNzRaPXDOVd4qWMiJCncbBsDnSYZIth2bJaAs5G8bepNd5j7wXkW/J qcnoGQ/Xlc6z7YafE5nqEUeRTXiHAQBYumVroy6RmzS04oENzGD+3/eBAQJ+uJgIN/4A xnvcYS8qD4ZfBsRIxwsX3vkjg0ShCa5MKE6y8/jmHuw0WrFE8qNwshCbCI81txmUGwEJ N8/xWJXWp5skwu6jhxwlpfhbF2DOI6eiWehogys+wXuxYLmn5oJN6UqbWUppWxNrbyTR QCdA== X-Gm-Message-State: AHQUAuZIbLYWgHFuJrFncWls/UAOUIoWCDlXn/vYjtjiejceijGae9DB NH6QMAVASy6vM+01OEXyZrpuXvy+jLEY87zl5D9fnUVKhHV3dxxfpfVwJL+llLo5H93FWWCrrpk ZFqphQuXuDoPGrduQL87Pm4+Zx2aA/TwufBxrV8W8WC6O8bPfKpe5WliY8sb3m3Kxn+m1C4QGZb wWvZr8mOHd0XyrZnIaMYEs X-Google-Smtp-Source: AHgI3IYtsZ0Rmd12BSwO4+ne3AWdW4diIwHYPnAzYMxPK/QE/qX1aFAMunce1+eSZgcyx9VrNdloOg== X-Received: by 2002:a81:71c5:: with SMTP id m188mr6787191ywc.353.1550216455965; Thu, 14 Feb 2019 23:40:55 -0800 (PST) Received: from dhcp-10-123-20-72.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id c124sm1696388ywe.12.2019.02.14.23.40.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 23:40:55 -0800 (PST) From: Suganath Prabu To: linux-scsi@vger.kernel.org Cc: Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com, Suganath Prabu Subject: [v1 2/7] mpt3sas: simplify interrupt handler. Date: Fri, 15 Feb 2019 02:40:25 -0500 Message-Id: <1550216430-36612-3-git-send-email-suganath-prabu.subramani@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1550216430-36612-1-git-send-email-suganath-prabu.subramani@broadcom.com> References: <1550216430-36612-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); } /**