netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-26] cxgb4vf: recover from failure in cxgb4vf_open()
@ 2011-01-11 21:57 Casey Leedom
  2011-01-11 23:44 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Casey Leedom @ 2011-01-11 21:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, Casey Leedom

If the Link Start fails in cxgb4vf_open(), we need to back out any state
that we've built up ...

Signed-off-by: Casey Leedom <leedom@chelsio.com>
---
 drivers/net/cxgb4vf/cxgb4vf_main.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 3c403f8..56166ae 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -749,13 +749,19 @@ static int cxgb4vf_open(struct net_device *dev)
 	netif_set_real_num_tx_queues(dev, pi->nqsets);
 	err = netif_set_real_num_rx_queues(dev, pi->nqsets);
 	if (err)
-		return err;
-	set_bit(pi->port_id, &adapter->open_device_map);
+		goto err_unwind;
 	err = link_start(dev);
 	if (err)
-		return err;
+		goto err_unwind;
+
 	netif_tx_start_all_queues(dev);
+	set_bit(pi->port_id, &adapter->open_device_map);
 	return 0;
+
+err_unwind:
+	if (adapter->open_device_map == 0)
+		adapter_down(adapter);
+	return err;
 }
 
 /*
@@ -764,13 +770,12 @@ static int cxgb4vf_open(struct net_device *dev)
  */
 static int cxgb4vf_stop(struct net_device *dev)
 {
-	int ret;
 	struct port_info *pi = netdev_priv(dev);
 	struct adapter *adapter = pi->adapter;
 
 	netif_tx_stop_all_queues(dev);
 	netif_carrier_off(dev);
-	ret = t4vf_enable_vi(adapter, pi->viid, false, false);
+	t4vf_enable_vi(adapter, pi->viid, false, false);
 	pi->link_cfg.link_ok = 0;
 
 	clear_bit(pi->port_id, &adapter->open_device_map);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-26] cxgb4vf: recover from failure in cxgb4vf_open()
  2011-01-11 21:57 [PATCH net-26] cxgb4vf: recover from failure in cxgb4vf_open() Casey Leedom
@ 2011-01-11 23:44 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-01-11 23:44 UTC (permalink / raw)
  To: leedom; +Cc: netdev

From: Casey Leedom <leedom@chelsio.com>
Date: Tue, 11 Jan 2011 13:57:59 -0800

> If the Link Start fails in cxgb4vf_open(), we need to back out any state
> that we've built up ...
> 
> Signed-off-by: Casey Leedom <leedom@chelsio.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-11 23:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-11 21:57 [PATCH net-26] cxgb4vf: recover from failure in cxgb4vf_open() Casey Leedom
2011-01-11 23:44 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).