ia64/xen-unstable

changeset 164:2a4e70540c0d

bitkeeper revision 1.22.1.14 (3e4cfb9e8kov7wBkpF_IkW4uJSFJYw)

Extraneous interrupt removal.
author akw27@boulderdash.cl.cam.ac.uk
date Fri Feb 14 14:22:22 2003 +0000 (2003-02-14)
parents afaade366555
children 1b51468b4a9c
files xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h xen-2.4.16/net/dev.c xenolinux-2.4.16-sparse/arch/xeno/drivers/network/network.c
line diff
     1.1 --- a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h	Fri Feb 14 13:15:39 2003 +0000
     1.2 +++ b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h	Fri Feb 14 14:22:22 2003 +0000
     1.3 @@ -108,13 +108,6 @@ typedef struct
     1.4  #define EVENT_DIE      0x08 /* OS is about to be killed. Clean up please! */
     1.5  #define EVENT_NET_TX   0x10 /* packets for transmission. */
     1.6  #define EVENT_NET_RX   0x20 /* empty buffers for receive. */
     1.7 -#define EVENT_NET2_TX  0x40 /* packets for transmission. */
     1.8 -#define EVENT_NET2_RX  0x80 /* empty buffers for receive. */
     1.9 -
    1.10 -/* should these macros and the ones below test for range violation? */
    1.11 -#define EVENT_NET_TX_FOR_VIF(x)    (EVENT_NET_TX << (2 * x))
    1.12 -#define EVENT_NET_RX_FOR_VIF(x)    (EVENT_NET_RX << (2 * x))
    1.13 -
    1.14  
    1.15  /* Bit offsets, as opposed to the above masks. */
    1.16  #define _EVENT_BLK_TX  0
    1.17 @@ -123,11 +116,7 @@ typedef struct
    1.18  #define _EVENT_DIE     3
    1.19  #define _EVENT_NET_TX  4
    1.20  #define _EVENT_NET_RX  5
    1.21 -#define _EVENT_NET2_TX 6
    1.22 -#define _EVENT_NET2_RX 7
    1.23  
    1.24 -#define _EVENT_NET_TX_FOR_VIF(x)    (_EVENT_NET_TX + (2 * x))
    1.25 -#define _EVENT_NET_RX_FOR_VIF(x)    (_EVENT_NET_RX + (2 * x))
    1.26  
    1.27  /*
    1.28   * NB. We expect that this struct is smaller than a page.
     2.1 --- a/xen-2.4.16/net/dev.c	Fri Feb 14 13:15:39 2003 +0000
     2.2 +++ b/xen-2.4.16/net/dev.c	Fri Feb 14 14:22:22 2003 +0000
     2.3 @@ -40,6 +40,12 @@
     2.4  #define rtnl_unlock() ((void)0)
     2.5  #define dst_init() ((void)0)
     2.6  
     2.7 +#if 1
     2.8 +#define DPRINTK(_f, _a...) printk(_f , ## _a)
     2.9 +#else 
    2.10 +#define DPRINTK(_f, _a...) ((void)0)
    2.11 +#endif
    2.12 +
    2.13  // Ring defines:
    2.14  #define TX_RING_INC(_i)    (((_i)+1) & (TX_RING_SIZE-1))
    2.15  #define RX_RING_INC(_i)    (((_i)+1) & (RX_RING_SIZE-1))
    2.16 @@ -1005,7 +1011,7 @@ void update_shared_ring(void)
    2.17                  __flush_tlb();
    2.18  
    2.19              if ( net_ring->rx_cons == net_ring->rx_event )
    2.20 -                set_bit(_EVENT_NET_RX_FOR_VIF(nvif), &s->events);
    2.21 +                set_bit(_EVENT_NET_RX, &s->events);
    2.22              
    2.23          }
    2.24      }
    2.25 @@ -1153,7 +1159,7 @@ void flush_rx_queue(void)
    2.26                  }
    2.27                  net_ring->rx_cons = (i+1) & (RX_RING_SIZE-1);
    2.28                  if ( net_ring->rx_cons == net_ring->rx_event )
    2.29 -                    set_bit(_EVENT_NET_RX_FOR_VIF(nvif), &s->events);
    2.30 +                    set_bit(_EVENT_NET_RX, &s->events);
    2.31              }
    2.32              kfree_skb(skb);
    2.33          }
    2.34 @@ -2222,14 +2228,14 @@ long do_net_update(void)
    2.35              
    2.36              if ( ((tx.addr & ~PAGE_MASK) + tx.size) >= PAGE_SIZE ) 
    2.37              {
    2.38 -                printk("tx.addr: %lx, size: %lu, end: %lu\n", tx.addr, tx.size,
    2.39 +                DPRINTK("tx.addr: %lx, size: %lu, end: %lu\n", tx.addr, tx.size,
    2.40                      (tx.addr &~PAGE_MASK) + tx.size);
    2.41                  continue;
    2.42                  //BUG();
    2.43              }
    2.44              
    2.45              if ( TX_RING_INC(i) == net_ring->tx_event )
    2.46 -                set_bit(_EVENT_NET_TX_FOR_VIF(j), &shared->events);
    2.47 +                set_bit(_EVENT_NET_TX, &shared->events);
    2.48  
    2.49              /* Map the skb in from the guest, and get it's delivery target.
    2.50               * We need this to know whether the packet is to be sent locally
     3.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/network/network.c	Fri Feb 14 13:15:39 2003 +0000
     3.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/network/network.c	Fri Feb 14 14:22:22 2003 +0000
     3.3 @@ -27,9 +27,6 @@
     3.4  #define NET_TX_IRQ _EVENT_NET_TX
     3.5  #define NET_RX_IRQ _EVENT_NET_RX
     3.6  
     3.7 -#define NET_TX_IRQ_FOR_VIF(x) _EVENT_NET_TX_FOR_VIF(x)
     3.8 -#define NET_RX_IRQ_FOR_VIF(x) _EVENT_NET_RX_FOR_VIF(x)
     3.9 -
    3.10  #define TX_MAX_ENTRIES (TX_RING_SIZE - 2)
    3.11  #define RX_MAX_ENTRIES (RX_RING_SIZE - 2)
    3.12  
    3.13 @@ -76,15 +73,7 @@ static int network_open(struct net_devic
    3.14  {
    3.15      struct net_private *np = dev->priv;
    3.16      int error = 0;
    3.17 -    char *rxlabel, *txlabel;
    3.18  
    3.19 -    // This is inevitably not the right way to allocate a couple of static strings.
    3.20 -    rxlabel = kmalloc(sizeof("net-rx- "), GFP_KERNEL);
    3.21 -    txlabel = kmalloc(sizeof("net-tx- "), GFP_KERNEL);
    3.22 -    if ((rxlabel == NULL) || (txlabel == NULL)) goto fail;
    3.23 -    sprintf(rxlabel, "net-rx-%d", np->id);
    3.24 -    sprintf(txlabel, "net-tx-%d", np->id);
    3.25 -    
    3.26      np->rx_idx = np->tx_idx = np->tx_full = 0;
    3.27  
    3.28      memset(&np->stats, 0, sizeof(np->stats));
    3.29 @@ -116,8 +105,8 @@ static int network_open(struct net_devic
    3.30  
    3.31      network_alloc_rx_buffers(dev);
    3.32  
    3.33 -    error = request_irq(NET_RX_IRQ_FOR_VIF(np->id), network_rx_int, 0, 
    3.34 -                    rxlabel, dev);
    3.35 +    error = request_irq(NET_RX_IRQ, network_rx_int, 0, 
    3.36 +                    "net-rx", dev);
    3.37      if ( error )
    3.38      {
    3.39          printk(KERN_WARNING "%s: Could not allocate receive interrupt\n",
    3.40 @@ -125,13 +114,13 @@ static int network_open(struct net_devic
    3.41          goto fail;
    3.42      }
    3.43  
    3.44 -    error = request_irq(NET_TX_IRQ_FOR_VIF(np->id), network_tx_int, 0, 
    3.45 -                    txlabel, dev);
    3.46 +    error = request_irq(NET_TX_IRQ, network_tx_int, 0, 
    3.47 +                    "net-tx", dev);
    3.48      if ( error )
    3.49      {
    3.50          printk(KERN_WARNING "%s: Could not allocate transmit interrupt\n",
    3.51                 dev->name);
    3.52 -        free_irq(NET_RX_IRQ_FOR_VIF(np->id), dev);
    3.53 +        free_irq(NET_RX_IRQ, dev);
    3.54          goto fail;
    3.55      }
    3.56  
    3.57 @@ -144,8 +133,6 @@ static int network_open(struct net_devic
    3.58      return 0;
    3.59  
    3.60   fail:
    3.61 -    if ( rxlabel ) kfree(rxlabel);
    3.62 -    if ( txlabel ) kfree(txlabel);
    3.63      if ( np->net_ring->rx_ring ) kfree(np->net_ring->rx_ring);
    3.64      if ( np->net_ring->tx_ring ) kfree(np->net_ring->tx_ring);
    3.65      if ( np->rx_skb_ring ) kfree(np->rx_skb_ring);
    3.66 @@ -293,6 +280,16 @@ static int network_start_xmit(struct sk_
    3.67  //print_range(skb->data + ETH_HLEN + 8, 20);
    3.68  //printk("skb->len is %u in guestOS (expected fraglen: %u).\n", skb->len, skb->len - (ETH_HLEN + 8));
    3.69      i = np->net_ring->tx_prod;
    3.70 +
    3.71 +    if ( (((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >= PAGE_SIZE )
    3.72 +    {
    3.73 +        struct sk_buff *new_skb = alloc_skb(RX_BUF_SIZE, GFP_KERNEL);
    3.74 +        skb_put(new_skb, skb->len);
    3.75 +        memcpy(new_skb->data, skb->data, skb->len);
    3.76 +        kfree_skb(skb);
    3.77 +        skb = new_skb;
    3.78 +    }   
    3.79 +    
    3.80      np->tx_skb_ring[i] = skb;
    3.81      np->net_ring->tx_ring[i].addr 
    3.82          = (unsigned long)phys_to_machine(virt_to_phys(skb->data));
    3.83 @@ -387,8 +384,8 @@ int network_close(struct net_device *dev
    3.84      struct net_private *np = dev->priv;
    3.85  
    3.86      netif_stop_queue(dev);
    3.87 -    free_irq(NET_RX_IRQ_FOR_VIF(np->id), dev);
    3.88 -    free_irq(NET_TX_IRQ_FOR_VIF(np->id), dev);
    3.89 +    free_irq(NET_RX_IRQ, dev);
    3.90 +    free_irq(NET_TX_IRQ, dev);
    3.91      network_free_rx_buffers(dev);
    3.92      kfree(np->net_ring->rx_ring);
    3.93      kfree(np->net_ring->tx_ring);