From: Robert Love <robert.w.love@intel.com>
To: linux-scsi@vger.kernel.org
Cc: Ross Brattain <ross.b.brattain@intel.com>
Subject: [PATCH 10/12] fcoe: Remove reference counting on 'stuct fcoe_interface'
Date: Fri, 10 Feb 2012 17:18:46 -0800 [thread overview]
Message-ID: <20120211011846.7668.12007.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20120211011754.7668.51489.stgit@localhost6.localdomain6>
The reference counting was necessary on these instances
because it was possible for NPIV ports to be destroyed
after the N_Port. A previous patch ensures that all NPIV
ports are destroyed before the N_Port making the need to
track references on the interface unnecessary.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
---
drivers/scsi/fcoe/fcoe.c | 48 +++++-----------------------------------------
drivers/scsi/fcoe/fcoe.h | 3 ---
2 files changed, 5 insertions(+), 46 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index f5286c4..0233242 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -376,7 +376,6 @@ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev,
}
dev_hold(netdev);
- kref_init(&fcoe->kref);
/*
* Initialize FIP.
@@ -404,42 +403,6 @@ out:
}
/**
- * fcoe_interface_release() - fcoe_port kref release function
- * @kref: Embedded reference count in an fcoe_interface struct
- */
-static void fcoe_interface_release(struct kref *kref)
-{
- struct fcoe_interface *fcoe;
- struct net_device *netdev;
-
- fcoe = container_of(kref, struct fcoe_interface, kref);
- netdev = fcoe->netdev;
- /* tear-down the FCoE controller */
- fcoe_ctlr_destroy(&fcoe->ctlr);
- kfree(fcoe);
- dev_put(netdev);
- module_put(THIS_MODULE);
-}
-
-/**
- * fcoe_interface_get() - Get a reference to a FCoE interface
- * @fcoe: The FCoE interface to be held
- */
-static inline void fcoe_interface_get(struct fcoe_interface *fcoe)
-{
- kref_get(&fcoe->kref);
-}
-
-/**
- * fcoe_interface_put() - Put a reference to a FCoE interface
- * @fcoe: The FCoE interface to be released
- */
-static inline void fcoe_interface_put(struct fcoe_interface *fcoe)
-{
- kref_put(&fcoe->kref, fcoe_interface_release);
-}
-
-/**
* fcoe_interface_cleanup() - Clean up a FCoE interface
* @fcoe: The FCoE interface to be cleaned up
*
@@ -486,7 +449,11 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
rtnl_unlock();
/* Release the self-reference taken during fcoe_interface_create() */
- fcoe_interface_put(fcoe);
+ /* tear-down the FCoE controller */
+ fcoe_ctlr_destroy(fip);
+ kfree(fcoe);
+ dev_put(netdev);
+ module_put(THIS_MODULE);
}
/**
@@ -968,9 +935,6 @@ static void fcoe_if_destroy(struct fc_lport *lport)
dev_uc_del(netdev, port->data_src_addr);
rtnl_unlock();
- /* Release reference held in fcoe_if_create() */
- fcoe_interface_put(fcoe);
-
/* Free queued packets for the per-CPU receive threads */
fcoe_percpu_clean(lport);
@@ -1160,7 +1124,6 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
goto out_lp_destroy;
}
- fcoe_interface_get(fcoe);
return lport;
out_lp_destroy:
@@ -2105,7 +2068,6 @@ static void fcoe_destroy_work(struct work_struct *work)
fcoe = port->priv;
fcoe_if_destroy(port->lport);
-
fcoe_interface_cleanup(fcoe);
mutex_unlock(&fcoe_config_mutex);
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h
index bcc89e6..3c2733a 100644
--- a/drivers/scsi/fcoe/fcoe.h
+++ b/drivers/scsi/fcoe/fcoe.h
@@ -71,8 +71,6 @@ do { \
* @ctlr: The FCoE controller (for FIP)
* @oem: The offload exchange manager for all local port
* instances associated with this port
- * @kref: The kernel reference
- *
* This structure is 1:1 with a net devive.
*/
struct fcoe_interface {
@@ -83,7 +81,6 @@ struct fcoe_interface {
struct packet_type fip_packet_type;
struct fcoe_ctlr ctlr;
struct fc_exch_mgr *oem;
- struct kref kref;
};
#define fcoe_from_ctlr(fip) container_of(fip, struct fcoe_interface, ctlr)
next prev parent reply other threads:[~2012-02-11 1:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-11 1:17 [PATCH 00/12] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
2012-02-11 1:17 ` [PATCH 01/12] libfcoe: Don't KERN_ERR on netdev notification Robert Love
2012-02-11 1:18 ` [PATCH 02/12] scsi_transport_fc: Add FDMI host attributes Robert Love
2012-02-11 1:18 ` [PATCH 03/12] scsi_transport_fc: Getting FC Port Speed in sync with FC-GS Robert Love
2012-02-11 1:18 ` [PATCH 04/12] libfc: Make the libfc Common Transport(CT) code generic Robert Love
2012-02-11 1:18 ` [PATCH 05/12] libfc: Add support for FDMI Robert Love
2012-02-11 1:18 ` [PATCH 06/12] fcoe: Add support for FDMI in fcoe Robert Love
2012-02-11 1:18 ` [PATCH 07/12] fcoe: Allow exposing FDMI attributes via sysfs Robert Love
2012-02-11 1:18 ` [PATCH 08/12] fcoe: Rename out_nomod label to out_putmod Robert Love
2012-02-11 1:18 ` [PATCH 09/12] fcoe: Do not switch context in vport_delete callback Robert Love
2012-02-11 1:18 ` Robert Love [this message]
2012-02-11 1:18 ` [PATCH 11/12] libfc: Fix panic in fc_exch_recv Robert Love
2012-02-11 1:18 ` [PATCH 12/12] libfc: Handle discovery failure during ctlr link down Robert Love
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=20120211011846.7668.12007.stgit@localhost6.localdomain6 \
--to=robert.w.love@intel.com \
--cc=linux-scsi@vger.kernel.org \
--cc=ross.b.brattain@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;
as well as URLs for NNTP newsgroup(s).