ia64/xen-unstable

changeset 243:084eaa7c072e

bitkeeper revision 1.101 (3e5ca3886XTHk1fZRjPIuqdNdAtuZQ)

dev.c:
Fix race in net tx code.
author kaf24@labyrinth.cl.cam.ac.uk
date Wed Feb 26 11:22:48 2003 +0000 (2003-02-26)
parents 7b3edf42feae
children 0f0113d4cd89
files xen/net/dev.c
line diff
     1.1 --- a/xen/net/dev.c	Mon Feb 24 23:45:39 2003 +0000
     1.2 +++ b/xen/net/dev.c	Wed Feb 26 11:22:48 2003 +0000
     1.3 @@ -731,15 +731,20 @@ static void net_tx_action(unsigned long 
     1.4          if ( vif->shadow_ring->tx_idx == vif->shadow_ring->tx_prod )
     1.5              continue;
     1.6  
     1.7 -        /* Check the chosen entry is good. */
     1.8 +        /* Pick an entry from the transmit queue. */
     1.9          tx = &vif->shadow_ring->tx_ring[vif->shadow_ring->tx_idx];
    1.10 -        if ( tx->status != RING_STATUS_OK ) goto skip_desc;
    1.11 +        vif->shadow_ring->tx_idx = TX_RING_INC(vif->shadow_ring->tx_idx);
    1.12 +        if ( vif->shadow_ring->tx_idx != vif->shadow_ring->tx_prod )
    1.13 +            add_to_net_schedule_list_tail(vif);
    1.14 +
    1.15 +        /* Check the chosen entry is good. */
    1.16 +        if ( tx->status != RING_STATUS_OK ) continue;
    1.17  
    1.18          if ( (skb = alloc_skb_nodata(GFP_ATOMIC)) == NULL )
    1.19          {
    1.20              add_to_net_schedule_list_tail(vif);
    1.21              printk("Out of memory in net_tx_action()!\n");
    1.22 -            goto out;
    1.23 +            break;
    1.24          }
    1.25          
    1.26          skb->destructor = tx_skb_release;
    1.27 @@ -766,15 +771,9 @@ static void net_tx_action(unsigned long 
    1.28          {
    1.29              add_to_net_schedule_list_tail(vif);
    1.30              printk("Weird failure in hard_start_xmit!\n");
    1.31 -            goto out;
    1.32 +            break;
    1.33          }
    1.34 -
    1.35 -    skip_desc:
    1.36 -        vif->shadow_ring->tx_idx = TX_RING_INC(vif->shadow_ring->tx_idx);
    1.37 -        if ( vif->shadow_ring->tx_idx != vif->shadow_ring->tx_prod )
    1.38 -            add_to_net_schedule_list_tail(vif);
    1.39      }
    1.40 - out:
    1.41      spin_unlock(&dev->xmit_lock);
    1.42  }
    1.43