Commit 7adc5a37 authored by Bhanu Prakash Gollapudi's avatar Bhanu Prakash Gollapudi Committed by James Bottomley

[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: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 3db8cc10
...@@ -2019,11 +2019,11 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) ...@@ -2019,11 +2019,11 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
struct fcoe_ctlr *ctlr; struct fcoe_ctlr *ctlr;
struct bnx2fc_interface *interface; struct bnx2fc_interface *interface;
struct bnx2fc_hba *hba; struct bnx2fc_hba *hba;
struct net_device *phys_dev; struct net_device *phys_dev = netdev;
struct fc_lport *lport; struct fc_lport *lport;
struct ethtool_drvinfo drvinfo; struct ethtool_drvinfo drvinfo;
int rc = 0; int rc = 0;
int vlan_id; int vlan_id = 0;
BNX2FC_MISC_DBG("Entered bnx2fc_create\n"); BNX2FC_MISC_DBG("Entered bnx2fc_create\n");
if (fip_mode != FIP_MODE_FABRIC) { if (fip_mode != FIP_MODE_FABRIC) {
...@@ -2041,14 +2041,9 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) ...@@ -2041,14 +2041,9 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
} }
/* obtain physical netdev */ /* obtain physical netdev */
if (netdev->priv_flags & IFF_802_1Q_VLAN) { if (netdev->priv_flags & IFF_802_1Q_VLAN)
phys_dev = vlan_dev_real_dev(netdev); phys_dev = vlan_dev_real_dev(netdev);
vlan_id = vlan_dev_vlan_id(netdev);
} else {
printk(KERN_ERR PFX "Not a vlan device\n");
rc = -EINVAL;
goto netdev_err;
}
/* verify if the physical device is a netxtreme2 device */ /* verify if the physical device is a netxtreme2 device */
if (phys_dev->ethtool_ops && phys_dev->ethtool_ops->get_drvinfo) { if (phys_dev->ethtool_ops && phys_dev->ethtool_ops->get_drvinfo) {
memset(&drvinfo, 0, sizeof(drvinfo)); memset(&drvinfo, 0, sizeof(drvinfo));
...@@ -2083,9 +2078,13 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode) ...@@ -2083,9 +2078,13 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
goto ifput_err; goto ifput_err;
} }
if (netdev->priv_flags & IFF_802_1Q_VLAN) {
vlan_id = vlan_dev_vlan_id(netdev);
interface->vlan_enabled = 1;
}
ctlr = bnx2fc_to_ctlr(interface); ctlr = bnx2fc_to_ctlr(interface);
interface->vlan_id = vlan_id; interface->vlan_id = vlan_id;
interface->vlan_enabled = 1;
interface->timer_work_queue = interface->timer_work_queue =
create_singlethread_workqueue("bnx2fc_timer_wq"); create_singlethread_workqueue("bnx2fc_timer_wq");
...@@ -2252,15 +2251,17 @@ static int bnx2fc_fcoe_reset(struct Scsi_Host *shost) ...@@ -2252,15 +2251,17 @@ static int bnx2fc_fcoe_reset(struct Scsi_Host *shost)
static bool bnx2fc_match(struct net_device *netdev) static bool bnx2fc_match(struct net_device *netdev)
{ {
struct net_device *phys_dev = netdev;
mutex_lock(&bnx2fc_dev_lock); mutex_lock(&bnx2fc_dev_lock);
if (netdev->priv_flags & IFF_802_1Q_VLAN) { if (netdev->priv_flags & IFF_802_1Q_VLAN)
struct net_device *phys_dev = vlan_dev_real_dev(netdev); phys_dev = vlan_dev_real_dev(netdev);
if (bnx2fc_hba_lookup(phys_dev)) { if (bnx2fc_hba_lookup(phys_dev)) {
mutex_unlock(&bnx2fc_dev_lock); mutex_unlock(&bnx2fc_dev_lock);
return true; return true;
}
} }
mutex_unlock(&bnx2fc_dev_lock); mutex_unlock(&bnx2fc_dev_lock);
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment