linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurence Oberman <loberman@redhat.com>
To: loberman@redhat.com, QLogic-Storage-Upstream@qlogic.com,
	linux-scsi@vger.kernel.org
Subject: [PATCH] bnx2fc: Handle scope bits when array returns BUSY or TASK_SET_FULL
Date: Fri,  6 Sep 2019 16:26:19 -0400	[thread overview]
Message-ID: <1567801579-18674-1-git-send-email-loberman@redhat.com> (raw)

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.

Signed-off-by: Laurence Oberman <loberman@redhat.com>
---
 drivers/scsi/bnx2fc/bnx2fc_io.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 9e50e5b..39f4aeb 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -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);
-- 
1.8.3.1


             reply	other threads:[~2019-09-06 20:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 20:26 Laurence Oberman [this message]
2019-09-06 20:31 ` [PATCH] bnx2fc: Handle scope bits when array returns BUSY or TASK_SET_FULL Laurence Oberman
2019-09-08  1:34 ` cdupuis1
2019-09-09 11:52   ` [PATCH] V2. " Laurence Oberman
2019-09-09 12:04     ` Laurence Oberman
2019-09-09 12:05 [PATCH] " Laurence Oberman
2019-09-09 17:40 ` Lee Duncan
2019-09-11  0:19 ` cdupuis1
2019-09-11  2:21 ` Martin K. Petersen
2019-09-11 13:56 Laurence Oberman
2019-09-24  2:19 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1567801579-18674-1-git-send-email-loberman@redhat.com \
    --to=loberman@redhat.com \
    --cc=QLogic-Storage-Upstream@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).