diff mbox series

[06/10] qla2xxx: Remove unsupported ql2xenabledif option.

Message ID 20230801114057.27039-7-njavali@marvell.com
State Superseded
Headers show
Series qla2xxx driver misc features | expand

Commit Message

Nilesh Javali Aug. 1, 2023, 11:40 a.m. UTC
From: Manish Rangankar <mrangankar@marvell.com>

User accidently pass module param ql2xenabledif=1, which is unsupported
in driver, but driver still progress and lead to guard tag error during
device discovery.

Remove unsupported ql2xenabledif=1 option and validate the user input.

Cc: stable@vger.kernel.org
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_attr.c | 2 --
 drivers/scsi/qla2xxx/qla_dbg.c  | 2 +-
 drivers/scsi/qla2xxx/qla_os.c   | 9 +++++++--
 3 files changed, 8 insertions(+), 5 deletions(-)

Comments

Himanshu Madhani Aug. 2, 2023, 7:54 p.m. UTC | #1
On 8/1/23 04:40, Nilesh Javali wrote:
> From: Manish Rangankar <mrangankar@marvell.com>
> 
> User accidently pass module param ql2xenabledif=1, which is unsupported
> in driver, but driver still progress and lead to guard tag error during
> device discovery.
> 
> Remove unsupported ql2xenabledif=1 option and validate the user input.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
>   drivers/scsi/qla2xxx/qla_attr.c | 2 --
>   drivers/scsi/qla2xxx/qla_dbg.c  | 2 +-
>   drivers/scsi/qla2xxx/qla_os.c   | 9 +++++++--
>   3 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
> index b00222459607..44449c70a375 100644
> --- a/drivers/scsi/qla2xxx/qla_attr.c
> +++ b/drivers/scsi/qla2xxx/qla_attr.c
> @@ -3093,8 +3093,6 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
>   			vha->flags.difdix_supported = 1;
>   			ql_dbg(ql_dbg_user, vha, 0x7082,
>   			    "Registered for DIF/DIX type 1 and 3 protection.\n");
> -			if (ql2xenabledif == 1)
> -				prot = SHOST_DIX_TYPE0_PROTECTION;
>   			scsi_host_set_prot(vha->host,
>   			    prot | SHOST_DIF_TYPE1_PROTECTION
>   			    | SHOST_DIF_TYPE2_PROTECTION
> diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
> index 4d104425146b..691ef827a5ab 100644
> --- a/drivers/scsi/qla2xxx/qla_dbg.c
> +++ b/drivers/scsi/qla2xxx/qla_dbg.c
> @@ -17,7 +17,7 @@
>    * | Queue Command and IO tracing |       0x3074       | 0x300b         |
>    * |                              |                    | 0x3027-0x3028  |
>    * |                              |                    | 0x303d-0x3041  |
> - * |                              |                    | 0x302d,0x3033  |
> + * |                              |                    | 0x302e,0x3033  |
>    * |                              |                    | 0x3036,0x3038  |
>    * |                              |                    | 0x303a		|
>    * | DPC Thread                   |       0x4023       | 0x4002,0x4013  |
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 7da13607e239..b9f9d1bb2634 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -3288,6 +3288,13 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
>   	host->max_id = ha->max_fibre_devices;
>   	host->cmd_per_lun = 3;
>   	host->unique_id = host->host_no;
> +
> +	if (ql2xenabledif && ql2xenabledif != 2) {
> +		ql_log(ql_log_warn, base_vha, 0x302d,
> +		       "Invalid value for ql2xenabledif, resetting it to default (2)\n");
> +		ql2xenabledif = 2;
> +	}
> +
>   	if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif)
>   		host->max_cmd_len = 32;
>   	else
> @@ -3524,8 +3531,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
>   			base_vha->flags.difdix_supported = 1;
>   			ql_dbg(ql_dbg_init, base_vha, 0x00f1,
>   			    "Registering for DIF/DIX type 1 and 3 protection.\n");
> -			if (ql2xenabledif == 1)
> -				prot = SHOST_DIX_TYPE0_PROTECTION;
>   			if (ql2xprotmask)
>   				scsi_host_set_prot(host, ql2xprotmask);
>   			else

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index b00222459607..44449c70a375 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -3093,8 +3093,6 @@  qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
 			vha->flags.difdix_supported = 1;
 			ql_dbg(ql_dbg_user, vha, 0x7082,
 			    "Registered for DIF/DIX type 1 and 3 protection.\n");
-			if (ql2xenabledif == 1)
-				prot = SHOST_DIX_TYPE0_PROTECTION;
 			scsi_host_set_prot(vha->host,
 			    prot | SHOST_DIF_TYPE1_PROTECTION
 			    | SHOST_DIF_TYPE2_PROTECTION
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 4d104425146b..691ef827a5ab 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -17,7 +17,7 @@ 
  * | Queue Command and IO tracing |       0x3074       | 0x300b         |
  * |                              |                    | 0x3027-0x3028  |
  * |                              |                    | 0x303d-0x3041  |
- * |                              |                    | 0x302d,0x3033  |
+ * |                              |                    | 0x302e,0x3033  |
  * |                              |                    | 0x3036,0x3038  |
  * |                              |                    | 0x303a		|
  * | DPC Thread                   |       0x4023       | 0x4002,0x4013  |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 7da13607e239..b9f9d1bb2634 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3288,6 +3288,13 @@  qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	host->max_id = ha->max_fibre_devices;
 	host->cmd_per_lun = 3;
 	host->unique_id = host->host_no;
+
+	if (ql2xenabledif && ql2xenabledif != 2) {
+		ql_log(ql_log_warn, base_vha, 0x302d,
+		       "Invalid value for ql2xenabledif, resetting it to default (2)\n");
+		ql2xenabledif = 2;
+	}
+
 	if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif)
 		host->max_cmd_len = 32;
 	else
@@ -3524,8 +3531,6 @@  qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 			base_vha->flags.difdix_supported = 1;
 			ql_dbg(ql_dbg_init, base_vha, 0x00f1,
 			    "Registering for DIF/DIX type 1 and 3 protection.\n");
-			if (ql2xenabledif == 1)
-				prot = SHOST_DIX_TYPE0_PROTECTION;
 			if (ql2xprotmask)
 				scsi_host_set_prot(host, ql2xprotmask);
 			else