提交 233af108 编写于 作者: S Suganath Prabu 提交者: Martin K. Petersen

scsi: mpt3sas: simplify interrupt handler

Separate out processing of reply descriptor post queue from _base_interrupt
to _base_process_reply_queue.
Signed-off-by: NSuganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 2c063507
...@@ -1383,16 +1383,16 @@ union reply_descriptor { ...@@ -1383,16 +1383,16 @@ union reply_descriptor {
}; };
/** /**
* _base_interrupt - MPT adapter (IOC) specific interrupt handler. * _base_process_reply_queue - Process reply descriptors from reply
* @irq: irq number (not used) * descriptor post queue.
* @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure * @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 static int
_base_interrupt(int irq, void *bus_id) _base_process_reply_queue(struct adapter_reply_queue *reply_q)
{ {
struct adapter_reply_queue *reply_q = bus_id;
union reply_descriptor rd; union reply_descriptor rd;
u32 completed_cmds; u32 completed_cmds;
u8 request_descript_type; u8 request_descript_type;
...@@ -1404,21 +1404,18 @@ _base_interrupt(int irq, void *bus_id) ...@@ -1404,21 +1404,18 @@ _base_interrupt(int irq, void *bus_id)
Mpi2ReplyDescriptorsUnion_t *rpf; Mpi2ReplyDescriptorsUnion_t *rpf;
u8 rc; u8 rc;
if (ioc->mask_interrupts) completed_cmds = 0;
return IRQ_NONE;
if (!atomic_add_unless(&reply_q->busy, 1, 1)) 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]; rpf = &reply_q->reply_post_free[reply_q->reply_post_host_index];
request_descript_type = rpf->Default.ReplyFlags request_descript_type = rpf->Default.ReplyFlags
& MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK; & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
if (request_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) { if (request_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) {
atomic_dec(&reply_q->busy); atomic_dec(&reply_q->busy);
return IRQ_NONE; return completed_cmds;
} }
completed_cmds = 0;
cb_idx = 0xFF; cb_idx = 0xFF;
do { do {
rd.word = le64_to_cpu(rpf->Words); rd.word = le64_to_cpu(rpf->Words);
...@@ -1521,14 +1518,14 @@ _base_interrupt(int irq, void *bus_id) ...@@ -1521,14 +1518,14 @@ _base_interrupt(int irq, void *bus_id)
if (!completed_cmds) { if (!completed_cmds) {
atomic_dec(&reply_q->busy); atomic_dec(&reply_q->busy);
return IRQ_NONE; return completed_cmds;
} }
if (ioc->is_warpdrive) { if (ioc->is_warpdrive) {
writel(reply_q->reply_post_host_index, writel(reply_q->reply_post_host_index,
ioc->reply_post_host_index[msix_index]); ioc->reply_post_host_index[msix_index]);
atomic_dec(&reply_q->busy); atomic_dec(&reply_q->busy);
return IRQ_HANDLED; return completed_cmds;
} }
/* Update Reply Post Host Index. /* Update Reply Post Host Index.
...@@ -1555,7 +1552,27 @@ _base_interrupt(int irq, void *bus_id) ...@@ -1555,7 +1552,27 @@ _base_interrupt(int irq, void *bus_id)
MPI2_RPHI_MSIX_INDEX_SHIFT), MPI2_RPHI_MSIX_INDEX_SHIFT),
&ioc->chip->ReplyPostHostIndex); &ioc->chip->ReplyPostHostIndex);
atomic_dec(&reply_q->busy); 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);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册