Skip to content

Commit 199510e

Browse files
Ranjan Kumarmartinkpetersen
authored andcommitted
scsi: mpi3mr: Update consumer index of reply queues after every 100 replies
Instead of updating the ConsumerIndex of the Admin and Operational ReplyQueues after processing all replies in the queue, the index will now be periodically updated after processing every 100 replies. Co-developed-by: Sathya Prakash <[email protected]> Signed-off-by: Sathya Prakash <[email protected]> Signed-off-by: Ranjan Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6dc7050 commit 199510e

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

drivers/scsi/mpi3mr/mpi3mr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ extern atomic64_t event_counter;
213213
#define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_INDEX 0
214214
#define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_DATA 1
215215

216+
#define MPI3MR_THRESHOLD_REPLY_COUNT 100
216217

217218
/* SGE Flag definition */
218219
#define MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST \

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)
443443
u32 admin_reply_ci = mrioc->admin_reply_ci;
444444
u32 num_admin_replies = 0;
445445
u64 reply_dma = 0;
446+
u16 threshold_comps = 0;
446447
struct mpi3_default_reply_descriptor *reply_desc;
447448

448449
if (!atomic_add_unless(&mrioc->admin_reply_q_in_use, 1, 1))
@@ -466,6 +467,7 @@ int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)
466467
if (reply_dma)
467468
mpi3mr_repost_reply_buf(mrioc, reply_dma);
468469
num_admin_replies++;
470+
threshold_comps++;
469471
if (++admin_reply_ci == mrioc->num_admin_replies) {
470472
admin_reply_ci = 0;
471473
exp_phase ^= 1;
@@ -476,6 +478,11 @@ int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)
476478
if ((le16_to_cpu(reply_desc->reply_flags) &
477479
MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK) != exp_phase)
478480
break;
481+
if (threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) {
482+
writel(admin_reply_ci,
483+
&mrioc->sysif_regs->admin_reply_queue_ci);
484+
threshold_comps = 0;
485+
}
479486
} while (1);
480487

481488
writel(admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci);
@@ -529,7 +536,7 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,
529536
u32 num_op_reply = 0;
530537
u64 reply_dma = 0;
531538
struct mpi3_default_reply_descriptor *reply_desc;
532-
u16 req_q_idx = 0, reply_qidx;
539+
u16 req_q_idx = 0, reply_qidx, threshold_comps = 0;
533540

534541
reply_qidx = op_reply_q->qid - 1;
535542

@@ -560,6 +567,7 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,
560567
if (reply_dma)
561568
mpi3mr_repost_reply_buf(mrioc, reply_dma);
562569
num_op_reply++;
570+
threshold_comps++;
563571

564572
if (++reply_ci == op_reply_q->num_replies) {
565573
reply_ci = 0;
@@ -581,13 +589,19 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,
581589
break;
582590
}
583591
#endif
592+
if (threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) {
593+
writel(reply_ci,
594+
&mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index);
595+
atomic_sub(threshold_comps, &op_reply_q->pend_ios);
596+
threshold_comps = 0;
597+
}
584598
} while (1);
585599

586600
writel(reply_ci,
587601
&mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index);
588602
op_reply_q->ci = reply_ci;
589603
op_reply_q->ephase = exp_phase;
590-
604+
atomic_sub(threshold_comps, &op_reply_q->pend_ios);
591605
atomic_dec(&op_reply_q->in_use);
592606
return num_op_reply;
593607
}

0 commit comments

Comments
 (0)