public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] mpi3mr: Critical bug fixes
@ 2024-08-08 12:54 Ranjan Kumar
  2024-08-08 12:54 ` [PATCH v1 1/3] mpi3mr: return complete ioc_status for ioctl commands Ranjan Kumar
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ranjan Kumar @ 2024-08-08 12:54 UTC (permalink / raw)
  To: linux-scsi, martin.petersen; +Cc: sathya.prakash, sumit.saxena, Ranjan Kumar

This patch set contains mpi3mr critical bug fixes.

Ranjan Kumar (3):
  mpi3mr: return complete ioc_status for ioctl commands
  mpi3mr: Update consumer index of reply queues after every 100 replies
  mpi3mr: Driver version update to 8.10.0.5.50

 drivers/scsi/mpi3mr/mpi3mr.h    |  5 +++--
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 32 +++++++++++++++++++++++++-------
 2 files changed, 28 insertions(+), 9 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/3] mpi3mr: return complete ioc_status for ioctl commands
  2024-08-08 12:54 [PATCH v1 0/3] mpi3mr: Critical bug fixes Ranjan Kumar
@ 2024-08-08 12:54 ` Ranjan Kumar
  2024-08-08 12:54 ` [PATCH v1 2/3] mpi3mr: Update consumer index of reply queues after every 100 replies Ranjan Kumar
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ranjan Kumar @ 2024-08-08 12:54 UTC (permalink / raw)
  To: linux-scsi, martin.petersen; +Cc: sathya.prakash, sumit.saxena, Ranjan Kumar

The driver masked the loginfo available bit in the iocstatus
before passing it to the applications, causing a mismatch in
error messages between Linux and other operating systems.

Driver has been modified to return unmasked(complete)
iocstatus, including the loginfo available bit, for the MPI
commands sent through the IOCTL interface.

Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index c196dc14ad20..169850393580 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -345,6 +345,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
 {
 	u16 reply_desc_type, host_tag = 0;
 	u16 ioc_status = MPI3_IOCSTATUS_SUCCESS;
+	u16 masked_ioc_status = MPI3_IOCSTATUS_SUCCESS;
 	u32 ioc_loginfo = 0, sense_count = 0;
 	struct mpi3_status_reply_descriptor *status_desc;
 	struct mpi3_address_reply_descriptor *addr_desc;
@@ -366,8 +367,8 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
 		if (ioc_status &
 		    MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL)
 			ioc_loginfo = le32_to_cpu(status_desc->ioc_log_info);
-		ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK;
-		mpi3mr_reply_trigger(mrioc, ioc_status, ioc_loginfo);
+		masked_ioc_status = ioc_status & MPI3_IOCSTATUS_STATUS_MASK;
+		mpi3mr_reply_trigger(mrioc, masked_ioc_status, ioc_loginfo);
 		break;
 	case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_ADDRESS_REPLY:
 		addr_desc = (struct mpi3_address_reply_descriptor *)reply_desc;
@@ -380,7 +381,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
 		if (ioc_status &
 		    MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL)
 			ioc_loginfo = le32_to_cpu(def_reply->ioc_log_info);
-		ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK;
+		masked_ioc_status = ioc_status & MPI3_IOCSTATUS_STATUS_MASK;
 		if (def_reply->function == MPI3_FUNCTION_SCSI_IO) {
 			scsi_reply = (struct mpi3_scsi_io_reply *)def_reply;
 			sense_buf = mpi3mr_get_sensebuf_virt_addr(mrioc,
@@ -393,7 +394,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
 				    sshdr.asc, sshdr.ascq);
 			}
 		}
-		mpi3mr_reply_trigger(mrioc, ioc_status, ioc_loginfo);
+		mpi3mr_reply_trigger(mrioc, masked_ioc_status, ioc_loginfo);
 		break;
 	case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_SUCCESS:
 		success_desc = (struct mpi3_success_reply_descriptor *)reply_desc;
@@ -408,7 +409,10 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
 		if (cmdptr->state & MPI3MR_CMD_PENDING) {
 			cmdptr->state |= MPI3MR_CMD_COMPLETE;
 			cmdptr->ioc_loginfo = ioc_loginfo;
-			cmdptr->ioc_status = ioc_status;
+			if (host_tag == MPI3MR_HOSTTAG_BSG_CMDS)
+				cmdptr->ioc_status = ioc_status;
+			else
+				cmdptr->ioc_status = masked_ioc_status;
 			cmdptr->state &= ~MPI3MR_CMD_PENDING;
 			if (def_reply) {
 				cmdptr->state |= MPI3MR_CMD_REPLY_VALID;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/3] mpi3mr: Update consumer index of reply queues after every 100 replies
  2024-08-08 12:54 [PATCH v1 0/3] mpi3mr: Critical bug fixes Ranjan Kumar
  2024-08-08 12:54 ` [PATCH v1 1/3] mpi3mr: return complete ioc_status for ioctl commands Ranjan Kumar
