bnx2fc: Handle scope bits when array returns BUSY or TASK_SET_FULL
Subsystems (2)
PATCH 1/1 bnx2fc: Handle scope bits when array returns BUSY or TASK_SET_FULL
The qla2xxx driver had this issue as well when the newer array firmware returned the retry_delay_timer in the fcp_rsp. The bnx2fc is not handling the masking of the scope bits either so the retry_delay_timestamp value lands up being a large value added to the timer timestamp delaying I/O for up to 27 Minutes. This patch adds similar code to handle this to the bnx2fc driver to avoid the huge delay.
--- drivers/scsi/bnx2fc/bnx2fc_io.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +20 -3
@@ -1928,6 +1928,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,struct bnx2fc_rport *tgt = io_req->tgt;struct scsi_cmnd *sc_cmd;struct Scsi_Host *host; +u16 scope, qualifier =0 ;/* scsi_cmd_cmpl is called with tgt lock held */
@@ -1997,12 +1998,28 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,if (io_req->cdb_status ==SAM_STAT_TASK_SET_FULL || io_req->cdb_status ==SAM_STAT_BUSY ) { +/* Newer array firmware with BUSY or +* TASK_SET_FULL may return a status that needs +* the scope bits masked. +* Or a huge delay timestamp up to 27 minutes +* can result. +*/ +if (fcp_rsp->retry_delay_timer) { +/* Upper 2 bits */ + scope = fcp_rsp->retry_delay_timer + &0xC000 ; +/* Lower 14 bits */ + qualifier = fcp_rsp->retry_delay_timer + &0x3FFF ; + } +if (scope >0 && qualifier >0 && + qualifier <=0x3FEF ) {/* Set the jiffies + retry_delay_timer * 100ms for the rport/tgt */ - tgt->retry_delay_timestamp = jiffies + - fcp_rsp->retry_delay_timer *HZ /10 ; + tgt->retry_delay_timestamp = jiffies + + (qualifier *HZ /10 ); + } } - }if (io_req->fcp_resid)scsi_set_resid (sc_cmd, io_req->fcp_resid);
Signature · 1 line
1.8.3.1
Quoted 61 lines · Laurence Oberman
The qla2xxx driver had this issue as well when the newer array firmware returned the
retry_delay_timerin thefcp_rsp. The bnx2fc is not handling the masking of the scope bits either so theretry_delay_timestampvalue lands up being a large value added to the timer timestamp delaying I/O for up to 27 Minutes. This patch adds similar code to handle this to the bnx2fc driver to avoid the huge delay.Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc_io.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0@@ -1928,6 +1928,7 @@ void bnx2fc_process_scsi_cmd_compl(structbnx2fc_cmd *io_req, struct bnx2fc_rport *tgt = io_req->tgt;struct scsi_cmnd *sc_cmd;struct Scsi_Host *host; +u16 scope, qualifier =0 ;drivers/scsi/bnx2fc/bnx2fc_io.c +0
-0/* scsi_cmd_cmpl is called with tgt lock held */ @@ -1997,12 +1998,28 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, if (io_req->cdb_status ==
SAM_STAT_TASK_SET_FULL||drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0io_req->cdb_status == SAM_STAT_BUSY) { +/* Newer array firmware with BUSY or +* TASK_SET_FULL may return a status that needs
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0+* the scope bits masked. +* Or a huge delay timestamp up to 27 minutes
drivers/scsi/bnx2fc/bnx2fc_io.c +5
-0+* can result. +*/ +if (fcp_rsp->retry_delay_timer) { +/* Upper 2 bits */ + scope = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +3
-0+ &0xC000 ; +/* Lower 14 bits */ + qualifier = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +4
-0+ &0x3FFF ; + } +if (scope >0 && qualifier >0 && + qualifier <=0x3FEF ) {/* Set the jiffies + retry_delay_timer * 100ms
drivers/scsi/bnx2fc/bnx2fc_io.c +0
-2for the rport/tgt */ - tgt->retry_delay_timestamp = jiffies + - fcp_rsp->retry_delay_timer *HZ / 10;
drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0+ tgt->retry_delay_timestamp =jiffies +
drivers/scsi/bnx2fc/bnx2fc_io.c void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, · line 2025
Quoted 7 lines
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-1+ (qualifier *HZ /10 ); + } } - }if (io_req->fcp_resid)scsi_set_resid (sc_cmd, io_req->fcp_resid);
Hello
Please add
Apologies forgot to add that.
Quoted 61 lines · Laurence Oberman
The qla2xxx driver had this issue as well when the newer array firmware returned the
retry_delay_timerin thefcp_rsp. The bnx2fc is not handling the masking of the scope bits either so theretry_delay_timestampvalue lands up being a large value added to the timer timestamp delaying I/O for up to 27 Minutes. This patch adds similar code to handle this to the bnx2fc driver to avoid the huge delay.Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc_io.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0@@ -1928,6 +1928,7 @@ void bnx2fc_process_scsi_cmd_compl(structbnx2fc_cmd *io_req, struct bnx2fc_rport *tgt = io_req->tgt;struct scsi_cmnd *sc_cmd;struct Scsi_Host *host; +u16 scope, qualifier =0 ;drivers/scsi/bnx2fc/bnx2fc_io.c +0
-0/* scsi_cmd_cmpl is called with tgt lock held */ @@ -1997,12 +1998,28 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, if (io_req->cdb_status ==
SAM_STAT_TASK_SET_FULL||drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0io_req->cdb_status == SAM_STAT_BUSY) { +/* Newer array firmware with BUSY or +* TASK_SET_FULL may return a status that needs
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0+* the scope bits masked. +* Or a huge delay timestamp up to 27 minutes
drivers/scsi/bnx2fc/bnx2fc_io.c +5
-0+* can result. +*/ +if (fcp_rsp->retry_delay_timer) { +/* Upper 2 bits */ + scope = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +3
-0+ &0xC000 ; +/* Lower 14 bits */ + qualifier = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +4
-0+ &0x3FFF ; + } +if (scope >0 && qualifier >0 && + qualifier <=0x3FEF ) {/* Set the jiffies + retry_delay_timer * 100ms
drivers/scsi/bnx2fc/bnx2fc_io.c +0
-2for the rport/tgt */ - tgt->retry_delay_timestamp = jiffies + - fcp_rsp->retry_delay_timer *HZ / 10;
drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0+ tgt->retry_delay_timestamp =jiffies +
drivers/scsi/bnx2fc/bnx2fc_io.c void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, · line 2025
Quoted 7 lines
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-1+ (qualifier *HZ /10 ); + } } - }if (io_req->fcp_resid)scsi_set_resid (sc_cmd, io_req->fcp_resid);
What better thing to be doing than reviewing patches on a Saturday evening. Looks good though I might suggest moving the indent of the comment in the new if statement.
Re: [PATCH] V2. bnx2fc: Handle scope bits when array returns BUSY or TASK_SET_FULL
Quoted 76 lines · On Sat, 2019-09-07 at 21:34 -0400, [email protected] wrote:
Quoted 63 lines · Laurence Oberman
The qla2xxx driver had this issue as well when the newer array firmware returned the
retry_delay_timerin thefcp_rsp. The bnx2fc is not handling the masking of the scope bits either so theretry_delay_timestampvalue lands up being a large value added to the timer timestamp delaying I/O for up to 27 Minutes. This patch adds similar code to handle this to the bnx2fc driver to avoid the huge delay.Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc_io.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0@@ -1928,6 +1928,7 @@ void bnx2fc_process_scsi_cmd_compl(structbnx2fc_cmd *io_req, struct bnx2fc_rport *tgt = io_req->tgt;struct scsi_cmnd *sc_cmd;struct Scsi_Host *host; +u16 scope, qualifier =0 ;drivers/scsi/bnx2fc/bnx2fc_io.c +0
-0/* scsi_cmd_cmpl is called with tgt lock held */ @@ -1997,12 +1998,28 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, if (io_req->cdb_status ==
SAM_STAT_TASK_SET_FULL||drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0io_req->cdb_status == SAM_STAT_BUSY) { +/* Newer array firmware with BUSY or +* TASK_SET_FULL may return a status that needs
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0+* the scope bits masked. +* Or a huge delay timestamp up to 27 minutes
drivers/scsi/bnx2fc/bnx2fc_io.c +5
-0+* can result. +*/ +if (fcp_rsp->retry_delay_timer) { +/* Upper 2 bits */ + scope = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +3
-0+ &0xC000 ; +/* Lower 14 bits */ + qualifier = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +4
-0+ &0x3FFF ; + } +if (scope >0 && qualifier >0 && + qualifier <=0x3FEF ) {/* Set the jiffies + retry_delay_timer * 100ms
drivers/scsi/bnx2fc/bnx2fc_io.c +0
-2for the rport/tgt */ - tgt->retry_delay_timestamp = jiffies + - fcp_rsp->retry_delay_timer *HZ / 10;
drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0+ tgt->retry_delay_timestamp =jiffies +
drivers/scsi/bnx2fc/bnx2fc_io.c
Quoted 7 lines
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-1+ (qualifier *HZ /10 ); + } } - }if (io_req->fcp_resid)scsi_set_resid (sc_cmd, io_req->fcp_resid);What better thing to be doing than reviewing patches on a Saturday evening. Looks good though I might suggest moving the indent of the comment in the new if statement.
Quoted 2 lines
Reviewed-by Chad Dupuis <[email protected]>
The qla2xxx driver had this issue as well when the newer array firmware returned the retry_delay_timer in the fcp_rsp. The bnx2fc is not handling the masking of the scope bits either so the retry_delay_timestamp value lands up being a large value added to the timer timestamp delaying I/O for up to 27 Minutes. This patch adds similar code to handle this to the bnx2fc driver to avoid the huge delay.
V2. Indent comments as suggested
--- drivers/scsi/bnx2fc/bnx2fc_io.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
(quoted diff) +0 -0
b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 9e50e5b..39f4aeb 100644
drivers/scsi/bnx2fc/bnx2fc_io.c +0 -0
@@ -1928,6 +1928,7 @@ void bnx2fc_process_scsi_cmd_compl(struct
bnx2fc_cmd *io_req,
struct bnx2fc_rport *tgt = io_req->tgt;
struct scsi_cmnd *sc_cmd;
struct Scsi_Host *host;
+ u16 scope, qualifier = 0;
/* scsi_cmd_cmpl is called with tgt lock held */
@@ -1997,12 +1998,28 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
if (io_req->cdb_status ==SAM_STAT_TASK_SET_FULL ||
io_req->cdb_status == SAM_STAT_BUSY) {
+ /* Newer array firmware with BUSY or
+ * TASK_SET_FULL may return a status
that needs
+ * the scope bits masked.
+ * Or a huge delay timestamp up to 27
minutes
+ * can result.
+ */
+ if (fcp_rsp->retry_delay_timer) {
+ /* Upper 2 bits */
+ scope = fcp_rsp-
Quoted 1 line
retry_delay_timer
+ & 0xC000;
+ /* Lower 14 bits */
+ qualifier = fcp_rsp-
Quoted 1 line
retry_delay_timer
+ & 0x3FFF;
+ }
+ if (scope > 0 && qualifier > 0 &&
+ qualifier <= 0x3FEF) {
/* Set the jiffies +retry_delay_timer * 100ms
for the rport/tgt */
- tgt->retry_delay_timestamp = jiffies +
- fcp_rsp->retry_delay_timer * HZ
/ 10;
+ tgt->retry_delay_timestamp =
jiffies +
+ (qualifier * HZ / 10);
+ }
}
-
}
if (io_req->fcp_resid)
scsi_set_resid(sc_cmd, io_req->fcp_resid);
Signature · 1 line
1.8.3.1
Re: [PATCH] V2. bnx2fc: Handle scope bits when array returns BUSY or TASK_SET_FULL
Quoted 148 lines · Laurence Oberman
Quoted 77 lines · On Sat, 2019-09-07 at 21:34 -0400, [email protected] wrote:
Quoted 63 lines · Laurence Oberman
The qla2xxx driver had this issue as well when the newer array firmware returned the
retry_delay_timerin thefcp_rsp. The bnx2fc is not handling the masking of the scope bits either so theretry_delay_timestampvalue lands up being a large value added to the timer timestamp delaying I/O for up to 27 Minutes. This patch adds similar code to handle this to the bnx2fc driver to avoid the huge delay.Signed-off-by Laurence Oberman <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc_io.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0@@ -1928,6 +1928,7 @@ void bnx2fc_process_scsi_cmd_compl(structbnx2fc_cmd *io_req, struct bnx2fc_rport *tgt = io_req->tgt;struct scsi_cmnd *sc_cmd;struct Scsi_Host *host; +u16 scope, qualifier =0 ;drivers/scsi/bnx2fc/bnx2fc_io.c +0
-0/* scsi_cmd_cmpl is called with tgt lock held */ @@ -1997,12 +1998,28 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, if (io_req->cdb_status ==
SAM_STAT_TASK_SET_FULL||drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0io_req->cdb_status == SAM_STAT_BUSY) { +/* Newer array firmware with BUSY or +* TASK_SET_FULL may return a status that needs
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0+* the scope bits masked. +* Or a huge delay timestamp up to 27 minutes
drivers/scsi/bnx2fc/bnx2fc_io.c +5
-0+* can result. +*/ +if (fcp_rsp->retry_delay_timer) { +/* Upper 2 bits */ + scope = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +3
-0+ &0xC000 ; +/* Lower 14 bits */ + qualifier = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +4
-0+ &0x3FFF ; + } +if (scope >0 && qualifier >0 && + qualifier <=0x3FEF ) {/* Set the jiffies + retry_delay_timer * 100ms
drivers/scsi/bnx2fc/bnx2fc_io.c +0
-2for the rport/tgt */ - tgt->retry_delay_timestamp = jiffies + - fcp_rsp->retry_delay_timer *HZ / 10;
drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0+ tgt->retry_delay_timestamp =jiffies +
drivers/scsi/bnx2fc/bnx2fc_io.c
Quoted 7 lines
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-1+ (qualifier *HZ /10 ); + } } - }if (io_req->fcp_resid)scsi_set_resid (sc_cmd, io_req->fcp_resid);What better thing to be doing than reviewing patches on a Saturday evening. Looks good though I might suggest moving the indent of the
comment in the new if statement.Quoted 2 lines
Reviewed-by Chad Dupuis <[email protected]>The qla2xxx driver had this issue as well when the newer array firmware returned the
retry_delay_timerin thefcp_rsp. The bnx2fc is not handling the masking of the scope bits either so theretry_delay_timestampvalue lands up being a large value added to the timer timestamp delaying I/O for up to 27 Minutes. This patch adds similar code to handle this to the bnx2fc driver to avoid the huge delay.V2. Indent comments as suggested
Signed-off-by Laurence Oberman <[email protected]>Reported-by David Jeffery <[email protected]>--- drivers/scsi/bnx2fc/bnx2fc_io.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0@@ -1928,6 +1928,7 @@ void bnx2fc_process_scsi_cmd_compl(structbnx2fc_cmd *io_req, struct bnx2fc_rport *tgt = io_req->tgt;struct scsi_cmnd *sc_cmd;struct Scsi_Host *host; +u16 scope, qualifier =0 ;drivers/scsi/bnx2fc/bnx2fc_io.c +0
-0/* scsi_cmd_cmpl is called with tgt lock held */ @@ -1997,12 +1998,28 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req, if (io_req->cdb_status ==
SAM_STAT_TASK_SET_FULL||drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0io_req->cdb_status == SAM_STAT_BUSY) { +/* Newer array firmware with BUSY or +* TASK_SET_FULL may return a status that needs
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-0+* the scope bits masked. +* Or a huge delay timestamp up to 27 minutes
drivers/scsi/bnx2fc/bnx2fc_io.c +5
-0+* can result. +*/ +if (fcp_rsp->retry_delay_timer) { +/* Upper 2 bits */ + scope = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +3
-0+ &0xC000 ; +/* Lower 14 bits */ + qualifier = fcp_rsp-Quoted 1 line
retry_delay_timerdrivers/scsi/bnx2fc/bnx2fc_io.c +4
-0+ &0x3FFF ; + } +if (scope >0 && qualifier >0 && + qualifier <=0x3FEF ) {/* Set the jiffies +
retry_delay_timer* 100msdrivers/scsi/bnx2fc/bnx2fc_io.c +0
-2for the rport/tgt */ - tgt->retry_delay_timestamp = jiffies + - fcp_rsp->retry_delay_timer *HZ / 10;
drivers/scsi/bnx2fc/bnx2fc_io.c +1
-0+ tgt->retry_delay_timestamp =jiffies +
drivers/scsi/bnx2fc/bnx2fc_io.c
Quoted 7 lines
drivers/scsi/bnx2fc/bnx2fc_io.c +2
-1+ (qualifier *HZ /10 ); + } } - }if (io_req->fcp_resid)scsi_set_resid (sc_cmd, io_req->fcp_resid);
I will send a V2 from git this got munged by the mailer on the reply. Also comments line landed up exceeding 79 column width