Adds support to fcoe_port's newly added get_netdev fucntion pointer.

Signed-off-by: Yi Zou <[email protected]>
---

 drivers/scsi/fcoe/fcoe.c |   11 +++++++++++
 drivers/scsi/fcoe/fcoe.h |   10 ----------
 include/scsi/libfcoe.h   |   12 ++++++++++++
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index ff5e45b..eaf968b 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1073,6 +1073,16 @@ static int fcoe_ddp_done(struct fc_lport *lport, u16 xid)
 }
 
 /**
+ * fcoe_netdev() - Return the net device associated with a local port
+ * @lport: The local port to get the net device from
+ */
+static struct net_device *fcoe_get_netdev(const struct fc_lport *lport)
+{
+       return ((struct fcoe_interface *)
+               ((struct fcoe_port *)lport_priv(lport))->priv)->netdev;
+}
+
+/**
  * fcoe_if_create() - Create a FCoE instance on an interface
  * @fcoe:   The FCoE interface to create a local port on
  * @parent: The device pointer to be the parent in sysfs for the SCSI host
@@ -1112,6 +1122,7 @@ static struct fc_lport *fcoe_if_create(struct 
fcoe_interface *fcoe,
        port = lport_priv(lport);
        port->lport = lport;
        port->priv = fcoe;
+       port->get_netdev = fcoe_get_netdev;
        port->max_queue_depth = FCOE_MAX_QUEUE_DEPTH;
        port->min_queue_depth = FCOE_MIN_QUEUE_DEPTH;
        INIT_WORK(&port->destroy_work, fcoe_destroy_work);
diff --git a/drivers/scsi/fcoe/fcoe.h b/drivers/scsi/fcoe/fcoe.h
index b42dc32..34a9994 100644
--- a/drivers/scsi/fcoe/fcoe.h
+++ b/drivers/scsi/fcoe/fcoe.h
@@ -91,14 +91,4 @@ struct fcoe_interface {
 #define fcoe_from_ctlr(x)                      \
        ((struct fcoe_interface *)((x) + 1))
 
-/**
- * fcoe_netdev() - Return the net device associated with a local port
- * @lport: The local port to get the net device from
- */
-static inline struct net_device *fcoe_netdev(const struct fc_lport *lport)
-{
-       return ((struct fcoe_interface *)
-                       ((struct fcoe_port *)lport_priv(lport))->priv)->netdev;
-}
-
 #endif /* _FCOE_H_ */
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 37ead4d..d0a6674 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -349,6 +349,18 @@ struct fcoe_port {
        u8                    data_src_addr[ETH_ALEN];
        struct net_device * (*get_netdev)(const struct fc_lport *lport);
 };
+
+/**
+ * fcoe_netdev() - Return the net device associated with a local port
+ * @lport: The local port to get the net device from
+ */
+static inline struct net_device *fcoe_netdev(const struct fc_lport *lport)
+{
+       struct fcoe_port *port = ((struct fcoe_port *)lport_priv(lport));
+
+       return (port->get_netdev) ? port->get_netdev(lport) : NULL;
+}
+
 void fcoe_clean_pending_queue(struct fc_lport *);
 void fcoe_check_wait_queue(struct fc_lport *lport, struct sk_buff *skb);
 void fcoe_queue_timer(ulong lport);

_______________________________________________
devel mailing list
[email protected]
https://lists.open-fcoe.org/mailman/listinfo/devel

Reply via email to