RE: [PATCH 10/10] megaraid_sas: fix endianess for the crash dump state support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>-----Original Message-----
>From: Christoph Hellwig [mailto:hch@xxxxxx]
>Sent: Saturday, January 10, 2015 10:41 PM
>To: Sumit.Saxena@xxxxxxxxxxxxx; kashyap.desai@xxxxxxxxxxxxx
>Cc: martin.petersen@xxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx
>Subject: [PATCH 10/10] megaraid_sas: fix endianess for the crash dump
state
>support
>
>Note that this one is a bit fishy: it seems like it should always be read
and
>written using either words or bytes, but never using a mixture.
>
>Please verify against the hardware documentation.
>
>Signed-off-by: Christoph Hellwig <hch@xxxxxx>
>---
> drivers/scsi/megaraid/megaraid_sas.h      | 2 +-
> drivers/scsi/megaraid/megaraid_sas_base.c | 7 ++++---
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas.h
>b/drivers/scsi/megaraid/megaraid_sas.h
>index 81484f1..465dd45 100644
>--- a/drivers/scsi/megaraid/megaraid_sas.h
>+++ b/drivers/scsi/megaraid/megaraid_sas.h
>@@ -1676,7 +1676,7 @@ struct megasas_instance {
> 	u32 drv_buf_alloc;
> 	u32 crash_dump_fw_support;
> 	u32 crash_dump_drv_support;
>-	u32 crash_dump_app_support;
>+	__le32 crash_dump_app_support;
> 	u32 secure_jbod_support;
> 	spinlock_t crashdump_lock;
>
>diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
>b/drivers/scsi/megaraid/megaraid_sas_base.c
>index 3d4a080..29a1b20 100644
>--- a/drivers/scsi/megaraid/megaraid_sas_base.c
>+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
>@@ -6010,7 +6010,7 @@ static int megasas_set_crash_dump_params_ioctl(
> {
> 	struct megasas_instance *local_instance;
> 	int i, error = 0;
>-	int crash_support;
>+	__le32 crash_support;
>
> 	crash_support = cmd->frame->dcmd.mbox.w[0];
>
>@@ -6020,7 +6020,7 @@ static int megasas_set_crash_dump_params_ioctl(
> 			if ((local_instance->adprecovery ==
> 				MEGASAS_HBA_OPERATIONAL) &&
>
>	!megasas_set_crash_dump_params(local_instance,
>-					crash_support)) {
>+					le32_to_cpu(crash_support))) {
> 				local_instance->crash_dump_app_support =
> 					crash_support;
> 				dev_info(&local_instance->pdev->dev,
>@@ -6084,7 +6084,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
>*instance,
> 					       MFI_FRAME_SGL64 |
> 					       MFI_FRAME_SENSE64));
>
>-	if (cmd->frame->dcmd.opcode ==
>MR_DRIVER_SET_APP_CRASHDUMP_MODE) {
>+	if (cmd->frame->dcmd.opcode ==
>+
>	cpu_to_le32(MR_DRIVER_SET_APP_CRASHDUMP_MODE)) {

Application will not do any byte swapping for this DCMD
frame(MR_DRIVER_SET_APP_CRASHDUMP_MODE) to convert it in LE format, since
this DCMD will not be sent to firmware, driver will only process this DCMD
and fire another DCMD- MR_DCMD_CTRL_SET_CRASH_DUMP_PARAMS to firmware.
DCMD frame will always be in CPU format only.
So this "if" condition does not need
cpu_to_le32(MR_DRIVER_SET_APP_CRASHDUMP_MODE).


> 		error = megasas_set_crash_dump_params_ioctl(cmd);
> 		megasas_return_cmd(instance, cmd);
> 		return error;
>--
>1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux