direct-io.hg

changeset 2509:ae5765bc62c2

bitkeeper revision 1.1159.79.11 (41506746mdOECqqSuCdLRNy-BA_bQQ)

A couple more network fixes.
author kaf24@freefall.cl.cam.ac.uk
date Tue Sep 21 17:39:18 2004 +0000 (2004-09-21)
parents 359b48f3b4f8
children 4553261ed7cb 4b472ab99c9b
files linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c
line diff
     1.1 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c	Tue Sep 21 16:52:40 2004 +0000
     1.2 +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c	Tue Sep 21 17:39:18 2004 +0000
     1.3 @@ -138,7 +138,6 @@ int netif_be_start_xmit(struct sk_buff *
     1.4       * We do not copy the packet unless:
     1.5       *  1. The data is shared; or
     1.6       *  2. The data is not allocated from our special cache.
     1.7 -     * The copying method is taken from skb_copy().
     1.8       * NB. We also couldn't cope with fragmented packets, but we won't get
     1.9       *     any because we not advertise the NETIF_F_SG feature.
    1.10       */
    1.11 @@ -148,10 +147,9 @@ int netif_be_start_xmit(struct sk_buff *
    1.12          struct sk_buff *nskb = dev_alloc_skb(hlen + skb->len);
    1.13          if ( unlikely(nskb == NULL) )
    1.14              goto drop;
    1.15 -        /* Account for any reservation already made by dev_alloc_skb(). */
    1.16 -        skb_reserve(nskb, hlen - (nskb->data - nskb->head));
    1.17 +        skb_reserve(nskb, hlen);
    1.18          __skb_put(nskb, skb->len);
    1.19 -        (void)skb_copy_bits(skb, -hlen, nskb->head, hlen + skb->len);
    1.20 +        (void)skb_copy_bits(skb, -hlen, nskb->data - hlen, skb->len + hlen);
    1.21          nskb->dev = skb->dev;
    1.22          dev_kfree_skb(skb);
    1.23          skb = nskb;
     2.1 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c	Tue Sep 21 16:52:40 2004 +0000
     2.2 +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c	Tue Sep 21 17:39:18 2004 +0000
     2.3 @@ -377,13 +377,14 @@ static int network_start_xmit(struct sk_
     2.4      if ( unlikely((((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >=
     2.5                    PAGE_SIZE) )
     2.6      {
     2.7 -        struct sk_buff *new_skb;
     2.8 -        if ( unlikely((new_skb = alloc_xen_skb(skb->len)) == NULL) )
     2.9 +        struct sk_buff *nskb;
    2.10 +        if ( unlikely((nskb = alloc_xen_skb(skb->len)) == NULL) )
    2.11              goto drop;
    2.12 -        skb_put(new_skb, skb->len);
    2.13 -        memcpy(new_skb->data, skb->data, skb->len);
    2.14 +        skb_put(nskb, skb->len);
    2.15 +        memcpy(nskb->data, skb->data, skb->len);
    2.16 +        nskb->dev = skb->dev;
    2.17          dev_kfree_skb(skb);
    2.18 -        skb = new_skb;
    2.19 +        skb = nskb;
    2.20      }
    2.21      
    2.22      spin_lock_irq(&np->tx_lock);
    2.23 @@ -553,13 +554,21 @@ static int netif_poll(struct net_device 
    2.24              /* Only copy the packet if it fits in the current MTU. */
    2.25              if ( skb->len <= (dev->mtu + ETH_HLEN) )
    2.26              {
    2.27 +                if ( (skb->tail > skb->end) && net_ratelimit() )
    2.28 +                    printk(KERN_INFO "Received packet needs %d bytes more "
    2.29 +                           "headroom.\n", skb->tail - skb->end);
    2.30 +
    2.31                  if ( (nskb = alloc_xen_skb(skb->len + 2)) != NULL )
    2.32                  {
    2.33                      skb_reserve(nskb, 2);
    2.34                      skb_put(nskb, skb->len);
    2.35                      memcpy(nskb->data, skb->data, skb->len);
    2.36 +                    nskb->dev = skb->dev;
    2.37                  }
    2.38              }
    2.39 +            else if ( net_ratelimit() )
    2.40 +                printk(KERN_INFO "Received packet too big for MTU "
    2.41 +                       "(%d > %d)\n", skb->len - ETH_HLEN, dev->mtu);
    2.42  
    2.43              /* Reinitialise and then destroy the old skbuff. */
    2.44              skb->len  = 0;