]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[SCSI] fcoe: Use LLD's WWPN and WWNN for lport if LLD supports ndo_fcoe_get_wwn
authorYi Zou <yi.zou@intel.com>
Fri, 20 Nov 2009 23:22:21 +0000 (15:22 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Thu, 10 Dec 2009 15:45:53 +0000 (09:45 -0600)
If the LLD wants its own WWNN/WWPN to be used, it should implement the
netdev_ops.ndo_fcoe_get_wwn(). If that is the case, we query the LLD and use
the queried WWNN/WWPN from the LLD.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/fcoe/fcoe.c

index a30ffaa1222c4fa3e1eb05b0f8f780bd10d5dbe8..9b6aebbb47d363d04db34752c604eab1dd3da567 100644 (file)
@@ -544,6 +544,23 @@ static void fcoe_queue_timer(ulong lport)
        fcoe_check_wait_queue((struct fc_lport *)lport, NULL);
 }
 
+/**
+ * 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_config() - Set up net devive for SW FCoE
  * @lport:  The local port that is associated with the net device
@@ -611,9 +628,13 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev)
                 */
                if (netdev->priv_flags & IFF_802_1Q_VLAN)
                        vid = vlan_dev_vlan_id(netdev);
-               wwnn = fcoe_wwn_from_mac(fcoe->ctlr.ctl_src_addr, 1, 0);
+
+               if (fcoe_get_wwn(netdev, &wwnn, NETDEV_FCOE_WWNN))
+                       wwnn = fcoe_wwn_from_mac(fcoe->ctlr.ctl_src_addr, 1, 0);
                fc_set_wwnn(lport, wwnn);
-               wwpn = fcoe_wwn_from_mac(fcoe->ctlr.ctl_src_addr, 2, vid);
+               if (fcoe_get_wwn(netdev, &wwpn, NETDEV_FCOE_WWPN))
+                       wwpn = fcoe_wwn_from_mac(fcoe->ctlr.ctl_src_addr,
+                                                2, vid);
                fc_set_wwpn(lport, wwpn);
        }