From: "Bhanu Prakash Gollapudi" <bprakash@broadcom.com>
To: JBottomley@parallels.com, linux-scsi@vger.kernel.org
Cc: michaelc@cs.wisc.edu, mchan@broadcom.com,
robert.w.love@intel.com, devel@open-fcoe.org,
Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Subject: [PATCH 07/18] bnx2fc: Reorganize cleanup code between interface_cleanup and if_destory
Date: Thu, 4 Aug 2011 11:47:02 -0700 [thread overview]
Message-ID: <1312483633-479-8-git-send-email-bprakash@broadcom.com> (raw)
In-Reply-To: <1312483633-479-1-git-send-email-bprakash@broadcom.com>
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 8760461..d87ab8d 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1385,16 +1385,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);
@@ -1402,6 +1396,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);
@@ -1418,15 +1430,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);
}
@@ -1444,7 +1447,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;
@@ -1458,7 +1460,6 @@ static int bnx2fc_destroy(struct net_device *netdev)
goto netdev_err;
}
- hba = interface->hba;
bnx2fc_interface_cleanup(interface);
lport = interface->ctlr.lp;
@@ -1466,7 +1467,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);
@@ -1479,19 +1480,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();
}
@@ -2064,7 +2063,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
next prev parent reply other threads:[~2011-08-04 18:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-04 18:46 [PATCH 00/18] bnx2fc version 1.0.5 Bhanu Prakash Gollapudi
2011-08-04 18:46 ` [PATCH 01/18] bnx2fc: Reset the max receive frame size Bhanu Prakash Gollapudi
2011-08-04 18:46 ` [PATCH 02/18] bnx2fc: Bug fixes in percpu_thread_create/destroy Bhanu Prakash Gollapudi
2011-08-04 18:46 ` [PATCH 03/18] bnx2fc: Enable bsg_request support for bnx2fc Bhanu Prakash Gollapudi
2011-08-04 18:46 ` [PATCH 04/18] bnx2fc: Remove erroneous kref_get on IO request Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 05/18] bnx2fc: Do not attempt destroying NPIV port twice Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 06/18] bnx2fc: Change function names of bnx2fc_netdev_setup/bnx2fc_netdev_cleanup Bhanu Prakash Gollapudi
2011-08-04 18:47 ` Bhanu Prakash Gollapudi [this message]
2011-08-04 18:47 ` [PATCH 08/18] bnx2fc: Handle NETDEV_UNREGISTER for vlan devices Bhanu Prakash Gollapudi
2011-08-18 23:52 ` Bhanu Gollapudi
2011-08-24 20:40 ` Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 09/18] bnx2fc: Clear DESTROY_CMPL flag after firmware destroy Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 10/18] bnx2fc: Do not reuse the fcoe connection id immediately Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 11/18] bnx2fc: IO errors when receiving unsolicited LOGO Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 12/18] bnx2fc: Fix NULL pointer deref during arm_cq Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 13/18] bnx2fc: code cleanup in bnx2fc_offload_session Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 14/18] bnx2fc: Drop incoming ABTS Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 15/18] fcoe: Move common functions to fcoe_transport library Bhanu Prakash Gollapudi
2011-08-04 23:09 ` Zou, Yi
2011-08-04 18:47 ` [PATCH 16/18] bnx2fc: Obtain WWNN/WWPN from the shared memory Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 17/18] bnx2fc: Prevent creating of NPIV port with duplicate WWN Bhanu Prakash Gollapudi
2011-08-04 18:47 ` [PATCH 18/18] bnx2fc: Bump version to 1.0.5 Bhanu Prakash Gollapudi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1312483633-479-8-git-send-email-bprakash@broadcom.com \
--to=bprakash@broadcom.com \
--cc=JBottomley@parallels.com \
--cc=devel@open-fcoe.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mchan@broadcom.com \
--cc=michaelc@cs.wisc.edu \
--cc=robert.w.love@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox