[Open-FCoE] [RFC PATCH V4 09/16] fcoe: move offload exchange manager pointer from fcoe_port to fcoe_interface

Chris Leech christopher.leech at intel.com
Thu Jul 16 23:22:41 UTC 2009


The offload EM pointer is only used when setting up a new libfc instance, but
as it's designed to be shared among NPIV VN_Ports it should be tracked in
fcoe_interface.

With the host-list changed to track fcoe_interfaces as well, this is needed
before we can remove the priv pointer from that structure (which is only there
to help in the transition, and stops making sense once NPIV is enabled).

Signed-off-by: Chris Leech <christopher.leech at intel.com>
---

 drivers/scsi/fcoe/fcoe.c |   14 ++++++--------
 drivers/scsi/fcoe/fcoe.h |    2 +-
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index a1d8fee..979f543 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -437,7 +437,6 @@ bool fcoe_oem_match(struct fc_frame *fp)
 static inline int fcoe_em_config(struct fc_lport *lp)
 {
 	struct fcoe_port *port = lport_priv(lp);
-	struct fcoe_port *oldport = NULL;
 	struct fcoe_interface *fcoe = port->fcoe;
 	struct fcoe_interface *oldfcoe = NULL;
 	u16 min_xid = FCOE_MIN_XID;
@@ -458,24 +457,23 @@ static inline int fcoe_em_config(struct fc_lport *lp)
 	 */
 	list_for_each_entry(oldfcoe, &fcoe_hostlist, list) {
 		if (oldfcoe->phys_dev == fcoe->phys_dev) {
-			oldport = oldfcoe->priv;
-			port->oem = oldport->oem;
+			fcoe->oem = oldfcoe->oem;
 			break;
 		}
 	}
 
-	if (port->oem) {
-		if (!fc_exch_mgr_add(lp, port->oem, fcoe_oem_match)) {
+	if (fcoe->oem) {
+		if (!fc_exch_mgr_add(lp, fcoe->oem, fcoe_oem_match)) {
 			printk(KERN_ERR "fcoe_em_config: failed to add "
 			       "offload em:%p on interface:%s\n",
-			       port->oem, fcoe->real_dev->name);
+			       fcoe->oem, fcoe->real_dev->name);
 			return -ENOMEM;
 		}
 	} else {
-		port->oem = fc_exch_mgr_alloc(lp, FC_CLASS_3,
+		fcoe->oem = fc_exch_mgr_alloc(lp, FC_CLASS_3,
 					    FCOE_MIN_XID, lp->lro_xid,
 					    fcoe_oem_match);
-		if (!port->oem) {
+		if (!fcoe->oem) {
 			printk(KERN_ERR "fcoe_em_config: failed to allocate "
 			       "em for offload exches on interface:%s\n",
 			       fcoe->real_dev->name);
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h
index 3d83ad9..a86cab1 100644
--- a/drivers/scsi/fcoe/fcoe.h
+++ b/drivers/scsi/fcoe/fcoe.h
@@ -87,6 +87,7 @@ struct fcoe_interface {
 	struct packet_type  fcoe_packet_type;
 	struct packet_type  fip_packet_type;
 	struct fcoe_ctlr ctlr;
+	struct fc_exch_mgr *oem;		/* offload exchange manager */
 };
 
 /*
@@ -95,7 +96,6 @@ struct fcoe_interface {
  */
 struct fcoe_port {
 	struct fcoe_interface *fcoe;
-	struct fc_exch_mgr *oem;		/* offload exchange manger */
 	struct sk_buff_head fcoe_pending_queue;
 	u8	fcoe_pending_queue_active;
 	struct timer_list timer;		/* queue timer */




More information about the devel mailing list