Mailing List Archive

Allow netback to be built as a module.
# HG changeset patch
# User kaf24@firebug.cl.cam.ac.uk
# Node ID 271cb04a4f2b74a7f7d3baa68868ef6f8c159525
# Parent ead0b7fcad3a8868ad753c5592a096f5506542cf
Allow netback to be built as a module.

From: Jan Beulich

Signed-off-by: Keir Fraser <keir@xensource.com>

diff -r ead0b7fcad3a -r 271cb04a4f2b buildconfigs/linux-defconfig_xen0_x86_32
--- a/buildconfigs/linux-defconfig_xen0_x86_32 Tue Feb 28 17:56:00 2006
+++ b/buildconfigs/linux-defconfig_xen0_x86_32 Tue Feb 28 17:59:24 2006
@@ -1320,6 +1320,7 @@
# CONFIG_XEN_BLKDEV_TAP_BE is not set
CONFIG_XEN_NETDEV_BACKEND=y
# CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
+CONFIG_XEN_NETDEV_LOOPBACK=y
# CONFIG_XEN_TPMDEV_BACKEND is not set
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
diff -r ead0b7fcad3a -r 271cb04a4f2b buildconfigs/linux-defconfig_xen0_x86_64
--- a/buildconfigs/linux-defconfig_xen0_x86_64 Tue Feb 28 17:56:00 2006
+++ b/buildconfigs/linux-defconfig_xen0_x86_64 Tue Feb 28 17:59:24 2006
@@ -1244,6 +1244,7 @@
# CONFIG_XEN_BLKDEV_TAP_BE is not set
CONFIG_XEN_NETDEV_BACKEND=y
# CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
+CONFIG_XEN_NETDEV_LOOPBACK=y
# CONFIG_XEN_TPMDEV_BACKEND is not set
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
diff -r ead0b7fcad3a -r 271cb04a4f2b buildconfigs/linux-defconfig_xen_x86_32
--- a/buildconfigs/linux-defconfig_xen_x86_32 Tue Feb 28 17:56:00 2006
+++ b/buildconfigs/linux-defconfig_xen_x86_32 Tue Feb 28 17:59:24 2006
@@ -2986,6 +2986,7 @@
# CONFIG_XEN_BLKDEV_TAP_BE is not set
CONFIG_XEN_NETDEV_BACKEND=y
# CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
+CONFIG_XEN_NETDEV_LOOPBACK=y
# CONFIG_XEN_TPMDEV_BACKEND is not set
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
diff -r ead0b7fcad3a -r 271cb04a4f2b buildconfigs/linux-defconfig_xen_x86_64
--- a/buildconfigs/linux-defconfig_xen_x86_64 Tue Feb 28 17:56:00 2006
+++ b/buildconfigs/linux-defconfig_xen_x86_64 Tue Feb 28 17:59:24 2006
@@ -2656,6 +2656,7 @@
# CONFIG_XEN_BLKDEV_TAP_BE is not set
CONFIG_XEN_NETDEV_BACKEND=y
# CONFIG_XEN_NETDEV_PIPELINED_TRANSMITTER is not set
+CONFIG_XEN_NETDEV_LOOPBACK=y
# CONFIG_XEN_TPMDEV_BACKEND is not set
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
diff -r ead0b7fcad3a -r 271cb04a4f2b linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig Tue Feb 28 17:56:00 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig Tue Feb 28 17:59:24 2006
@@ -89,7 +89,7 @@
modified to use grant tables.

config XEN_NETDEV_BACKEND
- bool "Network-device backend driver"
+ tristate "Network-device backend driver"
default y
help
The network-device backend driver allows the kernel to export its
@@ -109,6 +109,14 @@
are unsure; or if you experience network hangs when this option is
enabled; then you must say N here.

+config XEN_NETDEV_LOOPBACK
+ tristate "Network-device loopback driver"
+ depends on XEN_NETDEV_BACKEND
+ default y
+ help
+ A two-interface loopback device to emulate a local netfront-netback
+ connection.
+
config XEN_TPMDEV_BACKEND
bool "TPM-device backend driver"
default n
diff -r ead0b7fcad3a -r 271cb04a4f2b linux-2.6-xen-sparse/drivers/xen/core/skbuff.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/skbuff.c Tue Feb 28 17:56:00 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/core/skbuff.c Tue Feb 28 17:59:24 2006
@@ -16,6 +16,7 @@

/* Referenced in netback.c. */
/*static*/ kmem_cache_t *skbuff_cachep;
+EXPORT_SYMBOL(skbuff_cachep);

#define MAX_SKBUFF_ORDER 4
static kmem_cache_t *skbuff_order_cachep[MAX_SKBUFF_ORDER + 1];
diff -r ead0b7fcad3a -r 271cb04a4f2b linux-2.6-xen-sparse/drivers/xen/netback/Makefile
--- a/linux-2.6-xen-sparse/drivers/xen/netback/Makefile Tue Feb 28 17:56:00 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/Makefile Tue Feb 28 17:59:24 2006
@@ -1,2 +1,5 @@
+obj-$(CONFIG_XEN_NETDEV_BACKEND) := netbk.o
+obj-$(CONFIG_XEN_NETDEV_LOOPBACK) += netloop.o

-obj-y := netback.o xenbus.o interface.o loopback.o
+netbk-y := netback.o xenbus.o interface.o
+netloop-y := loopback.o
diff -r ead0b7fcad3a -r 271cb04a4f2b linux-2.6-xen-sparse/drivers/xen/netback/loopback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c Tue Feb 28 17:56:00 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c Tue Feb 28 17:59:24 2006
@@ -178,6 +178,23 @@
return err;
}

+static void __init clean_loopback(int i)
+{
+ struct net_device *dev1, *dev2;
+ char dev_name[IFNAMSIZ];
+
+ sprintf(dev_name, "vif0.%d", i);
+ dev1 = dev_get_by_name(dev_name);
+ sprintf(dev_name, "veth%d", i);
+ dev2 = dev_get_by_name(dev_name);
+ if (dev1 && dev2) {
+ unregister_netdev(dev2);
+ unregister_netdev(dev1);
+ free_netdev(dev2);
+ free_netdev(dev1);
+ }
+}
+
static int __init loopback_init(void)
{
int i, err = 0;
@@ -190,6 +207,18 @@
}

module_init(loopback_init);
+
+static void __exit loopback_exit(void)
+{
+ int i;
+
+ for (i = nloopbacks; i-- > 0; )
+ clean_loopback(i);
+}
+
+module_exit(loopback_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");

/*
* Local variables:
diff -r ead0b7fcad3a -r 271cb04a4f2b linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Feb 28 17:56:00 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Tue Feb 28 17:59:24 2006
@@ -809,6 +809,8 @@
&netif_be_dbg);
#endif

+ __unsafe(THIS_MODULE);
+
return 0;
}

@@ -819,6 +821,8 @@

module_init(netback_init);
module_exit(netback_cleanup);
+
+MODULE_LICENSE("Dual BSD/GPL");

/*
* Local variables:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog