ia64/xen-unstable

changeset 12062:b6de59741161

[NET] front: Clean up error handling. This eliminates earlier
workaround patch for an observed crash.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Oct 31 16:18:07 2006 +0000 (2006-10-31)
parents 6ad98bc30cb4
children d93280670c3f
files linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Tue Oct 31 15:54:03 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Tue Oct 31 16:18:07 2006 +0000
     1.3 @@ -242,7 +242,6 @@ static void end_access(int, void *);
     1.4  static void netif_disconnect_backend(struct netfront_info *);
     1.5  static int open_netdev(struct netfront_info *);
     1.6  static void close_netdev(struct netfront_info *);
     1.7 -static void netif_free(struct netfront_info *);
     1.8  
     1.9  static int network_connect(struct net_device *);
    1.10  static void network_tx_buf_gc(struct net_device *);
    1.11 @@ -428,7 +427,6 @@ again:
    1.12  	return err;
    1.13  }
    1.14  
    1.15 -
    1.16  static int setup_device(struct xenbus_device *dev, struct netfront_info *info)
    1.17  {
    1.18  	struct netif_tx_sring *txs;
    1.19 @@ -488,11 +486,9 @@ static int setup_device(struct xenbus_de
    1.20  	return 0;
    1.21  
    1.22   fail:
    1.23 -	netif_free(info);
    1.24  	return err;
    1.25  }
    1.26  
    1.27 -
    1.28  /**
    1.29   * Callback received when the backend's state changes.
    1.30   */
    1.31 @@ -513,24 +509,18 @@ static void backend_changed(struct xenbu
    1.32  		break;
    1.33  
    1.34  	case XenbusStateInitWait:
    1.35 -		if (network_connect(netdev) != 0) {
    1.36 -			netif_free(np);
    1.37 +		if (network_connect(netdev) != 0)
    1.38  			break;
    1.39 -		}
    1.40  		xenbus_switch_state(dev, XenbusStateConnected);
    1.41  		(void)send_fake_arp(netdev);
    1.42  		break;
    1.43  
    1.44  	case XenbusStateClosing:
    1.45 -		if (dev->state == XenbusStateConnected)
    1.46 -			netfront_closing(dev);
    1.47 -		else
    1.48 -			printk(KERN_DEBUG "Netfront: going to state Closing without being connected...\n");
    1.49 +		netfront_closing(dev);
    1.50  		break;
    1.51  	}
    1.52  }
    1.53  
    1.54 -
    1.55  /** Send a packet on a net device to encourage switches to learn the
    1.56   * MAC. We send a fake ARP request.
    1.57   *
    1.58 @@ -559,7 +549,6 @@ static int send_fake_arp(struct net_devi
    1.59  	return dev_queue_xmit(skb);
    1.60  }
    1.61  
    1.62 -
    1.63  static int network_open(struct net_device *dev)
    1.64  {
    1.65  	struct netfront_info *np = netdev_priv(dev);
    1.66 @@ -651,14 +640,12 @@ static void network_tx_buf_gc(struct net
    1.67  	network_maybe_wake_tx(dev);
    1.68  }
    1.69  
    1.70 -
    1.71  static void rx_refill_timeout(unsigned long data)
    1.72  {
    1.73  	struct net_device *dev = (struct net_device *)data;
    1.74  	netif_rx_schedule(dev);
    1.75  }
    1.76  
    1.77 -
    1.78  static void network_alloc_rx_buffers(struct net_device *dev)
    1.79  {
    1.80  	unsigned short id;
    1.81 @@ -2066,14 +2053,6 @@ static void netif_disconnect_backend(str
    1.82  }
    1.83  
    1.84  
    1.85 -static void netif_free(struct netfront_info *info)
    1.86 -{
    1.87 -	close_netdev(info);
    1.88 -	netif_disconnect_backend(info);
    1.89 -	free_netdev(info->netdev);
    1.90 -}
    1.91 -
    1.92 -
    1.93  static void end_access(int ref, void *page)
    1.94  {
    1.95  	if (ref != GRANT_INVALID_REF)