Skip to contentSkip to conversation

bnx2fc version 1.0.6

PATCH New Bhanu Prakash Gollapudi 1 participant 9 messages Aug 30, 2011

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

cover bnx2fc version 1.0.6

James,

Although all the below patches are bug fixes, I request you to apply them to scsi-misc tree (targetting 3.2) as the previous patchset (1.0.5) was submitted to that tree.

Thanks,
Bhanu

Bhanu Prakash Gollapudi (7):
bnx2fc: Reset max receive frame size during link up
bnx2fc: Send solicitation only after vlan discovery is complete
bnx2fc: No abort issued for REC when it times out
bnx2fc: Avoid calling bnx2fc_if_destroy with unnecessary locks
bnx2fc: Fix panic caused because of incorrect errror handling in

    create().

bnx2fc: Fix FW assert during RSCN stress tests
bnx2fc: Bumped version to 1.0.6

Nithin Nayak Sujir (1):
bnx2fc: Validate vlan id in NETDEV_UNREGISTER handler

 drivers/scsi/bnx2fc/bnx2fc.h      |    3 +-
 drivers/scsi/bnx2fc/bnx2fc_els.c  |   26 +++++++++--------
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   54 ++++++++++++++++++++++++-------------
 drivers/scsi/bnx2fc/bnx2fc_hwi.c  |    6 +++-
 drivers/scsi/bnx2fc/bnx2fc_tgt.c  |    4 +--
 5 files changed, 56 insertions(+), 37 deletions(-)
#4 lore raw

PATCH 4/8 bnx2fc: Validate vlan id in NETDEV_UNREGISTER handler

From: Nithin Nayak Sujir <[email protected]>

When bnx2fc receives an UNREGISTER event on a vlan interface it calls destroy on all interfaces that matches the physical interface. Add vlan_id check to destroy only the vlan interface that generated the event.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +3 -3
index ba88ddb..886938d 100644
@@ -838,9 +838,9 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
 			return;
 		mutex_lock(&bnx2fc_dev_lock);
 		list_for_each_entry_safe(interface, tmp, &if_list, list) {
-			if (interface->hba != hba)
-				continue;
-			__bnx2fc_destroy(interface);
+			if (interface->hba == hba &&
+			    interface->vlan_id == (vlan_id & VLAN_VID_MASK))
+				__bnx2fc_destroy(interface);
 		}
 		mutex_unlock(&bnx2fc_dev_lock);
 		return;
Signature · 1 line
1.7.0.6
#5 lore raw

PATCH 5/8 bnx2fc: Avoid calling bnx2fc_if_destroy with unnecessary locks

In reply to Bhanu Prakash Gollapudi

It is not required to hold rtnl_lock and bnx2fc_dev_lock when calling bnx2fc_if_destroy, as the locking is only required to serialize creation and deletion of fcoe instances. More importantly, this unnecessary locking causes deadlock as bnx2fc_if_destroy calls fc_remove_host holding rtnl_lock.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +2 -6
index 886938d..a5111f3 100644
@@ -1487,13 +1487,13 @@ static void bnx2fc_if_destroy(struct fc_lport *lport)
 static void __bnx2fc_destroy(struct bnx2fc_interface *interface)
 {
 	struct fc_lport *lport = interface->ctlr.lp;
+	struct fcoe_port *port = lport_priv(lport);
 
 	bnx2fc_interface_cleanup(interface);
 	bnx2fc_stop(interface);
 	list_del(&interface->list);
-	lport = interface->ctlr.lp;
 	bnx2fc_interface_put(interface);
-	bnx2fc_if_destroy(lport);
+	queue_work(bnx2fc_wq, &port->destroy_work);
 }
 
 /**
@@ -1541,11 +1541,7 @@ static void bnx2fc_destroy_work(struct work_struct *work)
 
 	BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n");
 
-	rtnl_lock();
-	mutex_lock(&bnx2fc_dev_lock);
 	bnx2fc_if_destroy(lport);
-	mutex_unlock(&bnx2fc_dev_lock);
-	rtnl_unlock();
 }
 
 static void bnx2fc_unbind_adapter_devices(struct bnx2fc_hba *hba)
Signature · 1 line
1.7.0.6
#6 lore raw

PATCH 6/8 bnx2fc: Fix panic caused because of incorrect errror handling in create().

In reply to Bhanu Prakash Gollapudi

Driver incorrectly calls bnx2fc_interface_cleanup() when bnx2fc_if_create fails which accesses bad pointer. Handle bnx2fc_if_create failure by directly calling bnx2fc_net_cleanup.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +10 -5
index a5111f3..330f9f0 100644
@@ -1441,6 +1441,14 @@ free_blport:
 	return NULL;
 }
 
+static void bnx2fc_net_cleanup(struct bnx2fc_interface *interface)
+{
+	/* Dont listen for Ethernet packets anymore */
+	__dev_remove_pack(&interface->fcoe_packet_type);
+	__dev_remove_pack(&interface->fip_packet_type);
+	synchronize_net();
+}
+
 static void bnx2fc_interface_cleanup(struct bnx2fc_interface *interface)
 {
 	struct fc_lport *lport = interface->ctlr.lp;
@@ -1453,10 +1461,7 @@ static void bnx2fc_interface_cleanup(struct bnx2fc_interface *interface)
 	/* Free existing transmit skbs */
 	fcoe_clean_pending_queue(lport);
 
-	/* Dont listen for Ethernet packets anymore */
-	__dev_remove_pack(&interface->fcoe_packet_type);
-	__dev_remove_pack(&interface->fip_packet_type);
-	synchronize_net();
+	bnx2fc_net_cleanup(interface);
 
 	bnx2fc_free_vport(hba, lport);
 }
@@ -1991,7 +1996,6 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
 	if (!lport) {
 		printk(KERN_ERR PFX "Failed to create interface (%s)\n",
 			netdev->name);
-		bnx2fc_interface_cleanup(interface);
 		rc = -EINVAL;
 		goto if_create_err;
 	}
@@ -2026,6 +2030,7 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
 if_create_err:
 	destroy_workqueue(interface->timer_work_queue);
 ifput_err:
+	bnx2fc_net_cleanup(interface);
 	bnx2fc_interface_put(interface);
 netdev_err:
 	module_put(THIS_MODULE);
Signature · 1 line
1.7.0.6
#3 lore raw

PATCH 3/8 bnx2fc: No abort issued for REC when it times out

In reply to Bhanu Prakash Gollapudi

ABTS was not issued for timed out REC, as REC completion handler exits out if the IO completed. Check for timed out REC and issue ABTS before proceeding with further processing in REC completion handler. Also, initialize rec_retry and srr_retry before starting the IO.

---
 drivers/scsi/bnx2fc/bnx2fc_els.c |   26 ++++++++++++++------------
 drivers/scsi/bnx2fc/bnx2fc_hwi.c |    6 ++++--
 2 files changed, 18 insertions(+), 14 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_els.c +14 -12
index d66dcbd..fd382fe 100644
@@ -391,18 +391,6 @@ void bnx2fc_rec_compl(struct bnx2fc_els_cb_arg *cb_arg)
 	BNX2FC_IO_DBG(rec_req, "rec_compl: orig xid = 0x%x", orig_io_req->xid);
 	tgt = orig_io_req->tgt;
 
-	if (test_bit(BNX2FC_FLAG_IO_COMPL, &orig_io_req->req_flags)) {
-		BNX2FC_IO_DBG(rec_req, "completed"
-		       "orig_io - 0x%x\n",
-			orig_io_req->xid);
-		goto rec_compl_done;
-	}
-	if (test_bit(BNX2FC_FLAG_ISSUE_ABTS, &orig_io_req->req_flags)) {
-		BNX2FC_IO_DBG(rec_req, "abts in prog "
-		       "orig_io - 0x%x\n",
-			orig_io_req->xid);
-		goto rec_compl_done;
-	}
 	/* Handle REC timeout case */
 	if (test_and_clear_bit(BNX2FC_FLAG_ELS_TIMEOUT, &rec_req->req_flags)) {
 		BNX2FC_IO_DBG(rec_req, "timed out, abort "
@@ -433,6 +421,20 @@ void bnx2fc_rec_compl(struct bnx2fc_els_cb_arg *cb_arg)
 		}
 		goto rec_compl_done;
 	}
+
+	if (test_bit(BNX2FC_FLAG_IO_COMPL, &orig_io_req->req_flags)) {
+		BNX2FC_IO_DBG(rec_req, "completed"
+		       "orig_io - 0x%x\n",
+			orig_io_req->xid);
+		goto rec_compl_done;
+	}
+	if (test_bit(BNX2FC_FLAG_ISSUE_ABTS, &orig_io_req->req_flags)) {
+		BNX2FC_IO_DBG(rec_req, "abts in prog "
+		       "orig_io - 0x%x\n",
+			orig_io_req->xid);
+		goto rec_compl_done;
+	}
+
 	mp_req = &(rec_req->mp_req);
 	fc_hdr = &(mp_req->resp_fc_hdr);
 	resp_len = mp_req->resp_len;
drivers/scsi/bnx2fc/bnx2fc_hwi.c +4 -2
index b241f3d..1923a25 100644
@@ -1743,11 +1743,13 @@ void bnx2fc_init_task(struct bnx2fc_cmd *io_req,
 	/* Init state to NORMAL */
 	task->txwr_rxrd.const_ctx.init_flags |= task_type <<
 				FCOE_TCE_TX_WR_RX_RD_CONST_TASK_TYPE_SHIFT;
-	if (dev_type == TYPE_TAPE)
+	if (dev_type == TYPE_TAPE) {
 		task->txwr_rxrd.const_ctx.init_flags |=
 				FCOE_TASK_DEV_TYPE_TAPE <<
 				FCOE_TCE_TX_WR_RX_RD_CONST_DEV_TYPE_SHIFT;
-	else
+		io_req->rec_retry = 0;
+		io_req->rec_retry = 0;
+	} else
 		task->txwr_rxrd.const_ctx.init_flags |=
 				FCOE_TASK_DEV_TYPE_DISK <<
 				FCOE_TCE_TX_WR_RX_RD_CONST_DEV_TYPE_SHIFT;
Signature · 1 line
1.7.0.6
#8 lore raw

PATCH 8/8 bnx2fc: Bumped version to 1.0.6

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 02535e8..8dd5d4a 100644
@@ -62,7 +62,7 @@
 #include "bnx2fc_constants.h"
 
 #define BNX2FC_NAME		"bnx2fc"
-#define BNX2FC_VERSION		"1.0.5"
+#define BNX2FC_VERSION		"1.0.6"
 
 #define PFX			"bnx2fc: "
 
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -1
index 330f9f0..eb28446 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	"Aug 03, 2011"
+#define DRV_MODULE_RELDATE	"Aug 30, 2011"
 
 
 static char version[] __devinitdata =
Signature · 1 line
1.7.0.6
#1 lore raw

PATCH 1/8 bnx2fc: Reset max receive frame size during link up

In reply to Bhanu Prakash Gollapudi

If the max receive frame size is changed during link down, the driver uses the same value after linkup unless it is reset to default.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +2 -0
index 24e7071..6387067 100644
@@ -863,6 +863,8 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
 		bnx2fc_link_speed_update(lport);
 
 		if (link_possible && !bnx2fc_link_ok(lport)) {
+			/* Reset max recv frame size to default */
+			fc_set_mfs(lport, BNX2FC_MFS);
 			printk(KERN_ERR "indicate_netevent: ctlr_link_up\n");
 			fcoe_ctlr_link_up(&interface->ctlr);
 		} else if (fcoe_ctlr_link_down(&interface->ctlr)) {
Signature · 1 line
1.7.0.6
#2 lore raw

PATCH 2/8 bnx2fc: Send solicitation only after vlan discovery is complete

In reply to Bhanu Prakash Gollapudi

Link up event is generated to the driver even before vlan discovery has started. Because of this driver can send discovery solicitation on a stale vlan. Call fcoe_ctlr_link_up() only when the driver is in enabled state, which implies the vlan discovery is complete before sending solicitation.

---
 drivers/scsi/bnx2fc/bnx2fc.h      |    1 +
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   21 +++++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +1 -0
index 903e8f6..02535e8 100644
@@ -224,6 +224,7 @@ struct bnx2fc_interface {
 	struct fcoe_ctlr ctlr;
 	u8 vlan_enabled;
 	int vlan_id;
+	bool enabled;
 };
 
 #define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_interface, ctlr)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +17 -4
index 6387067..ba88ddb 100644
@@ -865,8 +865,11 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
 		if (link_possible && !bnx2fc_link_ok(lport)) {
 			/* Reset max recv frame size to default */
 			fc_set_mfs(lport, BNX2FC_MFS);
-			printk(KERN_ERR "indicate_netevent: ctlr_link_up\n");
-			fcoe_ctlr_link_up(&interface->ctlr);
+			/*
+			 * ctlr link up will only be handled during
+			 * enable to avoid sending discovery solicitation
+			 * on a stale vlan
+			 */
 		} else if (fcoe_ctlr_link_down(&interface->ctlr)) {
 			mutex_lock(&lport->lp_mutex);
 			list_for_each_entry(vport, &lport->vports, list)
@@ -1784,7 +1787,7 @@ static void bnx2fc_start_disc(struct bnx2fc_interface *interface)
 	lport = interface->ctlr.lp;
 	BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n");
 
-	if (!bnx2fc_link_ok(lport)) {
+	if (!bnx2fc_link_ok(lport) && interface->enabled) {
 		BNX2FC_HBA_DBG(lport, "ctlr_link_up\n");
 		fcoe_ctlr_link_up(&interface->ctlr);
 		fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
@@ -1866,6 +1869,7 @@ static int bnx2fc_disable(struct net_device *netdev)
 		rc = -ENODEV;
 		printk(KERN_ERR PFX "bnx2fc_disable: interface or lport not found\n");
 	} else {
+		interface->enabled = false;
 		fcoe_ctlr_link_down(&interface->ctlr);
 		fcoe_clean_pending_queue(interface->ctlr.lp);
 	}
@@ -1888,8 +1892,10 @@ static int bnx2fc_enable(struct net_device *netdev)
 	if (!interface || !interface->ctlr.lp) {
 		rc = -ENODEV;
 		printk(KERN_ERR PFX "bnx2fc_enable: interface or lport not found\n");
-	} else if (!bnx2fc_link_ok(interface->ctlr.lp))
+	} else if (!bnx2fc_link_ok(interface->ctlr.lp)) {
 		fcoe_ctlr_link_up(&interface->ctlr);
+		interface->enabled = true;
+	}
 
 	mutex_unlock(&bnx2fc_dev_lock);
 	rtnl_unlock();
@@ -2002,8 +2008,15 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
 	/* Make this master N_port */
 	interface->ctlr.lp = lport;
 
+	if (!bnx2fc_link_ok(lport)) {
+		fcoe_ctlr_link_up(&interface->ctlr);
+		fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
+		set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state);
+	}
+
 	BNX2FC_HBA_DBG(lport, "create: START DISC\n");
 	bnx2fc_start_disc(interface);
+	interface->enabled = true;
 	/*
 	 * Release from kref_init in bnx2fc_interface_setup, on success
 	 * lport should be holding a reference taken in bnx2fc_if_create
Signature · 1 line
1.7.0.6
#7 lore raw

PATCH 7/8 bnx2fc: Fix FW assert during RSCN stress tests

In reply to Bhanu Prakash Gollapudi

Firmware asserts when the same CQE is armed twice. This scenario happens during RSCN stress tests as driver incorrects arms the CQ after the session is offloaded.

---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_tgt.c +1 -3
index 2138da9..c1800b5 100644
@@ -133,9 +133,7 @@ retry_ofld:
 		printk(KERN_ERR PFX "map doorbell failed - no mem\n");
 		/* upload will take care of cleaning up sess resc */
 		lport->tt.rport_logoff(rdata);
-	} else
-		/* Arm CQ */
-		bnx2fc_arm_cq(tgt);
+	}
 	return;
 
 ofld_err:
Signature · 1 line
1.7.0.6