scsi: mpt3sas: Improve the threshold value and introduce module param
authorSuganath Prabu <suganath-prabu.subramani@broadcom.com>
Fri, 15 Feb 2019 07:40:29 +0000 (02:40 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 18 Mar 2019 21:16:44 +0000 (17:16 -0400)
* Reduce the threshold value to 1/4 of the queue depth.

* With this FW can find enough entries to post the Reply Descriptors in the
  reply descriptor post queue.

* With module param, user can play with threshold value, the same
  irqpoll_weight is used as the budget in processing of reply descriptor
  post queues in _base_process_reply_queue.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/mpt3sas/mpt3sas_base.h

index 3c3e4745a7b83ad24345a7f52950d8848725804b..0aca627e21e8a5d4a2d7f54b24679f54e1c37991 100644 (file)
@@ -94,6 +94,11 @@ module_param(max_msix_vectors, int, 0);
 MODULE_PARM_DESC(max_msix_vectors,
        " max msix vectors");
 
+static int irqpoll_weight = -1;
+module_param(irqpoll_weight, int, 0);
+MODULE_PARM_DESC(irqpoll_weight,
+       "irq poll weight (default= one fourth of HBA queue depth)");
+
 static int mpt3sas_fwfault_debug;
 MODULE_PARM_DESC(mpt3sas_fwfault_debug,
        " enable detection of firmware fault and halt firmware - (default=0)");
@@ -1404,7 +1409,7 @@ static int
 _base_process_reply_queue(struct adapter_reply_queue *reply_q)
 {
        union reply_descriptor rd;
-       u32 completed_cmds;
+       u64 completed_cmds;
        u8 request_descript_type;
        u16 smid;
        u8 cb_idx;
@@ -1502,7 +1507,7 @@ _base_process_reply_queue(struct adapter_reply_queue *reply_q)
                 * So that FW can find enough entries to post the Reply
                 * Descriptors in the reply descriptor post queue.
                 */
-               if (completed_cmds > ioc->hba_queue_depth/3) {
+               if (!base_mod64(completed_cmds, ioc->thresh_hold)) {
                        if (ioc->combined_reply_queue) {
                                writel(reply_q->reply_post_host_index |
                                                ((msix_index  & 7) <<
@@ -6612,6 +6617,11 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
        if (r)
                goto out_free_resources;
 
+       if (irqpoll_weight > 0)
+               ioc->thresh_hold = irqpoll_weight;
+       else
+               ioc->thresh_hold = ioc->hba_queue_depth/4;
+
        _base_init_irqpolls(ioc);
        init_waitqueue_head(&ioc->reset_wq);
 
index 3895407183ffaaca7ffba0afae49b270bfb62ece..dab64f305fe1e42e3aa67b5ebe69278f3d9a1e06 100644 (file)
@@ -1028,6 +1028,8 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc);
  * @msix_load_balance: Enables load balancing of interrupts across
  * the multiple MSIXs
  * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands
+ * @thresh_hold: Max number of reply descriptors processed
+ *                             before updating Host Index
  * @scsi_io_cb_idx: shost generated commands
  * @tm_cb_idx: task management commands
  * @scsih_cb_idx: scsih internal commands
@@ -1205,6 +1207,7 @@ struct MPT3SAS_ADAPTER {
        u32             non_operational_loop;
        atomic64_t      total_io_cnt;
        bool            msix_load_balance;
+       u16             thresh_hold;
 
        /* internal commands, callback index */
        u8              scsi_io_cb_idx;