ia64/xen-unstable

changeset 3457:ed68fb045306

bitkeeper revision 1.1159.223.1 (41eced1denT_MsS4LtXTQroXHucvZA)

Fix small-packet delivery in netback driver.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jan 18 11:03:57 2005 +0000 (2005-01-18)
parents d1c129322f63
children 7413468a8d01 86a5dde2aef1
files linux-2.6.10-xen-sparse/drivers/xen/netback/netback.c linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c
line diff
     1.1 --- a/linux-2.6.10-xen-sparse/drivers/xen/netback/netback.c	Mon Jan 17 13:34:26 2005 +0000
     1.2 +++ b/linux-2.6.10-xen-sparse/drivers/xen/netback/netback.c	Tue Jan 18 11:03:57 2005 +0000
     1.3 @@ -13,8 +13,8 @@
     1.4  #include "common.h"
     1.5  #include <asm-xen/balloon.h>
     1.6  
     1.7 +static void netif_idx_release(u16 pending_idx);
     1.8  static void netif_page_release(struct page *page);
     1.9 -static void netif_skb_release(struct sk_buff *skb);
    1.10  static void make_tx_response(netif_t *netif, 
    1.11                               u16      id,
    1.12                               s8       st);
    1.13 @@ -411,7 +411,7 @@ static void net_tx_action(unsigned long 
    1.14          mcl[0].args[0] = MMAP_VADDR(pending_idx) >> PAGE_SHIFT;
    1.15          mcl[0].args[1] = 0;
    1.16          mcl[0].args[2] = 0;
    1.17 -        mcl++;        
    1.18 +        mcl++;     
    1.19      }
    1.20  
    1.21      mcl[-1].args[2] = UVMF_FLUSH_TLB;
    1.22 @@ -531,7 +531,7 @@ static void net_tx_action(unsigned long 
    1.23  
    1.24          pending_idx = pending_ring[MASK_PEND_IDX(pending_cons)];
    1.25  
    1.26 -        data_len = txreq.size > PKT_PROT_LEN ? PKT_PROT_LEN : txreq.size;
    1.27 +        data_len = (txreq.size > PKT_PROT_LEN) ? PKT_PROT_LEN : txreq.size;
    1.28  
    1.29          if ( unlikely((skb = alloc_skb(data_len+16, GFP_ATOMIC)) == NULL) )
    1.30          {
    1.31 @@ -592,14 +592,15 @@ static void net_tx_action(unsigned long 
    1.32          phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx)) >> PAGE_SHIFT] =
    1.33              FOREIGN_FRAME(txreq.addr >> PAGE_SHIFT);
    1.34  
    1.35 -        data_len = txreq.size > PKT_PROT_LEN ? PKT_PROT_LEN : txreq.size;
    1.36 +        data_len = (txreq.size > PKT_PROT_LEN) ? PKT_PROT_LEN : txreq.size;
    1.37  
    1.38          __skb_put(skb, data_len);
    1.39          memcpy(skb->data, 
    1.40                 (void *)(MMAP_VADDR(pending_idx)|(txreq.addr&~PAGE_MASK)),
    1.41                 data_len);
    1.42  
    1.43 -        if (data_len < txreq.size) {
    1.44 +        if ( data_len < txreq.size )
    1.45 +        {
    1.46              /* Append the packet payload as a fragment. */
    1.47              skb_shinfo(skb)->frags[0].page        = 
    1.48                  virt_to_page(MMAP_VADDR(pending_idx));
    1.49 @@ -607,10 +608,11 @@ static void net_tx_action(unsigned long 
    1.50              skb_shinfo(skb)->frags[0].page_offset = 
    1.51                  (txreq.addr + data_len) & ~PAGE_MASK;
    1.52              skb_shinfo(skb)->nr_frags = 1;
    1.53 -        } else {
    1.54 -            skb_shinfo(skb)->frags[0].page        = 
    1.55 -                virt_to_page(MMAP_VADDR(pending_idx));
    1.56 -            skb->destructor = netif_skb_release;
    1.57 +        }
    1.58 +        else
    1.59 +        {
    1.60 +            /* Schedule a response immediately. */
    1.61 +            netif_idx_release(pending_idx);
    1.62          }
    1.63  
    1.64          skb->data_len  = txreq.size - data_len;
    1.65 @@ -651,14 +653,6 @@ static void netif_page_release(struct pa
    1.66      netif_idx_release(pending_idx);
    1.67  }
    1.68  
    1.69 -static void netif_skb_release(struct sk_buff *skb)
    1.70 -{
    1.71 -    struct page *page = skb_shinfo(skb)->frags[0].page;
    1.72 -    u16 pending_idx = page - virt_to_page(mmap_vstart);
    1.73 -
    1.74 -    netif_idx_release(pending_idx);
    1.75 -}
    1.76 -
    1.77  irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs)
    1.78  {
    1.79      netif_t *netif = dev_id;
    1.80 @@ -747,7 +741,7 @@ static int __init netback_init(void)
    1.81      struct page *page;
    1.82  
    1.83      if ( !(xen_start_info.flags & SIF_NET_BE_DOMAIN) &&
    1.84 -	 !(xen_start_info.flags & SIF_INITDOMAIN) )
    1.85 +         !(xen_start_info.flags & SIF_INITDOMAIN) )
    1.86          return 0;
    1.87  
    1.88      printk("Initialising Xen netif backend\n");
     2.1 --- a/linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c	Mon Jan 17 13:34:26 2005 +0000
     2.2 +++ b/linux-2.6.10-xen-sparse/drivers/xen/netfront/netfront.c	Tue Jan 18 11:03:57 2005 +0000
     2.3 @@ -273,7 +273,6 @@ static int send_fake_arp(struct net_devi
     2.4                       dst_ip, dev, src_ip,
     2.5                       /*dst_hw*/ NULL, /*src_hw*/ NULL, 
     2.6                       /*target_hw*/ dev->dev_addr);
     2.7 -    printk(KERN_ALERT "ARP sent on %08x %08x %p\n", dst_ip, src_ip, skb);
     2.8      if ( skb == NULL )
     2.9          return -ENOMEM;
    2.10