Skip to content

Commit 6dc7050

Browse files
Ranjan Kumarmartinkpetersen
authored andcommitted
scsi: mpi3mr: Return complete ioc_status for ioctl commands
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. Modify driver to return unmasked (complete) iocstatus, including the loginfo available bit, for the MPI commands sent through the ioctl interface. 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 ff30732 commit 6dc7050

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
345345
{
346346
u16 reply_desc_type, host_tag = 0;
347347
u16 ioc_status = MPI3_IOCSTATUS_SUCCESS;
348+
u16 masked_ioc_status = MPI3_IOCSTATUS_SUCCESS;
348349
u32 ioc_loginfo = 0, sense_count = 0;
349350
struct mpi3_status_reply_descriptor *status_desc;
350351
struct mpi3_address_reply_descriptor *addr_desc;
@@ -366,8 +367,8 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
366367
if (ioc_status &
367368
MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL)
368369
ioc_loginfo = le32_to_cpu(status_desc->ioc_log_info);
369-
ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK;
370-
mpi3mr_reply_trigger(mrioc, ioc_status, ioc_loginfo);
370+
masked_ioc_status = ioc_status & MPI3_IOCSTATUS_STATUS_MASK;
371+
mpi3mr_reply_trigger(mrioc, masked_ioc_status, ioc_loginfo);
371372
break;
372373
case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_ADDRESS_REPLY:
373374
addr_desc = (struct mpi3_address_reply_descriptor *)reply_desc;
@@ -380,7 +381,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
380381
if (ioc_status &
381382
MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL)
382383
ioc_loginfo = le32_to_cpu(def_reply->ioc_log_info);
383-
ioc_status &= MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK;
384+
masked_ioc_status = ioc_status & MPI3_IOCSTATUS_STATUS_MASK;
384385
if (def_reply->function == MPI3_FUNCTION_SCSI_IO) {
385386
scsi_reply = (struct mpi3_scsi_io_reply *)def_reply;
386387
sense_buf = mpi3mr_get_sensebuf_virt_addr(mrioc,
@@ -393,7 +394,7 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
393394
sshdr.asc, sshdr.ascq);
394395
}
395396
}
396-
mpi3mr_reply_trigger(mrioc, ioc_status, ioc_loginfo);
397+
mpi3mr_reply_trigger(mrioc, masked_ioc_status, ioc_loginfo);
397398
break;
398399
case MPI3_REPLY_DESCRIPT_FLAGS_TYPE_SUCCESS:
399400
success_desc = (struct mpi3_success_reply_descriptor *)reply_desc;
@@ -408,7 +409,10 @@ static void mpi3mr_process_admin_reply_desc(struct mpi3mr_ioc *mrioc,
408409
if (cmdptr->state & MPI3MR_CMD_PENDING) {
409410
cmdptr->state |= MPI3MR_CMD_COMPLETE;
410411
cmdptr->ioc_loginfo = ioc_loginfo;
411-
cmdptr->ioc_status = ioc_status;
412+
if (host_tag == MPI3MR_HOSTTAG_BSG_CMDS)
413+
cmdptr->ioc_status = ioc_status;
414+
else
415+
cmdptr->ioc_status = masked_ioc_status;
412416
cmdptr->state &= ~MPI3MR_CMD_PENDING;
413417
if (def_reply) {
414418
cmdptr->state |= MPI3MR_CMD_REPLY_VALID;

0 commit comments

Comments
 (0)