bitkeeper revision 1.1159.261.3 (420e3c341h1fbkH3NCtXo63yPlvjGg)

Hand merge
This commit is contained in:
mafetter@fleming.research committed 2005-02-12 17:26:12 +00:00
commit dba0c0fcbc
16 files changed
+200 -189

No files matched your search

+1
View File
@@ -744,6 +744,7 @@
40fcefb3yMSrZvApO9ToIi-iQwnchA tools/sv/images/xen.png
41013a83z27rKvWIxAfUBMVZ1eDCDg tools/sv/inc/script.js
40fcefb3zGC9XNBkSwTEobCoq8YClA tools/sv/inc/style.css
420b963dK3yGNtqxRM8npGZtrCQd1g tools/vnet/00INSTALL
41a21888_WlknVWjSxb32Fo13_ujsw tools/vnet/00README
41a21888bOiOJc7blzRbe4MNJoaYTw tools/vnet/Makefile
41a21888mg2k5HeiVjlQYEtJBZT4Qg tools/vnet/doc/vnet-module.txt
@@ -240,7 +240,9 @@ void __init setup_arch(char **cmdline_p)
boot_cpu_data.pgd_quick = cpu0_pgd_quicklist;
boot_cpu_data.pte_quick = cpu0_pte_quicklist;
ROOT_DEV = MKDEV(RAMDISK_MAJOR,0);
/* This must be initialized to UNNAMED_MAJOR for ipconfig to work
properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd. */
ROOT_DEV = MKDEV(UNNAMED_MAJOR,0);
memset(&drive_info, 0, sizeof(drive_info));
memset(&screen_info, 0, sizeof(screen_info));
@@ -1360,7 +1360,10 @@ void __init setup_arch(char **cmdline_p)
efi_enabled = 1;
#endif
ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); /*old_decode_dev(ORIG_ROOT_DEV);*/
/* This must be initialized to UNNAMED_MAJOR for ipconfig to work
properly. Setting ROOT_DEV to default to /dev/ram0 breaks initrd.
*/
ROOT_DEV = MKDEV(UNNAMED_MAJOR,0);
drive_info = DRIVE_INFO;
screen_info = SCREEN_INFO;
edid_info = EDID_INFO;
@@ -5,7 +5,7 @@
*
* Copyright (c) 2003-2004, Keir Fraser & Steve Hand
* Modifications by Mark A. Williamson are (c) Intel Research Cambridge
* Copyright (c) 2004, Christian Limpach
* Copyright (c) 2004-2005, Christian Limpach
*
* This file may be distributed separately from the Linux kernel, or
* incorporated into other software packages, subject to the following license:
@@ -69,7 +69,8 @@ struct xlbd_type_info {
int devs_per_major;
int hardsect_size;
int max_sectors;
char *name;
char *devname;
char *diskname;
};
/*
@@ -5,7 +5,7 @@
*
* Copyright (c) 2003-2004, Keir Fraser & Steve Hand
* Modifications by Mark A. Williamson are (c) Intel Research Cambridge
* Copyright (c) 2004, Christian Limpach
* Copyright (c) 2004-2005, Christian Limpach
*
* This file may be distributed separately from the Linux kernel, or
* incorporated into other software packages, subject to the following license:
@@ -49,7 +49,8 @@ static struct xlbd_type_info xlbd_ide_type = {
.hardsect_size = 512,
.max_sectors = 128, /* 'hwif->rqsize' if we knew it */
// XXXcl todo read_ahead[major] = 8; /* from drivers/ide/ide-probe.c */
.name = "hd",
.devname = "ide",
.diskname = "hd",
};
static struct xlbd_type_info xlbd_scsi_type = {
@@ -59,7 +60,8 @@ static struct xlbd_type_info xlbd_scsi_type = {
.hardsect_size = 512,
.max_sectors = 128*8, /* XXX 128; */
// XXXcl todo read_ahead[major] = 0; /* XXX 8; -- guessing */
.name = "sd",
.devname = "sd",
.diskname = "sd",
};
static struct xlbd_type_info xlbd_vbd_type = {
@@ -69,7 +71,8 @@ static struct xlbd_type_info xlbd_vbd_type = {
.hardsect_size = 512,
.max_sectors = 128,
// XXXcl todo read_ahead[major] = 8;
.name = "xvd",
.devname = "xvd",
.diskname = "xvd",
};
static struct xlbd_major_info *major_info[NUM_IDE_MAJORS + NUM_SCSI_MAJORS +
@@ -183,13 +186,13 @@ static struct xlbd_major_info *xlbd_get_major_info(int xd_device, int *minor)
}
major_info[mi_idx]->major = new_major;
if (register_blkdev(major_info[mi_idx]->major, major_info[mi_idx]->type->name)) {
if (register_blkdev(major_info[mi_idx]->major, major_info[mi_idx]->type->devname)) {
printk(KERN_ALERT "XL VBD: can't get major %d with name %s\n",
major_info[mi_idx]->major, major_info[mi_idx]->type->name);
major_info[mi_idx]->major, major_info[mi_idx]->type->devname);
goto out;
}
devfs_mk_dir(major_info[mi_idx]->type->name);
devfs_mk_dir(major_info[mi_idx]->type->devname);
return major_info[mi_idx];
@@ -226,7 +229,7 @@ static struct gendisk *xlvbd_get_gendisk(struct xlbd_major_info *mi,
gd->first_minor = xd_minor;
gd->fops = &xlvbd_block_fops;
gd->private_data = di;
sprintf(gd->disk_name, "%s%c%d", mi->type->name,
sprintf(gd->disk_name, "%s%c%d", mi->type->diskname,
'a' + mi->index * mi->type->partn_per_major +
(xd_minor >> mi->type->partn_shift),
xd_minor & ((1 << mi->type->partn_shift) - 1));
@@ -1,11 +1,11 @@
/******************************************************************************
* arch/xen/drivers/netif/backend/main.c
* drivers/xen/netback/netback.c
*
* Back-end of the driver for virtual block devices. This portion of the
* driver exports a 'unified' block-device interface that can be accessed
* Back-end of the driver for virtual network devices. This portion of the
* driver exports a 'unified' network-device interface that can be accessed
* by any operating system that implements a compatible front end. A
* reference front-end implementation can be found in:
* arch/xen/drivers/netif/frontend
* drivers/xen/netfront/netfront.c
*
* Copyright (c) 2002-2004, K A Fraser
*/
@@ -41,6 +41,8 @@
#include <linux/bitops.h>
#include <net/sock.h>
#include <net/pkt_sched.h>
#include <net/arp.h>
#include <net/route.h>
#include <asm/io.h>
#include <asm-xen/evtchn.h>
#include <asm-xen/ctrl_if.h>
@@ -48,11 +50,6 @@
#include <asm-xen/balloon.h>
#include <asm/page.h>
#include <net/arp.h>
#include <net/route.h>
#define DEBUG 0
#ifndef __GFP_NOWARN
#define __GFP_NOWARN 0
#endif
@@ -63,7 +60,7 @@
atomic_set(&(skb_shinfo(_skb)->dataref), 1); \
skb_shinfo(_skb)->nr_frags = 0; \
skb_shinfo(_skb)->frag_list = NULL; \
} while ( 0 )
} while (0)
/* Allow headroom on each rx pkt for Ethernet header, alignment padding, ... */
#define RX_HEADROOM 200
@@ -171,10 +168,9 @@ static struct net_device *find_dev_by_handle(unsigned int handle)
{
struct list_head *ent;
struct net_private *np;
list_for_each ( ent, &dev_list )
{
list_for_each (ent, &dev_list) {
np = list_entry(ent, struct net_private, list);
if ( np->handle == handle )
if (np->handle == handle)
return np->dev;
}
return NULL;
@@ -203,7 +199,7 @@ static void netctrl_init(void)
*/
static int netctrl_err(int err)
{
if ( (err < 0) && !netctrl.err )
if ((err < 0) && !netctrl.err)
netctrl.err = err;
return netctrl.err;
}
@@ -216,9 +212,9 @@ static int netctrl_connected(void)
{
int ok;
if ( netctrl.err )
if (netctrl.err)
ok = netctrl.err;
else if ( netctrl.up == NETIF_DRIVER_STATUS_UP )
else if (netctrl.up == NETIF_DRIVER_STATUS_UP)
ok = (netctrl.connected_n == netctrl.interface_n);
else
ok = 0;
@@ -266,14 +262,14 @@ static int send_fake_arp(struct net_device *dev)
src_ip = inet_select_addr(dev, dst_ip, RT_SCOPE_LINK);
/* No IP? Then nothing to do. */
if ( src_ip == 0 )
if (src_ip == 0)
return 0;
skb = arp_create(ARPOP_REPLY, ETH_P_ARP,
dst_ip, dev, src_ip,
/*dst_hw*/ NULL, /*src_hw*/ NULL,
/*target_hw*/ dev->dev_addr);
if ( skb == NULL )
if (skb == NULL)
return -ENOMEM;
return dev_queue_xmit(skb);
@@ -302,15 +298,14 @@ static void network_tx_buf_gc(struct net_device *dev)
struct net_private *np = netdev_priv(dev);
struct sk_buff *skb;
if ( np->backend_state != BEST_CONNECTED )
if (np->backend_state != BEST_CONNECTED)
return;
do {
prod = np->tx->resp_prod;
rmb(); /* Ensure we see responses up to 'rp'. */
for ( i = np->tx_resp_cons; i != prod; i++ )
{
for (i = np->tx_resp_cons; i != prod; i++) {
id = np->tx->ring[MASK_NETIF_TX_IDX(i)].resp.id;
skb = np->tx_skbs[id];
ADD_ID_TO_FREELIST(np->tx_skbs, id);
@@ -330,14 +325,11 @@ static void network_tx_buf_gc(struct net_device *dev)
np->tx->event =
prod + ((np->tx->req_prod - prod) >> 1) + 1;
mb();
}
while ( prod != np->tx->resp_prod );
} while (prod != np->tx->resp_prod);
if ( np->tx_full &&
((np->tx->req_prod - prod) < NETIF_TX_RING_SIZE) )
{
if (np->tx_full && ((np->tx->req_prod - prod) < NETIF_TX_RING_SIZE)) {
np->tx_full = 0;
if ( np->user_state == UST_OPEN )
if (np->user_state == UST_OPEN)
netif_wake_queue(dev);
}
}
@@ -351,7 +343,7 @@ static void network_alloc_rx_buffers(struct net_device *dev)
int i, batch_target;
NETIF_RING_IDX req_prod = np->rx->req_prod;
if ( unlikely(np->backend_state != BEST_CONNECTED) )
if (unlikely(np->backend_state != BEST_CONNECTED))
return;
/*
@@ -361,20 +353,18 @@ static void network_alloc_rx_buffers(struct net_device *dev)
* ourself and for other kernel subsystems.
*/
batch_target = np->rx_target - (req_prod - np->rx_resp_cons);
for ( i = skb_queue_len(&np->rx_batch); i < batch_target; i++ )
{
if ( unlikely((skb = alloc_xen_skb(dev->mtu + RX_HEADROOM)) == NULL) )
for (i = skb_queue_len(&np->rx_batch); i < batch_target; i++) {
if (unlikely((skb = alloc_xen_skb(dev->mtu + RX_HEADROOM)) == NULL))
break;
__skb_queue_tail(&np->rx_batch, skb);
}
/* Is the batch large enough to be worthwhile? */
if ( i < (np->rx_target/2) )
if (i < (np->rx_target/2))
return;
for ( i = 0; ; i++ )
{
if ( (skb = __skb_dequeue(&np->rx_batch)) == NULL )
for (i = 0; ; i++) {
if ((skb = __skb_dequeue(&np->rx_batch)) == NULL)
break;
skb->dev = dev;
@@ -421,15 +411,15 @@ static void network_alloc_rx_buffers(struct net_device *dev)
(void)HYPERVISOR_multicall(rx_mcl, i+1);
/* Check return status of HYPERVISOR_dom_mem_op(). */
if ( unlikely(rx_mcl[i].args[5] != i) )
if (unlikely(rx_mcl[i].args[5] != i))
panic("Unable to reduce memory reservation\n");
/* Above is a suitable barrier to ensure backend will see requests. */
np->rx->req_prod = req_prod + i;
/* Adjust our floating fill target if we risked running out of buffers. */
if ( ((req_prod - np->rx->resp_prod) < (np->rx_target / 4)) &&
((np->rx_target *= 2) > RX_MAX_TARGET) )
if (((req_prod - np->rx->resp_prod) < (np->rx_target / 4)) &&
((np->rx_target *= 2) > RX_MAX_TARGET))
np->rx_target = RX_MAX_TARGET;
}
@@ -441,18 +431,16 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
netif_tx_request_t *tx;
NETIF_RING_IDX i;
if ( unlikely(np->tx_full) )
{
if (unlikely(np->tx_full)) {
printk(KERN_ALERT "%s: full queue wasn't stopped!\n", dev->name);
netif_stop_queue(dev);
goto drop;
}
if ( unlikely((((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >=
PAGE_SIZE) )
{
if (unlikely((((unsigned long)skb->data & ~PAGE_MASK) + skb->len) >=
PAGE_SIZE)) {
struct sk_buff *nskb;
if ( unlikely((nskb = alloc_xen_skb(skb->len)) == NULL) )
if (unlikely((nskb = alloc_xen_skb(skb->len)) == NULL))
goto drop;
skb_put(nskb, skb->len);
memcpy(nskb->data, skb->data, skb->len);
@@ -463,8 +451,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
spin_lock_irq(&np->tx_lock);
if ( np->backend_state != BEST_CONNECTED )
{
if (np->backend_state != BEST_CONNECTED) {
spin_unlock_irq(&np->tx_lock);
goto drop;
}
@@ -485,8 +472,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
network_tx_buf_gc(dev);
if ( (i - np->tx_resp_cons) == (NETIF_TX_RING_SIZE - 1) )
{
if ((i - np->tx_resp_cons) == (NETIF_TX_RING_SIZE - 1)) {
np->tx_full = 1;
netif_stop_queue(dev);
}
@@ -498,7 +484,7 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* Only notify Xen if we really have to. */
mb();
if ( np->tx->TX_TEST_IDX == i )
if (np->tx->TX_TEST_IDX == i)
notify_via_evtchn(np->evtchn);
return 0;
@@ -509,7 +495,6 @@ static int network_start_xmit(struct sk_buff *skb, struct net_device *dev)
return 0;
}
static irqreturn_t netif_int(int irq, void *dev_id, struct pt_regs *ptregs)
{
struct net_device *dev = dev_id;
@@ -520,8 +505,7 @@ static irqreturn_t netif_int(int irq, void *dev_id, struct pt_regs *ptregs)
network_tx_buf_gc(dev);
spin_unlock_irqrestore(&np->tx_lock, flags);
if ( (np->rx_resp_cons != np->rx->resp_prod) &&
(np->user_state == UST_OPEN) )
if ((np->rx_resp_cons != np->rx->resp_prod) && (np->user_state == UST_OPEN))
netif_rx_schedule(dev);
return IRQ_HANDLED;
@@ -542,33 +526,30 @@ static int netif_poll(struct net_device *dev, int *pbudget)
spin_lock(&np->rx_lock);
if ( np->backend_state != BEST_CONNECTED )
{
if (np->backend_state != BEST_CONNECTED) {
spin_unlock(&np->rx_lock);
return 0;
}
skb_queue_head_init(&rxq);
if ( (budget = *pbudget) > dev->quota )
if ((budget = *pbudget) > dev->quota)
budget = dev->quota;
rp = np->rx->resp_prod;
rmb(); /* Ensure we see queued responses up to 'rp'. */
for ( i = np->rx_resp_cons, work_done = 0;
(i != rp) && (work_done < budget);
i++, work_done++ )
{
for (i = np->rx_resp_cons, work_done = 0;
(i != rp) && (work_done < budget);
i++, work_done++) {
rx = &np->rx->ring[MASK_NETIF_RX_IDX(i)].resp;
/*
* An error here is very odd. Usually indicates a backend bug,
* low-memory condition, or that we didn't have reservation headroom.
*/
if ( unlikely(rx->status <= 0) )
{
if ( net_ratelimit() )
if (unlikely(rx->status <= 0)) {
if (net_ratelimit())
printk(KERN_WARNING "Bad rx buffer (memory squeeze?).\n");
np->rx->ring[MASK_NETIF_RX_IDX(np->rx->req_prod)].req.id = rx->id;
wmb();
@@ -608,8 +589,7 @@ static int netif_poll(struct net_device *dev, int *pbudget)
balloon_update_driver_allowance(-work_done);
/* Do all the remapping work, and M->P updates, in one big hypercall. */
if ( likely((mcl - rx_mcl) != 0) )
{
if (likely((mcl - rx_mcl) != 0)) {
mcl->op = __HYPERVISOR_mmu_update;
mcl->args[0] = (unsigned long)rx_mmu;
mcl->args[1] = mmu - rx_mmu;
@@ -618,33 +598,29 @@ static int netif_poll(struct net_device *dev, int *pbudget)
(void)HYPERVISOR_multicall(rx_mcl, mcl - rx_mcl);
}
while ( (skb = __skb_dequeue(&rxq)) != NULL )
{
while ((skb = __skb_dequeue(&rxq)) != NULL) {
/*
* Enough room in skbuff for the data we were passed? Also, Linux
* expects at least 16 bytes headroom in each receive buffer.
*/
if ( unlikely(skb->tail > skb->end) ||
unlikely((skb->data - skb->head) < 16) )
{
if (unlikely(skb->tail > skb->end) ||
unlikely((skb->data - skb->head) < 16)) {
nskb = NULL;
/* Only copy the packet if it fits in the current MTU. */
if ( skb->len <= (dev->mtu + ETH_HLEN) )
{
if ( (skb->tail > skb->end) && net_ratelimit() )
if (skb->len <= (dev->mtu + ETH_HLEN)) {
if ((skb->tail > skb->end) && net_ratelimit())
printk(KERN_INFO "Received packet needs %d bytes more "
"headroom.\n", skb->tail - skb->end);
if ( (nskb = alloc_xen_skb(skb->len + 2)) != NULL )
{
if ((nskb = alloc_xen_skb(skb->len + 2)) != NULL) {
skb_reserve(nskb, 2);
skb_put(nskb, skb->len);
memcpy(nskb->data, skb->data, skb->len);
nskb->dev = skb->dev;
}
}
else if ( net_ratelimit() )
else if (net_ratelimit())
printk(KERN_INFO "Received packet too big for MTU "
"(%d > %d)\n", skb->len - ETH_HLEN, dev->mtu);
@@ -655,7 +631,7 @@ static int netif_poll(struct net_device *dev, int *pbudget)
dev_kfree_skb(skb);
/* Switch old for new, if we copied the buffer. */
if ( (skb = nskb) == NULL )
if ((skb = nskb) == NULL)
continue;
}
@@ -674,8 +650,8 @@ static int netif_poll(struct net_device *dev, int *pbudget)
/* If we get a callback with very few responses, reduce fill target. */
/* NB. Note exponential increase, linear decrease. */
if ( ((np->rx->req_prod - np->rx->resp_prod) > ((3*np->rx_target) / 4)) &&
(--np->rx_target < RX_MIN_TARGET) )
if (((np->rx->req_prod - np->rx->resp_prod) > ((3*np->rx_target) / 4)) &&
(--np->rx_target < RX_MIN_TARGET))
np->rx_target = RX_MIN_TARGET;
network_alloc_rx_buffers(dev);
@@ -683,16 +659,14 @@ static int netif_poll(struct net_device *dev, int *pbudget)
*pbudget -= work_done;
dev->quota -= work_done;
if ( work_done < budget )
{
if (work_done < budget) {
local_irq_save(flags);
np->rx->event = i + 1;
/* Deal with hypervisor racing our resetting of rx_event. */
mb();
if ( np->rx->resp_prod == i )
{
if (np->rx->resp_prod == i) {
__netif_rx_complete(dev);
more_to_do = 0;
}
@@ -755,10 +729,8 @@ static void network_connect(struct net_device *dev,
* to avoid this but maybe it doesn't matter so much given the
* interface has been down.
*/
for ( requeue_idx = 0, i = 1; i <= NETIF_TX_RING_SIZE; i++ )
{
if ( (unsigned long)np->tx_skbs[i] >= __PAGE_OFFSET )
{
for (requeue_idx = 0, i = 1; i <= NETIF_TX_RING_SIZE; i++) {
if ((unsigned long)np->tx_skbs[i] >= __PAGE_OFFSET) {
struct sk_buff *skb = np->tx_skbs[i];
tx = &np->tx->ring[requeue_idx++].req;
@@ -775,8 +747,8 @@ static void network_connect(struct net_device *dev,
np->tx->req_prod = requeue_idx;
/* Rebuild the RX buffer freelist and the RX ring itself. */
for ( requeue_idx = 0, i = 1; i <= NETIF_RX_RING_SIZE; i++ )
if ( (unsigned long)np->rx_skbs[i] >= __PAGE_OFFSET )
for (requeue_idx = 0, i = 1; i <= NETIF_RX_RING_SIZE; i++)
if ((unsigned long)np->rx_skbs[i] >= __PAGE_OFFSET)
np->rx->ring[requeue_idx++].req.id = i;
wmb();
np->rx->req_prod = requeue_idx;
@@ -791,7 +763,7 @@ static void network_connect(struct net_device *dev,
notify_via_evtchn(status->evtchn);
network_tx_buf_gc(dev);
if ( np->user_state == UST_OPEN )
if (np->user_state == UST_OPEN)
netif_start_queue(dev);
spin_unlock(&np->rx_lock);
@@ -917,9 +889,7 @@ static void vif_disconnect(struct net_private *np)
* is initiated by a special "RESET" message - disconnect could
* just mean we're not allowed to use this interface any more.
*/
static void
vif_reset(
struct net_private *np)
static void vif_reset(struct net_private *np)
{
IPRINTK("Attempting to reconnect network interface: handle=%u\n",
np->handle);
@@ -932,9 +902,8 @@ vif_reset(
* Sets the mac and event channel from the message.
* Binds the irq to the event channel.
*/
static void
vif_connect(
struct net_private *np, netif_fe_interface_status_t *status)
static void
vif_connect(struct net_private *np, netif_fe_interface_status_t *status)
{
struct net_device *dev = np->dev;
memcpy(dev->dev_addr, status->mac, ETH_ALEN);
@@ -959,8 +928,7 @@ static int create_netdev(int handle, struct net_device **val)
struct net_device *dev = NULL;
struct net_private *np = NULL;
if ( (dev = alloc_etherdev(sizeof(struct net_private))) == NULL )
{
if ((dev = alloc_etherdev(sizeof(struct net_private))) == NULL) {
printk(KERN_WARNING "%s> alloc_etherdev failed.\n", __FUNCTION__);
err = -ENOMEM;
goto exit;
@@ -978,9 +946,9 @@ static int create_netdev(int handle, struct net_device **val)
np->rx_target = RX_MIN_TARGET;
/* Initialise {tx,rx}_skbs to be a free chain containing every entry. */
for ( i = 0; i <= NETIF_TX_RING_SIZE; i++ )
for (i = 0; i <= NETIF_TX_RING_SIZE; i++)
np->tx_skbs[i] = (void *)(i+1);
for ( i = 0; i <= NETIF_RX_RING_SIZE; i++ )
for (i = 0; i <= NETIF_RX_RING_SIZE; i++)
np->rx_skbs[i] = (void *)(i+1);
dev->open = network_open;
@@ -990,8 +958,7 @@ static int create_netdev(int handle, struct net_device **val)
dev->poll = netif_poll;
dev->weight = 64;
if ( (err = register_netdev(dev)) != 0 )
{
if ((err = register_netdev(dev)) != 0) {
printk(KERN_WARNING "%s> register_netdev err=%d\n", __FUNCTION__, err);
goto exit;
}
@@ -999,9 +966,9 @@ static int create_netdev(int handle, struct net_device **val)
list_add(&np->list, &dev_list);
exit:
if ( (err != 0) && (dev != NULL ) )
if ((err != 0) && (dev != NULL ))
kfree(dev);
else if ( val != NULL )
else if (val != NULL)
*val = dev;
return err;
}
@@ -1015,36 +982,34 @@ static int create_netdev(int handle, struct net_device **val)
* @return 0 on success, error code otherwise
*/
static int
target_vif(
netif_fe_interface_status_t *status, struct net_private **np)
target_vif(netif_fe_interface_status_t *status, struct net_private **np)
{
int err = 0;
struct net_device *dev;
DPRINTK("> handle=%d\n", status->handle);
if ( status->handle < 0 )
{
if (status->handle < 0) {
err = -EINVAL;
goto exit;
}
if ( (dev = find_dev_by_handle(status->handle)) != NULL )
if ((dev = find_dev_by_handle(status->handle)) != NULL)
goto exit;
if ( status->status == NETIF_INTERFACE_STATUS_CLOSED )
if (status->status == NETIF_INTERFACE_STATUS_CLOSED)
goto exit;
if ( status->status == NETIF_INTERFACE_STATUS_CHANGED )
if (status->status == NETIF_INTERFACE_STATUS_CHANGED)
goto exit;
/* It's a new interface in a good state - create it. */
DPRINTK("> create device...\n");
if ( (err = create_netdev(status->handle, &dev)) != 0 )
if ((err = create_netdev(status->handle, &dev)) != 0)
goto exit;
netctrl.interface_n++;
exit:
if ( np != NULL )
if (np != NULL)
*np = ((dev && !err) ? netdev_priv(dev) : NULL);
DPRINTK("< err=%d\n", err);
return err;
@@ -1059,23 +1024,19 @@ static void netif_interface_status(netif_fe_interface_status_t *status)
DPRINTK("> status=%s handle=%d\n",
status_name[status->status], status->handle);
if ( (err = target_vif(status, &np)) != 0 )
{
if ((err = target_vif(status, &np)) != 0) {
WPRINTK("Invalid netif: handle=%u\n", status->handle);
return;
}
if ( np == NULL )
{
if (np == NULL) {
DPRINTK("> no vif\n");
return;
}
switch ( status->status )
{
switch (status->status) {
case NETIF_INTERFACE_STATUS_CLOSED:
switch ( np->backend_state )
{
switch (np->backend_state) {
case BEST_CLOSED:
case BEST_DISCONNECTED:
case BEST_CONNECTED:
@@ -1085,8 +1046,7 @@ static void netif_interface_status(netif_fe_interface_status_t *status)
break;
case NETIF_INTERFACE_STATUS_DISCONNECTED:
switch ( np->backend_state )
{
switch (np->backend_state) {
case BEST_CLOSED:
vif_disconnect(np);
break;
@@ -1098,8 +1058,7 @@ static void netif_interface_status(netif_fe_interface_status_t *status)
break;
case NETIF_INTERFACE_STATUS_CONNECTED:
switch ( np->backend_state )
{
switch (np->backend_state) {
case BEST_CLOSED:
WPRINTK("Unexpected netif status %s in state %s\n",
status_name[status->status],
@@ -1141,20 +1100,17 @@ static void netif_driver_status(netif_fe_driver_status_t *status)
static void netif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id)
{
switch ( msg->subtype )
{
switch (msg->subtype) {
case CMSG_NETIF_FE_INTERFACE_STATUS:
if ( msg->length != sizeof(netif_fe_interface_status_t) )
if (msg->length != sizeof(netif_fe_interface_status_t))
goto error;
netif_interface_status((netif_fe_interface_status_t *)
&msg->msg[0]);
netif_interface_status((netif_fe_interface_status_t *) &msg->msg[0]);
break;
case CMSG_NETIF_FE_DRIVER_STATUS:
if ( msg->length != sizeof(netif_fe_driver_status_t) )
if (msg->length != sizeof(netif_fe_driver_status_t))
goto error;
netif_driver_status((netif_fe_driver_status_t *)
&msg->msg[0]);
netif_driver_status((netif_fe_driver_status_t *) &msg->msg[0]);
break;
error:
@@ -1179,8 +1135,7 @@ static int probe_interfaces(void)
DPRINTK(">\n");
for ( wait_i = 0; wait_i < wait_n; wait_i++)
{
for (wait_i = 0; wait_i < wait_n; wait_i++) {
DPRINTK("> wait_i=%d\n", wait_i);
conn = netctrl_connected();
if(conn) break;
@@ -1190,8 +1145,7 @@ static int probe_interfaces(void)
}
DPRINTK("> wait finished...\n");
if ( conn <= 0 )
{
if (conn <= 0) {
err = netctrl_err(-ENETDOWN);
WPRINTK("Failed to connect all virtual interfaces: err=%d\n", err);
}
@@ -1223,8 +1177,7 @@ static int probe_interfaces(void)
DPRINTK(">\n");
netctrl.interface_n = 0;
for ( wait_i = 0; wait_i < wait_n; wait_i++ )
{
for (wait_i = 0; wait_i < wait_n; wait_i++) {
DPRINTK("> wait_i=%d query=%d\n", wait_i, query);
msg.handle = query;
memcpy(cmsg.msg, &msg, sizeof(msg));
@@ -1236,7 +1189,7 @@ static int probe_interfaces(void)
DPRINTK("> err=%d\n", err);
if(err) goto exit;
DPRINTK("> rmsg=%p msg=%p, reply=%p\n", &rmsg, rmsg.msg, reply);
if((int)reply->handle < 0){
if((int)reply->handle < 0) {
// No more interfaces.
break;
}
@@ -1246,8 +1199,7 @@ static int probe_interfaces(void)
}
exit:
if ( err )
{
if (err) {
err = netctrl_err(-ENETDOWN);
WPRINTK("Connecting virtual network interfaces failed: err=%d\n", err);
}
@@ -1262,22 +1214,20 @@ static int probe_interfaces(void)
* We use this notifier to send out a fake ARP reply to reset switches and
* router ARP caches when an IP interface is brought up on a VIF.
*/
static int inetdev_notify(struct notifier_block *this,
unsigned long event,
void *ptr)
static int
inetdev_notify(struct notifier_block *this, unsigned long event, void *ptr)
{
struct in_ifaddr *ifa = (struct in_ifaddr *)ptr;
struct net_device *dev = ifa->ifa_dev->dev;
struct list_head *ent;
struct net_private *np;
if ( event != NETDEV_UP )
if (event != NETDEV_UP)
goto out;
list_for_each ( ent, &dev_list )
{
list_for_each (ent, &dev_list) {
np = list_entry(ent, struct net_private, list);
if ( np->dev == dev )
if (np->dev == dev)
(void)send_fake_arp(dev);
}
@@ -1295,7 +1245,7 @@ static int __init netif_init(void)
{
int err = 0;
if ( xen_start_info.flags & SIF_INITDOMAIN )
if (xen_start_info.flags & SIF_INITDOMAIN)
return 0;
IPRINTK("Initialising virtual ethernet driver.\n");
@@ -1306,7 +1256,7 @@ static int __init netif_init(void)
CALLBACK_IN_BLOCKING_CONTEXT);
send_driver_status(1);
err = probe_interfaces();
if ( err )
if (err)
ctrl_if_unregister_receiver(CMSG_NETIF_FE, netif_ctrlif_rx);
DPRINTK("< err=%d\n", err);
@@ -1338,8 +1288,7 @@ void netif_suspend(void)
struct list_head *ent;
struct net_private *np;
list_for_each ( ent, &dev_list )
{
list_for_each (ent, &dev_list) {
np = list_entry(ent, struct net_private, list);
vif_suspend(np);
}
@@ -1350,8 +1299,7 @@ void netif_resume(void)
struct list_head *ent;
struct net_private *np;
list_for_each ( ent, &dev_list )
{
list_for_each (ent, &dev_list) {
np = list_entry(ent, struct net_private, list);
vif_resume(np);
}
+31
View File
@@ -0,0 +1,31 @@
To compile and install run "make install"; if it fails or you need to reinstall
run "make clean" first or the build will fail, at least that is what I have
found under 2.6.10.
Other important items:
1) You will need to have your xen0 kernel compiled with HMAC_SUPPORT
2.6.x = (MAIN MENU: Cryptographic Options -> HMAC Support)
BEFORE running "make install".
2) You will want at least some of the other alogorithms listed under
"Cryptographic Options" for the kernel compiled as modules.
3) You will want the networking IPsec/VLAN options compiled in as modules
2.6.x = (MAIN MENU: Device Drivers -> Networking Support ->
Networking Options ->
IP: AH transformation
IP: ESP transformation
IP: IPComp transformation
IP: tunnel transformation
IPsec user configuration interface
802.1Q VLAN Support
4) The module (vnet_module) will not properly load from the command line
with a "modprobe vnet_module". Use network-vnet to properly configure
your system and load the module for you.
Please refer to the additional documentation found in tools/vnet/doc for
proper syntax and config file parameters.
+3 -3
View File
@@ -20,10 +20,10 @@ gc: gc.tar.gz
tar xfz gc.tar.gz
ln -sf gc?.? gc
gc/Makefile:
(cd gc && ./configure --prefix=`pwd`/install)
gc/.configure-makefile:
(cd gc && ./configure --prefix=`pwd`/install && touch .configure-makefile)
gc-install: gc gc/Makefile
gc-install: gc gc/.configure-makefile
make -C gc
make -C gc install
+1 -1
View File
@@ -36,7 +36,7 @@ typedef struct VnetMsgHdr {
} __attribute__((packed)) VnetMsgHdr;
typedef struct VarpHdr {
VnetMsgHdr;
VnetMsgHdr hdr;
uint32_t vnet;
Vmac vmac;
uint32_t addr;
+7 -7
View File
@@ -368,8 +368,8 @@ int varp_send(u16 opcode, struct net_device *dev, struct sk_buff *skbin,
// Varp header.
varph = (void*)skb_put(skbout, varp_n);
*varph = (VarpHdr){};
varph->id = htons(VARP_ID);
varph->opcode = htons(opcode);
varph->hdr.id = htons(VARP_ID);
varph->hdr.opcode = htons(opcode);
varph->vnet = htonl(vnet);
varph->vmac = *vmac;
varph->addr = saddr;
@@ -1076,9 +1076,9 @@ int varp_handle_message(struct sk_buff *skb){
goto exit;
}
mine = 1;
if(varph->id != htons(VARP_ID)){
if(varph->hdr.id != htons(VARP_ID)){
// It's not varp at all - ignore it.
wprintf("> Unknown id: %d \n", ntohs(varph->id));
wprintf("> Unknown id: %d \n", ntohs(varph->hdr.id));
goto exit;
}
if(1){
@@ -1086,13 +1086,13 @@ int varp_handle_message(struct sk_buff *skb){
NIPQUAD(skb->nh.iph->saddr), NIPQUAD(skb->nh.iph->daddr));
dprintf("> sport=%u dport=%u\n", ntohs(skb->h.uh->source), ntohs(skb->h.uh->dest));
dprintf("> opcode=%d vnet=%u vmac=" MACFMT " addr=" IPFMT "\n",
ntohs(varph->opcode),
ntohs(varph->hdr.opcode),
ntohl(varph->vnet),
MAC6TUPLE(varph->vmac.mac),
NIPQUAD(varph->addr));
varp_dprint();
}
switch(ntohs(varph->opcode)){
switch(ntohs(varph->hdr.opcode)){
case VARP_OP_REQUEST:
err = varp_handle_request(skb, varph);
break;
@@ -1100,7 +1100,7 @@ int varp_handle_message(struct sk_buff *skb){
err = varp_handle_announce(skb, varph);
break;
default:
wprintf("> Unknown opcode: %d \n", ntohs(varph->opcode));
wprintf("> Unknown opcode: %d \n", ntohs(varph->hdr.opcode));
break;
}
exit:
+1
View File
@@ -783,6 +783,7 @@ void domain_relinquish_memory(struct domain *d)
if ( pagetable_val(ed->arch.pagetable) != 0 )
put_page_and_type(&frame_table[pagetable_val(ed->arch.pagetable) >>
PAGE_SHIFT]);
ed->arch.pagetable = mk_pagetable(0);
}
#ifdef CONFIG_VMX
+2 -1
View File
@@ -63,8 +63,9 @@ search_exception_table(unsigned long addr)
}
unsigned long
search_pre_exception_table(unsigned long addr)
search_pre_exception_table(struct xen_regs *regs)
{
unsigned long addr = (unsigned long)regs->eip;
unsigned long fixup = search_one_table(
__start___pre_ex_table, __stop___pre_ex_table-1, addr);
DPRINTK("Pre-exception: %p -> %p\n", addr, fixup);
+28 -9
View File
@@ -1594,10 +1594,26 @@ int do_update_va_mapping(unsigned long va,
&shadow_linear_pg_table[l1_linear_offset(va)])))) )
{
/*
* Since L2's are guranteed RW, failure indicates the page was not
* shadowed, so ignore.
* Since L2's are guranteed RW, failure indicates either that the
* page was not shadowed, or that the L2 entry has not yet been
* updated to reflect the shadow.
*/
perfc_incrc(shadow_update_va_fail);
unsigned l2_idx = page_nr >> (L2_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT);
l2_pgentry_t gpde = linear_l2_table[l2_idx];
unsigned long gpfn = l2_pgentry_val(gpde) >> PAGE_SHIFT;
if (get_shadow_status(&d->mm, gpfn))
{
unsigned long *gl1e = map_domain_mem(gpfn << PAGE_SHIFT);
unsigned l1_idx = page_nr & (ENTRIES_PER_L1_PAGETABLE - 1);
gl1e[l1_idx] = sval;
unmap_domain_mem(gl1e);
put_shadow_status(&d->mm);
perfc_incrc(shadow_update_va_fail1);
}
else
perfc_incrc(shadow_update_va_fail2);
}
/*
@@ -2259,7 +2275,7 @@ void audit_domain(struct domain *d)
scan_for_pfn( e, xpfn );
}
int i;
int i, l1, l2;
unsigned long pfn;
struct list_head *list_ent;
struct pfn_info *page;
@@ -2318,8 +2334,8 @@ void audit_domain(struct domain *d)
/* PHASE 1 */
adjust(&frame_table[pagetable_val(d->exec_domain[0]->arch.pagetable)>>PAGE_SHIFT], -1, 1);
if( pagetable_val(d->exec_domain[0]->arch.pagetable) )
adjust(&frame_table[pagetable_val(d->exec_domain[0]->arch.pagetable)>>PAGE_SHIFT], -1, 1);
list_ent = d->page_list.next;
for ( i = 0; (list_ent != &d->page_list); i++ )
@@ -2500,6 +2516,7 @@ void audit_domain(struct domain *d)
/* PHASE 3 */
list_ent = d->page_list.next;
l1 = l2 = 0;
for ( i = 0; (list_ent != &d->page_list); i++ )
{
unsigned long *pt;
@@ -2509,6 +2526,7 @@ void audit_domain(struct domain *d)
switch ( page->u.inuse.type_info & PGT_type_mask )
{
case PGT_l2_page_table:
l2++;
if ( (page->u.inuse.type_info & PGT_pinned) == PGT_pinned )
adjust( page, 1, 1 );
@@ -2535,6 +2553,7 @@ void audit_domain(struct domain *d)
break;
case PGT_l1_page_table:
l1++;
if ( (page->u.inuse.type_info & PGT_pinned) == PGT_pinned )
adjust( page, 1, 1 );
@@ -2572,10 +2591,10 @@ void audit_domain(struct domain *d)
spin_unlock(&d->page_alloc_lock);
adjust(&frame_table[pagetable_val(
d->exec_domain[0]->arch.pagetable)>>PAGE_SHIFT], 1, 1);
if( pagetable_val(d->exec_domain[0]->arch.pagetable) )
adjust(&frame_table[pagetable_val(d->exec_domain[0]->arch.pagetable)>>PAGE_SHIFT], 1, 1);
printk("Audit %d: Done. ctot=%d ttot=%d\n", d->id, ctot, ttot );
printk("Audit %d: Done. pages=%d l1=%d l2=%d ctot=%d ttot=%d\n", d->id, i, l1, l2, ctot, ttot );
if ( d != current->domain )
domain_unpause(d);
+1 -1
View File
@@ -487,7 +487,7 @@ exception_with_ints_disabled:
testl $(3|X86_EFLAGS_VM),%eax # interrupts disabled outside Xen?
jnz 1b # it really does happen!
# (e.g., DOM0 X server)
pushl XREGS_eip(%esp)
pushl %esp
call search_pre_exception_table
addl $4,%esp
testl %eax,%eax # no fixup code for faulting EIP?
+2 -1
View File
@@ -25,7 +25,8 @@ PERFCOUNTER_CPU( shadow_l2_table_count, "shadow_l2_table count" )
PERFCOUNTER_CPU( shadow_l1_table_count, "shadow_l1_table count" )
PERFCOUNTER_CPU( unshadow_table_count, "unshadow_table count" )
PERFCOUNTER_CPU( shadow_fixup_count, "shadow_fixup count" )
PERFCOUNTER_CPU( shadow_update_va_fail, "shadow_update_va_fail" )
PERFCOUNTER_CPU( shadow_update_va_fail1, "shadow_update_va_fail1" )
PERFCOUNTER_CPU( shadow_update_va_fail2, "shadow_update_va_fail2" )
/* STATUS counters do not reset when 'P' is hit */
PERFSTATUS( shadow_l2_pages, "current # shadow L2 pages" )
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.