ia64/xen-unstable

changeset 254:2177b1e83599

bitkeeper revision 1.105.1.4 (3e5e6300OW6aJoXNU_rtBiUn9RxCUQ)

network.c, dev.c:
Fixed network transmit event dispatch. Was broken and not sending inter-CPU interrupts.
author kaf24@labyrinth.cl.cam.ac.uk
date Thu Feb 27 19:12:00 2003 +0000 (2003-02-27)
parents 1c21ed4799dc
children 3ad7fdd91087
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	Thu Feb 27 18:12:27 2003 +0000
     1.2 +++ b/xen/net/dev.c	Thu Feb 27 19:12:00 2003 +0000
     1.3 @@ -657,10 +657,11 @@ static void add_to_net_schedule_list_tai
     1.4  /* Destructor function for tx skbs. */
     1.5  static void tx_skb_release(struct sk_buff *skb)
     1.6  {
     1.7 -    int i;
     1.8 +    int i, send = 0;
     1.9      net_vif_t *vif = sys_vif_list[skb->src_vif];
    1.10      unsigned int idx;
    1.11      tx_shadow_entry_t *tx;
    1.12 +    unsigned long cpu_mask;
    1.13      
    1.14      for ( i = 0; i < skb_shinfo(skb)->nr_frags; i++ )
    1.15          put_page_tot(skb_shinfo(skb)->frags[i].page);
    1.16 @@ -691,9 +692,7 @@ static void tx_skb_release(struct sk_buf
    1.17          if ( idx == vif->shadow_ring->tx_idx ) BUG();
    1.18          tx  = &vif->shadow_ring->tx_ring[idx];
    1.19          vif->shadow_ring->tx_cons = TX_RING_INC(idx);
    1.20 -        if ( vif->shadow_ring->tx_cons == vif->net_ring->tx_event )
    1.21 -            set_bit(_EVENT_NET_TX, 
    1.22 -                    &sys_vif_list[skb->src_vif]->domain->shared_info->events);
    1.23 +        if ( vif->shadow_ring->tx_cons == vif->net_ring->tx_event ) send = 1;
    1.24      } while ( tx->status != RING_STATUS_OK );
    1.25  
    1.26      /* Now skip over any more bad descriptors, up to the next good one. */
    1.27 @@ -705,13 +704,19 @@ static void tx_skb_release(struct sk_buf
    1.28               (tx->status == RING_STATUS_OK) )
    1.29              break;
    1.30          vif->shadow_ring->tx_cons = TX_RING_INC(idx);
    1.31 -        if ( vif->shadow_ring->tx_cons == vif->net_ring->tx_event )
    1.32 -            set_bit(_EVENT_NET_TX, 
    1.33 -                    &sys_vif_list[skb->src_vif]->domain->shared_info->events);
    1.34 +        if ( vif->shadow_ring->tx_cons == vif->net_ring->tx_event ) send = 1;
    1.35      } while ( 1 );
    1.36  
    1.37 -    /* Finally, update shared consumer index to the new private value. */
    1.38 +    /* Update shared consumer index to the new private value. */
    1.39      vif->net_ring->tx_cons = vif->shadow_ring->tx_cons;
    1.40 +
    1.41 +    /* Send a transmit event if requested. */
    1.42 +    if ( send )
    1.43 +    {
    1.44 +        cpu_mask = mark_guest_event(
    1.45 +            sys_vif_list[skb->src_vif]->domain, _EVENT_NET_TX);
    1.46 +        guest_event_notify(cpu_mask);
    1.47 +    }
    1.48  }
    1.49  
    1.50      
     2.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c	Thu Feb 27 18:12:27 2003 +0000
     2.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/network/network.c	Thu Feb 27 19:12:00 2003 +0000
     2.3 @@ -23,6 +23,7 @@
     2.4  
     2.5  #include <asm/io.h>
     2.6  #include <net/sock.h>
     2.7 +#include <net/pkt_sched.h>
     2.8  
     2.9  #define NET_TX_IRQ _EVENT_NET_TX
    2.10  #define NET_RX_IRQ _EVENT_NET_RX
    2.11 @@ -185,7 +186,8 @@ static void network_tx_buf_gc(struct net
    2.12          np->tx_idx = i;
    2.13          
    2.14          /* Set a new event, then check for race with update of tx_cons. */
    2.15 -        np->net_ring->tx_event = TX_RING_INC(cons);
    2.16 +        np->net_ring->tx_event =
    2.17 +            TX_RING_ADD(cons, (atomic_read(&np->tx_entries)>>1) + 1);
    2.18          smp_mb();
    2.19      }
    2.20      while ( cons != np->net_ring->tx_cons );