Skip to contentSkip to conversation

bnx2fc version 1.0.5

PATCH In review Bhanu Prakash Gollapudi 3 participants 23 messages Aug 5, 2011 – Sep 8, 2011

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

v2 cover bnx2fc version 1.0.5

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(-)
#1 lore raw

PATCH v2 1/18 bnx2fc: Reset the max receive frame size

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

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +5 -0
index 7cb2cd4..ea1e6cc 100644
@@ -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);
 }
Signature · 1 line
1.7.0.6
#2 lore raw

PATCH v2 2/18 bnx2fc: Bug fixes in percpu_thread_create/destroy

In reply to Bhanu Prakash Gollapudi

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

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +2 -3
index ea1e6cc..a4770d9 100644
@@ -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);
Signature · 1 line
1.7.0.6
#3 lore raw

PATCH v2 3/18 bnx2fc: Enable bsg_request support for bnx2fc

In reply to Bhanu Prakash Gollapudi
---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +2 -0
index a4770d9..9e2bf39 100644
@@ -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,
 };
 
 /**
Signature · 1 line
1.7.0.6
#4 lore raw

PATCH v2 4/18 bnx2fc: Remove erroneous kref_get on IO request

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_io.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +0 -1
index 6cc3789..cb1791c 100644
@@ -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);
Signature · 1 line
1.7.0.6
#5 lore raw

PATCH v2 5/18 bnx2fc: Do not attempt destroying NPIV port twice

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +12 -0
index 9e2bf39..21792e7 100644
@@ -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);
Signature · 1 line
1.7.0.6
#6 lore raw

PATCH v2 6/18 bnx2fc: Change function names of bnx2fc_netdev_setup/bnx2fc_netdev_cleanup

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +6 -6
index 21792e7..407a9b8 100644
@@ -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);
Signature · 1 line
1.7.0.6
#7 lore raw

PATCH v2 7/18 bnx2fc: Reorganize cleanup code between interface_cleanup and if_destory

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   47 ++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 24 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +23 -24
index 407a9b8..673c97c 100644
@@ -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);
Signature · 1 line
1.7.0.6
#8 lore raw

PATCH v2 8/18 bnx2fc: Handle NETDEV_UNREGISTER for vlan devices

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   92 +++++++++++++++++++++++--------------
 1 files changed, 57 insertions(+), 35 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +57 -35
index 673c97c..dccabaf 100644
@@ -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);
Signature · 1 line
1.7.0.6
#9 lore raw

PATCH v2 9/18 bnx2fc: Clear DESTROY_CMPL flag after firmware destroy

In reply to Bhanu Prakash Gollapudi

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

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +3 -2
index dccabaf..ca2e206 100644
@@ -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);
Signature · 1 line
1.7.0.6
#10 lore raw

PATCH v2 10/18 bnx2fc: Do not reuse the fcoe connection id immediately

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_tgt.c +0 -1
index d5311b5..3d28fbe 100644
@@ -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);
 }
 
Signature · 1 line
1.7.0.6
#11 lore raw

PATCH v2 11/18 bnx2fc: IO errors when receiving unsolicited LOGO

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_io.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_io.c +0 -6
index cb1791c..120618d 100644
@@ -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.
Signature · 1 line
1.7.0.6
#12 lore raw

PATCH v2 12/18 bnx2fc: Fix NULL pointer deref during arm_cq.

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_hwi.c |   10 +++++++---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |   19 +++++++++++--------
 2 files changed, 18 insertions(+), 11 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_hwi.c +7 -3
index 72cfb14..b241f3d 100644
@@ -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);
drivers/scsi/bnx2fc/bnx2fc_tgt.c +11 -8
index 3d28fbe..2f7a7da 100644
@@ -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);
 }
Signature · 1 line
1.7.0.6
#13 lore raw

PATCH v2 13/18 bnx2fc: code cleanup in bnx2fc_offload_session

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_tgt.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_tgt.c +3 -4
index 2f7a7da..2138da9 100644
@@ -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;
 }
 
Signature · 1 line
1.7.0.6
#14 lore raw

PATCH v2 14/18 bnx2fc: Drop incoming ABTS

In reply to Bhanu Prakash Gollapudi

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

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +8 -0
index ca2e206..62c0e94 100644
@@ -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)
Signature · 1 line
1.7.0.6
#15 lore raw

PATCH v2 15/18 fcoe: Move common functions to fcoe_transport library

In reply to 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.

---
 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(-)
drivers/scsi/fcoe/fcoe.c +1 -65
index ba710e3..c30fa27 100644
@@ -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;
-}
drivers/scsi/fcoe/fcoe.h +0 -10
index c4a9399..408a6fd 100644
@@ -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_ */
drivers/scsi/fcoe/fcoe_transport.c +72 -0

78 lines not on this page · raw message

include/scsi/libfcoe.h +3 -0
index 8c1638b..0b2f843 100644
@@ -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.
Signature · 1 line
1.7.0.6
#16 lore raw

Re: [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library

Quoted 30 lines · Bhanu Prakash Gollapudi

/**
- * 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
- */

(quoted diff) +8 -10
-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
+ */

Review

Quoted 10 lines
(quoted diff) +10 -0
+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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw

Re: [PATCH v2 15/18] fcoe: Move common functions to fcoe_transport library

Quoted 57 lines · Mike Christie
Quoted 30 lines · Bhanu Prakash Gollapudi

/**
- * 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
- */

(quoted diff) +8 -10
-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
+ */

Review

Quoted 10 lines
(quoted diff) +10 -0
+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

Quoted 5 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#18 lore raw

PATCH v2 16/18 bnx2fc: Obtain WWNN/WWPN from the shared memory

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +9 -5
index 62c0e94..25d3bcd 100644
@@ -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;
Signature · 1 line
1.7.0.6
#19 lore raw

PATCH v2 17/18 bnx2fc: Prevent creating of NPIV port with duplicate WWN

In reply to 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.

---
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +11 -0
index 25d3bcd..351ca4c 100644
@@ -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"
Signature · 1 line
1.7.0.6
#20 lore raw

PATCH v2 18/18 bnx2fc: Bump version to 1.0.5

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 42228ca..903e8f6 100644
@@ -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: "
 
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -1
index 351ca4c..e6c9879 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	"Jun 23, 2011"
+#define DRV_MODULE_RELDATE	"Aug 03, 2011"
 
 
 static char version[] __devinitdata =
Signature · 1 line
1.7.0.6
#21 lore raw
In reply to Bhanu Prakash Gollapudi
Quoted 10 lines · 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.

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

#22 lore raw
Quoted 17 lines · James Bottomley
Quoted 10 lines · 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.

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?

Quoted 5 lines

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

Quoted 1 line