direct-io.hg

changeset 3448:4abfb7f9fa7a

bitkeeper revision 1.1159.217.19 (41ebbeff1WlznMQAbyxtY7zh9qY-_g)

Merge scramble.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
into scramble.cl.cam.ac.uk:/local/scratch/kaf24/xen-unstable.bk
author kaf24@scramble.cl.cam.ac.uk
date Mon Jan 17 13:34:55 2005 +0000 (2005-01-17)
parents 5dd6907756ef d1c129322f63
children 707455ee2ff6 2c56c6b39a48
files linux-2.4.28-xen-sparse/arch/xen/defconfig-xen0 linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig linux-2.6.10-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c
line diff
     1.1 --- a/linux-2.4.28-xen-sparse/arch/xen/defconfig-xen0	Sun Jan 16 11:55:31 2005 +0000
     1.2 +++ b/linux-2.4.28-xen-sparse/arch/xen/defconfig-xen0	Mon Jan 17 13:34:55 2005 +0000
     1.3 @@ -554,7 +554,7 @@ CONFIG_E100=y
     1.4  # CONFIG_LNE390 is not set
     1.5  # CONFIG_FEALNX is not set
     1.6  # CONFIG_NATSEMI is not set
     1.7 -# CONFIG_NE2K_PCI is not set
     1.8 +CONFIG_NE2K_PCI=y
     1.9  # CONFIG_FORCEDETH is not set
    1.10  # CONFIG_NE3210 is not set
    1.11  # CONFIG_ES3210 is not set
     2.1 --- a/linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig	Sun Jan 16 11:55:31 2005 +0000
     2.2 +++ b/linux-2.6.10-xen-sparse/arch/xen/configs/xen0_defconfig	Mon Jan 17 13:34:55 2005 +0000
     2.3 @@ -641,7 +641,7 @@ CONFIG_E100=y
     2.4  # CONFIG_E100_NAPI is not set
     2.5  # CONFIG_FEALNX is not set
     2.6  # CONFIG_NATSEMI is not set
     2.7 -# CONFIG_NE2K_PCI is not set
     2.8 +CONFIG_NE2K_PCI=y
     2.9  # CONFIG_8139CP is not set
    2.10  CONFIG_8139TOO=y
    2.11  CONFIG_8139TOO_PIO=y
     3.1 --- a/linux-2.6.10-xen-sparse/drivers/xen/blkfront/blkfront.c	Sun Jan 16 11:55:31 2005 +0000
     3.2 +++ b/linux-2.6.10-xen-sparse/drivers/xen/blkfront/blkfront.c	Mon Jan 17 13:34:55 2005 +0000
     3.3 @@ -162,7 +162,7 @@ static inline void flush_requests(void)
     3.4  
     3.5  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     3.6  
     3.7 -__initcall(xlblk_init);
     3.8 +module_init(xlblk_init);
     3.9  
    3.10  #if ENABLE_VBD_UPDATE
    3.11  static void vbd_update(void)
     4.1 --- a/linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c	Sun Jan 16 11:55:31 2005 +0000
     4.2 +++ b/linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c	Mon Jan 17 13:34:55 2005 +0000
     4.3 @@ -257,7 +257,7 @@ static int netctrl_connected_count(void)
     4.4   * @param dev device
     4.5   * @return 0 on success, error code otherwise
     4.6   */
     4.7 -static int vif_wake(struct net_device *dev)
     4.8 +static int send_fake_arp(struct net_device *dev)
     4.9  {
    4.10      struct sk_buff *skb;
    4.11      u32             src_ip, dst_ip;
    4.12 @@ -265,10 +265,15 @@ static int vif_wake(struct net_device *d
    4.13      dst_ip = INADDR_BROADCAST;
    4.14      src_ip = inet_select_addr(dev, dst_ip, RT_SCOPE_LINK);
    4.15  
    4.16 +    /* No IP? Then nothing to do. */
    4.17 +    if ( src_ip == 0 )
    4.18 +        return 0;
    4.19 +
    4.20      skb = arp_create(ARPOP_REPLY, ETH_P_ARP,
    4.21                       dst_ip, dev, src_ip,
    4.22                       /*dst_hw*/ NULL, /*src_hw*/ NULL, 
    4.23                       /*target_hw*/ dev->dev_addr);
    4.24 +    printk(KERN_ALERT "ARP sent on %08x %08x %p\n", dst_ip, src_ip, skb);
    4.25      if ( skb == NULL )
    4.26          return -ENOMEM;
    4.27  
    4.28 @@ -822,13 +827,11 @@ static void send_interface_connect(struc
    4.29      };
    4.30      netif_fe_interface_connect_t *msg = (void*)cmsg.msg;
    4.31  
    4.32 -    DPRINTK(">\n"); vif_show(np); 
    4.33      msg->handle = np->handle;
    4.34      msg->tx_shmem_frame = (virt_to_machine(np->tx) >> PAGE_SHIFT);
    4.35      msg->rx_shmem_frame = (virt_to_machine(np->rx) >> PAGE_SHIFT);
    4.36          
    4.37      ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
    4.38 -    DPRINTK("<\n");
    4.39  }
    4.40  
    4.41  /* Send a driver status notification to the domain controller. */
    4.42 @@ -876,13 +879,12 @@ static void vif_release(struct net_priva
    4.43   */
    4.44  static void vif_close(struct net_private *np)
    4.45  {
    4.46 -    DPRINTK(">\n"); vif_show(np);
    4.47      WPRINTK("Unexpected netif-CLOSED message in state %s\n",
    4.48              be_state_name[np->backend_state]);
    4.49      vif_release(np);
    4.50      np->backend_state = BEST_CLOSED;
    4.51      /* todo: take dev down and free. */
    4.52 -    vif_show(np); DPRINTK("<\n");
    4.53 +    vif_show(np);
    4.54  }
    4.55  
    4.56  /* Move the vif into disconnected state.
    4.57 @@ -891,7 +893,6 @@ static void vif_close(struct net_private
    4.58   */
    4.59  static void vif_disconnect(struct net_private *np)
    4.60  {
    4.61 -    DPRINTK(">\n");
    4.62      if(np->tx) free_page((unsigned long)np->tx);
    4.63      if(np->rx) free_page((unsigned long)np->rx);
    4.64      // Before this np->tx and np->rx had better be null.
    4.65 @@ -901,7 +902,7 @@ static void vif_disconnect(struct net_pr
    4.66      memset(np->rx, 0, PAGE_SIZE);
    4.67      np->backend_state = BEST_DISCONNECTED;
    4.68      send_interface_connect(np);
    4.69 -    vif_show(np); DPRINTK("<\n");
    4.70 +    vif_show(np);
    4.71  }
    4.72  
    4.73  /* Begin interface recovery.
    4.74 @@ -921,12 +922,11 @@ static void
    4.75  vif_reset(
    4.76      struct net_private *np)
    4.77  {
    4.78 -    DPRINTK(">\n");
    4.79      IPRINTK("Attempting to reconnect network interface: handle=%u\n",
    4.80              np->handle);    
    4.81      vif_release(np);
    4.82      vif_disconnect(np);
    4.83 -    vif_show(np); DPRINTK("<\n");
    4.84 +    vif_show(np);
    4.85  }
    4.86  
    4.87  /* Move the vif into connected state.
    4.88 @@ -938,15 +938,14 @@ vif_connect(
    4.89      struct net_private *np, netif_fe_interface_status_t *status)
    4.90  {
    4.91      struct net_device *dev = np->dev;
    4.92 -    DPRINTK(">\n");
    4.93      memcpy(dev->dev_addr, status->mac, ETH_ALEN);
    4.94      network_connect(dev, status);
    4.95      np->evtchn = status->evtchn;
    4.96      np->irq = bind_evtchn_to_irq(np->evtchn);
    4.97      (void)request_irq(np->irq, netif_int, SA_SAMPLE_RANDOM, dev->name, dev);
    4.98      netctrl_connected_count();
    4.99 -    vif_wake(dev);
   4.100 -    vif_show(np); DPRINTK("<\n");
   4.101 +    (void)send_fake_arp(dev);
   4.102 +    vif_show(np);
   4.103  }
   4.104  
   4.105  
   4.106 @@ -1058,7 +1057,6 @@ static void netif_interface_status(netif
   4.107      int err = 0;
   4.108      struct net_private *np = NULL;
   4.109      
   4.110 -    DPRINTK(">\n");
   4.111      DPRINTK("> status=%s handle=%d\n",
   4.112              status_name[status->status], status->handle);
   4.113  
   4.114 @@ -1074,8 +1072,6 @@ static void netif_interface_status(netif
   4.115          return;
   4.116      }
   4.117  
   4.118 -    DPRINTK(">\n"); vif_show(np);
   4.119 -
   4.120      switch ( status->status )
   4.121      {
   4.122      case NETIF_INTERFACE_STATUS_CLOSED:
   4.123 @@ -1129,8 +1125,8 @@ static void netif_interface_status(netif
   4.124          WPRINTK("Invalid netif status code %d\n", status->status);
   4.125          break;
   4.126      }
   4.127 +
   4.128      vif_show(np);
   4.129 -    DPRINTK("<\n");
   4.130  }
   4.131  
   4.132  /*
   4.133 @@ -1138,10 +1134,7 @@ static void netif_interface_status(netif
   4.134   */
   4.135  static void netif_driver_status(netif_fe_driver_status_t *status)
   4.136  {
   4.137 -    DPRINTK("> status=%d\n", status->status);
   4.138      netctrl.up = status->status;
   4.139 -    //netctrl.interface_n = status->max_handle;
   4.140 -    //netctrl.connected_n = 0;
   4.141      netctrl_connected_count();
   4.142  }
   4.143  
   4.144 @@ -1266,6 +1259,39 @@ static int probe_interfaces(void)
   4.145  
   4.146  #endif
   4.147  
   4.148 +/*
   4.149 + * We use this notifier to send out a fake ARP reply to reset switches and
   4.150 + * router ARP caches when an IP interface is brought up on a VIF.
   4.151 + */
   4.152 +static int inetdev_notify(struct notifier_block *this, 
   4.153 +                          unsigned long event, 
   4.154 +                          void *ptr)
   4.155 +{
   4.156 +    struct in_ifaddr  *ifa = (struct in_ifaddr *)ptr; 
   4.157 +    struct net_device *dev = ifa->ifa_dev->dev;
   4.158 +    struct list_head  *ent;
   4.159 +    struct net_private *np;
   4.160 +
   4.161 +    if ( event != NETDEV_UP )
   4.162 +        goto out;
   4.163 +
   4.164 +    list_for_each ( ent, &dev_list )
   4.165 +    {
   4.166 +        np = list_entry(ent, struct net_private, list);
   4.167 +        if ( np->dev == dev )
   4.168 +            (void)send_fake_arp(dev);
   4.169 +    }
   4.170 +        
   4.171 + out:
   4.172 +    return NOTIFY_DONE;
   4.173 +}
   4.174 +
   4.175 +static struct notifier_block notifier_inetdev = {
   4.176 +    .notifier_call  = inetdev_notify,
   4.177 +    .next           = NULL,
   4.178 +    .priority       = 0
   4.179 +};
   4.180 +
   4.181  static int __init netif_init(void)
   4.182  {
   4.183      int err = 0;
   4.184 @@ -1276,6 +1302,7 @@ static int __init netif_init(void)
   4.185  
   4.186      IPRINTK("Initialising virtual ethernet driver.\n");
   4.187      INIT_LIST_HEAD(&dev_list);
   4.188 +    (void)register_inetaddr_notifier(&notifier_inetdev);
   4.189      netctrl_init();
   4.190      (void)ctrl_if_register_receiver(CMSG_NETIF_FE, netif_ctrlif_rx,
   4.191                                      CALLBACK_IN_BLOCKING_CONTEXT);
   4.192 @@ -1290,57 +1317,48 @@ static int __init netif_init(void)
   4.193  
   4.194  static void vif_suspend(struct net_private *np)
   4.195  {
   4.196 -    // Avoid having tx/rx stuff happen until we're ready.
   4.197 -    DPRINTK(">\n");
   4.198 +    /* Avoid having tx/rx stuff happen until we're ready. */
   4.199      free_irq(np->irq, np->dev);
   4.200      unbind_evtchn_from_irq(np->evtchn);
   4.201 -    DPRINTK("<\n");
   4.202  }
   4.203  
   4.204  static void vif_resume(struct net_private *np)
   4.205  {
   4.206 -    // Connect regardless of whether IFF_UP flag set.
   4.207 -    // Stop bad things from happening until we're back up.
   4.208 -    DPRINTK(">\n");
   4.209 +    /*
   4.210 +     * Connect regardless of whether IFF_UP flag set.
   4.211 +     * Stop bad things from happening until we're back up.
   4.212 +     */
   4.213      np->backend_state = BEST_DISCONNECTED;
   4.214      memset(np->tx, 0, PAGE_SIZE);
   4.215      memset(np->rx, 0, PAGE_SIZE);
   4.216      
   4.217      send_interface_connect(np);
   4.218 -    DPRINTK("<\n");
   4.219  }
   4.220  
   4.221  void netif_suspend(void)
   4.222  {
   4.223 -#if 1 /* XXX THIS IS TEMPORARY */
   4.224      struct list_head *ent;
   4.225      struct net_private *np;
   4.226      
   4.227 -    DPRINTK(">\n");
   4.228 -    list_for_each(ent, &dev_list){
   4.229 +    list_for_each ( ent, &dev_list )
   4.230 +    {
   4.231          np = list_entry(ent, struct net_private, list);
   4.232          vif_suspend(np);
   4.233      }
   4.234 -    DPRINTK("<\n");
   4.235 -#endif
   4.236  }
   4.237  
   4.238  void netif_resume(void)
   4.239  {
   4.240 -#if 1
   4.241 -    /* XXX THIS IS TEMPORARY */
   4.242      struct list_head *ent;
   4.243      struct net_private *np;
   4.244  
   4.245 -    DPRINTK(">\n");
   4.246      list_for_each ( ent, &dev_list )
   4.247      {
   4.248          np = list_entry(ent, struct net_private, list);
   4.249          vif_resume(np);
   4.250      }
   4.251 -    DPRINTK("<\n");
   4.252 -#endif	    
   4.253  }
   4.254  
   4.255  
   4.256 -__initcall(netif_init);
   4.257 +module_init(netif_init);
   4.258 +