ChangeSet 1.1366, 2005/03/25 11:20:19+00:00, iap10@xxxxxxxxxxxxxxxxxxxxx
manual merge
linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c | 64 -
tools/python/xen/lowlevel/xu/xu.c | 893 ++++++++++------
tools/python/xen/xend/server/SrvDomain.py | 9
tools/python/xen/xend/server/blkif.py | 14
tools/python/xen/xend/server/channel.py | 9
tools/python/xen/xend/server/netif.py | 48
tools/python/xen/xm/create.py | 50
xen/include/public/io/domain_controller.h | 246 ++++
8 files changed, 1022 insertions(+), 311 deletions(-)
diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c
b/linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c 2005-03-25
07:06:03 -05:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/netback/interface.c 2005-03-25
07:06:03 -05:00
@@ -3,7 +3,7 @@
*
* Network-device interface management.
*
- * Copyright (c) 2004, Keir Fraser
+ * Copyright (c) 2004-2005, Keir Fraser
*/
#include "common.h"
@@ -140,7 +140,7 @@
netif->credit_bytes = netif->remaining_credit = ~0UL;
netif->credit_usec = 0UL;
- /*init_ac_timer(&new_vif->credit_timeout);*/
+ init_timer(&netif->credit_timeout);
pnetif = &netif_hash[NETIF_HASH(domid, handle)];
while ( *pnetif != NULL )
@@ -163,13 +163,24 @@
/* Disable queuing. */
dev->tx_queue_len = 0;
- /*
- * Initialise a dummy MAC address. We choose the numerically largest
- * non-broadcast address to prevent the address getting stolen by an
- * Ethernet bridge for STP purposes. (FE:FF:FF:FF:FF:FF)
- */
- memset(dev->dev_addr, 0xFF, ETH_ALEN);
- dev->dev_addr[0] &= ~0x01;
+ if ( (create->be_mac[0] == 0) && (create->be_mac[1] == 0) &&
+ (create->be_mac[2] == 0) && (create->be_mac[3] == 0) &&
+ (create->be_mac[4] == 0) && (create->be_mac[5] == 0) )
+ {
+ /*
+ * Initialise a dummy MAC address. We choose the numerically largest
+ * non-broadcast address to prevent the address getting stolen by an
+ * Ethernet bridge for STP purposes. (FE:FF:FF:FF:FF:FF)
+ */
+ memset(dev->dev_addr, 0xFF, ETH_ALEN);
+ dev->dev_addr[0] &= ~0x01;
+ }
+ else
+ {
+ memcpy(dev->dev_addr, create->be_mac, ETH_ALEN);
+ }
+
+ memcpy(netif->fe_dev_addr, create->mac, ETH_ALEN);
rtnl_lock();
err = register_netdevice(dev);
@@ -223,6 +234,38 @@
destroy->status = NETIF_BE_STATUS_OKAY;
}
+void netif_creditlimit(netif_be_creditlimit_t *creditlimit)
+{
+ domid_t domid = creditlimit->domid;
+ unsigned int handle = creditlimit->netif_handle;
+ netif_t *netif;
+
+ netif = netif_find_by_handle(domid, handle);
+ if ( unlikely(netif == NULL) )
+ {
+ DPRINTK("netif_creditlimit attempted for non-existent netif"
+ " (%u,%u)\n", creditlimit->domid, creditlimit->netif_handle);
+ creditlimit->status = NETIF_BE_STATUS_INTERFACE_NOT_FOUND;
+ return;
+ }
+
+ /* Set the credit limit (reset remaining credit to new limit). */
+ netif->credit_bytes = netif->remaining_credit = creditlimit->credit_bytes;
+ netif->credit_usec = creditlimit->period_usec;
+
+ if ( netif->status == CONNECTED )
+ {
+ /*
+ * Schedule work so that any packets waiting under previous credit
+ * limit are dealt with (acts like a replenishment point).
+ */
+ netif->credit_timeout.expires = jiffies;
+ netif_schedule_work(netif);
+ }
+
+ creditlimit->status = NETIF_BE_STATUS_OKAY;
+}
+
void netif_connect(netif_be_connect_t *connect)
{
domid_t domid = connect->domid;
@@ -234,9 +277,6 @@
pgprot_t prot;
int error;
netif_t *netif;
-#if 0
- struct net_device *eth0_dev;
-#endif
netif = netif_find_by_handle(domid, handle);
if ( unlikely(netif == NULL) )
diff -Nru a/tools/python/xen/lowlevel/xu/xu.c
b/tools/python/xen/lowlevel/xu/xu.c
--- a/tools/python/xen/lowlevel/xu/xu.c 2005-03-25 07:06:03 -05:00
+++ b/tools/python/xen/lowlevel/xu/xu.c 2005-03-25 07:06:03 -05:00
@@ -13,10 +13,10 @@
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/socket.h>
+#include <sys/un.h>
#include <sys/mman.h>
#include <sys/poll.h>
#include <sys/sysmacros.h>
-#include <netinet/in.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
@@ -49,16 +49,9 @@
/* Size of a machine page frame. */
#define PAGE_SIZE 4096
-#if defined(__i386__)
-#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
-#define wmb() __asm__ __volatile__ ( "" : : : "memory" )
-#else
-#error "Define barriers"
-#endif
-
-
/* Set the close-on-exec flag on a file descriptor. Doesn't currently bother
* to check for errors. */
+/*
static void set_cloexec(int fd)
{
int flags = fcntl(fd, F_GETFD, 0);
@@ -69,7 +62,179 @@
flags |= FD_CLOEXEC;
fcntl(fd, F_SETFD, flags);
}
+*/
+/*
+ * *********************** XCS INTERFACE ***********************
+ */
+
+#include <arpa/inet.h>
+#include <xcs_proto.h>
+
+static int xcs_ctrl_fd = -1; /* control connection to the xcs server. */
+static int xcs_data_fd = -1; /* data connection to the xcs server. */
+static u32 xcs_session_id = 0;
+
+static int xcs_ctrl_send(xcs_msg_t *msg);
+static int xcs_ctrl_read(xcs_msg_t *msg);
+static int xcs_data_send(xcs_msg_t *msg);
+static int xcs_data_read(xcs_msg_t *msg);
+
+static int xcs_connect(char *path)
+{
+ struct sockaddr_un addr;
+ int ret, len, flags;
+ xcs_msg_t msg;
+
+ if (xcs_data_fd != -1) /* already connected */
+ return 0;
+
+ xcs_ctrl_fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (xcs_ctrl_fd < 0)
+ {
+ printf("error creating xcs socket!\n");
+ goto fail;
+ }
+
+ addr.sun_family = AF_UNIX;
+ strcpy(addr.sun_path, path);
+ len = sizeof(addr.sun_family) + strlen(addr.sun_path) + 1;
+
+ ret = connect(xcs_ctrl_fd, (struct sockaddr *)&addr, len);
+ if (ret < 0)
+ {
+ printf("error connecting to xcs(ctrl)! (%d)\n", errno);
+ goto ctrl_fd_fail;
+ }
+
+ /*set_cloexec(xcs_ctrl_fd);*/
+
+ msg.type = XCS_CONNECT_CTRL;
+ msg.u.connect.session_id = xcs_session_id;
+ xcs_ctrl_send(&msg);
+ xcs_ctrl_read(&msg); /* TODO: timeout + error! */
+
+ if (msg.result != XCS_RSLT_OK)
+ {
+ printf("error connecting xcs control channel!\n");
+ goto ctrl_fd_fail;
+ }
+ xcs_session_id = msg.u.connect.session_id;
+
+ /* now the data connection. */
+ xcs_data_fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (xcs_data_fd < 0)
+ {
+ printf("error creating xcs data socket!\n");
+ goto ctrl_fd_fail;
+ }
+
+ addr.sun_family = AF_UNIX;
+ strcpy(addr.sun_path, path);
+ len = sizeof(addr.sun_family) + strlen(addr.sun_path) + 1;
+
+ ret = connect(xcs_data_fd, (struct sockaddr *)&addr, len);
+ if (ret < 0)
+ {
+ printf("error connecting to xcs(data)! (%d)\n", errno);
+ goto data_fd_fail;
+ }
+
+ //set_cloexec(xcs_data_fd);
+ msg.type = XCS_CONNECT_DATA;
+ msg.u.connect.session_id = xcs_session_id;
+ xcs_data_send(&msg);
+ xcs_data_read(&msg); /* TODO: timeout + error! */
+
+ if (msg.result != XCS_RSLT_OK)
+ {
+ printf("error connecting xcs control channel!\n");
+ goto ctrl_fd_fail;
+ }
+
+ if ( ((flags = fcntl(xcs_data_fd, F_GETFL, 0)) < 0) ||
+ (fcntl(xcs_data_fd, F_SETFL, flags | O_NONBLOCK) < 0) )
+ {
+ printf("Unable to set non-blocking status on data socket.");
+ goto data_fd_fail;
+ }
+
+ return 0;
+
+data_fd_fail:
+ close(xcs_data_fd);
+ xcs_data_fd = -1;
+
+ctrl_fd_fail:
+ close(xcs_ctrl_fd);
+ xcs_ctrl_fd = -1;
+
+fail:
+ return -1;
+
+}
+
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog
|