@ 2024-08-08 12:54 ` Ranjan Kumar
  2024-08-08 12:54 ` [PATCH v1 3/3] mpi3mr: Driver version update to 8.10.0.5.50 Ranjan Kumar
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ranjan Kumar @ 2024-08-08 12:54 UTC (permalink / raw)
  To: linux-scsi, martin.petersen; +Cc: sathya.prakash, sumit.saxena, Ranjan Kumar

Instead of updating the ConsumerIndex of the Admin
and Operational ReplyQueues after processing all
replies in the queue, it will now be periodically updated
after processing every 100 replies.

Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr.h    |  1 +
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h
index dc2cdd5f0311..cbb6e4b2d447 100644
--- a/drivers/scsi/mpi3mr/mpi3mr.h
+++ b/drivers/scsi/mpi3mr/mpi3mr.h
@@ -213,6 +213,7 @@ extern atomic64_t event_counter;
 #define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_INDEX   0
 #define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_DATA    1
 
+#define MPI3MR_THRESHOLD_REPLY_COUNT	100
 
 /* SGE Flag definition */
 #define MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST \
diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index 169850393580..6eb5bcd8e757 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -443,6 +443,7 @@ int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)
 	u32 admin_reply_ci = mrioc->admin_reply_ci;
 	u32 num_admin_replies = 0;
 	u64 reply_dma = 0;
+	u16 threshold_comps = 0;
 	struct mpi3_default_reply_descriptor *reply_desc;
 
 	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)
 		if (reply_dma)
 			mpi3mr_repost_reply_buf(mrioc, reply_dma);
 		num_admin_replies++;
+		threshold_comps++;
 		if (++admin_reply_ci == mrioc->num_admin_replies) {
 			admin_reply_ci = 0;
 			exp_phase ^= 1;
@@ -476,6 +478,11 @@ int mpi3mr_process_admin_reply_q(struct mpi3mr_ioc *mrioc)
 		if ((le16_to_cpu(reply_desc->reply_flags) &
 		    MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK) != exp_phase)
 			break;
+		if (threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) {
+			writel(admin_reply_ci,
+			    &mrioc->sysif_regs->admin_reply_queue_ci);
+			threshold_comps = 0;
+		}
 	} while (1);
 
 	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,
 	u32 num_op_reply = 0;
 	u64 reply_dma = 0;
 	struct mpi3_default_reply_descriptor *reply_desc;
-	u16 req_q_idx = 0, reply_qidx;
+	u16 req_q_idx = 0, reply_qidx, threshold_comps = 0;
 
 	reply_qidx = op_reply_q->qid - 1;
 
@@ -560,6 +567,7 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,
 		if (reply_dma)
 			mpi3mr_repost_reply_buf(mrioc, reply_dma);
 		num_op_reply++;
+		threshold_comps++;
 
 		if (++reply_ci == op_reply_q->num_replies) {
 			reply_ci = 0;
@@ -581,13 +589,19 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,
 			break;
 		}
 #endif
+		if (threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) {
+			writel(reply_ci,
+			    &mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index);
+			atomic_sub(threshold_comps, &op_reply_q->pend_ios);
+			threshold_comps = 0;
+		}
 	} while (1);
 
 	writel(reply_ci,
 	    &mrioc->sysif_regs->oper_queue_indexes[reply_qidx].consumer_index);
 	op_reply_q->ci = reply_ci;
 	op_reply_q->ephase = exp_phase;
-
+	atomic_sub(threshold_comps, &op_reply_q->pend_ios);
 	atomic_dec(&op_reply_q->in_use);
 	return num_op_reply;
 }
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 3/3] mpi3mr: Driver version update to 8.10.0.5.50
  2024-08-08 12:54 [PATCH v1 0/3] mpi3mr: Critical bug fixes Ranjan Kumar
  2024-08-08 12:54 ` [PATCH v1 1/3] mpi3mr: return complete ioc_status for ioctl commands Ranjan Kumar
  2024-08-08 12:54 ` [PATCH v1 2/3] mpi3mr: Update consumer index of reply queues after every 100 replies Ranjan Kumar
@ 2024-08-08 12:54 ` Ranjan Kumar
  2024-08-13  1:59 ` [PATCH v1 0/3] mpi3mr: Critical bug fixes Martin K. Petersen
  2024-08-17  1:37 ` Martin K. Petersen
  4 siblings, 0 replies; 6+ messages in thread
From: Ranjan Kumar @ 2024-08-08 12:54 UTC (permalink / raw)
  To: linux-scsi, martin.petersen; +Cc: sathya.prakash, sumit.saxena, Ranjan Kumar

Update driver version to 8.10.0.5.50

Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
---
 drivers/scsi/mpi3mr/mpi3mr.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h
index cbb6e4b2d447..875bad7538f2 100644
--- a/drivers/scsi/mpi3mr/mpi3mr.h
+++ b/drivers/scsi/mpi3mr/mpi3mr.h
@@ -57,8 +57,8 @@ extern struct list_head mrioc_list;
 extern int prot_mask;
 extern atomic64_t event_counter;
 
-#define MPI3MR_DRIVER_VERSION	"8.9.1.0.51"
-#define MPI3MR_DRIVER_RELDATE	"29-May-2024"
+#define MPI3MR_DRIVER_VERSION	"8.10.0.5.50"
+#define MPI3MR_DRIVER_RELDATE	"08-Aug-2024"
 
 #define MPI3MR_DRIVER_NAME	"mpi3mr"
 #define MPI3MR_DRIVER_LICENSE	"GPL"
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 0/3] mpi3mr: Critical bug fixes
  2024-08-08 12:54 [PATCH v1 0/3] mpi3mr: Critical bug fixes Ranjan Kumar
                   ` (2 preceding siblings ...)
  2024-08-08 12:54 ` [PATCH v1 3/3] mpi3mr: Driver version update to 8.10.0.5.50 Ranjan Kumar
@ 2024-08-13  1:59 ` Martin K. Petersen
  2024-08-17  1:37 ` Martin K. Petersen
  4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2024-08-13  1:59 UTC (permalink / raw)
  To: Ranjan Kumar; +Cc: linux-scsi, martin.petersen, sathya.prakash, sumit.saxena


Ranjan,

> This patch set contains mpi3mr critical bug fixes.

Applied to 6.12/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 0/3] mpi3mr: Critical bug fixes
  2024-08-08 12:54 [PATCH v1 0/3] mpi3mr: Critical bug fixes Ranjan Kumar
                   ` (3 preceding siblings ...)
  2024-08-13  1:59 ` [PATCH v1 0/3] mpi3mr: Critical bug fixes Martin K. Petersen
@ 2024-08-17  1:37 ` Martin K. Petersen
  4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2024-08-17  1:37 UTC (permalink / raw)
  To: linux-scsi, Ranjan Kumar
  Cc: Martin K . Petersen, sathya.prakash, sumit.saxena

On Thu, 08 Aug 2024 18:24:15 +0530, Ranjan Kumar wrote:

> This patch set contains mpi3mr critical bug fixes.
> 
> Ranjan Kumar (3):
>   mpi3mr: return complete ioc_status for ioctl commands
>   mpi3mr: Update consumer index of reply queues after every 100 replies
>   mpi3mr: Driver version update to 8.10.0.5.50
> 
> [...]

Applied to 6.12/scsi-queue, thanks!

[1/3] mpi3mr: return complete ioc_status for ioctl commands
      https://git.kernel.org/mkp/scsi/c/6dc7050d4671
[2/3] mpi3mr: Update consumer index of reply queues after every 100 replies
      https://git.kernel.org/mkp/scsi/c/199510e33dea
[3/3] mpi3mr: Driver version update to 8.10.0.5.50
      https://git.kernel.org/mkp/scsi/c/f856e57d6138

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-17  1:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-08 12:54 [PATCH v1 0/3] mpi3mr: Critical bug fixes Ranjan Kumar
2024-08-08 12:54 ` [PATCH v1 1/3] mpi3mr: return complete ioc_status for ioctl commands Ranjan Kumar
2024-08-08 12:54 ` [PATCH v1 2/3] mpi3mr: Update consumer index of reply queues after every 100 replies Ranjan Kumar
2024-08-08 12:54 ` [PATCH v1 3/3] mpi3mr: Driver version update to 8.10.0.5.50 Ranjan Kumar
2024-08-13  1:59 ` [PATCH v1 0/3] mpi3mr: Critical bug fixes Martin K. Petersen
2024-08-17  1:37 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox