All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/18] bnx2fc version 1.0.5
@ 2011-08-05  0:38 Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 01/18] bnx2fc: Reset the max receive frame size Bhanu Prakash Gollapudi
                   ` (18 more replies)
  0 siblings, 19 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

v2 submittal:
Minor changes to patch 5, 8 and patch 13.
Patch 5  - Removed unnecessary printk
Patch 8  - Added code to ignore netdev events other than UNREGISTER for vlan interface
patch 13 - Error handling fixed for tgt_init_err.
--------

This patchset contains bnx2fc bug fixes.  Please note that patch 15 is
'fcoe/libfcoe' patch, which moves LLD common code from fcoe driver to
fcoe_transport, to enable patch 16 and 17.

Bhanu Prakash Gollapudi (18):
  bnx2fc: Reset the max receive frame size
  bnx2fc: Bug fixes in percpu_thread_create/destroy
  bnx2fc: Enable bsg_request support for bnx2fc
  bnx2fc: Remove erroneous kref_get on IO request
  bnx2fc: Do not attempt destroying NPIV port twice
  bnx2fc: Change function names of
    bnx2fc_netdev_setup/bnx2fc_netdev_cleanup
  bnx2fc: Reorganize cleanup code between interface_cleanup and
    if_destory
  bnx2fc: Handle NETDEV_UNREGISTER for vlan devices
  bnx2fc: Clear DESTROY_CMPL flag after firmware destroy
  bnx2fc: Do not reuse the fcoe connection id immediately
  bnx2fc: IO errors when receiving unsolicited LOGO
  bnx2fc: Fix NULL pointer deref during arm_cq.
  bnx2fc: code cleanup in bnx2fc_offload_session
  bnx2fc: Drop incoming ABTS
  fcoe: Move common functions to fcoe_transport library
  bnx2fc: Obtain WWNN/WWPN from the shared memory
  bnx2fc: Prevent creating of NPIV port with duplicate WWN
  bnx2fc: Bump version to 1.0.5

 drivers/scsi/bnx2fc/bnx2fc.h       |    2 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c  |  191 ++++++++++++++++++++++++------------
 drivers/scsi/bnx2fc/bnx2fc_hwi.c   |   10 ++-
 drivers/scsi/bnx2fc/bnx2fc_io.c    |    7 --
 drivers/scsi/bnx2fc/bnx2fc_tgt.c   |   27 +++---
 drivers/scsi/fcoe/fcoe.c           |   66 +------------
 drivers/scsi/fcoe/fcoe.h           |   10 --
 drivers/scsi/fcoe/fcoe_transport.c |   72 ++++++++++++++
 include/scsi/libfcoe.h             |    3 +
 9 files changed, 225 insertions(+), 163 deletions(-)



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH v2 01/18] bnx2fc: Reset the max receive frame size
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 02/18] bnx2fc: Bug fixes in percpu_thread_create/destroy Bhanu Prakash Gollapudi
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Reset max receive frame size every time before attempting FLOGI. Without this,
the stale MFS value will be used.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 7cb2cd4..ea1e6cc 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1735,6 +1735,11 @@ static void bnx2fc_start_disc(struct bnx2fc_interface *interface)
 		if (++wait_cnt > 12)
 			break;
 	}
+
+	/* Reset max receive frame size to default */
+	if (fc_set_mfs(lport, BNX2FC_MFS))
+		return;
+
 	fc_lport_init(lport);
 	fc_fabric_login(lport);
 }
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 02/18] bnx2fc: Bug fixes in percpu_thread_create/destroy
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 01/18] bnx2fc: Reset the max receive frame size Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 03/18] bnx2fc: Enable bsg_request support for bnx2fc Bhanu Prakash Gollapudi
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Look up p->work_list to process cq completions, and correct the error check for
thread creation.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index ea1e6cc..a4770d9 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2122,7 +2122,7 @@ static void bnx2fc_percpu_thread_create(unsigned int cpu)
 				(void *)p,
 				"bnx2fc_thread/%d", cpu);
 	/* bind thread to the cpu */
-	if (likely(!IS_ERR(p->iothread))) {
+	if (likely(!IS_ERR(thread))) {
 		kthread_bind(thread, cpu);
 		p->iothread = thread;
 		wake_up_process(thread);
@@ -2134,7 +2134,6 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
 	struct bnx2fc_percpu_s *p;
 	struct task_struct *thread;
 	struct bnx2fc_work *work, *tmp;
-	LIST_HEAD(work_list);
 
 	BNX2FC_MISC_DBG("destroying io thread for CPU %d\n", cpu);
 
@@ -2146,7 +2145,7 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
 
 
 	/* Free all work in the list */
-	list_for_each_entry_safe(work, tmp, &work_list, list) {
+	list_for_each_entry_safe(work, tmp, &p->work_list, list) {
 		list_del_init(&work->list);
 		bnx2fc_process_cq_compl(work->tgt, work->wqe);
 		kfree(work);
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 03/18] bnx2fc: Enable bsg_request support for bnx2fc
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 01/18] bnx2fc: Reset the max receive frame size Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 02/18] bnx2fc: Bug fixes in percpu_thread_create/destroy Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 04/18] bnx2fc: Remove erroneous kref_get on IO request Bhanu Prakash Gollapudi
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index a4770d9..9e2bf39 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2378,6 +2378,7 @@ static struct fc_function_template bnx2fc_transport_function = {
 	.vport_create = bnx2fc_vport_create,
 	.vport_delete = bnx2fc_vport_destroy,
 	.vport_disable = bnx2fc_vport_disable,
+	.bsg_request = fc_lport_bsg_request,
 };
 
 static struct fc_function_template bnx2fc_vport_xport_function = {
@@ -2411,6 +2412,7 @@ static struct fc_function_template bnx2fc_vport_xport_function = {
 	.get_fc_host_stats = fc_get_host_stats,
 	.issue_fc_host_lip = bnx2fc_fcoe_reset,
 	.terminate_rport_io = fc_rport_terminate_io,
+	.bsg_request = fc_lport_bsg_request,
 };
 
 /**
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 04/18] bnx2fc: Remove erroneous kref_get on IO request
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (2 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 03/18] bnx2fc: Enable bsg_request support for bnx2fc Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 05/18] bnx2fc: Do not attempt destroying NPIV port twice Bhanu Prakash Gollapudi
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

During sequence cleanup, an additional reference for an IO has been
taken. Because of this, the IO is never released into the free list.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_io.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 6cc3789..cb1791c 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1251,7 +1251,6 @@ void bnx2fc_process_seq_cleanup_compl(struct bnx2fc_cmd *seq_clnp_req,
 			seq_clnp_req->xid);
 		goto free_cb_arg;
 	}
-	kref_get(&orig_io_req->refcount);
 
 	spin_unlock_bh(&tgt->tgt_lock);
 	rc = bnx2fc_send_srr(orig_io_req, offset, r_ctl);
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 05/18] bnx2fc: Do not attempt destroying NPIV port twice
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (3 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 04/18] bnx2fc: Remove erroneous kref_get on IO request Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 06/18] bnx2fc: Change function names of bnx2fc_netdev_setup/bnx2fc_netdev_cleanup Bhanu Prakash Gollapudi
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

When NPIV ports are created/deleted rapidly there is a race condition between
bnx2fc_vport_destroy() from sysfs and bnx2fc_flogi_resp(), which could try to
delete the NPIV port from the list twice. Fix is to loop through the list of
NPIV ports to find a match, and only when it exists remove it.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 9e2bf39..21792e7 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1028,8 +1028,20 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport)
 	struct fc_lport *n_port = shost_priv(shost);
 	struct fc_lport *vn_port = vport->dd_data;
 	struct fcoe_port *port = lport_priv(vn_port);
+	struct fc_lport *v_port;
+	bool found = false;
 
 	mutex_lock(&n_port->lp_mutex);
+	list_for_each_entry(v_port, &n_port->vports, list)
+		if (v_port->vport == vport) {
+			found = true;
+			break;
+		}
+
+	if (!found) {
+		mutex_unlock(&n_port->lp_mutex);
+		return -ENOENT;
+	}
 	list_del(&vn_port->list);
 	mutex_unlock(&n_port->lp_mutex);
 	queue_work(bnx2fc_wq, &port->destroy_work);
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 06/18] bnx2fc: Change function names of bnx2fc_netdev_setup/bnx2fc_netdev_cleanup
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (4 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 05/18] bnx2fc: Do not attempt destroying NPIV port twice Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 07/18] bnx2fc: Reorganize cleanup code between interface_cleanup and if_destory Bhanu Prakash Gollapudi
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Change them to bnx2fc_interface_setup/bnx2fc_interface_cleanup in preperation
for the patches to follow. Interface specific cleanup functionality will be
moved to bnx2fc_interface_cleanup.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 21792e7..407a9b8 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1064,7 +1064,7 @@ static int bnx2fc_vport_disable(struct fc_vport *vport, bool disable)
 }
 
 
-static int bnx2fc_netdev_setup(struct bnx2fc_interface *interface)
+static int bnx2fc_interface_setup(struct bnx2fc_interface *interface)
 {
 	struct net_device *netdev = interface->netdev;
 	struct net_device *physdev = interface->hba->phys_dev;
@@ -1262,7 +1262,7 @@ struct bnx2fc_interface *bnx2fc_interface_create(struct bnx2fc_hba *hba,
 	interface->ctlr.get_src_addr = bnx2fc_get_src_mac;
 	set_bit(BNX2FC_CTLR_INIT_DONE, &interface->if_flags);
 
-	rc = bnx2fc_netdev_setup(interface);
+	rc = bnx2fc_interface_setup(interface);
 	if (!rc)
 		return interface;
 
@@ -1382,7 +1382,7 @@ free_blport:
 	return NULL;
 }
 
-static void bnx2fc_netdev_cleanup(struct bnx2fc_interface *interface)
+static void bnx2fc_interface_cleanup(struct bnx2fc_interface *interface)
 {
 	/* Dont listen for Ethernet packets anymore */
 	__dev_remove_pack(&interface->fcoe_packet_type);
@@ -1459,7 +1459,7 @@ static int bnx2fc_destroy(struct net_device *netdev)
 
 	hba = interface->hba;
 
-	bnx2fc_netdev_cleanup(interface);
+	bnx2fc_interface_cleanup(interface);
 	lport = interface->ctlr.lp;
 	bnx2fc_stop(interface);
 	list_del(&interface->list);
@@ -1938,7 +1938,7 @@ 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_netdev_cleanup(interface);
+		bnx2fc_interface_cleanup(interface);
 		rc = -EINVAL;
 		goto if_create_err;
 	}
@@ -2057,7 +2057,7 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev)
 	list_for_each_entry_safe(interface, tmp, &if_list, list) {
 		/* destroy not called yet, move to quiesced list */
 		if (interface->hba == hba) {
-			bnx2fc_netdev_cleanup(interface);
+			bnx2fc_interface_cleanup(interface);
 			bnx2fc_stop(interface);
 
 			list_del(&interface->list);
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 07/18] bnx2fc: Reorganize cleanup code between interface_cleanup and if_destory
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (5 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 06/18] bnx2fc: Change function names of bnx2fc_netdev_setup/bnx2fc_netdev_cleanup Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 08/18] bnx2fc: Handle NETDEV_UNREGISTER for vlan devices Bhanu Prakash Gollapudi
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Move interface specific cleanup functionality to from bnx2fc_if_destroy to
bnx2fc_interface_cleanup. Do not access interface/hba in bnx2fc_if_destroy as
by the time this function is called interface may already be destroyed. This
patch is in preparation to handle NETDEV_UNREGISTER on a vlan device.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   47 ++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 407a9b8..673c97c 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1384,16 +1384,10 @@ free_blport:
 
 static void bnx2fc_interface_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_if_destroy(struct fc_lport *lport, struct bnx2fc_hba *hba)
-{
+	struct fc_lport *lport = interface->ctlr.lp;
 	struct fcoe_port *port = lport_priv(lport);
 	struct bnx2fc_lport *blport, *tmp;
+	struct bnx2fc_hba *hba = interface->hba;
 
 	/* Stop the transmit retry timer */
 	del_timer_sync(&port->timer);
@@ -1401,6 +1395,24 @@ static void bnx2fc_if_destroy(struct fc_lport *lport, struct bnx2fc_hba *hba)
 	/* 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();
+
+	spin_lock_bh(&hba->hba_lock);
+	list_for_each_entry_safe(blport, tmp, &hba->vports, list) {
+		if (blport->lport == lport) {
+			list_del(&blport->list);
+			kfree(blport);
+		}
+	}
+	spin_unlock_bh(&hba->hba_lock);
+}
+
+static void bnx2fc_if_destroy(struct fc_lport *lport)
+{
+
 	/* Free queued packets for the receive thread */
 	bnx2fc_clean_rx_queue(lport);
 
@@ -1417,15 +1429,6 @@ static void bnx2fc_if_destroy(struct fc_lport *lport, struct bnx2fc_hba *hba)
 	/* Free memory used by statistical counters */
 	fc_lport_free_stats(lport);
 
-	spin_lock_bh(&hba->hba_lock);
-	list_for_each_entry_safe(blport, tmp, &hba->vports, list) {
-		if (blport->lport == lport) {
-			list_del(&blport->list);
-			kfree(blport);
-		}
-	}
-	spin_unlock_bh(&hba->hba_lock);
-
 	/* Release Scsi_Host */
 	scsi_host_put(lport->host);
 }
@@ -1443,7 +1446,6 @@ static void bnx2fc_if_destroy(struct fc_lport *lport, struct bnx2fc_hba *hba)
 static int bnx2fc_destroy(struct net_device *netdev)
 {
 	struct bnx2fc_interface *interface = NULL;
-	struct bnx2fc_hba *hba;
 	struct fc_lport *lport;
 	int rc = 0;
 
@@ -1457,7 +1459,6 @@ static int bnx2fc_destroy(struct net_device *netdev)
 		goto netdev_err;
 	}
 
-	hba = interface->hba;
 
 	bnx2fc_interface_cleanup(interface);
 	lport = interface->ctlr.lp;
@@ -1465,7 +1466,7 @@ static int bnx2fc_destroy(struct net_device *netdev)
 	list_del(&interface->list);
 	destroy_workqueue(interface->timer_work_queue);
 	bnx2fc_interface_put(interface);
-	bnx2fc_if_destroy(lport, hba);
+	bnx2fc_if_destroy(lport);
 
 netdev_err:
 	mutex_unlock(&bnx2fc_dev_lock);
@@ -1478,19 +1479,17 @@ static void bnx2fc_destroy_work(struct work_struct *work)
 	struct fcoe_port *port;
 	struct fc_lport *lport;
 	struct bnx2fc_interface *interface;
-	struct bnx2fc_hba *hba;
 
 	port = container_of(work, struct fcoe_port, destroy_work);
 	lport = port->lport;
 	interface = port->priv;
-	hba = interface->hba;
 
 	BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n");
 
 	bnx2fc_port_shutdown(lport);
 	rtnl_lock();
 	mutex_lock(&bnx2fc_dev_lock);
-	bnx2fc_if_destroy(lport, hba);
+	bnx2fc_if_destroy(lport);
 	mutex_unlock(&bnx2fc_dev_lock);
 	rtnl_unlock();
 }
@@ -2063,7 +2062,7 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev)
 			list_del(&interface->list);
 			lport = interface->ctlr.lp;
 			bnx2fc_interface_put(interface);
-			bnx2fc_if_destroy(lport, hba);
+			bnx2fc_if_destroy(lport);
 		}
 	}
 	mutex_unlock(&bnx2fc_dev_lock);
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 08/18] bnx2fc: Handle NETDEV_UNREGISTER for vlan devices
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (6 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 07/18] bnx2fc: Reorganize cleanup code between interface_cleanup and if_destory Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 09/18] bnx2fc: Clear DESTROY_CMPL flag after firmware destroy Bhanu Prakash Gollapudi
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Since the driver holds the reference for vlan netdev, the reference has to be
released by the driver when the vlan device is removed. Driver handles this in
NETDEV_UNREGISTER event.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   92 +++++++++++++++++++++++--------------
 1 files changed, 57 insertions(+), 35 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 673c97c..dccabaf 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -56,6 +56,7 @@ static struct scsi_host_template bnx2fc_shost_template;
 static struct fc_function_template bnx2fc_transport_function;
 static struct fc_function_template bnx2fc_vport_xport_function;
 static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode);
+static void __bnx2fc_destroy(struct bnx2fc_interface *interface, bool schedule);
 static int bnx2fc_destroy(struct net_device *net_device);
 static int bnx2fc_enable(struct net_device *netdev);
 static int bnx2fc_disable(struct net_device *netdev);
@@ -78,6 +79,7 @@ static void bnx2fc_destroy_work(struct work_struct *work);
 static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev);
 static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device
 							*phys_dev);
+static inline void bnx2fc_interface_put(struct bnx2fc_interface *interface);
 static struct bnx2fc_hba *bnx2fc_find_hba_for_cnic(struct cnic_dev *cnic);
 
 static int bnx2fc_fw_init(struct bnx2fc_hba *hba);
@@ -783,7 +785,7 @@ static void bnx2fc_destroy_timer(unsigned long data)
  * @vlan_id:	vlan id - associated vlan id with this event
  *
  * Handles NETDEV_UP, NETDEV_DOWN, NETDEV_GOING_DOWN,NETDEV_CHANGE and
- * NETDEV_CHANGE_MTU events
+ * NETDEV_CHANGE_MTU events. Handle NETDEV_UNREGISTER only for vlans.
  */
 static void bnx2fc_indicate_netevent(void *context, unsigned long event,
 				     u16 vlan_id)
@@ -791,12 +793,11 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
 	struct bnx2fc_hba *hba = (struct bnx2fc_hba *)context;
 	struct fc_lport *lport;
 	struct fc_lport *vport;
-	struct bnx2fc_interface *interface;
+	struct bnx2fc_interface *interface, *tmp;
 	int wait_for_upload = 0;
 	u32 link_possible = 1;
 
-	/* Ignore vlans for now */
-	if (vlan_id != 0)
+	if (vlan_id != 0 && event != NETDEV_UNREGISTER)
 		return;
 
 	switch (event) {
@@ -820,6 +821,18 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
 	case NETDEV_CHANGE:
 		break;
 
+	case NETDEV_UNREGISTER:
+		if (!vlan_id)
+			return;
+		mutex_lock(&bnx2fc_dev_lock);
+		list_for_each_entry_safe(interface, tmp, &if_list, list) {
+			if (interface->hba != hba)
+				continue;
+			__bnx2fc_destroy(interface, true);
+		}
+		mutex_unlock(&bnx2fc_dev_lock);
+		return;
+
 	default:
 		printk(KERN_ERR PFX "Unkonwn netevent %ld", event);
 		return;
@@ -1022,12 +1035,27 @@ static int bnx2fc_vport_create(struct fc_vport *vport, bool disabled)
 	return 0;
 }
 
+static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport)
+{
+	struct bnx2fc_lport *blport, *tmp;
+
+	spin_lock_bh(&hba->hba_lock);
+	list_for_each_entry_safe(blport, tmp, &hba->vports, list) {
+		if (blport->lport == lport) {
+			list_del(&blport->list);
+			kfree(blport);
+		}
+	}
+	spin_unlock_bh(&hba->hba_lock);
+}
+
 static int bnx2fc_vport_destroy(struct fc_vport *vport)
 {
 	struct Scsi_Host *shost = vport_to_shost(vport);
 	struct fc_lport *n_port = shost_priv(shost);
 	struct fc_lport *vn_port = vport->dd_data;
 	struct fcoe_port *port = lport_priv(vn_port);
+	struct bnx2fc_interface *interface = port->priv;
 	struct fc_lport *v_port;
 	bool found = false;
 
@@ -1044,6 +1072,9 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport)
 	}
 	list_del(&vn_port->list);
 	mutex_unlock(&n_port->lp_mutex);
+	bnx2fc_free_vport(interface->hba, port->lport);
+	bnx2fc_port_shutdown(port->lport);
+	bnx2fc_interface_put(interface);
 	queue_work(bnx2fc_wq, &port->destroy_work);
 	return 0;
 }
@@ -1386,7 +1417,6 @@ static void bnx2fc_interface_cleanup(struct bnx2fc_interface *interface)
 {
 	struct fc_lport *lport = interface->ctlr.lp;
 	struct fcoe_port *port = lport_priv(lport);
-	struct bnx2fc_lport *blport, *tmp;
 	struct bnx2fc_hba *hba = interface->hba;
 
 	/* Stop the transmit retry timer */
@@ -1400,14 +1430,7 @@ static void bnx2fc_interface_cleanup(struct bnx2fc_interface *interface)
 	__dev_remove_pack(&interface->fip_packet_type);
 	synchronize_net();
 
-	spin_lock_bh(&hba->hba_lock);
-	list_for_each_entry_safe(blport, tmp, &hba->vports, list) {
-		if (blport->lport == lport) {
-			list_del(&blport->list);
-			kfree(blport);
-		}
-	}
-	spin_unlock_bh(&hba->hba_lock);
+	bnx2fc_free_vport(hba, lport);
 }
 
 static void bnx2fc_if_destroy(struct fc_lport *lport)
@@ -1433,6 +1456,23 @@ static void bnx2fc_if_destroy(struct fc_lport *lport)
 	scsi_host_put(lport->host);
 }
 
+static void __bnx2fc_destroy(struct bnx2fc_interface *interface, bool schedule)
+{
+	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);
+	if (schedule)
+		queue_work(bnx2fc_wq, &port->destroy_work);
+	else
+		bnx2fc_if_destroy(lport);
+}
+
 /**
  * bnx2fc_destroy - Destroy a bnx2fc FCoE interface
  *
@@ -1446,7 +1486,6 @@ static void bnx2fc_if_destroy(struct fc_lport *lport)
 static int bnx2fc_destroy(struct net_device *netdev)
 {
 	struct bnx2fc_interface *interface = NULL;
-	struct fc_lport *lport;
 	int rc = 0;
 
 	rtnl_lock();
@@ -1460,13 +1499,8 @@ static int bnx2fc_destroy(struct net_device *netdev)
 	}
 
 
-	bnx2fc_interface_cleanup(interface);
-	lport = interface->ctlr.lp;
-	bnx2fc_stop(interface);
-	list_del(&interface->list);
 	destroy_workqueue(interface->timer_work_queue);
-	bnx2fc_interface_put(interface);
-	bnx2fc_if_destroy(lport);
+	__bnx2fc_destroy(interface, false);
 
 netdev_err:
 	mutex_unlock(&bnx2fc_dev_lock);
@@ -1478,15 +1512,12 @@ static void bnx2fc_destroy_work(struct work_struct *work)
 {
 	struct fcoe_port *port;
 	struct fc_lport *lport;
-	struct bnx2fc_interface *interface;
 
 	port = container_of(work, struct fcoe_port, destroy_work);
 	lport = port->lport;
-	interface = port->priv;
 
 	BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n");
 
-	bnx2fc_port_shutdown(lport);
 	rtnl_lock();
 	mutex_lock(&bnx2fc_dev_lock);
 	bnx2fc_if_destroy(lport);
@@ -2031,7 +2062,6 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev)
 {
 	struct bnx2fc_hba *hba;
 	struct bnx2fc_interface *interface, *tmp;
-	struct fc_lport *lport;
 
 	BNX2FC_MISC_DBG("Entered bnx2fc_ulp_exit\n");
 
@@ -2053,18 +2083,10 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev)
 	list_del_init(&hba->list);
 	adapter_count--;
 
-	list_for_each_entry_safe(interface, tmp, &if_list, list) {
+	list_for_each_entry_safe(interface, tmp, &if_list, list)
 		/* destroy not called yet, move to quiesced list */
-		if (interface->hba == hba) {
-			bnx2fc_interface_cleanup(interface);
-			bnx2fc_stop(interface);
-
-			list_del(&interface->list);
-			lport = interface->ctlr.lp;
-			bnx2fc_interface_put(interface);
-			bnx2fc_if_destroy(lport);
-		}
-	}
+		if (interface->hba == hba)
+			__bnx2fc_destroy(interface, false);
 	mutex_unlock(&bnx2fc_dev_lock);
 
 	bnx2fc_ulp_stop(hba);
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 09/18] bnx2fc: Clear DESTROY_CMPL flag after firmware destroy
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (7 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 08/18] bnx2fc: Handle NETDEV_UNREGISTER for vlan devices Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 10/18] bnx2fc: Do not reuse the fcoe connection id immediately Bhanu Prakash Gollapudi
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Since this flag was never cleared, the driver does not wait for firmware
destroy completions, causing missed KCQEs.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index dccabaf..ca2e206 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -771,8 +771,8 @@ static void bnx2fc_destroy_timer(unsigned long data)
 {
 	struct bnx2fc_hba *hba = (struct bnx2fc_hba *)data;
 
-	BNX2FC_MISC_DBG("ERROR:bnx2fc_destroy_timer - "
-		   "Destroy compl not received!!\n");
+	printk(KERN_ERR PFX "ERROR:bnx2fc_destroy_timer - "
+	       "Destroy compl not received!!\n");
 	set_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags);
 	wake_up_interruptible(&hba->destroy_wait);
 }
@@ -1701,6 +1701,7 @@ static void bnx2fc_fw_destroy(struct bnx2fc_hba *hba)
 			wait_event_interruptible(hba->destroy_wait,
 					test_bit(BNX2FC_FLAG_DESTROY_CMPL,
 						 &hba->flags));
+			clear_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags);
 			/* This should never happen */
 			if (signal_pending(current))
 				flush_signals(current);
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 10/18] bnx2fc: Do not reuse the fcoe connection id immediately
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (8 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 09/18] bnx2fc: Clear DESTROY_CMPL flag after firmware destroy Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 11/18] bnx2fc: IO errors when receiving unsolicited LOGO Bhanu Prakash Gollapudi
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

CFC_DELETE is issued 2 secs after CONN_TERM is completed. If the session is
uploaded and offloaded immediately, it has to wait for the connection id to be
available.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index d5311b5..3d28fbe 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
@@ -624,7 +624,6 @@ static void bnx2fc_free_conn_id(struct bnx2fc_hba *hba, u32 conn_id)
 	/* called with hba mutex held */
 	spin_lock_bh(&hba->hba_lock);
 	hba->tgt_ofld_list[conn_id] = NULL;
-	hba->next_conn_id = conn_id;
 	spin_unlock_bh(&hba->hba_lock);
 }
 
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 11/18] bnx2fc: IO errors when receiving unsolicited LOGO
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (9 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 10/18] bnx2fc: Do not reuse the fcoe connection id immediately Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 12/18] bnx2fc: Fix NULL pointer deref during arm_cq Bhanu Prakash Gollapudi
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

During the unsolicited LOGO processing, the session is uploaded and offloaded
after the relogin is complete. In between any new IOs are errored back as the
upload completion flag is set. Upon exhausting the retry count, the application
fails the IOs. Return target busy for all the cases when session is not ready.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_io.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index cb1791c..120618d 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1789,12 +1789,6 @@ int bnx2fc_queuecommand(struct Scsi_Host *host,
 	tgt = (struct bnx2fc_rport *)&rp[1];
 
 	if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) {
-		if (test_bit(BNX2FC_FLAG_UPLD_REQ_COMPL, &tgt->flags))  {
-			sc_cmd->result = DID_NO_CONNECT << 16;
-			sc_cmd->scsi_done(sc_cmd);
-			return 0;
-
-		}
 		/*
 		 * Session is not offloaded yet. Let SCSI-ml retry
 		 * the command.
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 12/18] bnx2fc: Fix NULL pointer deref during arm_cq.
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (10 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 11/18] bnx2fc: IO errors when receiving unsolicited LOGO Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 13/18] bnx2fc: code cleanup in bnx2fc_offload_session Bhanu Prakash Gollapudi
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

There exists a race condition between CQ doorbell unmap and IO completion path
that arms the CQ which causes a NULL dereference. Protect the ctx_base with
cq_lock to avoid this. Also, wait for the CQ doorbell to be successfully mapped
before arming the CQ.

Also, do not count uncolicited CQ completions for free_sqes.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_hwi.c |   10 +++++++---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |   19 +++++++++++--------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
index 72cfb14..b241f3d 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
@@ -1009,6 +1009,7 @@ int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt)
 	u32 cq_cons;
 	struct fcoe_cqe *cqe;
 	u32 num_free_sqes = 0;
+	u32 num_cqes = 0;
 	u16 wqe;
 
 	/*
@@ -1058,10 +1059,11 @@ unlock:
 				wake_up_process(fps->iothread);
 			else
 				bnx2fc_process_cq_compl(tgt, wqe);
+			num_free_sqes++;
 		}
 		cqe++;
 		tgt->cq_cons_idx++;
-		num_free_sqes++;
+		num_cqes++;
 
 		if (tgt->cq_cons_idx == BNX2FC_CQ_WQES_MAX) {
 			tgt->cq_cons_idx = 0;
@@ -1070,8 +1072,10 @@ unlock:
 				1 - tgt->cq_curr_toggle_bit;
 		}
 	}
-	if (num_free_sqes) {
-		bnx2fc_arm_cq(tgt);
+	if (num_cqes) {
+		/* Arm CQ only if doorbell is mapped */
+		if (tgt->ctx_base)
+			bnx2fc_arm_cq(tgt);
 		atomic_add(num_free_sqes, &tgt->free_sqes);
 	}
 	spin_unlock_bh(&tgt->cq_lock);
diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index 3d28fbe..2f7a7da 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
@@ -133,9 +133,9 @@ 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);
-	}
-	/* Arm CQ */
-	bnx2fc_arm_cq(tgt);
+	} else
+		/* Arm CQ */
+		bnx2fc_arm_cq(tgt);
 	return;
 
 ofld_err:
@@ -806,14 +806,14 @@ mem_alloc_failure:
 static void bnx2fc_free_session_resc(struct bnx2fc_hba *hba,
 						struct bnx2fc_rport *tgt)
 {
-	BNX2FC_TGT_DBG(tgt, "Freeing up session resources\n");
+	void __iomem *ctx_base_ptr;
 
-	if (tgt->ctx_base) {
-		iounmap(tgt->ctx_base);
-		tgt->ctx_base = NULL;
-	}
+	BNX2FC_TGT_DBG(tgt, "Freeing up session resources\n");
 
 	spin_lock_bh(&tgt->cq_lock);
+	ctx_base_ptr = tgt->ctx_base;
+	tgt->ctx_base = NULL;
+
 	/* Free LCQ */
 	if (tgt->lcq) {
 		dma_free_coherent(&hba->pcidev->dev, tgt->lcq_mem_size,
@@ -867,4 +867,7 @@ static void bnx2fc_free_session_resc(struct bnx2fc_hba *hba,
 		tgt->sq = NULL;
 	}
 	spin_unlock_bh(&tgt->cq_lock);
+
+	if (ctx_base_ptr)
+		iounmap(ctx_base_ptr);
 }
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 13/18] bnx2fc: code cleanup in bnx2fc_offload_session
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (11 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 12/18] bnx2fc: Fix NULL pointer deref during arm_cq Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 14/18] bnx2fc: Drop incoming ABTS Bhanu Prakash Gollapudi
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

- Free session resources before rport logoff
- Do not free session resources in bnx2fc_alloc_session_resc() as it is handled
  in caller's error handling path.
- Do not call bnx2fc_free_session_resc() if bnx2fc_init_tgt() fails as cq_lock
  is not yet initialized.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_tgt.c b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
index 2f7a7da..2138da9 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_tgt.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_tgt.c
@@ -76,7 +76,7 @@ static void bnx2fc_offload_session(struct fcoe_port *port,
 	if (rval) {
 		printk(KERN_ERR PFX "Failed to allocate conn id for "
 			"port_id (%6x)\n", rport->port_id);
-		goto ofld_err;
+		goto tgt_init_err;
 	}
 
 	/* Allocate session resources */
@@ -141,11 +141,12 @@ retry_ofld:
 ofld_err:
 	/* couldn't offload the session. log off from this rport */
 	BNX2FC_TGT_DBG(tgt, "bnx2fc_offload_session - offload error\n");
-	lport->tt.rport_logoff(rdata);
 	/* Free session resources */
 	bnx2fc_free_session_resc(hba, tgt);
+tgt_init_err:
 	if (tgt->fcoe_conn_id != -1)
 		bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id);
+	lport->tt.rport_logoff(rdata);
 }
 
 void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt)
@@ -790,8 +791,6 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
 	return 0;
 
 mem_alloc_failure:
-	bnx2fc_free_session_resc(hba, tgt);
-	bnx2fc_free_conn_id(hba, tgt->fcoe_conn_id);
 	return -ENOMEM;
 }
 
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 14/18] bnx2fc: Drop incoming ABTS
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (12 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 13/18] bnx2fc: code cleanup in bnx2fc_offload_session Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library Bhanu Prakash Gollapudi
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

As an initiator, driver need not handle incoming ABTS. It initiates an ABTS if
any IO requests time out.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index ca2e206..62c0e94 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -547,6 +547,14 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
 			break;
 		}
 	}
+
+	if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) {
+		/* Drop incoming ABTS */
+		put_cpu();
+		kfree_skb(skb);
+		return;
+	}
+
 	if (le32_to_cpu(fr_crc(fp)) !=
 			~crc32(~0, skb->data, fr_len)) {
 		if (stats->InvalidCRCCount < 5)
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (13 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 14/18] bnx2fc: Drop incoming ABTS Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-09-08 11:11   ` Mike Christie
  2011-08-05  0:38 ` [PATCH v2 16/18] bnx2fc: Obtain WWNN/WWPN from the shared memory Bhanu Prakash Gollapudi
                   ` (3 subsequent siblings)
  18 siblings, 1 reply; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Export fcoe_get_wwn, fcoe_validate_vport_create and fcoe_wwn_to_str so that all
LLDs can use these common function.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/fcoe/fcoe.c           |   66 +--------------------------------
 drivers/scsi/fcoe/fcoe.h           |   10 -----
 drivers/scsi/fcoe/fcoe_transport.c |   72 ++++++++++++++++++++++++++++++++++++
 include/scsi/libfcoe.h             |    3 +
 4 files changed, 76 insertions(+), 75 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index ba710e3..c30fa27 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -138,7 +138,6 @@ static int fcoe_vport_create(struct fc_vport *, bool disabled);
 static int fcoe_vport_disable(struct fc_vport *, bool disable);
 static void fcoe_set_vport_symbolic_name(struct fc_vport *);
 static void fcoe_set_port_id(struct fc_lport *, u32, struct fc_frame *);
-static int fcoe_validate_vport_create(struct fc_vport *);
 
 static struct libfc_function_template fcoe_libfc_fcn_templ = {
 	.frame_send = fcoe_xmit,
@@ -577,23 +576,6 @@ static int fcoe_lport_config(struct fc_lport *lport)
 }
 
 /**
- * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
- * @netdev: the associated net device
- * @wwn: the output WWN
- * @type: the type of WWN (WWPN or WWNN)
- *
- * Returns: 0 for success
- */
-static int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
-{
-	const struct net_device_ops *ops = netdev->netdev_ops;
-
-	if (ops->ndo_fcoe_get_wwn)
-		return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
-	return -EINVAL;
-}
-
-/**
  * fcoe_netdev_features_change - Updates the lport's offload flags based
  * on the LLD netdev's FCoE feature flags
  */
@@ -2444,7 +2426,7 @@ static int fcoe_vport_create(struct fc_vport *vport, bool disabled)
 
 	rc = fcoe_validate_vport_create(vport);
 	if (rc) {
-		wwn_to_str(vport->port_name, buf, sizeof(buf));
+		fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf));
 		printk(KERN_ERR "fcoe: Failed to create vport, "
 			"WWPN (0x%s) already exists\n",
 			buf);
@@ -2596,49 +2578,3 @@ static void fcoe_set_port_id(struct fc_lport *lport,
 	if (fp && fc_frame_payload_op(fp) == ELS_FLOGI)
 		fcoe_ctlr_recv_flogi(&fcoe->ctlr, lport, fp);
 }
-
-/**
- * fcoe_validate_vport_create() - Validate a vport before creating it
- * @vport: NPIV port to be created
- *
- * This routine is meant to add validation for a vport before creating it
- * via fcoe_vport_create().
- * Current validations are:
- *      - WWPN supplied is unique for given lport
- *
- *
-*/
-static int fcoe_validate_vport_create(struct fc_vport *vport)
-{
-	struct Scsi_Host *shost = vport_to_shost(vport);
-	struct fc_lport *n_port = shost_priv(shost);
-	struct fc_lport *vn_port;
-	int rc = 0;
-	char buf[32];
-
-	mutex_lock(&n_port->lp_mutex);
-
-	wwn_to_str(vport->port_name, buf, sizeof(buf));
-	/* Check if the wwpn is not same as that of the lport */
-	if (!memcmp(&n_port->wwpn, &vport->port_name, sizeof(u64))) {
-		FCOE_DBG("vport WWPN 0x%s is same as that of the "
-			"base port WWPN\n", buf);
-		rc = -EINVAL;
-		goto out;
-	}
-
-	/* Check if there is any existing vport with same wwpn */
-	list_for_each_entry(vn_port, &n_port->vports, list) {
-		if (!memcmp(&vn_port->wwpn, &vport->port_name, sizeof(u64))) {
-			FCOE_DBG("vport with given WWPN 0x%s already "
-			"exists\n", buf);
-			rc = -EINVAL;
-			break;
-		}
-	}
-
-out:
-	mutex_unlock(&n_port->lp_mutex);
-
-	return rc;
-}
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h
index c4a9399..408a6fd 100644
--- a/drivers/scsi/fcoe/fcoe.h
+++ b/drivers/scsi/fcoe/fcoe.h
@@ -99,14 +99,4 @@ static inline struct net_device *fcoe_netdev(const struct fc_lport *lport)
 			((struct fcoe_port *)lport_priv(lport))->priv)->netdev;
 }
 
-static inline void wwn_to_str(u64 wwn, char *buf, int len)
-{
-	u8 wwpn[8];
-
-	u64_to_wwn(wwn, wwpn);
-	snprintf(buf, len, "%02x%02x%02x%02x%02x%02x%02x%02x",
-		wwpn[0], wwpn[1], wwpn[2], wwpn[3],
-		wwpn[4], wwpn[5], wwpn[6], wwpn[7]);
-}
-
 #endif /* _FCOE_H_ */
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index 41068e8..50c8c4a 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -83,6 +83,78 @@ static struct notifier_block libfcoe_notifier = {
 	.notifier_call = libfcoe_device_notification,
 };
 
+void fcoe_wwn_to_str(u64 wwn, char *buf, int len)
+{
+	u8 wwpn[8];
+
+	u64_to_wwn(wwn, wwpn);
+	snprintf(buf, len, "%02x%02x%02x%02x%02x%02x%02x%02x",
+		 wwpn[0], wwpn[1], wwpn[2], wwpn[3],
+		 wwpn[4], wwpn[5], wwpn[6], wwpn[7]);
+}
+EXPORT_SYMBOL_GPL(fcoe_wwn_to_str);
+
+/**
+ * fcoe_validate_vport_create() - Validate a vport before creating it
+ * @vport: NPIV port to be created
+ *
+ * This routine is meant to add validation for a vport before creating it
+ * via fcoe_vport_create().
+ * Current validations are:
+ *      - WWPN supplied is unique for given lport
+ */
+int fcoe_validate_vport_create(struct fc_vport *vport)
+{
+	struct Scsi_Host *shost = vport_to_shost(vport);
+	struct fc_lport *n_port = shost_priv(shost);
+	struct fc_lport *vn_port;
+	int rc = 0;
+	char buf[32];
+
+	mutex_lock(&n_port->lp_mutex);
+
+	fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf));
+	/* Check if the wwpn is not same as that of the lport */
+	if (!memcmp(&n_port->wwpn, &vport->port_name, sizeof(u64))) {
+		LIBFCOE_TRANSPORT_DBG("vport WWPN 0x%s is same as that of the "
+				      "base port WWPN\n", buf);
+		rc = -EINVAL;
+		goto out;
+	}
+
+	/* Check if there is any existing vport with same wwpn */
+	list_for_each_entry(vn_port, &n_port->vports, list) {
+		if (!memcmp(&vn_port->wwpn, &vport->port_name, sizeof(u64))) {
+			LIBFCOE_TRANSPORT_DBG("vport with given WWPN 0x%s "
+					      "already exists\n", buf);
+			rc = -EINVAL;
+			break;
+		}
+	}
+out:
+	mutex_unlock(&n_port->lp_mutex);
+	return rc;
+}
+EXPORT_SYMBOL_GPL(fcoe_validate_vport_create);
+
+/**
+ * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
+ * @netdev: the associated net device
+ * @wwn: the output WWN
+ * @type: the type of WWN (WWPN or WWNN)
+ *
+ * Returns: 0 for success
+ */
+int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
+{
+	const struct net_device_ops *ops = netdev->netdev_ops;
+
+	if (ops->ndo_fcoe_get_wwn)
+		return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
+	return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(fcoe_get_wwn);
+
 /**
  * fcoe_fc_crc() - Calculates the CRC for a given frame
  * @fp: The frame to be checksumed
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 8c1638b..0b2f843 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -229,6 +229,9 @@ int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
 		      const struct libfc_function_template *, int init_fcp);
 u32 fcoe_fc_crc(struct fc_frame *fp);
 int fcoe_start_io(struct sk_buff *skb);
+int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
+void fcoe_wwn_to_str(u64 wwn, char *buf, int len);
+int fcoe_validate_vport_create(struct fc_vport *vport);
 
 /**
  * is_fip_mode() - returns true if FIP mode selected.
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 16/18] bnx2fc: Obtain WWNN/WWPN from the shared memory
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (14 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 17/18] bnx2fc: Prevent creating of NPIV port with duplicate WWN Bhanu Prakash Gollapudi
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

bnx2x driver would obtain the WWNN/WWPN from the shared memory and can be
obtained by the bnx2fc driver via ndo_fcoe_get_wwn.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 62c0e94..25d3bcd 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -65,7 +65,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb);
 
 static void bnx2fc_start_disc(struct bnx2fc_interface *interface);
 static int bnx2fc_shost_config(struct fc_lport *lport, struct device *dev);
-static int bnx2fc_net_config(struct fc_lport *lp);
 static int bnx2fc_lport_config(struct fc_lport *lport);
 static int bnx2fc_em_config(struct fc_lport *lport);
 static int bnx2fc_bind_adapter_devices(struct bnx2fc_hba *hba);
@@ -737,7 +736,7 @@ void bnx2fc_get_link_state(struct bnx2fc_hba *hba)
 		clear_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state);
 }
 
-static int bnx2fc_net_config(struct fc_lport *lport)
+static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev)
 {
 	struct bnx2fc_hba *hba;
 	struct bnx2fc_interface *interface;
@@ -763,11 +762,16 @@ static int bnx2fc_net_config(struct fc_lport *lport)
 	bnx2fc_link_speed_update(lport);
 
 	if (!lport->vport) {
-		wwnn = fcoe_wwn_from_mac(interface->ctlr.ctl_src_addr, 1, 0);
+		if (fcoe_get_wwn(netdev, &wwnn, NETDEV_FCOE_WWNN))
+			wwnn = fcoe_wwn_from_mac(interface->ctlr.ctl_src_addr,
+						 1, 0);
 		BNX2FC_HBA_DBG(lport, "WWNN = 0x%llx\n", wwnn);
 		fc_set_wwnn(lport, wwnn);
 
-		wwpn = fcoe_wwn_from_mac(interface->ctlr.ctl_src_addr, 2, 0);
+		if (fcoe_get_wwn(netdev, &wwpn, NETDEV_FCOE_WWPN))
+			wwpn = fcoe_wwn_from_mac(interface->ctlr.ctl_src_addr,
+						 2, 0);
+
 		BNX2FC_HBA_DBG(lport, "WWPN = 0x%llx\n", wwpn);
 		fc_set_wwpn(lport, wwpn);
 	}
@@ -1367,7 +1371,7 @@ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
 		fc_set_wwpn(lport, vport->port_name);
 	}
 	/* Configure netdev and networking properties of the lport */
-	rc = bnx2fc_net_config(lport);
+	rc = bnx2fc_net_config(lport, interface->netdev);
 	if (rc) {
 		printk(KERN_ERR PFX "Error on bnx2fc_net_config\n");
 		goto lp_config_err;
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 17/18] bnx2fc: Prevent creating of NPIV port with duplicate WWN
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (15 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 16/18] bnx2fc: Obtain WWNN/WWPN from the shared memory Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-05  0:38 ` [PATCH v2 18/18] bnx2fc: Bump version to 1.0.5 Bhanu Prakash Gollapudi
  2011-08-24  5:48 ` [PATCH v2 00/18] bnx2fc version 1.0.5 James Bottomley
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

This patch adds a validation step before allowing creation of a new NPIV port.
It checks whether the WWPN passed for the new NPIV port to be created is unique
for the given physical port.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 25d3bcd..351ca4c 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1020,6 +1020,17 @@ static int bnx2fc_vport_create(struct fc_vport *vport, bool disabled)
 	struct bnx2fc_interface *interface = port->priv;
 	struct net_device *netdev = interface->netdev;
 	struct fc_lport *vn_port;
+	int rc;
+	char buf[32];
+
+	rc = fcoe_validate_vport_create(vport);
+	if (rc) {
+		fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf));
+		printk(KERN_ERR PFX "Failed to create vport, "
+		       "WWPN (0x%s) already exists\n",
+		       buf);
+		return rc;
+	}
 
 	if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) {
 		printk(KERN_ERR PFX "vn ports cannot be created on"
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v2 18/18] bnx2fc: Bump version to 1.0.5
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (16 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 17/18] bnx2fc: Prevent creating of NPIV port with duplicate WWN Bhanu Prakash Gollapudi
@ 2011-08-05  0:38 ` Bhanu Prakash Gollapudi
  2011-08-24  5:48 ` [PATCH v2 00/18] bnx2fc version 1.0.5 James Bottomley
  18 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-05  0:38 UTC (permalink / raw)
  To: JBottomley, linux-scsi
  Cc: michaelc, mchan, robert.w.love, devel, Bhanu Prakash Gollapudi

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
---
 drivers/scsi/bnx2fc/bnx2fc.h      |    2 +-
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 42228ca..903e8f6 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -62,7 +62,7 @@
 #include "bnx2fc_constants.h"
 
 #define BNX2FC_NAME		"bnx2fc"
-#define BNX2FC_VERSION		"1.0.4"
+#define BNX2FC_VERSION		"1.0.5"
 
 #define PFX			"bnx2fc: "
 
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 351ca4c..e6c9879 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -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	"Jun 23, 2011"
+#define DRV_MODULE_RELDATE	"Aug 03, 2011"
 
 
 static char version[] __devinitdata =
-- 
1.7.0.6



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 00/18] bnx2fc version 1.0.5
  2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
                   ` (17 preceding siblings ...)
  2011-08-05  0:38 ` [PATCH v2 18/18] bnx2fc: Bump version to 1.0.5 Bhanu Prakash Gollapudi
@ 2011-08-24  5:48 ` James Bottomley
  2011-08-24 18:29   ` Bhanu Prakash Gollapudi
  18 siblings, 1 reply; 23+ messages in thread
From: James Bottomley @ 2011-08-24  5:48 UTC (permalink / raw)
  To: Bhanu Prakash Gollapudi; +Cc: linux-scsi, michaelc, mchan, robert.w.love, devel

On Thu, 2011-08-04 at 17:38 -0700, Bhanu Prakash Gollapudi wrote:
> v2 submittal:
> Minor changes to patch 5, 8 and patch 13.
> Patch 5  - Removed unnecessary printk
> Patch 8  - Added code to ignore netdev events other than UNREGISTER for vlan interface
> patch 13 - Error handling fixed for tgt_init_err.
> --------
> 
> This patchset contains bnx2fc bug fixes.  Please note that patch 15 is
> 'fcoe/libfcoe' patch, which moves LLD common code from fcoe driver to
> fcoe_transport, to enable patch 16 and 17.

So this is a nice mix of features and bug fixes ... what do I have to do
exactly to persuade you to submit the two things separately ... so they
can go through separate trees and be tagged for backport to stable if
necessary?

However, it's late and I'm tired, so I just put them in SCSI misc.  This
means that if you can separate out the bug fixes, you can submit them to
stable manually.

James


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 00/18] bnx2fc version 1.0.5
  2011-08-24  5:48 ` [PATCH v2 00/18] bnx2fc version 1.0.5 James Bottomley
@ 2011-08-24 18:29   ` Bhanu Prakash Gollapudi
  0 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-08-24 18:29 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi, michaelc, Michael Chan, robert.w.love, devel

On 8/23/2011 10:48 PM, James Bottomley wrote:
> On Thu, 2011-08-04 at 17:38 -0700, Bhanu Prakash Gollapudi wrote:
>> v2 submittal:
>> Minor changes to patch 5, 8 and patch 13.
>> Patch 5  - Removed unnecessary printk
>> Patch 8  - Added code to ignore netdev events other than UNREGISTER for vlan interface
>> patch 13 - Error handling fixed for tgt_init_err.
>> --------
>>
>> This patchset contains bnx2fc bug fixes.  Please note that patch 15 is
>> 'fcoe/libfcoe' patch, which moves LLD common code from fcoe driver to
>> fcoe_transport, to enable patch 16 and 17.
>
> So this is a nice mix of features and bug fixes ... what do I have to do
> exactly to persuade you to submit the two things separately ... so they
> can go through separate trees and be tagged for backport to stable if
> necessary?
>
> However, it's late and I'm tired, so I just put them in SCSI misc.  This
> means that if you can separate out the bug fixes, you can submit them to
> stable manually.
>
> James

