diff mbox series

[v2,8/8] lpfc: Added support to handle marginal state

Message ID 1601268657-940-9-git-send-email-muneendra.kumar@broadcom.com
State New
Headers show
Series scsi: Support to handle Intermittent errors | expand

Commit Message

Muneendra Kumar Sept. 28, 2020, 4:50 a.m. UTC
Added additional check to set SCMD_NORETRIES_ABORT bit in scmd->state
if port state is marginal prior to initiating io to the port.

Signed-off-by: Muneendra <muneendra.kumar@broadcom.com>

---
v2:
New patch
---
 drivers/scsi/lpfc/lpfc_scsi.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Hannes Reinecke Sept. 30, 2020, 9:36 a.m. UTC | #1
On 9/28/20 6:50 AM, Muneendra wrote:
> Added additional check to set SCMD_NORETRIES_ABORT bit in scmd->state

> if port state is marginal prior to initiating io to the port.

> 

> Signed-off-by: Muneendra <muneendra.kumar@broadcom.com>

> 

> ---

> v2:

> New patch

> ---

>   drivers/scsi/lpfc/lpfc_scsi.c | 6 ++++++

>   1 file changed, 6 insertions(+)

> 

> diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c

> index 5e802c8b22a9..1198351d34a8 100644

> --- a/drivers/scsi/lpfc/lpfc_scsi.c

> +++ b/drivers/scsi/lpfc/lpfc_scsi.c

> @@ -4526,6 +4526,12 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)

>   		cmnd->result = err;

>   		goto out_fail_command;

>   	}

> +

> +	/*

> +	 * If port state is marginal

> +	 * Set the SCMD_NORETRIES_ABORT bit in scmd->state

> +	 */

> +	fc_rport_chkmarginal_set_noretries(rport, cmnd);

>   	ndlp = rdata->pnode;

>   

>   	if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) &&

> 

This really should be moved into the transport class; fc_block_rport() 
would be an ideal place for it.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer
Muneendra Kumar Sept. 30, 2020, 11:33 a.m. UTC | #2
Hi Hannes,
Thanks for the input.

>> +++ b/drivers/scsi/lpfc/lpfc_scsi.c
>> @@ -4526,6 +4526,12 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct
>> scsi_cmnd *cmnd)
>>   		cmnd->result = err;
>>   		goto out_fail_command;
>>   	}
>> +
>> +	/*
>> +	 * If port state is marginal
>> +	 * Set the SCMD_NORETRIES_ABORT bit in scmd->state
>> +	 */
>> +	fc_rport_chkmarginal_set_noretries(rport, cmnd);
>>   	ndlp = rdata->pnode;
>>
>>   	if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) &&
>>
>This really should be moved into the transport class; fc_block_rport()
>would be an ideal place for it.

[Muneendra]Correct me if I didn't understand correctly.
As fc_block_rport cannot take arg of scsi_cmd can we add it as part of
fc_block_scsi_eh ?

Regards,
Muneendra.
Hannes Reinecke Sept. 30, 2020, 11:50 a.m. UTC | #3
On 9/30/20 1:33 PM, Muneendra Kumar M wrote:
> Hi Hannes,

> Thanks for the input.

> 

>>> +++ b/drivers/scsi/lpfc/lpfc_scsi.c

>>> @@ -4526,6 +4526,12 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct

>>> scsi_cmnd *cmnd)

>>>    		cmnd->result = err;

>>>    		goto out_fail_command;

>>>    	}

>>> +

>>> +	/*

>>> +	 * If port state is marginal

>>> +	 * Set the SCMD_NORETRIES_ABORT bit in scmd->state

>>> +	 */

>>> +	fc_rport_chkmarginal_set_noretries(rport, cmnd);

>>>    	ndlp = rdata->pnode;

>>>

>>>    	if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) &&

>>>

>> This really should be moved into the transport class; fc_block_rport()

>> would be an ideal place for it.

> 

> [Muneendra]Correct me if I didn't understand correctly.

> As fc_block_rport cannot take arg of scsi_cmd can we add it as part of

> fc_block_scsi_eh ?

> 

Ah, right.
Actually I meant 'fc_remote_port_chkready()'.
That doesnt' take an scmd as argument, but I don't see why we can't 
modify it to have an additonal 'sdev' parameter...

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer
Muneendra Kumar Oct. 1, 2020, 8:59 a.m. UTC | #4
Hi Hannes,

>>> +     * If port state is marginal

>>> +     * Set the SCMD_NORETRIES_ABORT bit in scmd->state

>>> +     */

>>> +               fc_rport_chkmarginal_set_noretries(rport, cmnd);

>>>        ndlp = rdata->pnode;

>>>

>>>        if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) &&

>>>

>> This really should be moved into the transport class;

>> fc_block_rport() would be an ideal place for it.

>

>> [Muneendra]Correct me if I didn't understand correctly.

>> As fc_block_rport cannot take arg of scsi_cmd can we add it as part of

>> fc_block_scsi_eh ?

> >

>>Ah, right.

>>Actually I meant 'fc_remote_port_chkready()'.

>>That doesnt' take an scmd as argument, but I don't see why we can't modify

>>it to have an additonal 'sdev' parameter...


fc_remote_port_chkready function is even getting called in slave alloc
(lpfc_slave_alloc, qla2xxx_slave_alloc,...)  and few ELS initiative
functions
bnx2fc_initiate_els, qedf_initiate_els.. where scsi_cmnd cannot be passed.
In these cases we need to pass NULL for scsi_cmnd ?

Regards,
Muneendra.
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 5e802c8b22a9..1198351d34a8 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -4526,6 +4526,12 @@  lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
 		cmnd->result = err;
 		goto out_fail_command;
 	}
+
+	/*
+	 * If port state is marginal
+	 * Set the SCMD_NORETRIES_ABORT bit in scmd->state
+	 */
+	fc_rport_chkmarginal_set_noretries(rport, cmnd);
 	ndlp = rdata->pnode;
 
 	if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) &&