ia64/xen-unstable

changeset 1430:24ad109055b6

bitkeeper revision 1.934 (40bf588ddomhTq7ECMnz9Besla7qeg)

More minor tweaks.
author mwilli2@equilibrium.research.intel-research.net
date Thu Jun 03 16:57:49 2004 +0000 (2004-06-03)
parents 4a84a7bb8d01
children 0a5f9f92c571 2629c9faf1ad c061db2d4eb5
files xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c xenolinux-2.4.26-sparse/arch/xen/drivers/netif/frontend/main.c
line diff
     1.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c	Thu Jun 03 14:26:45 2004 +0000
     1.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/backend/main.c	Thu Jun 03 16:57:49 2004 +0000
     1.3 @@ -733,10 +733,10 @@ static int __init init_module(void)
     1.4      int i;
     1.5  
     1.6      if ( !(start_info.flags & SIF_NET_BE_DOMAIN) &&
     1.7 -	 !(start_info.flags & SIF_INIT_DOMAIN) )
     1.8 +	 !(start_info.flags & SIF_INITDOMAIN) )
     1.9          return 0;
    1.10  
    1.11 -    printk("Initialising Xen virtual ethernet backend driver\n");
    1.12 +    printk("Initialising Xen netif backend\n");
    1.13  
    1.14      skb_queue_head_init(&rx_queue);
    1.15      skb_queue_head_init(&tx_queue);
     2.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/frontend/main.c	Thu Jun 03 14:26:45 2004 +0000
     2.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/netif/frontend/main.c	Thu Jun 03 16:57:49 2004 +0000
     2.3 @@ -520,6 +520,14 @@ static void netif_status_change(netif_fe
     2.4  	    printk(KERN_INFO "Attempting to reconnect network interface\n");
     2.5  
     2.6              /* Begin interface recovery.
     2.7 +	     *
     2.8 +	     * NB. Whilst we're recovering, we turn the carrier state off.  We
     2.9 +	     * take measures to ensure that this device isn't used for
    2.10 +	     * anything.  We also stop the queue for this device.  Various
    2.11 +	     * different approaches (e.g. continuing to buffer packets) have
    2.12 +	     * been tested but don't appear to improve the overall impact on
    2.13 +             * TCP connections.
    2.14 +	     *
    2.15               * TODO: (MAW) Change the Xend<->Guest protocol so that a recovery
    2.16               * is initiated by a special "RESET" message - disconnect could
    2.17               * just mean we're not allowed to use this interface any more.
    2.18 @@ -527,17 +535,16 @@ static void netif_status_change(netif_fe
    2.19  
    2.20              /* Stop old i/f to prevent errors whilst we rebuild the state. */
    2.21              spin_lock_irq(&np->tx_lock);
    2.22 -            spin_lock_irq(&np->rx_lock);
    2.23 +            spin_lock(&np->rx_lock);
    2.24              netif_stop_queue(dev);
    2.25              netif_carrier_off(dev);
    2.26              np->state  = NETIF_STATE_DISCONNECTED;
    2.27 -            spin_unlock_irq(&np->rx_lock);
    2.28 +            spin_unlock(&np->rx_lock);
    2.29              spin_unlock_irq(&np->tx_lock);
    2.30  
    2.31              /* Free resources. */
    2.32              free_irq(np->irq, dev);
    2.33              unbind_evtchn_from_irq(np->evtchn);
    2.34 -
    2.35  	    free_page((unsigned long)np->tx);
    2.36              free_page((unsigned long)np->rx);
    2.37          }
    2.38 @@ -589,17 +596,18 @@ static void netif_status_change(netif_fe
    2.39              np->rx->event = 1;
    2.40  
    2.41              /* Step 2: Rebuild the RX and TX ring contents.
    2.42 -             * NB. We could just throw away the queued TX packets but we hope
    2.43 +             * NB. We could just free the queued TX packets now but we hope
    2.44               * that sending them out might do some good.  We have to rebuild
    2.45               * the RX ring because some of our pages are currently flipped out
    2.46               * so we can't just free the RX skbs.
    2.47  	     * NB2. Freelist index entries are always going to be less than
    2.48  	     *  __PAGE_OFFSET, whereas pointers to skbs will always be equal or
    2.49 -	     * greater than __PAGE_OFFSET, so we use this to distinguish them.
    2.50 +	     * greater than __PAGE_OFFSET: we use this property to distinguish
    2.51 +             * them.
    2.52               */
    2.53  
    2.54              /* Rebuild the TX buffer freelist and the TX ring itself.
    2.55 -             * NB. This reorders packets :-( We could keep more private state
    2.56 +             * NB. This reorders packets.  We could keep more private state
    2.57               * to avoid this but maybe it doesn't matter so much given the
    2.58               * interface has been down.
    2.59               */
    2.60 @@ -609,7 +617,7 @@ static void netif_status_change(netif_fe
    2.61                  {
    2.62                      struct sk_buff *skb = np->tx_skbs[i];
    2.63                      
    2.64 -                    tx = &np->tx->ring[MASK_NET_TX_IDX(requeue_idx++)].req;
    2.65 +                    tx = &np->tx->ring[requeue_idx++].req;
    2.66                      
    2.67                      tx->id   = i;
    2.68                      tx->addr = virt_to_machine(skb->data);
    2.69 @@ -629,10 +637,11 @@ static void netif_status_change(netif_fe
    2.70              wmb();                
    2.71              np->rx->req_prod = requeue_idx;
    2.72  
    2.73 -            /* Step 3: All public and private state should now be sane.  Start
    2.74 -             * sending and receiving packets again and give the driver domain a
    2.75 -	     * kick because we've probably just requeued some packets. */
    2.76 -
    2.77 +            /* Step 3: All public and private state should now be sane.  Get
    2.78 +             * ready to start sending and receiving packets and give the driver
    2.79 +             * domain a kick because we've probably just requeued some
    2.80 +             * packets.
    2.81 +             */
    2.82              netif_carrier_on(dev);
    2.83              netif_start_queue(dev);
    2.84              np->state = NETIF_STATE_ACTIVE;