aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBhanu Prakash Gollapudi <bprakash@broadcom.com>2011-08-30 18:54:48 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-09-17 10:01:58 -0400
commit8a5badf1ea10c726b9cc04e52f91395b1248e034 (patch)
tree8582d19380586f787b444116f7e8e5f02e3b3d86
parentc780673cfb1e3d16d23f9808738539625d3b9363 (diff)
[SCSI] bnx2fc: Send solicitation only after vlan discovery is complete
Link up event is generated to the driver even before vlan discovery has started. Because of this driver can send discovery solicitation on a stale vlan. Call fcoe_ctlr_link_up() only when the driver is in enabled state, which implies the vlan discovery is complete before sending solicitation. Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc.h1
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c21
2 files changed, 18 insertions, 4 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h
index 903e8f64980..02535e8d9e0 100644
--- a/drivers/scsi/bnx2fc/bnx2fc.h
+++ b/drivers/scsi/bnx2fc/bnx2fc.h
@@ -224,6 +224,7 @@ struct bnx2fc_interface {
224 struct fcoe_ctlr ctlr; 224 struct fcoe_ctlr ctlr;
225 u8 vlan_enabled; 225 u8 vlan_enabled;
226 int vlan_id; 226 int vlan_id;
227 bool enabled;
227}; 228};
228 229
229#define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_interface, ctlr) 230#define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_interface, ctlr)
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 6387067b91a..ba88ddb4580 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -865,8 +865,11 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
865 if (link_possible && !bnx2fc_link_ok(lport)) { 865 if (link_possible && !bnx2fc_link_ok(lport)) {
866 /* Reset max recv frame size to default */ 866 /* Reset max recv frame size to default */
867 fc_set_mfs(lport, BNX2FC_MFS); 867 fc_set_mfs(lport, BNX2FC_MFS);
868 printk(KERN_ERR "indicate_netevent: ctlr_link_up\n"); 868 /*
869 fcoe_ctlr_link_up(&interface->ctlr); 869 * ctlr link up will only be handled during
870 * enable to avoid sending discovery solicitation
871 * on a stale vlan
872 */
870 } else if (fcoe_ctlr_link_down(&interface->ctlr)) { 873 } else if (fcoe_ctlr_link_down(&interface->ctlr)) {
871 mutex_lock(&lport->lp_mutex); 874 mutex_lock(&lport->lp_mutex);
872 list_for_each_entry(vport, &lport->vports, list) 875 list_for_each_entry(vport, &lport->vports, list)
@@ -1784,7 +1787,7 @@ static void bnx2fc_start_disc(struct bnx2fc_interface *interface)
1784 lport = interface->ctlr.lp; 1787 lport = interface->ctlr.lp;
1785 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n"); 1788 BNX2FC_HBA_DBG(lport, "calling fc_fabric_login\n");
1786 1789
1787 if (!bnx2fc_link_ok(lport)) { 1790 if (!bnx2fc_link_ok(lport) && interface->enabled) {
1788 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n"); 1791 BNX2FC_HBA_DBG(lport, "ctlr_link_up\n");
1789 fcoe_ctlr_link_up(&interface->ctlr); 1792 fcoe_ctlr_link_up(&interface->ctlr);
1790 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT; 1793 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
@@ -1866,6 +1869,7 @@ static int bnx2fc_disable(struct net_device *netdev)
1866 rc = -ENODEV; 1869 rc = -ENODEV;
1867 printk(KERN_ERR PFX "bnx2fc_disable: interface or lport not found\n"); 1870 printk(KERN_ERR PFX "bnx2fc_disable: interface or lport not found\n");
1868 } else { 1871 } else {
1872 interface->enabled = false;
1869 fcoe_ctlr_link_down(&interface->ctlr); 1873 fcoe_ctlr_link_down(&interface->ctlr);
1870 fcoe_clean_pending_queue(interface->ctlr.lp); 1874 fcoe_clean_pending_queue(interface->ctlr.lp);
1871 } 1875 }
@@ -1888,8 +1892,10 @@ static int bnx2fc_enable(struct net_device *netdev)
1888 if (!interface || !interface->ctlr.lp) { 1892 if (!interface || !interface->ctlr.lp) {
1889 rc = -ENODEV; 1893 rc = -ENODEV;
1890 printk(KERN_ERR PFX "bnx2fc_enable: interface or lport not found\n"); 1894 printk(KERN_ERR PFX "bnx2fc_enable: interface or lport not found\n");
1891 } else if (!bnx2fc_link_ok(interface->ctlr.lp)) 1895 } else if (!bnx2fc_link_ok(interface->ctlr.lp)) {
1892 fcoe_ctlr_link_up(&interface->ctlr); 1896 fcoe_ctlr_link_up(&interface->ctlr);
1897 interface->enabled = true;
1898 }
1893 1899
1894 mutex_unlock(&bnx2fc_dev_lock); 1900 mutex_unlock(&bnx2fc_dev_lock);
1895 rtnl_unlock(); 1901 rtnl_unlock();
@@ -2002,8 +2008,15 @@ static int bnx2fc_create(struct net_device *netdev, enum fip_state fip_mode)
2002 /* Make this master N_port */ 2008 /* Make this master N_port */
2003 interface->ctlr.lp = lport; 2009 interface->ctlr.lp = lport;
2004 2010
2011 if (!bnx2fc_link_ok(lport)) {
2012 fcoe_ctlr_link_up(&interface->ctlr);
2013 fc_host_port_type(lport->host) = FC_PORTTYPE_NPORT;
2014 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state);
2015 }
2016
2005 BNX2FC_HBA_DBG(lport, "create: START DISC\n"); 2017 BNX2FC_HBA_DBG(lport, "create: START DISC\n");
2006 bnx2fc_start_disc(interface); 2018 bnx2fc_start_disc(interface);
2019 interface->enabled = true;
2007 /* 2020 /*
2008 * Release from kref_init in bnx2fc_interface_setup, on success 2021 * Release from kref_init in bnx2fc_interface_setup, on success
2009 * lport should be holding a reference taken in bnx2fc_if_create 2022 * lport should be holding a reference taken in bnx2fc_if_create