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

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 <sathya.prakash@broadcom.com>
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://lore.kernel.org/r/20240808125418.8832-3-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Ranjan Kumar and committed by
Martin K. Petersen
199510e3 6dc7050d

+17 -2
+1
drivers/scsi/mpi3mr/mpi3mr.h
··· 213 213 #define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_INDEX 0 214 214 #define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_DATA 1 215 215 216 + #define MPI3MR_THRESHOLD_REPLY_COUNT 100 216 217 217 218 /* SGE Flag definition */ 218 219 #define MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST \
+16 -2
drivers/scsi/mpi3mr/mpi3mr_fw.c
··· 443 443 u32 admin_reply_ci = mrioc->admin_reply_ci; 444 444 u32 num_admin_replies = 0; 445 445 u64 reply_dma = 0; 446 + u16 threshold_comps = 0; 446 447 struct mpi3_default_reply_descriptor *reply_desc; 447 448 448 449 if (!atomic_add_unless(&mrioc->admin_reply_q_in_use, 1, 1)) ··· 467 466 if (reply_dma) 468 467 mpi3mr_repost_reply_buf(mrioc, reply_dma); 469 468 num_admin_replies++; 469 + threshold_comps++; 470 470 if (++admin_reply_ci == mrioc->num_admin_replies) { 471 471 admin_reply_ci = 0; 472 472 exp_phase ^= 1; ··· 478 476 if ((le16_to_cpu(reply_desc->reply_flags) & 479 477 MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK) != exp_phase) 480 478 break; 479 + if (threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) { 480 + writel(admin_reply_ci, 481 + &mrioc->sysif_regs->admin_reply_queue_ci); 482 + threshold_comps = 0; 483 + } 481 484 } while (1); 482 485 483 486 writel(admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci); ··· 536 529 u32 num_op_reply = 0; 537 530 u64 reply_dma = 0; 538 531 struct mpi3_default_reply_descriptor *reply_desc; 539 - u16 req_q_idx = 0, reply_qidx; 532 + u16 req_q_idx = 0, reply_qidx, threshold_comps = 0; 540 533 541 534 reply_qidx = op_reply_q->qid - 1; 542 535 ··· 567 560 if (reply_dma) 568 561 mpi3mr_repost_reply_buf(mrioc, reply_dma); 569 562 num_op_reply++; 563 + threshold_comps++; 570 564 571 565 if (++reply_ci == op_reply_q->num_replies) { 572 566 reply_ci = 0; ··· 589 581 break; 590 582 } 591 583 #endif 584 + if (threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) { 585 + writel(reply_ci, 586 + &mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index); 587 + atomic_sub(threshold_comps, &op_reply_q->pend_ios); 588 + threshold_comps = 0; 589 + } 592 590 } while (1); 593 591 594 592 writel(reply_ci, 595 593 &mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index); 596 594 op_reply_q->ci = reply_ci; 597 595 op_reply_q->ephase = exp_phase; 598 - 596 + atomic_sub(threshold_comps, &op_reply_q->pend_ios); 599 597 atomic_dec(&op_reply_q->in_use); 600 598 return num_op_reply; 601 599 }