Skip to contentSkip to conversation

bnx2fc version 1.0.11

PATCH In review Bhanu Prakash Gollapudi 3 participants 11 messages Apr 24, 2012 – May 22, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover bnx2fc version 1.0.11

v2 submittal:
Updated "0002-bnx2fc-Decrememnt-io-ref-count-when-abort-times-out" patch to release the command reference before waiting for the target to relogin. Without this, the logout process will not complete and recovery fails.
---------------

James, please consider merging the following bug fixes for 3.5.

Thanks,
Bhanu

Bhanu Prakash Gollapudi (4):
bnx2fc: Allow FLOGI to be retried when receiving bad responses.
bnx2fc: Decrememnt io ref count when abort times out
bnx2fc: cleanup task management IO when it times out. Bumped version to 1.0.11

 drivers/scsi/bnx2fc/bnx2fc.h      |    2 +-
 drivers/scsi/bnx2fc/bnx2fc_els.c  |   16 +----
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    2 +-
 drivers/scsi/bnx2fc/bnx2fc_io.c   |  122 +++++++++++++++++++++++--------------
 drivers/scsi/bnx2fc/bnx2fc_tgt.c  |   21 ++++++-
 5 files changed, 100 insertions(+), 63 deletions(-)
#1 lore raw

PATCH v2 1/4 bnx2fc: Allow FLOGI to be retried when receiving bad responses.

Commit 907c07d45199f954ddcf66c2c9763c87d012cb15 added more cases to do FLOGI retry on receiving bad response. Remove the code that drops the packet and allow the stack to handle bad FLOGI response.

---
 drivers/scsi/bnx2fc/bnx2fc_els.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_els.c +3 -13
