aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
diff options
context:
space:
mode:
authorBhanu Prakash Gollapudi <bprakash@broadcom.com>2012-06-04 19:15:44 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-07-20 03:58:19 -0400
commit7adc5a3746553971c13fdebc75d6ac1678638d94 (patch)
tree947cda934dfec36705ff4580416e545f3d23d0ab /drivers/scsi/bnx2fc/bnx2fc_fcoe.c
parent3db8cc106569aa81088ee83d46f52a631471811c (diff)
[SCSI] bnx2fc: Support interface creation on non-VLAN interface also.
bnx2fc had an assumption that the fcoe interface will always start on the vlan dev. However, some switch implementations (Eg., HP virtual connect FlexFabric) expects the fcoe interface to be started on physical interface. Do not error out if the netdev is not a vlan dev. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bnx2fc/bnx2fc_fcoe.c')
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 9eefa8be605f..17ab9f7d2e26 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2019,11 +2019,11 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
2019 struct fcoe_ctlr *ctlr; 2019 struct fcoe_ctlr *ctlr;
2020 struct bnx2fc_interface *interface; 2020 struct bnx2fc_interface *interface;
2021 struct bnx2fc_hba *hba; 2021 struct bnx2fc_hba *hba;
2022 struct net_device *phys_dev; 2022 struct net_device *phys_dev = netdev;
2023 struct fc_lport *lport; 2023 struct fc_lport *lport;
2024 struct ethtool_drvinfo drvinfo; 2024 struct ethtool_drvinfo drvinfo;
2025 int rc = 0; 2025 int rc = 0;
2026 int vlan_id; 2026 int vlan_id = 0;
2027 2027
2028 BNX2FC_MISC_DBG("Entered bnx2fc_create\n"); 2028 BNX2FC_MISC_DBG("Entered bnx2fc_create\n");
2029 if (fip_mode != FIP_MODE_FABRIC) { 2029 if (fip_mode != FIP_MODE_FABRIC) {
@@ -2041,14 +2041,9 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
2041 } 2041 }
2042 2042
2043 /* obtain physical netdev */ 2043 /* obtain physical netdev */
2044 if (netdev->priv_flags & IFF_802_1Q_VLAN) { 2044 if (netdev->priv_flags & IFF_802_1Q_VLAN)
2045 phys_dev = vlan_dev_real_dev(netdev); 2045 phys_dev = vlan_dev_real_dev(netdev);
2046 vlan_id = vlan_dev_vlan_id(netdev); 2046
2047 } else {
2048 printk(KERN_ERR PFX "Not a vlan device\n");
2049 rc = -EINVAL;
2050 goto netdev_err;
2051 }
2052 /* verify if the physical device is a netxtreme2 device */ 2047 /* verify if the physical device is a netxtreme2 device */
2053 if (phys_dev->ethtool_ops && phys_dev->ethtool_ops->get_drvinfo) { 2048 if (phys_dev->ethtool_ops && phys_dev->ethtool_ops->get_drvinfo) {
2054 memset(&drvinfo, 0, sizeof(drvinfo)); 2049 memset(&drvinfo, 0, sizeof(drvinfo));
@@ -2083,9 +2078,13 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
2083 goto ifput_err; 2078 goto ifput_err;
2084 } 2079 }
2085 2080
2081 if (netdev->priv_flags & IFF_802_1Q_VLAN) {
2082 vlan_id = vlan_dev_vlan_id(netdev);
2083 interface->vlan_enabled = 1;
2084 }
2085
2086 ctlr = bnx2fc_to_ctlr(interface); 2086 ctlr = bnx2fc_to_ctlr(interface);
2087 interface->vlan_id = vlan_id; 2087 interface->vlan_id = vlan_id;
2088 interface->vlan_enabled = 1;
2089 2088
2090 interface->timer_work_queue = 2089 interface->timer_work_queue =
2091 create_singlethread_workqueue("bnx2fc_timer_wq"); 2090 create_singlethread_workqueue("bnx2fc_timer_wq");
@@ -2252,15 +2251,17 @@ static int bnx2fc_fcoe_reset(struct Scsi_Host *shost)
2252 2251
2253static bool bnx2fc_match(struct net_device *netdev) 2252static bool bnx2fc_match(struct net_device *netdev)
2254{ 2253{
2254 struct net_device *phys_dev = netdev;
2255
2255 mutex_lock(&bnx2fc_dev_lock); 2256 mutex_lock(&bnx2fc_dev_lock);
2256 if (netdev->priv_flags & IFF_802_1Q_VLAN) { 2257 if (netdev->priv_flags & IFF_802_1Q_VLAN)
2257 struct net_device *phys_dev = vlan_dev_real_dev(netdev); 2258 phys_dev = vlan_dev_real_dev(netdev);
2258 2259
2259 if (bnx2fc_hba_lookup(phys_dev)) { 2260 if (bnx2fc_hba_lookup(phys_dev)) {
2260 mutex_unlock(&bnx2fc_dev_lock); 2261 mutex_unlock(&bnx2fc_dev_lock);
2261 return true; 2262 return true;
2262 }
2263 } 2263 }
2264
2264 mutex_unlock(&bnx2fc_dev_lock); 2265 mutex_unlock(&bnx2fc_dev_lock);
2265 return false; 2266 return false;
2266} 2267}