James, in future, I'll make sure to submit enhancements and bug fixes in 
separate patchsets. For not, it is okay if they are merged to 3.2.

Thanks,
Bhanu
>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library
  2011-08-05  0:38 ` [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library Bhanu Prakash Gollapudi
@ 2011-09-08 11:11   ` Mike Christie
  2011-09-08 14:41     ` Bhanu Prakash Gollapudi
  0 siblings, 1 reply; 23+ messages in thread
From: Mike Christie @ 2011-09-08 11:11 UTC (permalink / raw)
  To: Bhanu Prakash Gollapudi
  Cc: JBottomley, linux-scsi, mchan, robert.w.love, devel

On 08/04/2011 07:38 PM, Bhanu Prakash Gollapudi wrote:
>  /**
> - * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
> - * @netdev: the associated net device
> - * @wwn: the output WWN
> - * @type: the type of WWN (WWPN or WWNN)
> - *
> - * Returns: 0 for success
> - */
> -static int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
> -{
> -	const struct net_device_ops *ops = netdev->netdev_ops;
> -
> -	if (ops->ndo_fcoe_get_wwn)
> -		return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
> -	return -EINVAL;
> -}
> -
> -/**



> +/**
> + * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
> + * @netdev: the associated net device
> + * @wwn: the output WWN
> + * @type: the type of WWN (WWPN or WWNN)
> + *
> + * Returns: 0 for success
> + */
> +int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
> +{
> +	const struct net_device_ops *ops = netdev->netdev_ops;
> +
> +	if (ops->ndo_fcoe_get_wwn)
> +		return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
> +	return -EINVAL;
> +}
> +EXPORT_SYMBOL_GPL(fcoe_get_wwn);
> +
>

I got a report that this is going to be a problem because the fcoe ops
like ndo_fcoe_get_wwn are defined when CONFIG_FCOE is set. That is set
for fcoe.ko. If you move functions calling those callouts to libfcoe
then it is possible CONFIG_FCOE is not set (if you were just using
bnx2fc.ko and not using fcoe.ko for example), and the build fails like this:


drivers/scsi/fcoe/fcoe_transport.c: In function ‘fcoe_get_wwn’:
drivers/scsi/fcoe/fcoe_transport.c:152: error: ‘const struct
net_device_ops’ has no member named ‘ndo_fcoe_get_wwn’
drivers/scsi/fcoe/fcoe_transport.c:153: error: ‘const struct
net_device_ops’ has no member named ‘ndo_fcoe_get_wwn’
make[3]: *** [drivers/scsi/fcoe/fcoe_transport.o] Error 1


Do we need some ifdefs in libfcoe around the ops use or should there be
some sort of lower level transport module callouts (or whatever modules
like bnxfc and fcoe are called) that libfcoe calls into so those drivers
can call into something like the netdev callouts if they use them?
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library
  2011-09-08 11:11   ` Mike Christie
@ 2011-09-08 14:41     ` Bhanu Prakash Gollapudi
  0 siblings, 0 replies; 23+ messages in thread
From: Bhanu Prakash Gollapudi @ 2011-09-08 14:41 UTC (permalink / raw)
  To: Mike Christie; +Cc: JBottomley, linux-scsi, Michael Chan, robert.w.love, devel

On 9/8/2011 4:11 AM, Mike Christie wrote:
> On 08/04/2011 07:38 PM, Bhanu Prakash Gollapudi wrote:
>>   /**
>> - * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
>> - * @netdev: the associated net device
>> - * @wwn: the output WWN
>> - * @type: the type of WWN (WWPN or WWNN)
>> - *
>> - * Returns: 0 for success
>> - */
>> -static int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
>> -{
>> -	const struct net_device_ops *ops = netdev->netdev_ops;
>> -
>> -	if (ops->ndo_fcoe_get_wwn)
>> -		return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
>> -	return -EINVAL;
>> -}
>> -
>> -/**
>
>
>
>> +/**
>> + * fcoe_get_wwn() - Get the world wide name from LLD if it supports it
>> + * @netdev: the associated net device
>> + * @wwn: the output WWN
>> + * @type: the type of WWN (WWPN or WWNN)
>> + *
>> + * Returns: 0 for success
>> + */
>> +int fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type)
>> +{
>> +	const struct net_device_ops *ops = netdev->netdev_ops;
>> +
>> +	if (ops->ndo_fcoe_get_wwn)
>> +		return ops->ndo_fcoe_get_wwn(netdev, wwn, type);
>> +	return -EINVAL;
>> +}
>> +EXPORT_SYMBOL_GPL(fcoe_get_wwn);
>> +
>>
>
> I got a report that this is going to be a problem because the fcoe ops
> like ndo_fcoe_get_wwn are defined when CONFIG_FCOE is set. That is set
> for fcoe.ko. If you move functions calling those callouts to libfcoe
> then it is possible CONFIG_FCOE is not set (if you were just using
> bnx2fc.ko and not using fcoe.ko for example), and the build fails like this:
>
>
> drivers/scsi/fcoe/fcoe_transport.c: In function ‘fcoe_get_wwn’:
> drivers/scsi/fcoe/fcoe_transport.c:152: error: ‘const struct
> net_device_ops’ has no member named ‘ndo_fcoe_get_wwn’
> drivers/scsi/fcoe/fcoe_transport.c:153: error: ‘const struct
> net_device_ops’ has no member named ‘ndo_fcoe_get_wwn’
> make[3]: *** [drivers/scsi/fcoe/fcoe_transport.o] Error 1
>
>
> Do we need some ifdefs in libfcoe around the ops use or should there be
> some sort of lower level transport module callouts (or whatever modules
> like bnxfc and fcoe are called) that libfcoe calls into so those drivers
> can call into something like the netdev callouts if they use them?
>
Mike, This change has already been submitted and applied to net-next 
tree, as the change is in netdevice.h. The flags and ndo_fcoe_get_wwn 
are now moved under CONFIG_LIBFCOE.

http://patchwork.ozlabs.org/patch/111838/


Thanks,
Bhanu


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2011-09-08 14:41 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05  0:38 [PATCH v2 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 01/18] bnx2fc: Reset the max receive frame size Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 02/18] bnx2fc: Bug fixes in percpu_thread_create/destroy Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 03/18] bnx2fc: Enable bsg_request support for bnx2fc Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 04/18] bnx2fc: Remove erroneous kref_get on IO request Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 05/18] bnx2fc: Do not attempt destroying NPIV port twice Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 06/18] bnx2fc: Change function names of bnx2fc_netdev_setup/bnx2fc_netdev_cleanup Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 07/18] bnx2fc: Reorganize cleanup code between interface_cleanup and if_destory Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 08/18] bnx2fc: Handle NETDEV_UNREGISTER for vlan devices Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 09/18] bnx2fc: Clear DESTROY_CMPL flag after firmware destroy Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 10/18] bnx2fc: Do not reuse the fcoe connection id immediately Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 11/18] bnx2fc: IO errors when receiving unsolicited LOGO Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 12/18] bnx2fc: Fix NULL pointer deref during arm_cq Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 13/18] bnx2fc: code cleanup in bnx2fc_offload_session Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 14/18] bnx2fc: Drop incoming ABTS Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library Bhanu Prakash Gollapudi
2011-09-08 11:11   ` Mike Christie
2011-09-08 14:41     ` Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 16/18] bnx2fc: Obtain WWNN/WWPN from the shared memory Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 17/18] bnx2fc: Prevent creating of NPIV port with duplicate WWN Bhanu Prakash Gollapudi
2011-08-05  0:38 ` [PATCH v2 18/18] bnx2fc: Bump version to 1.0.5 Bhanu Prakash Gollapudi
2011-08-24  5:48 ` [PATCH v2 00/18] bnx2fc version 1.0.5 James Bottomley
2011-08-24 18:29   ` Bhanu Prakash Gollapudi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.