index ce0ce3e..cf3bdcd 100644
@@ -854,7 +854,6 @@ static void bnx2fc_flogi_resp(struct fc_seq *seq, struct fc_frame *fp,
 	struct fc_exch *exch = fc_seq_exch(seq);
 	struct fc_lport *lport = exch->lp;
 	u8 *mac;
-	struct fc_frame_header *fh;
 	u8 op;
 
 	if (IS_ERR(fp))
@@ -862,13 +861,6 @@ static void bnx2fc_flogi_resp(struct fc_seq *seq, struct fc_frame *fp,
 
 	mac = fr_cb(fp)->granted_mac;
 	if (is_zero_ether_addr(mac)) {
-		fh = fc_frame_header_get(fp);
-		if (fh->fh_type != FC_TYPE_ELS) {
-			printk(KERN_ERR PFX "bnx2fc_flogi_resp:"
-				"fh_type != FC_TYPE_ELS\n");
-			fc_frame_free(fp);
-			return;
-		}
 		op = fc_frame_payload_op(fp);
 		if (lport->vport) {
 			if (op == ELS_LS_RJT) {
@@ -878,12 +870,10 @@ static void bnx2fc_flogi_resp(struct fc_seq *seq, struct fc_frame *fp,
 				return;
 			}
 		}
-		if (fcoe_ctlr_recv_flogi(fip, lport, fp)) {
-			fc_frame_free(fp);
-			return;
-		}
+		fcoe_ctlr_recv_flogi(fip, lport, fp);
 	}
-	fip->update_mac(lport, mac);
+	if (!is_zero_ether_addr(mac))
+		fip->update_mac(lport, mac);
 done:
 	fc_lport_flogi_resp(seq, fp, lport);
 }
Signature · 1 line
1.7.0.6
#2 lore raw

PATCH v2 2/4 bnx2fc: Decrememnt io ref count when abort times out

In reply to Bhanu Prakash Gollapudi

When IO abort times out during eh_abort or a flush operation is performed while abort is pending, the driver is not cleaning up the IO and thus not reducing the IO reference count. With this change, as part of explicit logout, the IO is cleaned up.

---
 drivers/scsi/bnx2fc/bnx2fc_io.c  |  106 +++++++++++++++++++++----------------
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |   11 ++++-
 2 files changed, 70 insertions(+), 47 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +60 -46
index 84a78af..4843b42 100644
@@ -1089,6 +1089,48 @@ int bnx2fc_eh_device_reset(struct scsi_cmnd *sc_cmd)
 	return bnx2fc_initiate_tmf(sc_cmd, FCP_TMF_LUN_RESET);
 }
 
+int bnx2fc_expl_logo(struct fc_lport *lport, struct bnx2fc_cmd *io_req)
+{
+	struct bnx2fc_rport *tgt = io_req->tgt;
+	struct fc_rport_priv *rdata = tgt->rdata;
+	int logo_issued;
+	int rc = SUCCESS;
+	int wait_cnt = 0;
+
+	BNX2FC_IO_DBG(io_req, "Expl logo - tgt flags = 0x%lx\n",
+		      tgt->flags);
+	logo_issued = test_and_set_bit(BNX2FC_FLAG_EXPL_LOGO,
+				       &tgt->flags);
+	io_req->wait_for_comp = 1;
+	bnx2fc_initiate_cleanup(io_req);
+
+	spin_unlock_bh(&tgt->tgt_lock);
+
+	wait_for_completion(&io_req->tm_done);
+
+	io_req->wait_for_comp = 0;
+	/*
+	 * release the reference taken in eh_abort to allow the
+	 * target to re-login after flushing IOs
+	 */
+	 kref_put(&io_req->refcount, bnx2fc_cmd_release);
+
+	if (!logo_issued) {
+		clear_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags);
+		mutex_lock(&lport->disc.disc_mutex);
+		lport->tt.rport_logoff(rdata);
+		mutex_unlock(&lport->disc.disc_mutex);
+		do {
+			msleep(BNX2FC_RELOGIN_WAIT_TIME);
+			if (wait_cnt++ > BNX2FC_RELOGIN_WAIT_CNT) {
+				rc = FAILED;
+				break;
+			}
+		} while (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags));
+	}
+	spin_lock_bh(&tgt->tgt_lock);
+	return rc;
+}
 /**
  * bnx2fc_eh_abort - eh_abort_handler api to abort an outstanding
  *			SCSI command
@@ -1103,10 +1145,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
 	struct fc_rport_libfc_priv *rp = rport->dd_data;
 	struct bnx2fc_cmd *io_req;
 	struct fc_lport *lport;
-	struct fc_rport_priv *rdata;
 	struct bnx2fc_rport *tgt;
-	int logo_issued;
-	int wait_cnt = 0;
 	int rc = FAILED;
 
 
@@ -1183,58 +1222,31 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
 	list_add_tail(&io_req->link, &tgt->io_retire_queue);
 
 	init_completion(&io_req->tm_done);
-	io_req->wait_for_comp = 1;
 
-	if (!test_and_set_bit(BNX2FC_FLAG_ISSUE_ABTS, &io_req->req_flags)) {
-		/* Cancel the current timer running on this io_req */
-		if (cancel_delayed_work(&io_req->timeout_work))
-			kref_put(&io_req->refcount,
-				 bnx2fc_cmd_release); /* drop timer hold */
-		set_bit(BNX2FC_FLAG_EH_ABORT, &io_req->req_flags);
-		rc = bnx2fc_initiate_abts(io_req);
-	} else {
+	if (test_and_set_bit(BNX2FC_FLAG_ISSUE_ABTS, &io_req->req_flags)) {
 		printk(KERN_ERR PFX "eh_abort: io_req (xid = 0x%x) "
 				"already in abts processing\n", io_req->xid);
 		if (cancel_delayed_work(&io_req->timeout_work))
 			kref_put(&io_req->refcount,
 				 bnx2fc_cmd_release); /* drop timer hold */
-		bnx2fc_initiate_cleanup(io_req);
+		rc = bnx2fc_expl_logo(lport, io_req);
+		goto out;
+	}
 
+	/* Cancel the current timer running on this io_req */
+	if (cancel_delayed_work(&io_req->timeout_work))
+		kref_put(&io_req->refcount,
+			 bnx2fc_cmd_release); /* drop timer hold */
+	set_bit(BNX2FC_FLAG_EH_ABORT, &io_req->req_flags);
+	io_req->wait_for_comp = 1;
+	rc = bnx2fc_initiate_abts(io_req);
+	if (rc == FAILED) {
+		bnx2fc_initiate_cleanup(io_req);
 		spin_unlock_bh(&tgt->tgt_lock);
-
 		wait_for_completion(&io_req->tm_done);
-
 		spin_lock_bh(&tgt->tgt_lock);
 		io_req->wait_for_comp = 0;
-		rdata = io_req->tgt->rdata;
-		logo_issued = test_and_set_bit(BNX2FC_FLAG_EXPL_LOGO,
-					       &tgt->flags);
-		kref_put(&io_req->refcount, bnx2fc_cmd_release);
-		spin_unlock_bh(&tgt->tgt_lock);
-
-		if (!logo_issued) {
-			BNX2FC_IO_DBG(io_req, "Expl logo - tgt flags = 0x%lx\n",
-				      tgt->flags);
-			mutex_lock(&lport->disc.disc_mutex);
-			lport->tt.rport_logoff(rdata);
-			mutex_unlock(&lport->disc.disc_mutex);
-			do {
-				msleep(BNX2FC_RELOGIN_WAIT_TIME);
-				/*
-				 * If session not recovered, let SCSI-ml
-				 * escalate error recovery.
-				 */
-				if (wait_cnt++ > BNX2FC_RELOGIN_WAIT_CNT)
-					return FAILED;
-			} while (!test_bit(BNX2FC_FLAG_SESSION_READY,
-					   &tgt->flags));
-		}
-		return SUCCESS;
-	}
-	if (rc == FAILED) {
-		kref_put(&io_req->refcount, bnx2fc_cmd_release);
-		spin_unlock_bh(&tgt->tgt_lock);
-		return rc;
+		goto done;
 	}
 	spin_unlock_bh(&tgt->tgt_lock);
 
@@ -1247,7 +1259,8 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
 		/* Let the scsi-ml try to recover this command */
 		printk(KERN_ERR PFX "abort failed, xid = 0x%x\n",
 		       io_req->xid);
-		rc = FAILED;
+		rc = bnx2fc_expl_logo(lport, io_req);
+		goto out;
 	} else {
 		/*
 		 * We come here even when there was a race condition
@@ -1259,9 +1272,10 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
 		bnx2fc_scsi_done(io_req, DID_ABORT);
 		kref_put(&io_req->refcount, bnx2fc_cmd_release);
 	}
-
+done:
 	/* release the reference taken in eh_abort */
 	kref_put(&io_req->refcount, bnx2fc_cmd_release);
+out:
 	spin_unlock_bh(&tgt->tgt_lock);
 	return rc;
 }
