direct-io.hg

changeset 2483:c530850a0014

bitkeeper revision 1.1159.76.8 (414952f4XmpfTwUZczAePp3RY8piQQ)

A few network cleanups (but this fixes no bugs).
author kaf24@freefall.cl.cam.ac.uk
date Thu Sep 16 08:46:44 2004 +0000 (2004-09-16)
parents 13c1ab1a4d0e
children 75c62d5f88c3
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	Thu Sep 16 07:42:17 2004 +0000
     1.2 +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netback/netback.c	Thu Sep 16 08:46:44 2004 +0000
     1.3 @@ -108,10 +108,6 @@ static inline void maybe_schedule_tx_act
     1.4          tasklet_schedule(&net_tx_tasklet);
     1.5  }
     1.6  
     1.7 -/*
     1.8 - * This is the primary RECEIVE function for a network interface.
     1.9 - * Note that, from the p.o.v. of /this/ OS it looks like a transmit.
    1.10 - */
    1.11  int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev)
    1.12  {
    1.13      netif_t *netif = (netif_t *)dev->priv;
    1.14 @@ -156,7 +152,7 @@ int netif_be_start_xmit(struct sk_buff *
    1.15      return 0;
    1.16  
    1.17   drop:
    1.18 -    netif->stats.rx_dropped++;
    1.19 +    netif->stats.tx_dropped++;
    1.20      dev_kfree_skb(skb);
    1.21      return 0;
    1.22  }
    1.23 @@ -260,8 +256,8 @@ static void net_rx_action(unsigned long 
    1.24          skb_shinfo(skb)->nr_frags = 0;
    1.25          skb_shinfo(skb)->frag_list = NULL;
    1.26  
    1.27 -        netif->stats.rx_bytes += size;
    1.28 -        netif->stats.rx_packets++;
    1.29 +        netif->stats.tx_bytes += size;
    1.30 +        netif->stats.tx_packets++;
    1.31  
    1.32          /* The update_va_mapping() must not fail. */
    1.33          if ( unlikely(mcl[0].args[5] != 0) )
    1.34 @@ -579,8 +575,8 @@ static void net_tx_action(unsigned long 
    1.35          skb->dev      = netif->dev;
    1.36          skb->protocol = eth_type_trans(skb, skb->dev);
    1.37  
    1.38 -        netif->stats.tx_bytes += txreq.size;
    1.39 -        netif->stats.tx_packets++;
    1.40 +        netif->stats.rx_bytes += txreq.size;
    1.41 +        netif->stats.rx_packets++;
    1.42  
    1.43          netif_rx(skb);
    1.44          netif->dev->last_rx = jiffies;
     2.1 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c	Thu Sep 16 07:42:17 2004 +0000
     2.2 +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c	Thu Sep 16 08:46:44 2004 +0000
     2.3 @@ -358,7 +358,7 @@ static int network_start_xmit(struct sk_
     2.4      {
     2.5          printk(KERN_ALERT "%s: full queue wasn't stopped!\n", dev->name);
     2.6          netif_stop_queue(dev);
     2.7 -        return -ENOBUFS;
     2.8 +        goto drop;
     2.9      }
    2.10  
    2.11      if ( unlikely((((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >=
    2.12 @@ -366,7 +366,7 @@ static int network_start_xmit(struct sk_
    2.13      {
    2.14          struct sk_buff *new_skb;
    2.15          if ( unlikely((new_skb = alloc_skb_page()) == NULL) )
    2.16 -            return 1;
    2.17 +            goto drop;
    2.18          skb_put(new_skb, skb->len);
    2.19          memcpy(new_skb->data, skb->data, skb->len);
    2.20          dev_kfree_skb(skb);
    2.21 @@ -378,7 +378,7 @@ static int network_start_xmit(struct sk_
    2.22      if ( np->backend_state != BEST_CONNECTED )
    2.23      {
    2.24          spin_unlock_irq(&np->tx_lock);
    2.25 -        return 1;
    2.26 +        goto drop;
    2.27      }
    2.28  
    2.29      i = np->tx->req_prod;
    2.30 @@ -414,6 +414,11 @@ static int network_start_xmit(struct sk_
    2.31          notify_via_evtchn(np->evtchn);
    2.32  
    2.33      return 0;
    2.34 +
    2.35 + drop:
    2.36 +    np->stats.tx_dropped++;
    2.37 +    dev_kfree_skb(skb);
    2.38 +    return 0;
    2.39  }
    2.40  
    2.41