# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Date 1169145630 0
# Node ID 16847428f8595359972985934cba843c903570ab
# Parent 4f0a68df2585dabdf35cdcbf0ced43f8e24bbfa7
[linux networking] Remove the code to allocate page sized skbs.
This is no longer used much since the default is to always copy packets
to guests.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
linux-2.6-xen-sparse/drivers/xen/core/skbuff.c | 145 ---------------------
buildconfigs/linux-defconfig_xen0_ia64 | 3
buildconfigs/linux-defconfig_xen0_x86_32 | 2
buildconfigs/linux-defconfig_xen0_x86_64 | 2
buildconfigs/linux-defconfig_xenU_ia64 | 3
buildconfigs/linux-defconfig_xenU_x86_32 | 2
buildconfigs/linux-defconfig_xenU_x86_64 | 2
buildconfigs/linux-defconfig_xen_ia64 | 3
buildconfigs/linux-defconfig_xen_x86_32 | 2
buildconfigs/linux-defconfig_xen_x86_64 | 2
linux-2.6-xen-sparse/arch/ia64/Kconfig | 6
linux-2.6-xen-sparse/drivers/xen/Kconfig | 13 -
linux-2.6-xen-sparse/drivers/xen/core/Makefile | 1
linux-2.6-xen-sparse/drivers/xen/netback/netback.c | 38 -----
linux-2.6-xen-sparse/include/linux/skbuff.h | 5
linux-2.6-xen-sparse/net/core/skbuff.c | 43 +-----
16 files changed, 16 insertions(+), 256 deletions(-)
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xen0_ia64
--- a/buildconfigs/linux-defconfig_xen0_ia64 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xen0_ia64 Thu Jan 18 18:40:30 2007 +0000
@@ -1512,10 +1512,7 @@ CONFIG_CRYPTO_DES=y
# Hardware crypto devices
#
# CONFIG_XEN_UTIL is not set
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_XEN_BALLOON=y
-CONFIG_XEN_SKBUFF=y
# CONFIG_XEN_DEVMEM is not set
CONFIG_XEN_REBOOT=y
# CONFIG_XEN_SMPBOOT is not set
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xen0_x86_32
--- a/buildconfigs/linux-defconfig_xen0_x86_32 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xen0_x86_32 Thu Jan 18 18:40:30 2007 +0000
@@ -1338,8 +1338,6 @@ CONFIG_XEN_COMPAT_030002_AND_LATER=y
CONFIG_XEN_COMPAT_030002_AND_LATER=y
# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
CONFIG_XEN_COMPAT_030002=y
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
#
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xen0_x86_64
--- a/buildconfigs/linux-defconfig_xen0_x86_64 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xen0_x86_64 Thu Jan 18 18:40:30 2007 +0000
@@ -1278,8 +1278,6 @@ CONFIG_XEN_COMPAT_030002_AND_LATER=y
CONFIG_XEN_COMPAT_030002_AND_LATER=y
# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
CONFIG_XEN_COMPAT_030002=y
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
#
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xenU_ia64
--- a/buildconfigs/linux-defconfig_xenU_ia64 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xenU_ia64 Thu Jan 18 18:40:30 2007 +0000
@@ -1386,10 +1386,7 @@ CONFIG_CRYPTO_DES=y
# Hardware crypto devices
#
# CONFIG_XEN_UTIL is not set
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_XEN_BALLOON=y
-CONFIG_XEN_SKBUFF=y
# CONFIG_XEN_DEVMEM is not set
CONFIG_XEN_REBOOT=y
# CONFIG_XEN_SMPBOOT is not set
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xenU_x86_32
--- a/buildconfigs/linux-defconfig_xenU_x86_32 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xenU_x86_32 Thu Jan 18 18:40:30 2007 +0000
@@ -865,8 +865,6 @@ CONFIG_XEN_COMPAT_030002_AND_LATER=y
CONFIG_XEN_COMPAT_030002_AND_LATER=y
# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
CONFIG_XEN_COMPAT_030002=y
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
#
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xenU_x86_64
--- a/buildconfigs/linux-defconfig_xenU_x86_64 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xenU_x86_64 Thu Jan 18 18:40:30 2007 +0000
@@ -1151,8 +1151,6 @@ CONFIG_XEN_COMPAT_030002_AND_LATER=y
CONFIG_XEN_COMPAT_030002_AND_LATER=y
# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
CONFIG_XEN_COMPAT_030002=y
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
#
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xen_ia64
--- a/buildconfigs/linux-defconfig_xen_ia64 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xen_ia64 Thu Jan 18 18:40:30 2007 +0000
@@ -1518,10 +1518,7 @@ CONFIG_CRYPTO_DES=y
# Hardware crypto devices
#
# CONFIG_XEN_UTIL is not set
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_XEN_BALLOON=y
-CONFIG_XEN_SKBUFF=y
# CONFIG_XEN_DEVMEM is not set
CONFIG_XEN_REBOOT=y
# CONFIG_XEN_SMPBOOT is not set
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xen_x86_32
--- a/buildconfigs/linux-defconfig_xen_x86_32 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xen_x86_32 Thu Jan 18 18:40:30 2007 +0000
@@ -3043,8 +3043,6 @@ CONFIG_XEN_COMPAT_030002_AND_LATER=y
CONFIG_XEN_COMPAT_030002_AND_LATER=y
# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
CONFIG_XEN_COMPAT_030002=y
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
#
diff -r 4f0a68df2585 -r 16847428f859 buildconfigs/linux-defconfig_xen_x86_64
--- a/buildconfigs/linux-defconfig_xen_x86_64 Thu Jan 18 18:39:07 2007 +0000
+++ b/buildconfigs/linux-defconfig_xen_x86_64 Thu Jan 18 18:40:30 2007 +0000
@@ -2874,8 +2874,6 @@ CONFIG_XEN_COMPAT_030002_AND_LATER=y
CONFIG_XEN_COMPAT_030002_AND_LATER=y
# CONFIG_XEN_COMPAT_LATEST_ONLY is not set
CONFIG_XEN_COMPAT_030002=y
-CONFIG_HAVE_ARCH_ALLOC_SKB=y
-CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
CONFIG_NO_IDLE_HZ=y
#
diff -r 4f0a68df2585 -r 16847428f859 linux-2.6-xen-sparse/arch/ia64/Kconfig
--- a/linux-2.6-xen-sparse/arch/ia64/Kconfig Thu Jan 18 18:39:07 2007 +0000
+++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig Thu Jan 18 18:40:30 2007 +0000
@@ -521,12 +521,6 @@ config XEN_UTIL
config XEN_UTIL
default n
-config HAVE_ARCH_ALLOC_SKB
- default y
-
-config HAVE_ARCH_DEV_ALLOC_SKB
- default y
-
config XEN_BALLOON
default y
diff -r 4f0a68df2585 -r 16847428f859 linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig Thu Jan 18 18:39:07 2007 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig Thu Jan 18 18:40:30 2007 +0000
@@ -238,14 +238,6 @@ config XEN_COMPAT_030002
endmenu
-config HAVE_ARCH_ALLOC_SKB
- bool
- default y
-
-config HAVE_ARCH_DEV_ALLOC_SKB
- bool
- default y
-
config HAVE_IRQ_IGNORE_UNHANDLED
bool
default y
@@ -266,11 +258,6 @@ config XEN_DEVMEM
bool
default y
-config XEN_SKBUFF
- bool
- default y
- depends on NET
-
config XEN_REBOOT
bool
default y
diff -r 4f0a68df2585 -r 16847428f859
linux-2.6-xen-sparse/drivers/xen/core/Makefile
--- a/linux-2.6-xen-sparse/drivers/xen/core/Makefile Thu Jan 18 18:39:07
2007 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/core/Makefile Thu Jan 18 18:40:30
2007 +0000
@@ -8,7 +8,6 @@ obj-$(CONFIG_SYSFS) += hypervisor_sysfs
obj-$(CONFIG_SYSFS) += hypervisor_sysfs.o
obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o
obj-$(CONFIG_XEN_SYSFS) += xen_sysfs.o
-obj-$(CONFIG_XEN_SKBUFF) += skbuff.o
obj-$(CONFIG_XEN_REBOOT) += reboot.o machine_reboot.o
obj-$(CONFIG_XEN_SMPBOOT) += smpboot.o
obj-$(CONFIG_KEXEC) += machine_kexec.o
diff -r 4f0a68df2585 -r 16847428f859
linux-2.6-xen-sparse/drivers/xen/core/skbuff.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/skbuff.c Thu Jan 18 18:39:07
2007 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/netdevice.h>
-#include <linux/inetdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/init.h>
-#include <asm/io.h>
-#include <asm/page.h>
-#include <asm/hypervisor.h>
-
-/* Referenced in netback.c. */
-/*static*/ kmem_cache_t *skbuff_cachep;
-EXPORT_SYMBOL(skbuff_cachep);
-
-/* Allow up to 64kB or page-sized packets (whichever is greater). */
-#if PAGE_SHIFT < 16
-#define MAX_SKBUFF_ORDER (16 - PAGE_SHIFT)
-#else
-#define MAX_SKBUFF_ORDER 0
-#endif
-static kmem_cache_t *skbuff_order_cachep[MAX_SKBUFF_ORDER + 1];
-
-static struct {
- int size;
- kmem_cache_t *cachep;
-} skbuff_small[] = { { 512, NULL }, { 2048, NULL } };
-
-struct sk_buff *__alloc_skb(unsigned int length, gfp_t gfp_mask,
- int fclone)
-{
- int order, i;
- kmem_cache_t *cachep;
-
- length = SKB_DATA_ALIGN(length) + sizeof(struct skb_shared_info);
-
- if (length <= skbuff_small[ARRAY_SIZE(skbuff_small)-1].size) {
- for (i = 0; skbuff_small[i].size < length; i++)
- continue;
- cachep = skbuff_small[i].cachep;
- } else {
- order = get_order(length);
- if (order > MAX_SKBUFF_ORDER) {
- printk(KERN_ALERT "Attempt to allocate order %d "
- "skbuff. Increase MAX_SKBUFF_ORDER.\n", order);
- return NULL;
- }
- cachep = skbuff_order_cachep[order];
- }
-
- length -= sizeof(struct skb_shared_info);
-
- return alloc_skb_from_cache(cachep, length, gfp_mask, fclone);
-}
-
-struct sk_buff *__dev_alloc_skb(unsigned int length, gfp_t gfp_mask)
-{
- struct sk_buff *skb;
- int order;
-
- length = SKB_DATA_ALIGN(length + 16);
- order = get_order(length + sizeof(struct skb_shared_info));
- if (order > MAX_SKBUFF_ORDER) {
- printk(KERN_ALERT "Attempt to allocate order %d skbuff. "
- "Increase MAX_SKBUFF_ORDER.\n", order);
- return NULL;
- }
-
- skb = alloc_skb_from_cache(
- skbuff_order_cachep[order], length, gfp_mask, 0);
- if (skb != NULL)
- skb_reserve(skb, 16);
-
- return skb;
-}
-
-static void skbuff_ctor(void *buf, kmem_cache_t *cachep, unsigned long unused)
-{
- int order = 0;
-
- while (skbuff_order_cachep[order] != cachep)
- order++;
-
- /* Do our best to allocate contiguous memory but fall back to IOMMU. */
- if (order != 0)
- (void)xen_create_contiguous_region(
- (unsigned long)buf, order, 0);
-
- scrub_pages(buf, 1 << order);
-}
-
-static void skbuff_dtor(void *buf, kmem_cache_t *cachep, unsigned long unused)
-{
- int order = 0;
-
- while (skbuff_order_cachep[order] != cachep)
- order++;
-
- if (order != 0)
- xen_destroy_contiguous_region((unsigned long)buf, order);
-}
-
-static int __init skbuff_init(void)
-{
- static char name[MAX_SKBUFF_ORDER + 1][20];
- static char small_name[ARRAY_SIZE(skbuff_small)][20];
- unsigned long size;
- int i, order;
-
- for (i = 0; i < ARRAY_SIZE(skbuff_small); i++) {
- size = skbuff_small[i].size;
- sprintf(small_name[i], "xen-skb-%lu", size);
- /*
- * No ctor/dtor: objects do not span page boundaries, and they
- * are only used on transmit path so no need for scrubbing.
- */
- skbuff_small[i].cachep = kmem_cache_create(
- small_name[i], size, size, 0, NULL, NULL);
- }
-
- for (order = 0; order <= MAX_SKBUFF_ORDER; order++) {
- size = PAGE_SIZE << order;
- sprintf(name[order], "xen-skb-%lu", size);
- if (is_running_on_xen() && is_initial_xendomain())
- skbuff_order_cachep[order] = kmem_cache_create(
- name[order], size, size, 0,
- skbuff_ctor, skbuff_dtor);
- else
- skbuff_order_cachep[order] = kmem_cache_create(
- name[order], size, size, 0, NULL, NULL);
-
- }
-
- skbuff_cachep = skbuff_order_cachep[0];
-
- return 0;
-}
-core_initcall(skbuff_init);
-
-EXPORT_SYMBOL(__dev_alloc_skb);
diff -r 4f0a68df2585 -r 16847428f859
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Thu Jan 18
18:39:07 2007 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c Thu Jan 18
18:40:30 2007 +0000
@@ -136,42 +136,6 @@ static inline void maybe_schedule_tx_act
tasklet_schedule(&net_tx_tasklet);
}
-/*
- * A gross way of confirming the origin of an skb data page. The slab
- * allocator abuses a field in the page struct to cache the kmem_cache_t ptr.
- */
-static inline int is_xen_skb(struct sk_buff *skb)
-{
- extern kmem_cache_t *skbuff_cachep;
- kmem_cache_t *cp = (kmem_cache_t *)virt_to_page(skb->head)->lru.next;
- return (cp == skbuff_cachep);
-}
-
-/*
- * We can flip without copying the packet unless:
- * 1. The data is not allocated from our special cache; or
- * 2. The main data area is shared; or
- * 3. One or more fragments are shared; or
- * 4. There are chained fragments.
- */
-static inline int is_flippable_skb(struct sk_buff *skb)
-{
- int frag;
-
- if (!is_xen_skb(skb) || skb_cloned(skb))
- return 0;
-
- for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {
- if (page_count(skb_shinfo(skb)->frags[frag].page) > 1)
- return 0;
- }
-
- if (skb_shinfo(skb)->frag_list != NULL)
- return 0;
-
- return 1;
-}
-
static struct sk_buff *netbk_copy_skb(struct sk_buff *skb)
{
struct skb_shared_info *ninfo;
@@ -285,7 +249,7 @@ int netif_be_start_xmit(struct sk_buff *
* Copy the packet here if it's destined for a flipping interface
* but isn't flippable (e.g. extra references to data).
*/
- if (!netif->copying_receiver && !is_flippable_skb(skb)) {
+ if (!netif->copying_receiver) {
struct sk_buff *nskb = netbk_copy_skb(skb);
if ( unlikely(nskb == NULL) )
goto drop;
diff -r 4f0a68df2585 -r 16847428f859 linux-2.6-xen-sparse/include/linux/skbuff.h
--- a/linux-2.6-xen-sparse/include/linux/skbuff.h Thu Jan 18 18:39:07
2007 +0000
+++ b/linux-2.6-xen-sparse/include/linux/skbuff.h Thu Jan 18 18:40:30
2007 +0000
@@ -338,8 +338,7 @@ static inline struct sk_buff *alloc_skb_
extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
unsigned int size,
- gfp_t priority,
- int fclone);
+ gfp_t priority);
extern void kfree_skbmem(struct sk_buff *skb);
extern struct sk_buff *skb_clone(struct sk_buff *skb,
gfp_t priority);
@@ -1069,7 +1068,7 @@ static inline struct sk_buff *__dev_allo
return skb;
}
#else
-extern struct sk_buff *__dev_alloc_skb(unsigned int length, gfp_t gfp_mask);
+extern struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask);
#endif
/**
diff -r 4f0a68df2585 -r 16847428f859 linux-2.6-xen-sparse/net/core/skbuff.c
--- a/linux-2.6-xen-sparse/net/core/skbuff.c Thu Jan 18 18:39:07 2007 +0000
+++ b/linux-2.6-xen-sparse/net/core/skbuff.c Thu Jan 18 18:40:30 2007 +0000
@@ -132,7 +132,6 @@ void skb_under_panic(struct sk_buff *skb
* Buffers may only be allocated from interrupts using a @gfp_mask of
* %GFP_ATOMIC.
*/
-#ifndef CONFIG_HAVE_ARCH_ALLOC_SKB
struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
int fclone)
{
@@ -187,7 +186,6 @@ nodata:
skb = NULL;
goto out;
}
-#endif /* !CONFIG_HAVE_ARCH_ALLOC_SKB */
/**
* alloc_skb_from_cache - allocate a network buffer
@@ -205,18 +203,14 @@ nodata:
*/
struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
unsigned int size,
- gfp_t gfp_mask,
- int fclone)
-{
- kmem_cache_t *cache;
- struct skb_shared_info *shinfo;
+ gfp_t gfp_mask)
+{
struct sk_buff *skb;
u8 *data;
- cache = fclone ? skbuff_fclone_cache : skbuff_head_cache;
-
/* Get the HEAD */
- skb = kmem_cache_alloc(cache, gfp_mask & ~__GFP_DMA);
+ skb = kmem_cache_alloc(skbuff_head_cache,
+ gfp_mask & ~__GFP_DMA);
if (!skb)
goto out;
@@ -233,29 +227,18 @@ struct sk_buff *alloc_skb_from_cache(kme
skb->data = data;
skb->tail = data;
skb->end = data + size;
- /* make sure we initialize shinfo sequentially */
- shinfo = skb_shinfo(skb);
- atomic_set(&shinfo->dataref, 1);
- shinfo->nr_frags = 0;
- shinfo->gso_size = 0;
- shinfo->gso_segs = 0;
- shinfo->gso_type = 0;
- shinfo->ip6_frag_id = 0;
- shinfo->frag_list = NULL;
-
- if (fclone) {
- struct sk_buff *child = skb + 1;
- atomic_t *fclone_ref = (atomic_t *) (child + 1);
-
- skb->fclone = SKB_FCLONE_ORIG;
- atomic_set(fclone_ref, 1);
-
- child->fclone = SKB_FCLONE_UNAVAILABLE;
- }
+
+ atomic_set(&(skb_shinfo(skb)->dataref), 1);
+ skb_shinfo(skb)->nr_frags = 0;
+ skb_shinfo(skb)->gso_size = 0;
+ skb_shinfo(skb)->gso_segs = 0;
+ skb_shinfo(skb)->gso_type = 0;
+ skb_shinfo(skb)->ip6_frag_id = 0;
+ skb_shinfo(skb)->frag_list = NULL;
out:
return skb;
nodata:
- kmem_cache_free(cache, skb);
+ kmem_cache_free(skbuff_head_cache, skb);
skb = NULL;
goto out;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|