drivers/scsi/bnx2fc/bnx2fc_tgt.c +10 -1
index c1800b5..d3ee231 100644
@@ -213,8 +213,17 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)
 
 		BNX2FC_IO_DBG(io_req, "retire_queue flush\n");
 
-		if (cancel_delayed_work(&io_req->timeout_work))
+		if (cancel_delayed_work(&io_req->timeout_work)) {
+			if (test_and_clear_bit(BNX2FC_FLAG_EH_ABORT,
+						&io_req->req_flags)) {
+				/* Handle eh_abort timeout */
+				BNX2FC_IO_DBG(io_req, "eh_abort for IO "
+					      "in retire_q\n");
+				if (io_req->wait_for_comp)
+					complete(&io_req->tm_done);
+			}
 			kref_put(&io_req->refcount, bnx2fc_cmd_release);
+		}
 
 		clear_bit(BNX2FC_FLAG_ISSUE_RRQ, &io_req->req_flags);
 	}
Signature · 1 line
1.7.0.6
#3 lore raw

PATCH v2 3/4 bnx2fc: cleanup task management IO when it times out.

In reply to Bhanu Prakash Gollapudi

When the task management IO times out, or a flush operation is performed while task management IO is pending, driver is not cleaning up the IO. This patch cleans up the IO for the above cases.

---
 drivers/scsi/bnx2fc/bnx2fc_io.c  |   16 +++++++++++++++-
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |   10 ++++++++++
 2 files changed, 25 insertions(+), 1 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +15 -1
