ia64/xen-unstable

changeset 242:7b3edf42feae

bitkeeper revision 1.100 (3e5aaea3k3nRhpFN71_BWfIyFoVBmg)

dev.c:
Fixed net rx path to update descriptors properly.
author kaf24@labyrinth.cl.cam.ac.uk
date Mon Feb 24 23:45:39 2003 +0000 (2003-02-24)
parents 9d65151a408e
children 084eaa7c072e 6c2320ec1f38
files xen/net/dev.c
line diff
     1.1 --- a/xen/net/dev.c	Mon Feb 24 18:03:21 2003 +0000
     1.2 +++ b/xen/net/dev.c	Mon Feb 24 23:45:39 2003 +0000
     1.3 @@ -555,8 +555,6 @@ int netif_rx(struct sk_buff *skb)
     1.4  #ifdef CONFIG_SMP
     1.5      unsigned long cpu_mask;
     1.6  #endif
     1.7 -        
     1.8 -    struct task_struct *p;
     1.9      int this_cpu = smp_processor_id();
    1.10      unsigned long flags;
    1.11      net_vif_t *vif;
    1.12 @@ -567,15 +565,6 @@ int netif_rx(struct sk_buff *skb)
    1.13      ASSERT((skb->data - skb->head) == (18 + ETH_HLEN));
    1.14          
    1.15      skb->head = (u8 *)map_domain_mem(((skb->pf - frame_table) << PAGE_SHIFT));
    1.16 -
    1.17 -    /*
    1.18 -     * remapping this address really screws up all the skb pointers.  We
    1.19 -     * need to map them all here sufficiently to get the packet
    1.20 -     * demultiplexed. this remapping happens more than once in the code and
    1.21 -     * is grim.  It will be fixed in a later update -- drivers should be
    1.22 -     * able to align the packet arbitrarily.
    1.23 -     */
    1.24 -                
    1.25      skb->data = skb->head;
    1.26      skb_reserve(skb,18); /* 18 is the 16 from dev_alloc_skb plus 2 for
    1.27                              IP header alignment. */
    1.28 @@ -592,46 +581,20 @@ int netif_rx(struct sk_buff *skb)
    1.29          skb->dst_vif = __net_get_target_vif(skb->mac.raw, 
    1.30                                              skb->len, skb->src_vif);
    1.31          
    1.32 -    if ( (vif = sys_vif_list[skb->dst_vif]) == NULL )
    1.33 -        goto drop;
    1.34 -
    1.35 -    /*
    1.36 -     * This lock-and-walk of the task list isn't really necessary, and is
    1.37 -     * an artifact of the old code.  The vif contains a pointer to the skb
    1.38 -     * list we are going to queue the packet in, so the lock and the inner
    1.39 -     * loop could be removed. The argument against this is a possible race
    1.40 -     * in which a domain is killed as packets are being delivered to it.
    1.41 -     * This would result in the dest vif vanishing before we can deliver to
    1.42 -     * it.
    1.43 -     */
    1.44 -        
    1.45 -    if ( skb->dst_vif >= VIF_PHYSICAL_INTERFACE )
    1.46 +    if ( ((vif = sys_vif_list[skb->dst_vif]) == NULL) ||
    1.47 +         (skb->dst_vif <= VIF_PHYSICAL_INTERFACE) )
    1.48      {
    1.49 -        read_lock(&tasklist_lock);
    1.50 -        p = &idle0_task;
    1.51 -        do {
    1.52 -            if ( p != vif->domain ) continue;
    1.53 -            deliver_packet(skb, vif);
    1.54 -            cpu_mask = mark_hyp_event(p, _HYP_EVENT_NET_RX);
    1.55 -            read_unlock(&tasklist_lock);
    1.56 -            goto found;
    1.57 -        }
    1.58 -        while ( (p = p->next_task) != &idle0_task );
    1.59 -        read_unlock(&tasklist_lock); 
    1.60 -        goto drop;
    1.61 +        netdev_rx_stat[this_cpu].dropped++;
    1.62 +        unmap_domain_mem(skb->head);
    1.63 +        kfree_skb(skb);
    1.64 +        local_irq_restore(flags);
    1.65 +        return NET_RX_DROP;
    1.66      }
    1.67  
    1.68 - drop:
    1.69 -    netdev_rx_stat[this_cpu].dropped++;
    1.70 +    deliver_packet(skb, vif);
    1.71 +    cpu_mask = mark_hyp_event(vif->domain, _HYP_EVENT_NET_RX);
    1.72      unmap_domain_mem(skb->head);
    1.73      kfree_skb(skb);
    1.74 -    local_irq_restore(flags);
    1.75 -    return NET_RX_DROP;
    1.76 -
    1.77 - found:
    1.78 -    unmap_domain_mem(skb->head);
    1.79 -    skb->head = skb->data = skb->tail = (void *)0xdeadbeef;
    1.80 -    kfree_skb(skb);
    1.81      hyp_event_notify(cpu_mask);
    1.82      local_irq_restore(flags);
    1.83      return NET_RX_SUCCESS;
    1.84 @@ -858,7 +821,7 @@ void update_shared_ring(void)
    1.85          while ( shadow_ring->rx_cons != shadow_ring->rx_idx )
    1.86          {
    1.87              rx = shadow_ring->rx_ring + shadow_ring->rx_cons;
    1.88 -            copy_to_user(net_ring->rx_ring + net_ring->rx_cons, rx, 
    1.89 +            copy_to_user(net_ring->rx_ring + shadow_ring->rx_cons, rx, 
    1.90                           sizeof(rx_entry_t));
    1.91  
    1.92              if ( rx->flush_count == tlb_flush_count[smp_processor_id()] )