Skip to contentSkip to conversation

BNX2FC: Fixed the handling for the SCSI retry delay

PATCH New Eddie Wai 1 participant 2 messages Dec 11, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Eddie Wai

author
#1 lore raw

PATCH 2/3 BNX2FC: Fixed the handling for the SCSI retry delay

SCSI retry delay upon SAM_STAT_BUSY/_SET_FULL was not being handled in bnx2fc. This patch adds such handling by returning TARGET_BUSY to the SCSI ML for the corresponding LUN until the retry timer expires.

---
 drivers/scsi/bnx2fc/bnx2fc.h     |    1 +
 drivers/scsi/bnx2fc/bnx2fc_io.c  |   19 ++++++++++++++++++-
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |    1 +
 3 files changed, 20 insertions(+), 1 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +1 -0
index 1ebf3fb..2e984e3 100644
@@ -367,6 +367,7 @@ struct bnx2fc_rport {
 	atomic_t num_active_ios;
 	u32 flush_in_prog;
 	unsigned long timestamp;
+	unsigned long retry_delay_timestamp;
 	struct list_head free_task_list;
 	struct bnx2fc_cmd *pending_queue[BNX2FC_SQ_WQES_MAX+1];
 	struct list_head active_cmd_queue;
drivers/scsi/bnx2fc/bnx2fc_io.c +18 -1
index ed88089..d2cabc9 100644
@@ -1871,7 +1871,15 @@ int bnx2fc_queuecommand(struct Scsi_Host *host,
 		rc = SCSI_MLQUEUE_TARGET_BUSY;
 		goto exit_qcmd;
 	}
-
+	if (tgt->retry_delay_timestamp) {
+		if (time_after(jiffies, tgt->retry_delay_timestamp)) {
+			tgt->retry_delay_timestamp = 0;
+		} else {
+			/* If retry_delay timer is active, flow off the ML */
+			rc = SCSI_MLQUEUE_TARGET_BUSY;
+			goto exit_qcmd;
+		}
+	}
 	io_req = bnx2fc_cmd_alloc(tgt);
 	if (!io_req) {
 		rc = SCSI_MLQUEUE_HOST_BUSY;
@@ -1961,6 +1969,15 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
 				 " fcp_resid = 0x%x\n",
 				io_req->cdb_status, io_req->fcp_resid);
 			sc_cmd->result = (DID_OK << 16) | io_req->cdb_status;
+
+			if (io_req->cdb_status == SAM_STAT_TASK_SET_FULL ||
+			    io_req->cdb_status == SAM_STAT_BUSY) {
+				/* Set the jiffies + retry_delay_timer * 100ms
+				   for the rport/tgt */
+				tgt->retry_delay_timestamp = jiffies +
+					fcp_rsp->retry_delay_timer * HZ / 10;
+			}
+
 		}
 		if (io_req->fcp_resid)
 			scsi_set_resid(sc_cmd, io_req->fcp_resid);
drivers/scsi/bnx2fc/bnx2fc_tgt.c +1 -0
index 4d93177..68948b7 100644
@@ -386,6 +386,7 @@ static int bnx2fc_init_tgt(struct bnx2fc_rport *tgt,
 	tgt->rq_prod_idx = 0x8000;
 	tgt->rq_cons_idx = 0;
 	atomic_set(&tgt->num_active_ios, 0);
+	tgt->retry_delay_timestamp = 0;
 
 	if (rdata->flags & FC_RP_FLAGS_RETRY &&
 	    rdata->ids.roles & FC_RPORT_ROLE_FCP_TARGET &&
Signature · 1 line
1.7.1
author
#2 lore raw

PATCH 3/3 BNX2FC: Updated version to 2.4.2

In reply to a message not in the archive

Old version: 2.4.1
New version: 2.4.2

---
 drivers/scsi/bnx2fc/bnx2fc.h      |    2 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
index 2e984e3..6a97665 100644
@@ -64,7 +64,7 @@
 #include "bnx2fc_constants.h"
 
 #define BNX2FC_NAME		"bnx2fc"
-#define BNX2FC_VERSION		"2.4.1"
+#define BNX2FC_VERSION		"2.4.2"
 
 #define PFX			"bnx2fc: "
 
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -1
index 4cabd3e..6287f6a 100644
@@ -22,7 +22,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);
 
 #define DRV_MODULE_NAME		"bnx2fc"
 #define DRV_MODULE_VERSION	BNX2FC_VERSION
-#define DRV_MODULE_RELDATE	"Sep 17, 2013"
+#define DRV_MODULE_RELDATE	"Dec 11, 2013"
 
 
 static char version[] =
Signature · 1 line
1.7.1