ia64/xen-unstable

changeset 29:d421c8e84808

bitkeeper revision 1.7.1.8 (3dfdbdfbe2pZAGaXI4oPfJVdSW3qpg)

minor cleaning up.
author akw27@labyrinth.cl.cam.ac.uk
date Mon Dec 16 11:50:19 2002 +0000 (2002-12-16)
parents 78ce779f901c
children 34208c741acc
files xen-2.4.16/common/network.c xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h xen-2.4.16/include/xeno/vif.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/common/network.c	Fri Dec 06 14:20:10 2002 +0000
     1.2 +++ b/xen-2.4.16/common/network.c	Mon Dec 16 11:50:19 2002 +0000
     1.3 @@ -1,8 +1,11 @@
     1.4 -/* net_ring.c
     1.5 +/* network.c
     1.6   *
     1.7 - * ring data structures for buffering messages between hypervisor and
     1.8 - * guestos's.  As it stands this is only used for network buffer exchange.
     1.9 + * Network virtualization for Xen.  Lower-level network interactions are in 
    1.10 + * net/dev.c and in the drivers.  This file contains routines to interact 
    1.11 + * with the virtual interfaces (vifs) and the virtual firewall/router through
    1.12 + * the use of rules.
    1.13   *
    1.14 + * Copyright (c) 2002, A K Warfield and K A Fraser
    1.15   */
    1.16  
    1.17  #include <hypervisor-ifs/network.h>
    1.18 @@ -18,19 +21,30 @@
    1.19  
    1.20  /* vif globals 
    1.21   * sys_vif_list is a lookup table for vifs, used in packet forwarding.
    1.22 - * it should be replaced later by something a little more flexible.
    1.23 + * it will be replaced later by something a little more flexible.
    1.24   */
    1.25  
    1.26 -int sys_vif_count;
    1.27 -net_vif_t *sys_vif_list[MAX_SYSTEM_VIFS];
    1.28 -net_rule_ent_t *net_rule_list;
    1.29 -kmem_cache_t *net_vif_cache;
    1.30 +int sys_vif_count;                                  /* global vif count */
    1.31 +net_vif_t *sys_vif_list[MAX_SYSTEM_VIFS];           /* global vif array */
    1.32 +net_rule_ent_t *net_rule_list;                      /* global list of rules */
    1.33 +kmem_cache_t *net_vif_cache;                        
    1.34  kmem_cache_t *net_rule_cache;
    1.35 -static rwlock_t net_rule_lock = RW_LOCK_UNLOCKED;
    1.36 -static rwlock_t sys_vif_lock = RW_LOCK_UNLOCKED;
    1.37 +static rwlock_t net_rule_lock = RW_LOCK_UNLOCKED;   /* rule mutex */
    1.38 +static rwlock_t sys_vif_lock = RW_LOCK_UNLOCKED;    /* vif mutex */
    1.39  
    1.40  void print_net_rule_list();
    1.41  
    1.42 +
    1.43 +/* ----[ VIF Functions ]----------------------------------------------------*/
    1.44 +
    1.45 +/* create_net_vif - Create a new vif and append it to the specified domain.
    1.46 + * 
    1.47 + * the domain is examined to determine how many vifs currently are allocated
    1.48 + * and the newly allocated vif is appended.  The vif is also added to the
    1.49 + * global list.
    1.50 + * 
    1.51 + */
    1.52 +
    1.53  net_vif_t *create_net_vif(int domain)
    1.54  {
    1.55      net_vif_t *new_vif;
    1.56 @@ -65,9 +79,12 @@ net_vif_t *create_net_vif(int domain)
    1.57      return new_vif;
    1.58  }
    1.59  
    1.60 -/* delete the last vif in the given domain. There doesn't seem to be any reason
    1.61 - * (yet) to be able to axe an arbitrary vif, by vif id. 
    1.62 +/* delete_net_vif - Delete the last vif in the given domain. 
    1.63 + *
    1.64 + * There doesn't seem to be any reason (yet) to be able to axe an arbitrary 
    1.65 + * vif, by vif id. 
    1.66   */
    1.67 +
    1.68  void destroy_net_vif(struct task_struct *p)
    1.69  {
    1.70      struct sk_buff *skb;
    1.71 @@ -88,6 +105,9 @@ void destroy_net_vif(struct task_struct 
    1.72      kmem_cache_free(net_vif_cache, p->net_vif_list[i]);
    1.73  }
    1.74  
    1.75 +/* print_vif_list - Print the contents of the global vif table.
    1.76 + */
    1.77 +
    1.78  void print_vif_list()
    1.79  {
    1.80      int i;
    1.81 @@ -103,6 +123,11 @@ void print_vif_list()
    1.82      }
    1.83  }
    1.84  
    1.85 +/* ----[ Net Rule Functions ]-----------------------------------------------*/
    1.86 +
    1.87 +/* add_net_rule - Add a new network filter rule.
    1.88 + */
    1.89 +
    1.90  int add_net_rule(net_rule_t *rule)
    1.91  {
    1.92      net_rule_ent_t *new_ent;
    1.93 @@ -122,6 +147,9 @@ int add_net_rule(net_rule_t *rule)
    1.94      return 0;
    1.95  }
    1.96  
    1.97 +/* delete_net_rule - Delete an existing network rule.
    1.98 + */
    1.99 +
   1.100  int delete_net_rule(net_rule_t *rule)
   1.101  {
   1.102      net_rule_ent_t *ent = net_rule_list, *prev = NULL;
   1.103 @@ -148,10 +176,12 @@ int delete_net_rule(net_rule_t *rule)
   1.104      return 0;
   1.105  }
   1.106   
   1.107 -/* add_default_net_rule.
   1.108 +/* add_default_net_rule - Set up default network path (ie for dom0).
   1.109 + * 
   1.110   * this is a utility function to route all traffic with the specified
   1.111   * ip address to the specified vif.  It's used to set up domain zero.
   1.112   */
   1.113 +
   1.114  void add_default_net_rule(int vif_id, u32 ipaddr)
   1.115  {
   1.116      net_rule_t new_rule;
   1.117 @@ -178,6 +208,9 @@ void add_default_net_rule(int vif_id, u3
   1.118  
   1.119  }
   1.120  
   1.121 +/* print_net_rule - Print a single net rule.
   1.122 + */
   1.123 +
   1.124  void print_net_rule(net_rule_t *r)
   1.125  {
   1.126      printk("===] NET RULE:\n");
   1.127 @@ -195,11 +228,18 @@ void print_net_rule(net_rule_t *r)
   1.128      printk("=] action           : %u\n", r->action);
   1.129  }
   1.130  
   1.131 +/* print_net_rule_list - Print the global rule table.
   1.132 + */
   1.133 +
   1.134  void print_net_rule_list()
   1.135  {
   1.136 -    net_rule_ent_t *ent = net_rule_list;
   1.137 +    net_rule_ent_t *ent;
   1.138      int count = 0;
   1.139      
   1.140 +    read_lock(&net_rule_lock);
   1.141 +
   1.142 +    ent = net_rule_list;
   1.143 +    
   1.144      while (ent) 
   1.145      {
   1.146          print_net_rule(&ent->r);
   1.147 @@ -207,10 +247,14 @@ void print_net_rule_list()
   1.148          count++;
   1.149      }
   1.150      printk("\nTotal of %d rules.\n", count);
   1.151 +
   1.152 +    read_unlock(&net_rule_lock);
   1.153  }
   1.154  
   1.155 -/* Apply the rules to this skbuff and return the vif id that it is bound for.
   1.156 - * -1 to drop.
   1.157 +/* net_find_rule - Find the destination vif according to the current rules.
   1.158 + *
   1.159 + * Apply the rules to this skbuff and return the vif id that it is bound for.
   1.160 + * If there is no match, VIF_DROP is returned.
   1.161   */
   1.162  
   1.163  int net_find_rule(u8 nproto, u8 tproto, u32 src_addr, u32 dst_addr, u16 src_port, u16 dst_port, 
   1.164 @@ -252,6 +296,25 @@ int net_find_rule(u8 nproto, u8 tproto, 
   1.165      return dest;
   1.166  }
   1.167  
   1.168 +/* net_get_target_vif - Find the vif that the given sk_buff is bound for.
   1.169 + *
   1.170 + * This is intended to be the main interface to the VFR rules, where 
   1.171 + * net_find_rule (above) is a private aspect of the current matching 
   1.172 + * implementation.  All in-hypervisor routing should use this function only
   1.173 + * to ensure that this can be rewritten later.
   1.174 + *
   1.175 + * Currently, network rules are stored in a global linked list.  New rules are
   1.176 + * added to the front of this list, and (at present) the first matching rule
   1.177 + * determines the vif that a packet is sent to.  This is obviously not ideal,
   1.178 + * it might be more advisable to have chains, or at lest most-specific 
   1.179 + * matching, and moreover routing latency increases linearly (for old rules)
   1.180 + * as new rules are added.  
   1.181 + *
   1.182 + * net_get_target_vif examines the sk_buff and pulls out the relevant fields
   1.183 + * based on the packet type.  it then calls net_find_rule to scan the rule 
   1.184 + * list.
   1.185 + */
   1.186 +
   1.187  int net_get_target_vif(struct sk_buff *skb)
   1.188  {
   1.189      int target = VIF_DROP;
   1.190 @@ -296,6 +359,8 @@ int net_get_target_vif(struct sk_buff *s
   1.191      return VIF_DROP;
   1.192  }
   1.193  
   1.194 +/* ----[ Syscall Interface ]------------------------------------------------*/
   1.195 +
   1.196  /* 
   1.197   * This is the hook function to handle guest-invoked traps requesting 
   1.198   * changes to the network system.
     2.1 --- a/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h	Fri Dec 06 14:20:10 2002 +0000
     2.2 +++ b/xen-2.4.16/include/hypervisor-ifs/hypervisor-if.h	Mon Dec 16 11:50:19 2002 +0000
     2.3 @@ -44,127 +44,6 @@ typedef struct
     2.4  #define TRAP_INSTR "int $0x82"
     2.5  
     2.6  
     2.7 -static inline int HYPERVISOR_set_trap_table(trap_info_t *table)
     2.8 -{
     2.9 -    int ret;
    2.10 -    __asm__ __volatile__ (
    2.11 -        TRAP_INSTR
    2.12 -        : "=a" (ret) : "0" (__HYPERVISOR_set_trap_table),
    2.13 -        "b" (table) );
    2.14 -
    2.15 -    return ret;
    2.16 -}
    2.17 -
    2.18 -
    2.19 -static inline int HYPERVISOR_pt_update(page_update_request_t *req, int count)
    2.20 -{
    2.21 -    int ret;
    2.22 -    __asm__ __volatile__ (
    2.23 -        TRAP_INSTR
    2.24 -        : "=a" (ret) : "0" (__HYPERVISOR_pt_update), 
    2.25 -        "b" (req), "c" (count) );
    2.26 -
    2.27 -    return ret;
    2.28 -}
    2.29 -
    2.30 -
    2.31 -static inline int HYPERVISOR_console_write(const char *str, int count)
    2.32 -{
    2.33 -    int ret;
    2.34 -    __asm__ __volatile__ (
    2.35 -        TRAP_INSTR
    2.36 -        : "=a" (ret) : "0" (__HYPERVISOR_console_write), 
    2.37 -        "b" (str), "c" (count) );
    2.38 -
    2.39 -
    2.40 -    return ret;
    2.41 -}
    2.42 -
    2.43 -static inline int HYPERVISOR_set_pagetable(unsigned long ptr)
    2.44 -{
    2.45 -    int ret;
    2.46 -    __asm__ __volatile__ (
    2.47 -        TRAP_INSTR
    2.48 -        : "=a" (ret) : "0" (__HYPERVISOR_set_pagetable),
    2.49 -        "b" (ptr) );
    2.50 -
    2.51 -    return ret;
    2.52 -}
    2.53 -
    2.54 -static inline int HYPERVISOR_set_guest_stack(
    2.55 -    unsigned long ss, unsigned long esp)
    2.56 -{
    2.57 -    int ret;
    2.58 -    __asm__ __volatile__ (
    2.59 -        TRAP_INSTR
    2.60 -        : "=a" (ret) : "0" (__HYPERVISOR_set_guest_stack),
    2.61 -        "b" (ss), "c" (esp) );
    2.62 -
    2.63 -    return ret;
    2.64 -}
    2.65 -
    2.66 -static inline int HYPERVISOR_net_update(void)
    2.67 -{
    2.68 -    int ret;
    2.69 -    __asm__ __volatile__ (
    2.70 -        TRAP_INSTR
    2.71 -        : "=a" (ret) : "0" (__HYPERVISOR_net_update) );
    2.72 -
    2.73 -    return ret;
    2.74 -}
    2.75 -
    2.76 -static inline int HYPERVISOR_fpu_taskswitch(void)
    2.77 -{
    2.78 -    int ret;
    2.79 -    __asm__ __volatile__ (
    2.80 -        TRAP_INSTR
    2.81 -        : "=a" (ret) : "0" (__HYPERVISOR_fpu_taskswitch) );
    2.82 -
    2.83 -    return ret;
    2.84 -}
    2.85 -
    2.86 -static inline int HYPERVISOR_yield(void)
    2.87 -{
    2.88 -    int ret;
    2.89 -    __asm__ __volatile__ (
    2.90 -        TRAP_INSTR
    2.91 -        : "=a" (ret) : "0" (__HYPERVISOR_yield) );
    2.92 -
    2.93 -    return ret;
    2.94 -}
    2.95 -
    2.96 -static inline int HYPERVISOR_exit(void)
    2.97 -{
    2.98 -    int ret;
    2.99 -    __asm__ __volatile__ (
   2.100 -        TRAP_INSTR
   2.101 -        : "=a" (ret) : "0" (__HYPERVISOR_exit) );
   2.102 -
   2.103 -    return ret;
   2.104 -}
   2.105 -
   2.106 -static inline int HYPERVISOR_dom0_op(void *dom0_op)
   2.107 -{
   2.108 -    int ret;
   2.109 -    __asm__ __volatile__ (
   2.110 -        TRAP_INSTR
   2.111 -        : "=a" (ret) : "0" (__HYPERVISOR_dom0_op),
   2.112 -        "b" (dom0_op) );
   2.113 -
   2.114 -    return ret;
   2.115 -}
   2.116 -
   2.117 -static inline int HYPERVISOR_network_op(void *network_op)
   2.118 -{
   2.119 -    int ret;
   2.120 -    __asm__ __volatile__ (
   2.121 -        TRAP_INSTR
   2.122 -        : "=a" (ret) : "0" (__HYPERVISOR_network_op),
   2.123 -        "b" (network_op) );
   2.124 -
   2.125 -    return ret;
   2.126 -}
   2.127 -
   2.128  /* Event message note:
   2.129   *
   2.130   * Here, as in the interrupts to the guestos, additional network interfaces
     3.1 --- a/xen-2.4.16/include/xeno/vif.h	Fri Dec 06 14:20:10 2002 +0000
     3.2 +++ b/xen-2.4.16/include/xeno/vif.h	Mon Dec 16 11:50:19 2002 +0000
     3.3 @@ -1,7 +1,9 @@
     3.4  /* vif.h
     3.5   * 
     3.6 - * this is the hypervisor end of the network code.  The net_ring structure
     3.7 + * This is the hypervisor end of the network code.  The net_ring structure
     3.8   * stored in each vif is placed on a shared page to interact with the guest VM.
     3.9 + *
    3.10 + * Copyright (c) 2002, A K Warfield and K A Fraser
    3.11   */
    3.12  
    3.13  /* virtual network interface struct and associated defines. */
    3.14 @@ -26,7 +28,7 @@ typedef struct net_vif_st {
    3.15  
    3.16  /* VIF-related defines. */
    3.17  #define MAX_GUEST_VIFS    2 // each VIF is a small overhead in task_struct
    3.18 -#define MAX_SYSTEM_VIFS 256 // trying to avoid dynamic allocation 
    3.19 +#define MAX_SYSTEM_VIFS 256  
    3.20  
    3.21  /* vif globals */
    3.22  extern int sys_vif_count;
     4.1 --- a/xen-2.4.16/net/dev.c	Fri Dec 06 14:20:10 2002 +0000
     4.2 +++ b/xen-2.4.16/net/dev.c	Mon Dec 16 11:50:19 2002 +0000
     4.3 @@ -687,7 +687,6 @@ int netif_rx(struct sk_buff *skb)
     4.4          unsigned long cpu_mask;
     4.5  #endif
     4.6          struct task_struct *p;
     4.7 -//        unsigned int dest_dom;
     4.8  	int this_cpu = smp_processor_id();
     4.9  	struct softnet_data *queue;
    4.10  	unsigned long flags;
    4.11 @@ -703,58 +702,29 @@ int netif_rx(struct sk_buff *skb)
    4.12  	local_irq_save(flags);
    4.13          
    4.14  	netdev_rx_stat[this_cpu].total++;
    4.15 -/*
    4.16 -        skb->h.raw = skb->nh.raw = skb->data;
    4.17 -        
    4.18 -        if ( skb->len < 2 ) goto drop;
    4.19 -        switch ( ntohs(skb->mac.ethernet->h_proto) )
    4.20 -        {
    4.21 -        case ETH_P_ARP:
    4.22 -            if ( skb->len < 28 ) goto drop;
    4.23 -            dest_dom = ntohl(*(unsigned long *)
    4.24 -                             (skb->nh.raw + 24));
    4.25 -            break;
    4.26 -        case ETH_P_IP:
    4.27 -            if ( skb->len < 20 ) goto drop;
    4.28 -            dest_dom = ntohl(*(unsigned long *)
    4.29 -                             (skb->nh.raw + 16));
    4.30 -            break;
    4.31 -        default:
    4.32 -            goto drop;
    4.33 -        }
    4.34 -        
    4.35 -        if ( (dest_dom < opt_ipbase) ||
    4.36 -             (dest_dom > (opt_ipbase + 16)) )
    4.37 -            goto drop;
    4.38 -        
    4.39 -        dest_dom -= opt_ipbase;
    4.40 -        
    4.41 -        read_lock(&tasklist_lock);
    4.42 -        p = &idle0_task;
    4.43 -        do {
    4.44 -            if ( p->domain != dest_dom ) continue;
    4.45 -            skb_queue_tail(&p->net_vif_list[0]->skb_list, skb); // vfr will fix.
    4.46 -            cpu_mask = mark_hyp_event(p, _HYP_EVENT_NET_RX);
    4.47 -            read_unlock(&tasklist_lock);
    4.48 -            goto found;
    4.49 -        }
    4.50 -        while ( (p = p->next_task) != &idle0_task );
    4.51 -        read_unlock(&tasklist_lock);
    4.52 -        goto drop;
    4.53 -*/
    4.54 +
    4.55          if (skb->src_vif == VIF_UNKNOWN_INTERFACE)
    4.56              skb->src_vif = VIF_PHYSICAL_INTERFACE;
    4.57  
    4.58          if (skb->dst_vif == VIF_UNKNOWN_INTERFACE)
    4.59              net_get_target_vif(skb);
    4.60 -if (skb->dst_vif > 1)
    4.61 -printk("netifrx got packet bound for system vif %d.\n", skb->dst_vif);
    4.62 +        
    4.63          if (sys_vif_list[skb->dst_vif] == NULL)
    4.64          {
    4.65              // the target vif does not exist.
    4.66              goto drop;
    4.67          }
    4.68  
    4.69 +        /* This lock-and-walk of the task list isn't really necessary, and is an
    4.70 +         * artifact of the old code.  The vif contains a pointer to the skb list 
    4.71 +         * we are going to queue the packet in, so the lock and the inner loop
    4.72 +         * could be removed.
    4.73 +         *
    4.74 +         * The argument against this is a possible race in which a domain is killed
    4.75 +         * as packets are being delivered to it.  This would result in the dest vif
    4.76 +         * vanishing before we can deliver to it.
    4.77 +         */
    4.78 +        
    4.79          if ( skb->dst_vif >= VIF_PHYSICAL_INTERFACE )
    4.80          {
    4.81              read_lock(&tasklist_lock);
    4.82 @@ -770,19 +740,6 @@ printk("netifrx got packet bound for sys
    4.83              read_unlock(&tasklist_lock); 
    4.84              goto drop;
    4.85          }
    4.86 -// found:
    4.87 -#if 0
    4.88 -        __skb_queue_tail(&queue->input_pkt_queue,skb);
    4.89 -        /* Runs from irqs or BH's, no need to wake BH */
    4.90 -        cpu_raise_softirq(this_cpu, NET_RX_SOFTIRQ);
    4.91 -        local_irq_restore(flags);
    4.92 -        get_sample_stats(this_cpu);
    4.93 -        return softnet_data[this_cpu].cng_level;
    4.94 -//#else
    4.95 -        hyp_event_notify(cpu_mask);
    4.96 -        local_irq_restore(flags);
    4.97 -        return 0;
    4.98 -#endif
    4.99  
   4.100  drop:
   4.101  	netdev_rx_stat[this_cpu].dropped++;
   4.102 @@ -943,8 +900,6 @@ void flush_rx_queue(void)
   4.103          while ( (skb = skb_dequeue(&current->net_vif_list[nvif]->skb_list)) 
   4.104                          != NULL )
   4.105          {
   4.106 -if (nvif > 0)
   4.107 -printk("flushrxqueue on vif %d (sys: %d) (pkt_type=%d)\n", nvif, current->net_vif_list[nvif]->id, skb->pkt_type);
   4.108              /*
   4.109               * Write the virtual MAC address into the destination field
   4.110               * of the ethernet packet. Furthermore, do the same for ARP
   4.111 @@ -952,15 +907,15 @@ printk("flushrxqueue on vif %d (sys: %d)
   4.112               * is always 00-00-00-00-00-00.
   4.113               *
   4.114               * Actually, the MAC address is now all zeros, except for the
   4.115 -             * first sixteen bits, which are the per-host vif id.
   4.116 -             * (so eth0 should be 00-00-..., eth1 is 01-00-...)
   4.117 +             * second sixteen bits, which are the per-host vif id.
   4.118 +             * (so eth0 should be 00-00-..., eth1 is 00-01-...)
   4.119               */
   4.120              memset(skb->mac.ethernet->h_dest, 0, ETH_ALEN);
   4.121 -            *(unsigned int *)(skb->mac.ethernet->h_dest) = nvif;
   4.122 +            *(unsigned int *)(skb->mac.ethernet->h_dest + 1) = nvif;
   4.123              if ( ntohs(skb->mac.ethernet->h_proto) == ETH_P_ARP )
   4.124              {
   4.125                  memset(skb->nh.raw + 18, 0, ETH_ALEN);
   4.126 -                *(unsigned int *)(skb->nh.raw + 18) = nvif;
   4.127 +                *(unsigned int *)(skb->nh.raw + 18 + 1) = nvif;
   4.128              }
   4.129  
   4.130              i = net_ring->rx_cons;
   4.131 @@ -1978,8 +1933,6 @@ long do_net_update(void)
   4.132          net_ring = current_vif->net_ring;
   4.133          for ( i = net_ring->tx_cons; i != net_ring->tx_prod; i = TX_RING_INC(i) )
   4.134          {
   4.135 -if (j > 0)
   4.136 -printk("net_update called with packet on vif %d system: %d)\n", j, current_vif->id);
   4.137              if ( copy_from_user(&tx, net_ring->tx_ring+i, sizeof(tx)) )
   4.138                  continue;
   4.139  
   4.140 @@ -2028,40 +1981,21 @@ printk("net_update called with packet on
   4.141                  net_get_target_vif(skb);
   4.142                  if ( skb->dst_vif > VIF_PHYSICAL_INTERFACE )
   4.143                  {
   4.144 -if (j > 0)
   4.145 -    printk("Sent to netif_rx.\n");
   4.146                      if (netif_rx(skb) == 0)
   4.147                          /* Give up non-local reference. Packet delivered locally. */
   4.148                          kfree_skb(skb);
   4.149                  }
   4.150                  else if ( skb->dst_vif == VIF_PHYSICAL_INTERFACE )
   4.151                  {
   4.152 -if (j > 0)
   4.153 -    printk("Sent to physical device.\n");
   4.154  
   4.155                          skb_push(skb, skb->dev->hard_header_len);
   4.156                          dev_queue_xmit(skb);
   4.157                  } 
   4.158                  else
   4.159                  {
   4.160 -if (j > 0)
   4.161 -    printk("dropped.\n");
   4.162                      kfree_skb(skb);
   4.163                  }
   4.164  
   4.165 -                /*
   4.166 -                skb_get(skb); 
   4.167 -                skb->protocol = eth_type_trans(skb, skb->dev);
   4.168 -                if ( netif_rx(skb) == 0 )
   4.169 -                {
   4.170 -                    kfree_skb(skb);
   4.171 -                }
   4.172 -                else
   4.173 -                {
   4.174 -                    skb_push(skb, skb->dev->hard_header_len);
   4.175 -                    dev_queue_xmit(skb);
   4.176 -                }
   4.177 -                */
   4.178              }
   4.179          }
   4.180          net_ring->tx_cons = i;
     5.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/network/network.c	Fri Dec 06 14:20:10 2002 +0000
     5.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/network/network.c	Mon Dec 16 11:50:19 2002 +0000
     5.3 @@ -20,7 +20,6 @@
     5.4  #include <linux/etherdevice.h>
     5.5  #include <linux/skbuff.h>
     5.6  #include <linux/init.h>
     5.7 -#include <linux/ip.h> //remove this.
     5.8  
     5.9  #include <net/sock.h>
    5.10  
    5.11 @@ -226,11 +225,6 @@ static int network_start_xmit(struct sk_
    5.12      unsigned int i;
    5.13      struct net_private *np = (struct net_private *)dev->priv;
    5.14      
    5.15 -if ((np->id > 0) || ((skb->len > 20) 
    5.16 -                && (skb->nh.iph != NULL) 
    5.17 -                && (skb->nh.iph->protocol == 1)))
    5.18 -    printk(KERN_WARNING "TX on vif %d (dev:%p)\n", np->id, dev);
    5.19 -    
    5.20      if ( np->tx_full )
    5.21      {
    5.22          printk(KERN_WARNING "%s: full queue wasn't stopped!\n", dev->name);
    5.23 @@ -287,17 +281,8 @@ static void network_rx_int(int irq, void
    5.24          skb->protocol = eth_type_trans(skb, dev);
    5.25          np->stats.rx_packets++;
    5.26          np->stats.rx_bytes += np->net_ring->rx_ring[i].size;
    5.27 -
    5.28 -if (((skb->len > 20)
    5.29 -    && ((*(unsigned char *)(skb->data + 9) == 1) || (np->id > 0)) ))
    5.30 -    printk(KERN_WARNING "RX on vif %d (dev:%p)\n", np->id, dev);
    5.31 -if ((skb != NULL) && (skb->data != NULL) && (skb->len > 20) && ntohl(*(unsigned long *)(skb->data + 16)) == 167903489)
    5.32 -    printk(KERN_WARNING "RX INT (driver): pkt_type is %d.!", skb->pkt_type);
    5.33 -
    5.34          netif_rx(skb);
    5.35          dev->last_rx = jiffies;
    5.36 -                
    5.37 -
    5.38      }
    5.39  
    5.40      np->rx_idx = i;
    5.41 @@ -307,7 +292,6 @@ if ((skb != NULL) && (skb->data != NULL)
    5.42      /* Deal with hypervisor racing our resetting of rx_event. */
    5.43      smp_mb();
    5.44      if ( np->net_ring->rx_cons != i ) { 
    5.45 -//printk("redoing network rx...\n"); 
    5.46                  goto again;
    5.47          }
    5.48  }
    5.49 @@ -371,7 +355,7 @@ int __init init_module(void)
    5.50          dev->get_stats       = network_get_stats;
    5.51  
    5.52          memset(dev->dev_addr, 0, ETH_ALEN);
    5.53 -        *(unsigned int *)(dev->dev_addr) = i;
    5.54 +        *(unsigned int *)(dev->dev_addr + 1) = i;
    5.55  
    5.56          if ( (err = register_netdev(dev)) != 0 )
    5.57          {
    5.58 @@ -382,7 +366,6 @@ int __init init_module(void)
    5.59          np->dev = dev;
    5.60          np->id = i;
    5.61          list_add(&np->list, &dev_list);
    5.62 -printk(KERN_WARNING "Added VIF, ifindex is %d.\n", dev->ifindex);
    5.63      }
    5.64  
    5.65      return 0;