ia64/xen-unstable

changeset 765:c54c6595f6ae

bitkeeper revision 1.463 (3f721646eB7aycwk0W8Qp2kzIZ1KhA)

dev.c:
Fix network start-of-day race.
author kaf24@scramble.cl.cam.ac.uk
date Wed Sep 24 22:10:14 2003 +0000 (2003-09-24)
parents c40b417de19f
children 8e974c88fa7a b468fc159c6b
files xen/net/dev.c
line diff
     1.1 --- a/xen/net/dev.c	Wed Sep 24 21:52:58 2003 +0000
     1.2 +++ b/xen/net/dev.c	Wed Sep 24 22:10:14 2003 +0000
     1.3 @@ -2152,27 +2152,6 @@ int setup_network_devices(void)
     1.4  {
     1.5      int i, ret;
     1.6      extern char opt_ifname[];
     1.7 -    struct net_device *dev;
     1.8 -
     1.9 -    if ( (dev = dev_get_by_name(opt_ifname)) == NULL ) 
    1.10 -    {
    1.11 -        printk("Could not find device %s: using dummy device\n", opt_ifname);
    1.12 -        strcpy(opt_ifname, "dummy");
    1.13 -        if ( (dev = dev_get_by_name(opt_ifname)) == NULL )
    1.14 -        {
    1.15 -            printk("Failed to find the dummy device!\n");
    1.16 -            return 0;
    1.17 -        }
    1.18 -    }
    1.19 -
    1.20 -    if ( (ret = dev_open(dev)) != 0 )
    1.21 -    {
    1.22 -        printk("Error opening device %s for use (%d)\n", opt_ifname, ret);
    1.23 -        return 0;
    1.24 -    }
    1.25 -
    1.26 -    printk("Device %s opened and ready for use.\n", opt_ifname);
    1.27 -    the_dev = dev;
    1.28  
    1.29      for ( i = 0; i < smp_num_cpus; i++ )
    1.30          skb_queue_head_init(&rx_skb_queue[i]);
    1.31 @@ -2180,6 +2159,26 @@ int setup_network_devices(void)
    1.32      open_softirq(NET_RX_SOFTIRQ, net_rx_action, NULL);
    1.33      tasklet_enable(&net_tx_tasklet);
    1.34  
    1.35 +    if ( (the_dev = dev_get_by_name(opt_ifname)) == NULL ) 
    1.36 +    {
    1.37 +        printk("Could not find device %s: using dummy device\n", opt_ifname);
    1.38 +        strcpy(opt_ifname, "dummy");
    1.39 +        if ( (the_dev = dev_get_by_name(opt_ifname)) == NULL )
    1.40 +        {
    1.41 +            printk("Failed to find the dummy device!\n");
    1.42 +            return 0;
    1.43 +        }
    1.44 +    }
    1.45 +
    1.46 +    if ( (ret = dev_open(the_dev)) != 0 )
    1.47 +    {
    1.48 +        printk("Error opening device %s for use (%d)\n", opt_ifname, ret);
    1.49 +        the_dev = NULL;
    1.50 +        return 0;
    1.51 +    }
    1.52 +
    1.53 +    printk("Device %s opened and ready for use.\n", opt_ifname);
    1.54 +
    1.55      return 1;
    1.56  }
    1.57