Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: mpt3sas: simplify interrupt handler

Separate out processing of reply descriptor post queue from _base_interrupt
to _base_process_reply_queue.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Suganath Prabu and committed by
Martin K. Petersen
233af108 2c063507

+33 -16
+33 -16
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 1383 1383 }; 1384 1384 1385 1385 /** 1386 - * _base_interrupt - MPT adapter (IOC) specific interrupt handler. 1387 - * @irq: irq number (not used) 1388 - * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure 1386 + * _base_process_reply_queue - Process reply descriptors from reply 1387 + * descriptor post queue. 1388 + * @reply_q: per IRQ's reply queue object. 1389 1389 * 1390 - * Return: IRQ_HANDLED if processed, else IRQ_NONE. 1390 + * Return: number of reply descriptors processed from reply 1391 + * descriptor queue. 1391 1392 */ 1392 - static irqreturn_t 1393 - _base_interrupt(int irq, void *bus_id) 1393 + static int 1394 + _base_process_reply_queue(struct adapter_reply_queue *reply_q) 1394 1395 { 1395 - struct adapter_reply_queue *reply_q = bus_id; 1396 1396 union reply_descriptor rd; 1397 1397 u32 completed_cmds; 1398 1398 u8 request_descript_type; ··· 1404 1404 Mpi2ReplyDescriptorsUnion_t *rpf; 1405 1405 u8 rc; 1406 1406 1407 - if (ioc->mask_interrupts) 1408 - return IRQ_NONE; 1409 - 1407 + completed_cmds = 0; 1410 1408 if (!atomic_add_unless(&reply_q->busy, 1, 1)) 1411 - return IRQ_NONE; 1409 + return completed_cmds; 1412 1410 1413 1411 rpf = &reply_q->reply_post_free[reply_q->reply_post_host_index]; 1414 1412 request_descript_type = rpf->Default.ReplyFlags 1415 1413 & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK; 1416 1414 if (request_descript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED) { 1417 1415 atomic_dec(&reply_q->busy); 1418 - return IRQ_NONE; 1416 + return completed_cmds; 1419 1417 } 1420 1418 1421 - completed_cmds = 0; 1422 1419 cb_idx = 0xFF; 1423 1420 do { 1424 1421 rd.word = le64_to_cpu(rpf->Words); ··· 1518 1521 1519 1522 if (!completed_cmds) { 1520 1523 atomic_dec(&reply_q->busy); 1521 - return IRQ_NONE; 1524 + return completed_cmds; 1522 1525 } 1523 1526 1524 1527 if (ioc->is_warpdrive) { 1525 1528 writel(reply_q->reply_post_host_index, 1526 1529 ioc->reply_post_host_index[msix_index]); 1527 1530 atomic_dec(&reply_q->busy); 1528 - return IRQ_HANDLED; 1531 + return completed_cmds; 1529 1532 } 1530 1533 1531 1534 /* Update Reply Post Host Index. ··· 1552 1555 MPI2_RPHI_MSIX_INDEX_SHIFT), 1553 1556 &ioc->chip->ReplyPostHostIndex); 1554 1557 atomic_dec(&reply_q->busy); 1555 - return IRQ_HANDLED; 1558 + return completed_cmds; 1559 + } 1560 + 1561 + /** 1562 + * _base_interrupt - MPT adapter (IOC) specific interrupt handler. 1563 + * @irq: irq number (not used) 1564 + * @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure 1565 + * 1566 + * Return: IRQ_HANDLED if processed, else IRQ_NONE. 1567 + */ 1568 + static irqreturn_t 1569 + _base_interrupt(int irq, void *bus_id) 1570 + { 1571 + struct adapter_reply_queue *reply_q = bus_id; 1572 + struct MPT3SAS_ADAPTER *ioc = reply_q->ioc; 1573 + 1574 + if (ioc->mask_interrupts) 1575 + return IRQ_NONE; 1576 + 1577 + return ((_base_process_reply_queue(reply_q) > 0) ? 1578 + IRQ_HANDLED : IRQ_NONE); 1556 1579 } 1557 1580 1558 1581 /**