direct-io.hg

changeset 247:0a7d144921ff

bitkeeper revision 1.105 (3e5cfaa1sTwHu-8MSxs6PpY5y9101Q)

network.c, dev.c:
Add compiler barriers to ensure descriptor updates occur before index updates in network code.
author kaf24@labyrinth.cl.cam.ac.uk
date Wed Feb 26 17:34:25 2003 +0000 (2003-02-26)
parents 0feeef527323
children 3cc17656be66 574648259ee0
files xen/net/dev.c xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c
line diff
     1.1 --- a/xen/net/dev.c	Wed Feb 26 17:03:13 2003 +0000
     1.2 +++ b/xen/net/dev.c	Wed Feb 26 17:34:25 2003 +0000
     1.3 @@ -533,6 +533,7 @@ void deliver_packet(struct sk_buff *skb,
     1.4      skb->pf = g_pfn;
     1.5  
     1.6   inc_and_out:        
     1.7 +    smp_wmb(); /* updates must happen before releasing the descriptor. */
     1.8      shadow_ring->rx_idx = RX_RING_INC(i);
     1.9  }
    1.10  
    1.11 @@ -681,6 +682,8 @@ static void tx_skb_release(struct sk_buf
    1.12       * mutual exclusion from do_IRQ().
    1.13       */
    1.14  
    1.15 +    smp_wmb(); /* make sure any status updates occur before inc'ing tx_cons. */
    1.16 +
    1.17      /* Skip over a sequence of bad descriptors, plus the first good one. */
    1.18      do {
    1.19          idx = vif->shadow_ring->tx_cons;
    1.20 @@ -826,6 +829,7 @@ void update_shared_ring(void)
    1.21              if ( rx->flush_count == tlb_flush_count[smp_processor_id()] )
    1.22                  __flush_tlb();
    1.23  
    1.24 +            smp_wmb(); /* copy descriptor before inc'ing rx_cons */
    1.25              shadow_ring->rx_cons = RX_RING_INC(shadow_ring->rx_cons);
    1.26  
    1.27              if ( shadow_ring->rx_cons == net_ring->rx_event )
     2.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c	Wed Feb 26 17:03:13 2003 +0000
     2.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c	Wed Feb 26 17:34:25 2003 +0000
     2.3 @@ -293,7 +293,7 @@ static void network_rx_int(int irq, void
     2.4      {
     2.5          if (np->net_ring->rx_ring[i].status != RING_STATUS_OK)
     2.6          {
     2.7 -            printk("bad buffer on RX ring!(%d)\n", 
     2.8 +            printk(KERN_ALERT "bad buffer on RX ring!(%d)\n", 
     2.9                     np->net_ring->rx_ring[i].status);
    2.10              continue;
    2.11          }