ia64/xen-unstable

changeset 670:0e5f8fd98576

bitkeeper revision 1.385 (3f281523ZcjTKYBHYR4Oynisduu7hA)

network.c:
Network bug fix.
author kaf24@scramble.cl.cam.ac.uk
date Wed Jul 30 18:57:39 2003 +0000 (2003-07-30)
parents 734baea3a436
children 15a6d4d70e86
files xenolinux-2.4.21-sparse/arch/xeno/drivers/network/network.c
line diff
     1.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/network/network.c	Wed Jul 30 18:43:28 2003 +0000
     1.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/network/network.c	Wed Jul 30 18:57:39 2003 +0000
     1.3 @@ -216,8 +216,10 @@ static void network_alloc_rx_buffers(str
     1.4      struct sk_buff *skb;
     1.5      unsigned int end = RX_RING_ADD(np->rx_resp_cons, RX_MAX_ENTRIES);    
     1.6  
     1.7 -    for ( i = np->net_idx->rx_req_prod; i != end; i = RX_RING_INC(i) )
     1.8 -    {
     1.9 +    if ( (i = np->net_idx->rx_req_prod) == end )
    1.10 +        return;
    1.11 +
    1.12 +    do {
    1.13          skb = dev_alloc_skb(RX_BUF_SIZE);
    1.14          if ( skb == NULL ) break;
    1.15          skb->dev = dev;
    1.16 @@ -231,21 +233,21 @@ static void network_alloc_rx_buffers(str
    1.17  
    1.18          np->rx_bufs_to_notify++;
    1.19      }
    1.20 +    while ( (i = RX_RING_INC(i)) != end );
    1.21  
    1.22 +    /*
    1.23 +     * We may have allocated buffers which have entries outstanding in the page
    1.24 +     * update queue -- make sure we flush those first!
    1.25 +     */
    1.26 +    flush_page_update_queue();
    1.27 +
    1.28 +    np->net_idx->rx_req_prod = i;
    1.29 +    np->net_idx->rx_event    = RX_RING_INC(np->rx_resp_cons);
    1.30 +        
    1.31 +    /* Batch Xen notifications. */
    1.32      if ( np->rx_bufs_to_notify > (RX_MAX_ENTRIES/4) )
    1.33      {
    1.34 -        /*
    1.35 -         * We may have allocated buffers which have entries outstanding in the 
    1.36 -         * page update queue -- make sure we flush those first!
    1.37 -         */
    1.38 -        flush_page_update_queue();
    1.39 -
    1.40 -        np->net_idx->rx_req_prod = i;
    1.41 -        
    1.42 -        np->net_idx->rx_event = RX_RING_INC(np->rx_resp_cons);
    1.43 -        
    1.44          HYPERVISOR_net_update();
    1.45 -
    1.46          np->rx_bufs_to_notify = 0;
    1.47      }
    1.48  }