From: Jens Axboe <jens.axboe@oracle.com>
To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Cc: Eric.Moore@lsi.com, jeff@garzik.org, Jens Axboe <jens.axboe@oracle.com>
Subject: [PATCH 3/3] mptfusion: add support for blk-iopoll
Date: Thu, 6 Aug 2009 21:58:05 +0200 [thread overview]
Message-ID: <1249588685-4662-4-git-send-email-jens.axboe@oracle.com> (raw)
In-Reply-To: <1249588685-4662-1-git-send-email-jens.axboe@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
---
drivers/message/fusion/mptbase.c | 99 ++++++++++++++++++++++++++++++++-----
drivers/message/fusion/mptbase.h | 3 +
2 files changed, 88 insertions(+), 14 deletions(-)
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5d0ba4f..24549d6 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -114,6 +114,9 @@ module_param_call(mpt_fwfault_debug, param_set_int, param_get_int,
MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault"
" and halt Firmware on fault - (default=0)");
+static int mpt_iopoll_w = 32;
+module_param(mpt_iopoll_w, int, 0);
+MODULE_PARM_DESC(mpt_iopoll_w, " blk iopoll budget (default=32");
#ifdef MFCNT
@@ -515,6 +518,44 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
mb();
}
+static void mpt_irq_disable(MPT_ADAPTER *ioc)
+{
+ CHIPREG_WRITE32(&ioc->chip->IntMask, 0xFFFFFFFF);
+ CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
+ CHIPREG_READ32(&ioc->chip->IntStatus);
+}
+
+static void mpt_irq_enable(MPT_ADAPTER *ioc)
+{
+ CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM);
+}
+
+static inline void __mpt_handle_irq(MPT_ADAPTER *ioc, u32 pa)
+{
+ if (pa & MPI_ADDRESS_REPLY_A_BIT)
+ mpt_reply(ioc, pa);
+ else
+ mpt_turbo_reply(ioc, pa);
+}
+
+static int mpt_handle_irq(MPT_ADAPTER *ioc, unsigned int budget)
+{
+ int nr = 0;
+ u32 pa;
+
+ /*
+ * Drain the reply FIFO!
+ */
+ while ((pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo)) != 0xffffffff) {
+ nr++;
+ __mpt_handle_irq(ioc, pa);
+ if (nr == budget)
+ break;
+ }
+
+ return nr;
+}
+
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/**
* mpt_interrupt - MPT adapter (IOC) specific interrupt handler.
@@ -536,23 +577,48 @@ static irqreturn_t
mpt_interrupt(int irq, void *bus_id)
{
MPT_ADAPTER *ioc = bus_id;
- u32 pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo);
+ int nr = 0;
+
+ if (!blk_iopoll_enabled)
+ nr = mpt_handle_irq(ioc, -1U);
+ else if (blk_iopoll_sched_prep(&ioc->iopoll)) {
+ mpt_irq_disable(ioc);
+ ioc->iopoll.data =CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo);
+ blk_iopoll_sched(&ioc->iopoll);
+ nr = 1;
+ } else {
+ /*
+ * Not really handled, but it will be by iopoll.
+ */
+ nr = 1;
+ }
- if (pa == 0xFFFFFFFF)
- return IRQ_NONE;
+ if (nr)
+ return IRQ_HANDLED;
- /*
- * Drain the reply FIFO!
- */
- do {
- if (pa & MPI_ADDRESS_REPLY_A_BIT)
- mpt_reply(ioc, pa);
- else
- mpt_turbo_reply(ioc, pa);
- pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo);
- } while (pa != 0xFFFFFFFF);
+ return IRQ_NONE;
+}
- return IRQ_HANDLED;
+static int mpt_iopoll(struct blk_iopoll *iop, int budget)
+{
+ MPT_ADAPTER *ioc = container_of(iop, MPT_ADAPTER, iopoll);
+ int ret = 0;
+ u32 pa;
+
+ pa = iop->data;
+ iop->data = 0xffffffff;
+ if (pa != 0xffffffff) {
+ __mpt_handle_irq(ioc, pa);
+ ret = 1;
+ }
+
+ ret += mpt_handle_irq(ioc, budget - ret);
+ if (ret < budget) {
+ blk_iopoll_complete(iop);
+ mpt_irq_enable(ioc);
+ }
+
+ return ret;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -2091,6 +2157,7 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state)
/* Clear any lingering interrupt */
CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
+ blk_iopoll_disable(&ioc->iopoll);
free_irq(ioc->pci_irq, ioc);
if (ioc->msi_enable)
pci_disable_msi(ioc->pcidev);
@@ -2358,6 +2425,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
ret = -EBUSY;
goto out;
}
+ blk_iopoll_init(&ioc->iopoll, mpt_iopoll_w, mpt_iopoll);
+ blk_iopoll_enable(&ioc->iopoll);
irq_allocated = 1;
ioc->pci_irq = ioc->pcidev->irq;
pci_set_master(ioc->pcidev); /* ?? */
@@ -2578,6 +2647,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
out:
if ((ret != 0) && irq_allocated) {
+ blk_iopoll_disable(&ioc->iopoll);
free_irq(ioc->pci_irq, ioc);
if (ioc->msi_enable)
pci_disable_msi(ioc->pcidev);
@@ -2786,6 +2856,7 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
mpt_adapter_disable(ioc);
if (ioc->pci_irq != -1) {
+ blk_iopoll_disable(&ioc->iopoll);
free_irq(ioc->pci_irq, ioc);
if (ioc->msi_enable)
pci_disable_msi(ioc->pcidev);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 1c8514d..954a59f 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -52,6 +52,7 @@
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/mutex.h>
+#include <linux/blk-iopoll.h>
#include "lsi/mpi_type.h"
#include "lsi/mpi.h" /* Fusion MPI(nterface) basic defs */
@@ -763,6 +764,8 @@ typedef struct _MPT_ADAPTER
struct workqueue_struct *reset_work_q;
struct delayed_work fault_reset_work;
+ struct blk_iopoll iopoll;
+
u8 sg_addr_size;
u8 in_rescan;
u8 SGE_size;
--
1.6.3.2.306.g4f4fa
next prev parent reply other threads:[~2009-08-06 19:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-06 19:58 [PATCH 0/3]: blk-iopoll, a polled completion API for block devices Jens Axboe
2009-08-06 19:58 ` [PATCH 1/3] block: add blk-iopoll, a NAPI like approach " Jens Axboe
2009-08-06 21:32 ` Alan Cox
2009-08-07 6:37 ` Jens Axboe
2009-08-07 8:38 ` Jeff Garzik
2009-08-07 8:50 ` Jens Axboe
2009-08-07 11:05 ` Jens Axboe
2009-08-07 11:31 ` Jens Axboe
2009-08-19 19:08 ` Jens Axboe
2009-08-20 11:30 ` [PATCH 1/3] block: add blk-iopoll, a NAPI like approach forblock devices jack wang
2009-08-20 11:38 ` Jens Axboe
2009-08-06 19:58 ` [PATCH 2/3] libata: add support for blk-iopoll Jens Axboe
2009-08-10 17:15 ` Jonathan Corbet
2009-08-10 17:22 ` Jens Axboe
2009-08-06 19:58 ` Jens Axboe [this message]
2009-08-11 10:35 ` [PATCH 0/3]: blk-iopoll, a polled completion API for block devices Bart Van Assche
2009-08-11 14:39 ` Jens Axboe
2009-08-11 14:59 ` Bart Van Assche
2009-08-11 17:14 ` Jens Axboe
2009-08-11 18:37 ` Bart Van Assche
2009-08-11 18:41 ` Jens Axboe
2009-08-11 18:49 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1249588685-4662-4-git-send-email-jens.axboe@oracle.com \
--to=jens.axboe@oracle.com \
--cc=Eric.Moore@lsi.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®