diff mbox

[v2,04/10] qla2xxx: Reset reserved field in firmware options to 0.

Message ID 1482357459-31079-5-git-send-email-himanshu.madhani@cavium.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Madhani, Himanshu Dec. 21, 2016, 9:57 p.m. UTC
During NVRAM initialization in target mode, reset reserved
fields in firmware options to Zero (BIT 15)

Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>
---
 drivers/scsi/qla2xxx/qla_target.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Bart Van Assche Dec. 23, 2016, 8:37 a.m. UTC | #1
On Wed, 2016-12-21 at 13:57 -0800, Himanshu Madhani wrote:
> During NVRAM initialization in target mode, reset reserved

> fields in firmware options to Zero (BIT 15)

> 

> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>

> Signed-off-by: Giridhar Malavali <giridhar.malavali@cavium.com>

> ---

>  drivers/scsi/qla2xxx/qla_target.c | 17 ++++++++++++++++-

>  1 file changed, 16 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c

> index b9c559c..5037b51 100644

> --- a/drivers/scsi/qla2xxx/qla_target.c

> +++ b/drivers/scsi/qla2xxx/qla_target.c

> @@ -6539,6 +6539,14 @@ static void qlt_disable_vha(struct scsi_qla_host *vha)

>  

>  		/* Disable Full Login after LIP */

>  		nv->host_p &= cpu_to_le32(~BIT_10);

> +

> +		/*

> +		 * clear BIT 15 explicitly as we have seen at least

> +		 * a couple of instances where this was set and this

> +		 * was causing the firmware to not be initialized.

> +		 */

> +		nv->firmware_options_1 &=

> +		    __constant_cpu_to_le32(~BIT_15);

>  		/* Enable target PRLI control */

>  		nv->firmware_options_2 |= cpu_to_le32(BIT_14);

>  	} else {

> @@ -6623,11 +6631,18 @@ static void qlt_disable_vha(struct scsi_qla_host *vha)

>  		/* Disable ini mode, if requested */

>  		if (!qla_ini_mode_enabled(vha))

>  			nv->firmware_options_1 |= cpu_to_le32(BIT_5);

> -

>  		/* Disable Full Login after LIP */

>  		nv->firmware_options_1 &= cpu_to_le32(~BIT_13);

>  		/* Enable initial LIP */

>  		nv->firmware_options_1 &= cpu_to_le32(~BIT_9);

> +		/*

> +		 * clear BIT 15 explicitly as we have seen at

> +		 * least a couple of instances where this was set

> +		 * and this was causing the firmware to not be

> +		 * initialized.

> +		 */

> +		nv->firmware_options_1 &=

> +		    __constant_cpu_to_le32(~BIT_15);

>  		if (ql2xtgt_tape_enable)

>  			/* Enable FC tape support */

>  			nv->firmware_options_2 |= cpu_to_le32(BIT_12);


Hello Himanshu,

Please use cpu_to_le32() in new code instead of __constant_cpu_to_le32().
gcc generates the same code for both conversion functions but the former
function makes source code easier to read.

Bart.
Madhani, Himanshu Dec. 24, 2016, 12:07 a.m. UTC | #2
On 12/23/16, 12:37 AM, "Bart Van Assche" <Bart.VanAssche@sandisk.com> wrote:

>Please use cpu_to_le32() in new code instead of __constant_cpu_to_le32().

>gcc generates the same code for both conversion functions but the former

>function makes source code easier to read.


Ack. Will update the patch.

>
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index b9c559c..5037b51 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -6539,6 +6539,14 @@  static void qlt_disable_vha(struct scsi_qla_host *vha)
 
 		/* Disable Full Login after LIP */
 		nv->host_p &= cpu_to_le32(~BIT_10);
+
+		/*
+		 * clear BIT 15 explicitly as we have seen at least
+		 * a couple of instances where this was set and this
+		 * was causing the firmware to not be initialized.
+		 */
+		nv->firmware_options_1 &=
+		    __constant_cpu_to_le32(~BIT_15);
 		/* Enable target PRLI control */
 		nv->firmware_options_2 |= cpu_to_le32(BIT_14);
 	} else {
@@ -6623,11 +6631,18 @@  static void qlt_disable_vha(struct scsi_qla_host *vha)
 		/* Disable ini mode, if requested */
 		if (!qla_ini_mode_enabled(vha))
 			nv->firmware_options_1 |= cpu_to_le32(BIT_5);
-
 		/* Disable Full Login after LIP */
 		nv->firmware_options_1 &= cpu_to_le32(~BIT_13);
 		/* Enable initial LIP */
 		nv->firmware_options_1 &= cpu_to_le32(~BIT_9);
+		/*
+		 * clear BIT 15 explicitly as we have seen at
+		 * least a couple of instances where this was set
+		 * and this was causing the firmware to not be
+		 * initialized.
+		 */
+		nv->firmware_options_1 &=
+		    __constant_cpu_to_le32(~BIT_15);
 		if (ql2xtgt_tape_enable)
 			/* Enable FC tape support */
 			nv->firmware_options_2 |= cpu_to_le32(BIT_12);