index 4843b42..27074ee 100644
@@ -810,8 +810,22 @@ retry_tmf:
 	spin_lock_bh(&tgt->tgt_lock);
 
 	io_req->wait_for_comp = 0;
-	if (!(test_bit(BNX2FC_FLAG_TM_COMPL, &io_req->req_flags)))
+	if (!(test_bit(BNX2FC_FLAG_TM_COMPL, &io_req->req_flags))) {
 		set_bit(BNX2FC_FLAG_TM_TIMEOUT, &io_req->req_flags);
+		if (io_req->on_tmf_queue) {
+			list_del_init(&io_req->link);
+			io_req->on_tmf_queue = 0;
+		}
+		io_req->wait_for_comp = 1;
+		bnx2fc_initiate_cleanup(io_req);
+		spin_unlock_bh(&tgt->tgt_lock);
+		rc = wait_for_completion_timeout(&io_req->tm_done,
+						 BNX2FC_FW_TIMEOUT);
+		spin_lock_bh(&tgt->tgt_lock);
+		io_req->wait_for_comp = 0;
+		if (!rc)
+			kref_put(&io_req->refcount, bnx2fc_cmd_release);
+	}
 
 	spin_unlock_bh(&tgt->tgt_lock);
 
drivers/scsi/bnx2fc/bnx2fc_tgt.c +10 -0
index d3ee231..082a25c 100644
@@ -185,6 +185,16 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)
 		BUG_ON(rc);
 	}
 
+	list_for_each_safe(list, tmp, &tgt->active_tm_queue) {
+		i++;
+		io_req = (struct bnx2fc_cmd *)list;
+		list_del_init(&io_req->link);
+		io_req->on_tmf_queue = 0;
+		BNX2FC_IO_DBG(io_req, "tm_queue cleanup\n");
+		if (io_req->wait_for_comp)
+			complete(&io_req->tm_done);
+	}
+
 	list_for_each_safe(list, tmp, &tgt->els_queue) {
 		i++;
 		io_req = (struct bnx2fc_cmd *)list;
Signature · 1 line
1.7.0.6
#5 lore raw

PATCH v2 4/4 Bumped version to 1.0.11

In reply to Bhanu Prakash Gollapudi
---
 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 a4953ef..f2b8875 100644
@@ -62,7 +62,7 @@
 #include "bnx2fc_constants.h"
 
 #define BNX2FC_NAME		"bnx2fc"
-#define BNX2FC_VERSION		"1.0.10"
+#define BNX2FC_VERSION		"1.0.11"
 
 #define PFX			"bnx2fc: "
 
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -1
index 1c34a44..9783b0a 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	"Jan 22, 2011"
+#define DRV_MODULE_RELDATE	"Apr 24, 2012"
 
 
 static char version[] __devinitdata =
Signature · 1 line
1.7.0.6
#4 lore raw

Re: [v2 PATCH 3/4] bnx2fc: cleanup task management IO when it times out.

In reply to Bhanu Prakash Gollapudi

drivers/scsi/bnx2fc/bnx2fc_tgt.c void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt) · line 190

Quoted 11 lines · Bhanu Prakash Gollapudi
drivers/scsi/bnx2fc/bnx2fc_tgt.c +3 -0
index d3ee231..082a25c 100644
@@ -185,6 +185,16 @@ void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)
 		BUG_ON(rc);
 	}
 
+	list_for_each_safe(list, tmp, &tgt->active_tm_queue) {
+		i++;
+		io_req = (struct bnx2fc_cmd *)list;

Why didn't you use list_for_each_entry_safe()? Or, when using list_for_each_safe, instead of the cast are we supposed to be using list_entry()?

Quoted 10 lines
drivers/scsi/bnx2fc/bnx2fc_tgt.c +7 -0
+		list_del_init(&io_req->link);
+		io_req->on_tmf_queue = 0;
+		BNX2FC_IO_DBG(io_req, "tm_queue cleanup\n");
+		if (io_req->wait_for_comp)
+			complete(&io_req->tm_done);
+	}
+
 	list_for_each_safe(list, tmp, &tgt->els_queue) {
 		i++;
 		io_req = (struct bnx2fc_cmd *)list;
#6 lore raw
In reply to Bhanu Prakash Gollapudi

On 4/24/2012 3:26 PM, Bhanu Prakash Gollapudi wrote:

James, can you please include this patch set in the next round of 3.4+ merge window?

thanks,
Bhanu

Quoted 25 lines

v2 submittal:
Updated "0002-bnx2fc-Decrememnt-io-ref-count-when-abort-times-out" patch to release the command reference before waiting for the target to relogin. Without this, the logout process will not complete and recovery fails.
---------------

James, please consider merging the following bug fixes for 3.5.

Thanks,
Bhanu

Bhanu Prakash Gollapudi (4):
bnx2fc: Allow FLOGI to be retried when receiving bad responses.
bnx2fc: Decrememnt io ref count when abort times out
bnx2fc: cleanup task management IO when it times out. Bumped version to 1.0.11

  drivers/scsi/bnx2fc/bnx2fc.h      |    2 +-
  drivers/scsi/bnx2fc/bnx2fc_els.c  |   16 +----
  drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    2 +-
  drivers/scsi/bnx2fc/bnx2fc_io.c   |  122 +++++++++++++++++++++++--------------
  drivers/scsi/bnx2fc/bnx2fc_tgt.c  |   21 ++++++-
  5 files changed, 100 insertions(+), 63 deletions(-)
maintainer
#7 lore raw
Quoted 4 lines · Bhanu Prakash Gollapudi

On 4/24/2012 3:26 PM, Bhanu Prakash Gollapudi wrote:

James, can you please include this patch set in the next round of 3.4+ merge window?

I was waiting for you to respond to Mike Christie's comment about using list_for_each_entry_safe() or list_entry().

James

#8 lore raw
Quoted 8 lines · James Bottomley
Quoted 4 lines · Bhanu Prakash Gollapudi

On 4/24/2012 3:26 PM, Bhanu Prakash Gollapudi wrote:

James, can you please include this patch set in the next round of 3.4+ merge window?

I was waiting for you to respond to Mike Christie's comment about using list_for_each_entry_safe() or list_entry().

James, I responded to Mike Christie's comment. Here is the link for the thread - http://marc.info/?l=linux-scsi&m=133643754200805&w=2.

thanks,
Bhanu

Quoted 5 lines

James

maintainer
#9 lore raw
Quoted 4 lines · Bhanu Prakash Gollapudi
Quoted 3 lines · James Bottomley
Quoted 2 lines · Bhanu Prakash Gollapudi

On 4/24/2012 3:26 PM, Bhanu Prakash Gollapudi wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

James, can you please include this patch set in the next round of 3.4+ merge window?

I was waiting for you to respond to Mike Christie's comment about using list_for_each_entry_safe() or list_entry().

James, I responded to Mike Christie's comment. Here is the link for the thread - http://marc.info/?l=linux-scsi&m=133643754200805&w=2.

Ah, OK, you broke threading, which is why I didn't get this. You need to reply to the message on the list. Your reply has:

References: <[email protected]>
In-reply-to: <[email protected]>

But the actual message is:

Message-id: <[email protected]>

Evolution matches threads by the in-reply-to fields.

James

#10 lore raw
Quoted 17 lines · James Bottomley
Quoted 4 lines · Bhanu Prakash Gollapudi
Quoted 3 lines · James Bottomley
Quoted 2 lines · Bhanu Prakash Gollapudi

On 4/24/2012 3:26 PM, Bhanu Prakash Gollapudi wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

James, can you please include this patch set in the next round of 3.4+ merge window?

I was waiting for you to respond to Mike Christie's comment about using list_for_each_entry_safe() or list_entry().

James, I responded to Mike Christie's comment. Here is the link for the thread - http://marc.info/?l=linux-scsi&m=133643754200805&w=2.

Ah, OK, you broke threading, which is why I didn't get this. You need to reply to the message on the list. Your reply has:

Quoted 8 lines

References:<[email protected]>
In-reply-to:<[email protected]>

But the actual message is:

Message-id:<[email protected]>

Evolution matches threads by the in-reply-to fields.

Thanks for the information, James. I'll take care of it from next time.

Quoted 5 lines

James