mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
Update to Linux 2.6.14.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
This commit is contained in:
1 parent
a2643a47da
commit
c06c7d7c07
163 files changed
+8561
-9173
No files matched your search
@@ -12,8 +12,8 @@ struct vm_area_struct;
|
||||
* GFP bitmasks..
|
||||
*/
|
||||
/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
|
||||
#define __GFP_DMA 0x01
|
||||
#define __GFP_HIGHMEM 0x02
|
||||
#define __GFP_DMA 0x01u
|
||||
#define __GFP_HIGHMEM 0x02u
|
||||
|
||||
/*
|
||||
* Action modifiers - doesn't change the zoning
|
||||
@@ -39,6 +39,8 @@ struct vm_area_struct;
|
||||
#define __GFP_COMP 0x4000u /* Add compound page metadata */
|
||||
#define __GFP_ZERO 0x8000u /* Return zeroed page on success */
|
||||
#define __GFP_NOMEMALLOC 0x10000u /* Don't use emergency reserves */
|
||||
#define __GFP_NORECLAIM 0x20000u /* No realy zone reclaim during allocation */
|
||||
#define __GFP_HARDWALL 0x40000u /* Enforce hardwall cpuset memory allocs */
|
||||
|
||||
#define __GFP_BITS_SHIFT 20 /* Room for 20 __GFP_FOO bits */
|
||||
#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
|
||||
@@ -47,14 +49,15 @@ struct vm_area_struct;
|
||||
#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
|
||||
__GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
|
||||
__GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
|
||||
__GFP_NOMEMALLOC)
|
||||
__GFP_NOMEMALLOC|__GFP_NORECLAIM|__GFP_HARDWALL)
|
||||
|
||||
#define GFP_ATOMIC (__GFP_HIGH)
|
||||
#define GFP_NOIO (__GFP_WAIT)
|
||||
#define GFP_NOFS (__GFP_WAIT | __GFP_IO)
|
||||
#define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS)
|
||||
#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS)
|
||||
#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HIGHMEM)
|
||||
#define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL)
|
||||
#define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | \
|
||||
__GFP_HIGHMEM)
|
||||
|
||||
/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
|
||||
platforms, used as appropriate on others */
|
||||
@@ -86,9 +89,9 @@ static inline int arch_free_page(struct page *page, int order) { return 0; }
|
||||
#endif
|
||||
|
||||
extern struct page *
|
||||
FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *));
|
||||
FASTCALL(__alloc_pages(gfp_t, unsigned int, struct zonelist *));
|
||||
|
||||
static inline struct page *alloc_pages_node(int nid, unsigned int __nocast gfp_mask,
|
||||
static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
|
||||
unsigned int order)
|
||||
{
|
||||
if (unlikely(order >= MAX_ORDER))
|
||||
@@ -99,17 +102,17 @@ static inline struct page *alloc_pages_node(int nid, unsigned int __nocast gfp_m
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
extern struct page *alloc_pages_current(unsigned int __nocast gfp_mask, unsigned order);
|
||||
extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
|
||||
|
||||
static inline struct page *
|
||||
alloc_pages(unsigned int __nocast gfp_mask, unsigned int order)
|
||||
alloc_pages(gfp_t gfp_mask, unsigned int order)
|
||||
{
|
||||
if (unlikely(order >= MAX_ORDER))
|
||||
return NULL;
|
||||
|
||||
return alloc_pages_current(gfp_mask, order);
|
||||
}
|
||||
extern struct page *alloc_page_vma(unsigned __nocast gfp_mask,
|
||||
extern struct page *alloc_page_vma(gfp_t gfp_mask,
|
||||
struct vm_area_struct *vma, unsigned long addr);
|
||||
#else
|
||||
#define alloc_pages(gfp_mask, order) \
|
||||
@@ -118,8 +121,8 @@ extern struct page *alloc_page_vma(unsigned __nocast gfp_mask,
|
||||
#endif
|
||||
#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
|
||||
|
||||
extern unsigned long FASTCALL(__get_free_pages(unsigned int __nocast gfp_mask, unsigned int order));
|
||||
extern unsigned long FASTCALL(get_zeroed_page(unsigned int __nocast gfp_mask));
|
||||
extern unsigned long FASTCALL(__get_free_pages(gfp_t gfp_mask, unsigned int order));
|
||||
extern unsigned long FASTCALL(get_zeroed_page(gfp_t gfp_mask));
|
||||
|
||||
#define __get_free_page(gfp_mask) \
|
||||
__get_free_pages((gfp_mask),0)
|
||||
@@ -136,5 +139,10 @@ extern void FASTCALL(free_cold_page(struct page *page));
|
||||
#define free_page(addr) free_pages((addr),0)
|
||||
|
||||
void page_alloc_init(void);
|
||||
#ifdef CONFIG_NUMA
|
||||
void drain_remote_pages(void);
|
||||
#else
|
||||
static inline void drain_remote_pages(void) { };
|
||||
#endif
|
||||
|
||||
#endif /* __LINUX_GFP_H */
|
||||
@@ -34,6 +34,7 @@ static inline void *kmap(struct page *page)
|
||||
|
||||
#define kmap_atomic(page, idx) page_address(page)
|
||||
#define kunmap_atomic(addr, idx) do { } while (0)
|
||||
#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
|
||||
#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
|
||||
|
||||
#endif /* CONFIG_HIGHMEM */
|
||||
|
||||
@@ -1,262 +0,0 @@
|
||||
#ifndef _LINUX_INIT_H
|
||||
#define _LINUX_INIT_H
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
/* These macros are used to mark some functions or
|
||||
* initialized data (doesn't apply to uninitialized data)
|
||||
* as `initialization' functions. The kernel can take this
|
||||
* as hint that the function is used only during the initialization
|
||||
* phase and free up used memory resources after
|
||||
*
|
||||
* Usage:
|
||||
* For functions:
|
||||
*
|
||||
* You should add __init immediately before the function name, like:
|
||||
*
|
||||
* static void __init initme(int x, int y)
|
||||
* {
|
||||
* extern int z; z = x * y;
|
||||
* }
|
||||
*
|
||||
* If the function has a prototype somewhere, you can also add
|
||||
* __init between closing brace of the prototype and semicolon:
|
||||
*
|
||||
* extern int initialize_foobar_device(int, int, int) __init;
|
||||
*
|
||||
* For initialized data:
|
||||
* You should insert __initdata between the variable name and equal
|
||||
* sign followed by value, e.g.:
|
||||
*
|
||||
* static int init_variable __initdata = 0;
|
||||
* static char linux_logo[] __initdata = { 0x32, 0x36, ... };
|
||||
*
|
||||
* Don't forget to initialize data not at file scope, i.e. within a function,
|
||||
* as gcc otherwise puts the data into the bss section and not into the init
|
||||
* section.
|
||||
*
|
||||
* Also note, that this data cannot be "const".
|
||||
*/
|
||||
|
||||
/* These are for everybody (although not all archs will actually
|
||||
discard it in modules) */
|
||||
#define __init __attribute__ ((__section__ (".init.text")))
|
||||
#define __initdata __attribute__ ((__section__ (".init.data")))
|
||||
#define __exitdata __attribute__ ((__section__(".exit.data")))
|
||||
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
|
||||
|
||||
#ifdef MODULE
|
||||
#define __exit __attribute__ ((__section__(".exit.text")))
|
||||
#else
|
||||
#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text")))
|
||||
#endif
|
||||
|
||||
/* For assembly routines */
|
||||
#define __INIT .section ".init.text","ax"
|
||||
#define __FINIT .previous
|
||||
#define __INITDATA .section ".init.data","aw"
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/*
|
||||
* Used for initialization calls..
|
||||
*/
|
||||
typedef int (*initcall_t)(void);
|
||||
typedef void (*exitcall_t)(void);
|
||||
|
||||
extern initcall_t __con_initcall_start[], __con_initcall_end[];
|
||||
extern initcall_t __security_initcall_start[], __security_initcall_end[];
|
||||
|
||||
/* Defined in init/main.c */
|
||||
extern char saved_command_line[];
|
||||
#endif
|
||||
|
||||
#ifndef MODULE
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* initcalls are now grouped by functionality into separate
|
||||
* subsections. Ordering inside the subsections is determined
|
||||
* by link order.
|
||||
* For backwards compatibility, initcall() puts the call in
|
||||
* the device init subsection.
|
||||
*/
|
||||
|
||||
#define __define_initcall(level,fn) \
|
||||
static initcall_t __initcall_##fn __attribute_used__ \
|
||||
__attribute__((__section__(".initcall" level ".init"))) = fn
|
||||
|
||||
#define core_initcall(fn) __define_initcall("1",fn)
|
||||
#define postcore_initcall(fn) __define_initcall("2",fn)
|
||||
#define arch_initcall(fn) __define_initcall("3",fn)
|
||||
#define subsys_initcall(fn) __define_initcall("4",fn)
|
||||
#define fs_initcall(fn) __define_initcall("5",fn)
|
||||
#define device_initcall(fn) __define_initcall("6",fn)
|
||||
#define late_initcall(fn) __define_initcall("7",fn)
|
||||
|
||||
#define __initcall(fn) device_initcall(fn)
|
||||
|
||||
#define __exitcall(fn) \
|
||||
static exitcall_t __exitcall_##fn __exit_call = fn
|
||||
|
||||
#define console_initcall(fn) \
|
||||
static initcall_t __initcall_##fn \
|
||||
__attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn
|
||||
|
||||
#define security_initcall(fn) \
|
||||
static initcall_t __initcall_##fn \
|
||||
__attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn
|
||||
|
||||
struct obs_kernel_param {
|
||||
const char *str;
|
||||
int (*setup_func)(char *);
|
||||
int early;
|
||||
};
|
||||
|
||||
/*
|
||||
* Only for really core code. See moduleparam.h for the normal way.
|
||||
*
|
||||
* Force the alignment so the compiler doesn't space elements of the
|
||||
* obs_kernel_param "array" too far apart in .init.setup.
|
||||
*/
|
||||
#define __setup_param(str, unique_id, fn, early) \
|
||||
static char __setup_str_##unique_id[] __initdata = str; \
|
||||
static struct obs_kernel_param __setup_##unique_id \
|
||||
__attribute_used__ \
|
||||
__attribute__((__section__(".init.setup"))) \
|
||||
__attribute__((aligned((sizeof(long))))) \
|
||||
= { __setup_str_##unique_id, fn, early }
|
||||
|
||||
#define __setup_null_param(str, unique_id) \
|
||||
__setup_param(str, unique_id, NULL, 0)
|
||||
|
||||
#define __setup(str, fn) \
|
||||
__setup_param(str, fn, fn, 0)
|
||||
|
||||
#define __obsolete_setup(str) \
|
||||
__setup_null_param(str, __LINE__)
|
||||
|
||||
/* NOTE: fn is as per module_param, not __setup! Emits warning if fn
|
||||
* returns non-zero. */
|
||||
#define early_param(str, fn) \
|
||||
__setup_param(str, fn, fn, 1)
|
||||
|
||||
/* Relies on saved_command_line being set */
|
||||
void __init parse_early_param(void);
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/**
|
||||
* module_init() - driver initialization entry point
|
||||
* @x: function to be run at kernel boot time or module insertion
|
||||
*
|
||||
* module_init() will either be called during do_initcalls (if
|
||||
* builtin) or at module insertion time (if a module). There can only
|
||||
* be one per module.
|
||||
*/
|
||||
#define module_init(x) __initcall(x);
|
||||
|
||||
/**
|
||||
* module_exit() - driver exit entry point
|
||||
* @x: function to be run when driver is removed
|
||||
*
|
||||
* module_exit() will wrap the driver clean-up code
|
||||
* with cleanup_module() when used with rmmod when
|
||||
* the driver is a module. If the driver is statically
|
||||
* compiled into the kernel, module_exit() has no effect.
|
||||
* There can only be one per module.
|
||||
*/
|
||||
#define module_exit(x) __exitcall(x);
|
||||
|
||||
#else /* MODULE */
|
||||
|
||||
/* Don't use these in modules, but some people do... */
|
||||
#define core_initcall(fn) module_init(fn)
|
||||
#define postcore_initcall(fn) module_init(fn)
|
||||
#define arch_initcall(fn) module_init(fn)
|
||||
#define subsys_initcall(fn) module_init(fn)
|
||||
#define fs_initcall(fn) module_init(fn)
|
||||
#define device_initcall(fn) module_init(fn)
|
||||
#define late_initcall(fn) module_init(fn)
|
||||
|
||||
#define security_initcall(fn) module_init(fn)
|
||||
|
||||
/* These macros create a dummy inline: gcc 2.9x does not count alias
|
||||
as usage, hence the `unused function' warning when __init functions
|
||||
are declared static. We use the dummy __*_module_inline functions
|
||||
both to kill the warning and check the type of the init/cleanup
|
||||
function. */
|
||||
|
||||
/* Each module must use one module_init(), or one no_module_init */
|
||||
#define module_init(initfn) \
|
||||
static inline initcall_t __inittest(void) \
|
||||
{ return initfn; } \
|
||||
int init_module(void) __attribute__((alias(#initfn)));
|
||||
|
||||
/* This is only required if you want to be unloadable. */
|
||||
#define module_exit(exitfn) \
|
||||
static inline exitcall_t __exittest(void) \
|
||||
{ return exitfn; } \
|
||||
void cleanup_module(void) __attribute__((alias(#exitfn)));
|
||||
|
||||
#define __setup_param(str, unique_id, fn) /* nothing */
|
||||
#define __setup_null_param(str, unique_id) /* nothing */
|
||||
#define __setup(str, func) /* nothing */
|
||||
#define __obsolete_setup(str) /* nothing */
|
||||
#endif
|
||||
|
||||
/* Data marked not to be saved by software_suspend() */
|
||||
#define __nosavedata __attribute__ ((__section__ (".data.nosave")))
|
||||
|
||||
/* This means "can be init if no module support, otherwise module load
|
||||
may call it." */
|
||||
#ifdef CONFIG_MODULES
|
||||
#define __init_or_module
|
||||
#define __initdata_or_module
|
||||
#else
|
||||
#define __init_or_module __init
|
||||
#define __initdata_or_module __initdata
|
||||
#endif /*CONFIG_MODULES*/
|
||||
|
||||
#ifdef CONFIG_HOTPLUG
|
||||
#define __devinit
|
||||
#define __devinitdata
|
||||
#define __devexit
|
||||
#define __devexitdata
|
||||
#else
|
||||
#define __devinit __init
|
||||
#define __devinitdata __initdata
|
||||
#define __devexit __exit
|
||||
#define __devexitdata __exitdata
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
#define __cpuinit
|
||||
#define __cpuinitdata
|
||||
#define __cpuexit
|
||||
#define __cpuexitdata
|
||||
#else
|
||||
#define __cpuinit __init
|
||||
#define __cpuinitdata __initdata
|
||||
#define __cpuexit __exit
|
||||
#define __cpuexitdata __exitdata
|
||||
#endif
|
||||
|
||||
/* Functions marked as __devexit may be discarded at kernel link time, depending
|
||||
on config options. Newer versions of binutils detect references from
|
||||
retained sections to discarded sections and flag an error. Pointers to
|
||||
__devexit functions must use __devexit_p(function_name), the wrapper will
|
||||
insert either the function_name or NULL, depending on the config options.
|
||||
*/
|
||||
#if defined(MODULE) || defined(CONFIG_HOTPLUG)
|
||||
#define __devexit_p(x) x
|
||||
#else
|
||||
#define __devexit_p(x) NULL
|
||||
#endif
|
||||
|
||||
#ifdef MODULE
|
||||
#define __exit_p(x) x
|
||||
#else
|
||||
#define __exit_p(x) NULL
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_INIT_H */
|
||||
@@ -32,7 +32,12 @@
|
||||
#define IRQ_WAITING 32 /* IRQ not yet seen - for autodetection */
|
||||
#define IRQ_LEVEL 64 /* IRQ level triggered */
|
||||
#define IRQ_MASKED 128 /* IRQ masked - shouldn't be seen again */
|
||||
#define IRQ_PER_CPU 256 /* IRQ is per CPU */
|
||||
#if defined(ARCH_HAS_IRQ_PER_CPU)
|
||||
# define IRQ_PER_CPU 256 /* IRQ is per CPU */
|
||||
# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
|
||||
#else
|
||||
# define CHECK_IRQ_PER_CPU(var) 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Interrupt controller descriptor. This is all we need
|
||||
@@ -47,6 +52,10 @@ struct hw_interrupt_type {
|
||||
void (*ack)(unsigned int irq);
|
||||
void (*end)(unsigned int irq);
|
||||
void (*set_affinity)(unsigned int irq, cpumask_t dest);
|
||||
/* Currently used only by UML, might disappear one day.*/
|
||||
#ifdef CONFIG_IRQ_RELEASE_METHOD
|
||||
void (*release)(unsigned int irq, void *dev_id);
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct hw_interrupt_type hw_irq_controller;
|
||||
@@ -67,10 +76,20 @@ typedef struct irq_desc {
|
||||
unsigned int irq_count; /* For detecting broken interrupts */
|
||||
unsigned int irqs_unhandled;
|
||||
spinlock_t lock;
|
||||
#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
|
||||
unsigned int move_irq; /* Flag need to re-target intr dest*/
|
||||
#endif
|
||||
} ____cacheline_aligned irq_desc_t;
|
||||
|
||||
extern irq_desc_t irq_desc [NR_IRQS];
|
||||
|
||||
/* Return a pointer to the irq descriptor for IRQ. */
|
||||
static inline irq_desc_t *
|
||||
irq_descp (int irq)
|
||||
{
|
||||
return irq_desc + irq;
|
||||
}
|
||||
|
||||
#include <asm/hw_irq.h> /* the arch dependent stuff */
|
||||
|
||||
extern int setup_irq(unsigned int irq, struct irqaction * new);
|
||||
@@ -80,14 +99,127 @@ extern int teardown_irq(unsigned int irq, struct irqaction * old);
|
||||
|
||||
#ifdef CONFIG_GENERIC_HARDIRQS
|
||||
extern cpumask_t irq_affinity[NR_IRQS];
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
static inline void set_native_irq_info(int irq, cpumask_t mask)
|
||||
{
|
||||
irq_affinity[irq] = mask;
|
||||
}
|
||||
#else
|
||||
static inline void set_native_irq_info(int irq, cpumask_t mask)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
#if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE)
|
||||
extern cpumask_t pending_irq_cpumask[NR_IRQS];
|
||||
|
||||
static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
|
||||
{
|
||||
irq_desc_t *desc = irq_desc + irq;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&desc->lock, flags);
|
||||
desc->move_irq = 1;
|
||||
pending_irq_cpumask[irq] = mask;
|
||||
spin_unlock_irqrestore(&desc->lock, flags);
|
||||
}
|
||||
|
||||
static inline void
|
||||
move_native_irq(int irq)
|
||||
{
|
||||
cpumask_t tmp;
|
||||
irq_desc_t *desc = irq_descp(irq);
|
||||
|
||||
if (likely (!desc->move_irq))
|
||||
return;
|
||||
|
||||
desc->move_irq = 0;
|
||||
|
||||
if (likely(cpus_empty(pending_irq_cpumask[irq])))
|
||||
return;
|
||||
|
||||
if (!desc->handler->set_affinity)
|
||||
return;
|
||||
|
||||
/* note - we hold the desc->lock */
|
||||
cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
|
||||
|
||||
/*
|
||||
* If there was a valid mask to work with, please
|
||||
* do the disable, re-program, enable sequence.
|
||||
* This is *not* particularly important for level triggered
|
||||
* but in a edge trigger case, we might be setting rte
|
||||
* when an active trigger is comming in. This could
|
||||
* cause some ioapics to mal-function.
|
||||
* Being paranoid i guess!
|
||||
*/
|
||||
if (unlikely(!cpus_empty(tmp))) {
|
||||
desc->handler->disable(irq);
|
||||
desc->handler->set_affinity(irq,tmp);
|
||||
desc->handler->enable(irq);
|
||||
}
|
||||
cpus_clear(pending_irq_cpumask[irq]);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
/*
|
||||
* Wonder why these are dummies?
|
||||
* For e.g the set_ioapic_affinity_vector() calls the set_ioapic_affinity_irq()
|
||||
* counter part after translating the vector to irq info. We need to perform
|
||||
* this operation on the real irq, when we dont use vector, i.e when
|
||||
* pci_use_vector() is false.
|
||||
*/
|
||||
static inline void move_irq(int irq)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void set_irq_info(int irq, cpumask_t mask)
|
||||
{
|
||||
}
|
||||
|
||||
#else // CONFIG_PCI_MSI
|
||||
|
||||
static inline void move_irq(int irq)
|
||||
{
|
||||
move_native_irq(irq);
|
||||
}
|
||||
|
||||
static inline void set_irq_info(int irq, cpumask_t mask)
|
||||
{
|
||||
set_native_irq_info(irq, mask);
|
||||
}
|
||||
#endif // CONFIG_PCI_MSI
|
||||
|
||||
#else // CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE
|
||||
|
||||
#define move_irq(x)
|
||||
#define move_native_irq(x)
|
||||
#define set_pending_irq(x,y)
|
||||
static inline void set_irq_info(int irq, cpumask_t mask)
|
||||
{
|
||||
set_native_irq_info(irq, mask);
|
||||
}
|
||||
|
||||
#endif // CONFIG_GENERIC_PENDING_IRQ
|
||||
|
||||
#else // CONFIG_SMP
|
||||
|
||||
#define move_irq(x)
|
||||
#define move_native_irq(x)
|
||||
|
||||
#endif // CONFIG_SMP
|
||||
|
||||
extern int no_irq_affinity;
|
||||
extern int noirqdebug_setup(char *str);
|
||||
|
||||
extern fastcall int handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
|
||||
struct irqaction *action);
|
||||
struct irqaction *action);
|
||||
extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
|
||||
extern void note_interrupt(unsigned int irq, irq_desc_t *desc, int action_ret);
|
||||
extern void report_bad_irq(unsigned int irq, irq_desc_t *desc, int action_ret);
|
||||
extern void note_interrupt(unsigned int irq, irq_desc_t *desc,
|
||||
int action_ret, struct pt_regs *regs);
|
||||
extern int can_request_irq(unsigned int irq, unsigned long irqflags);
|
||||
|
||||
extern void init_irq_proc(void);
|
||||
|
||||
@@ -136,6 +136,7 @@ extern unsigned int kobjsize(const void *objp);
|
||||
#define VM_EXEC 0x00000004
|
||||
#define VM_SHARED 0x00000008
|
||||
|
||||
/* mprotect() hardcodes VM_MAYREAD >> 4 == VM_READ, and so for r/w/x bits. */
|
||||
#define VM_MAYREAD 0x00000010 /* limits for mprotect() etc */
|
||||
#define VM_MAYWRITE 0x00000020
|
||||
#define VM_MAYEXEC 0x00000040
|
||||
@@ -353,7 +354,8 @@ static inline void put_page(struct page *page)
|
||||
* only one copy in memory, at most, normally.
|
||||
*
|
||||
* For the non-reserved pages, page_count(page) denotes a reference count.
|
||||
* page_count() == 0 means the page is free.
|
||||
* page_count() == 0 means the page is free. page->lru is then used for
|
||||
* freelist management in the buddy allocator.
|
||||
* page_count() == 1 means the page is used for exactly one purpose
|
||||
* (e.g. a private data page of one process).
|
||||
*
|
||||
@@ -379,10 +381,8 @@ static inline void put_page(struct page *page)
|
||||
* attaches, plus 1 if `private' contains something, plus one for
|
||||
* the page cache itself.
|
||||
*
|
||||
* All pages belonging to an inode are in these doubly linked lists:
|
||||
* mapping->clean_pages, mapping->dirty_pages and mapping->locked_pages;
|
||||
* using the page->list list_head. These fields are also used for
|
||||
* freelist managemet (when page_count()==0).
|
||||
* Instead of keeping dirty/clean pages in per address-space lists, we instead
|
||||
* now tag pages as dirty/under writeback in the radix tree.
|
||||
*
|
||||
* There is also a per-mapping radix tree mapping index to the page
|
||||
* in memory if present. The tree is rooted at mapping->root.
|
||||
@@ -398,19 +398,81 @@ static inline void put_page(struct page *page)
|
||||
/*
|
||||
* The zone field is never updated after free_area_init_core()
|
||||
* sets it, so none of the operations on it need to be atomic.
|
||||
* We'll have up to (MAX_NUMNODES * MAX_NR_ZONES) zones total,
|
||||
* so we use (MAX_NODES_SHIFT + MAX_ZONES_SHIFT) here to get enough bits.
|
||||
*/
|
||||
#define NODEZONE_SHIFT (sizeof(page_flags_t)*8 - MAX_NODES_SHIFT - MAX_ZONES_SHIFT)
|
||||
#define NODEZONE(node, zone) ((node << ZONES_SHIFT) | zone)
|
||||
|
||||
|
||||
/*
|
||||
* page->flags layout:
|
||||
*
|
||||
* There are three possibilities for how page->flags get
|
||||
* laid out. The first is for the normal case, without
|
||||
* sparsemem. The second is for sparsemem when there is
|
||||
* plenty of space for node and section. The last is when
|
||||
* we have run out of space and have to fall back to an
|
||||
* alternate (slower) way of determining the node.
|
||||
*
|
||||
* No sparsemem: | NODE | ZONE | ... | FLAGS |
|
||||
* with space for node: | SECTION | NODE | ZONE | ... | FLAGS |
|
||||
* no space for node: | SECTION | ZONE | ... | FLAGS |
|
||||
*/
|
||||
#ifdef CONFIG_SPARSEMEM
|
||||
#define SECTIONS_WIDTH SECTIONS_SHIFT
|
||||
#else
|
||||
#define SECTIONS_WIDTH 0
|
||||
#endif
|
||||
|
||||
#define ZONES_WIDTH ZONES_SHIFT
|
||||
|
||||
#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED
|
||||
#define NODES_WIDTH NODES_SHIFT
|
||||
#else
|
||||
#define NODES_WIDTH 0
|
||||
#endif
|
||||
|
||||
/* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */
|
||||
#define SECTIONS_PGOFF ((sizeof(page_flags_t)*8) - SECTIONS_WIDTH)
|
||||
#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
|
||||
#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
|
||||
|
||||
/*
|
||||
* We are going to use the flags for the page to node mapping if its in
|
||||
* there. This includes the case where there is no node, so it is implicit.
|
||||
*/
|
||||
#define FLAGS_HAS_NODE (NODES_WIDTH > 0 || NODES_SHIFT == 0)
|
||||
|
||||
#ifndef PFN_SECTION_SHIFT
|
||||
#define PFN_SECTION_SHIFT 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the bit shifts to access each section. For non-existant
|
||||
* sections we define the shift as 0; that plus a 0 mask ensures
|
||||
* the compiler will optimise away reference to them.
|
||||
*/
|
||||
#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0))
|
||||
#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
|
||||
#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
|
||||
|
||||
/* NODE:ZONE or SECTION:ZONE is used to lookup the zone from a page. */
|
||||
#if FLAGS_HAS_NODE
|
||||
#define ZONETABLE_SHIFT (NODES_SHIFT + ZONES_SHIFT)
|
||||
#else
|
||||
#define ZONETABLE_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT)
|
||||
#endif
|
||||
#define ZONETABLE_PGSHIFT ZONES_PGSHIFT
|
||||
|
||||
#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
|
||||
#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
|
||||
#endif
|
||||
|
||||
#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
|
||||
#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
|
||||
#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
|
||||
#define ZONETABLE_MASK ((1UL << ZONETABLE_SHIFT) - 1)
|
||||
|
||||
static inline unsigned long page_zonenum(struct page *page)
|
||||
{
|
||||
return (page->flags >> NODEZONE_SHIFT) & (~(~0UL << ZONES_SHIFT));
|
||||
}
|
||||
static inline unsigned long page_to_nid(struct page *page)
|
||||
{
|
||||
return (page->flags >> (NODEZONE_SHIFT + ZONES_SHIFT));
|
||||
return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
|
||||
}
|
||||
|
||||
struct zone;
|
||||
@@ -418,13 +480,44 @@ extern struct zone *zone_table[];
|
||||
|
||||
static inline struct zone *page_zone(struct page *page)
|
||||
{
|
||||
return zone_table[page->flags >> NODEZONE_SHIFT];
|
||||
return zone_table[(page->flags >> ZONETABLE_PGSHIFT) &
|
||||
ZONETABLE_MASK];
|
||||
}
|
||||
|
||||
static inline void set_page_zone(struct page *page, unsigned long nodezone_num)
|
||||
static inline unsigned long page_to_nid(struct page *page)
|
||||
{
|
||||
page->flags &= ~(~0UL << NODEZONE_SHIFT);
|
||||
page->flags |= nodezone_num << NODEZONE_SHIFT;
|
||||
if (FLAGS_HAS_NODE)
|
||||
return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
|
||||
else
|
||||
return page_zone(page)->zone_pgdat->node_id;
|
||||
}
|
||||
static inline unsigned long page_to_section(struct page *page)
|
||||
{
|
||||
return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
|
||||
}
|
||||
|
||||
static inline void set_page_zone(struct page *page, unsigned long zone)
|
||||
{
|
||||
page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
|
||||
page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
|
||||
}
|
||||
static inline void set_page_node(struct page *page, unsigned long node)
|
||||
{
|
||||
page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
|
||||
page->flags |= (node & NODES_MASK) << NODES_PGSHIFT;
|
||||
}
|
||||
static inline void set_page_section(struct page *page, unsigned long section)
|
||||
{
|
||||
page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT);
|
||||
page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
|
||||
}
|
||||
|
||||
static inline void set_page_links(struct page *page, unsigned long zone,
|
||||
unsigned long node, unsigned long pfn)
|
||||
{
|
||||
set_page_zone(page, zone);
|
||||
set_page_node(page, node);
|
||||
set_page_section(page, pfn_to_section_nr(pfn));
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DISCONTIGMEM
|
||||
@@ -535,10 +628,16 @@ static inline int page_mapped(struct page *page)
|
||||
* Used to decide whether a process gets delivered SIGBUS or
|
||||
* just gets major/minor fault counters bumped up.
|
||||
*/
|
||||
#define VM_FAULT_OOM (-1)
|
||||
#define VM_FAULT_SIGBUS 0
|
||||
#define VM_FAULT_MINOR 1
|
||||
#define VM_FAULT_MAJOR 2
|
||||
#define VM_FAULT_OOM 0x00
|
||||
#define VM_FAULT_SIGBUS 0x01
|
||||
#define VM_FAULT_MINOR 0x02
|
||||
#define VM_FAULT_MAJOR 0x03
|
||||
|
||||
/*
|
||||
* Special case for get_user_pages.
|
||||
* Must be in a distinct bit from the above VM_FAULT_ flags.
|
||||
*/
|
||||
#define VM_FAULT_WRITE 0x10
|
||||
|
||||
#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
|
||||
|
||||
@@ -614,7 +713,13 @@ extern pte_t *FASTCALL(pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsign
|
||||
extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
|
||||
extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, struct page *page, pgprot_t prot);
|
||||
extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, unsigned long pgoff, pgprot_t prot);
|
||||
extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
|
||||
extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
|
||||
|
||||
static inline int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, int write_access)
|
||||
{
|
||||
return __handle_mm_fault(mm, vma, address, write_access) & (~VM_FAULT_WRITE);
|
||||
}
|
||||
|
||||
extern int make_pages_present(unsigned long addr, unsigned long end);
|
||||
extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
|
||||
void install_arg_page(struct vm_area_struct *, struct page *, unsigned long);
|
||||
@@ -694,6 +799,12 @@ extern void show_mem(void);
|
||||
extern void si_meminfo(struct sysinfo * val);
|
||||
extern void si_meminfo_node(struct sysinfo *val, int nid);
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
extern void setup_per_cpu_pageset(void);
|
||||
#else
|
||||
static inline void setup_per_cpu_pageset(void) {}
|
||||
#endif
|
||||
|
||||
/* prio_tree.c */
|
||||
void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
|
||||
void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *);
|
||||
@@ -824,8 +935,8 @@ typedef int (*pte_fn_t)(pte_t *pte, struct page *pte_page, unsigned long addr,
|
||||
void *data);
|
||||
extern int generic_page_range(struct mm_struct *mm, unsigned long address,
|
||||
unsigned long size, pte_fn_t fn, void *data);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
void __vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
|
||||
#else
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/textsearch.h>
|
||||
#include <net/checksum.h>
|
||||
|
||||
#define HAVE_ALLOC_SKB /* For the drivers to know */
|
||||
@@ -154,16 +155,27 @@ struct skb_shared_info {
|
||||
#define SKB_DATAREF_SHIFT 16
|
||||
#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
|
||||
|
||||
struct skb_timeval {
|
||||
u32 off_sec;
|
||||
u32 off_usec;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
SKB_FCLONE_UNAVAILABLE,
|
||||
SKB_FCLONE_ORIG,
|
||||
SKB_FCLONE_CLONE,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct sk_buff - socket buffer
|
||||
* @next: Next buffer in list
|
||||
* @prev: Previous buffer in list
|
||||
* @list: List we are on
|
||||
* @sk: Socket we are owned by
|
||||
* @stamp: Time we arrived
|
||||
* @tstamp: Time we arrived
|
||||
* @dev: Device we arrived on/are leaving by
|
||||
* @input_dev: Device we arrived on
|
||||
* @real_dev: The real device we are using
|
||||
* @h: Transport layer header
|
||||
* @nh: Network layer header
|
||||
* @mac: Link layer header
|
||||
@@ -184,7 +196,6 @@ struct skb_shared_info {
|
||||
* @priority: Packet queueing priority
|
||||
* @users: User count - see {datagram,tcp}.c
|
||||
* @protocol: Packet protocol from driver
|
||||
* @security: Security level of packet
|
||||
* @truesize: Buffer size
|
||||
* @head: Head of buffer
|
||||
* @data: Data head pointer
|
||||
@@ -192,15 +203,11 @@ struct skb_shared_info {
|
||||
* @end: End pointer
|
||||
* @destructor: Destruct function
|
||||
* @nfmark: Can be used for communication between hooks
|
||||
* @nfcache: Cache info
|
||||
* @nfct: Associated connection, if any
|
||||
* @nfctinfo: Relationship of this skb to the connection
|
||||
* @nf_debug: Netfilter debugging
|
||||
* @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
|
||||
* @private: Data which is private to the HIPPI implementation
|
||||
* @tc_index: Traffic control index
|
||||
* @tc_verd: traffic control verdict
|
||||
* @tc_classid: traffic control classid
|
||||
*/
|
||||
|
||||
struct sk_buff {
|
||||
@@ -208,12 +215,10 @@ struct sk_buff {
|
||||
struct sk_buff *next;
|
||||
struct sk_buff *prev;
|
||||
|
||||
struct sk_buff_head *list;
|
||||
struct sock *sk;
|
||||
struct timeval stamp;
|
||||
struct skb_timeval tstamp;
|
||||
struct net_device *dev;
|
||||
struct net_device *input_dev;
|
||||
struct net_device *real_dev;
|
||||
|
||||
union {
|
||||
struct tcphdr *th;
|
||||
@@ -251,44 +256,39 @@ struct sk_buff {
|
||||
data_len,
|
||||
mac_len,
|
||||
csum;
|
||||
unsigned char local_df,
|
||||
cloned:1,
|
||||
nohdr:1,
|
||||
#ifdef CONFIG_XEN
|
||||
proto_csum_valid:1,
|
||||
proto_csum_blank:1,
|
||||
#endif
|
||||
pkt_type,
|
||||
ip_summed;
|
||||
__u32 priority;
|
||||
unsigned short protocol,
|
||||
security;
|
||||
__u8 local_df:1,
|
||||
cloned:1,
|
||||
ip_summed:2,
|
||||
nohdr:1,
|
||||
nfctinfo:3;
|
||||
__u8 pkt_type:3,
|
||||
#ifndef CONFIG_XEN
|
||||
fclone:2;
|
||||
#else
|
||||
fclone:2,
|
||||
proto_csum_valid:1,
|
||||
proto_csum_blank:1;
|
||||
/* 1 bit spare */
|
||||
#endif
|
||||
__be16 protocol;
|
||||
|
||||
void (*destructor)(struct sk_buff *skb);
|
||||
#ifdef CONFIG_NETFILTER
|
||||
unsigned long nfmark;
|
||||
__u32 nfcache;
|
||||
__u32 nfctinfo;
|
||||
__u32 nfmark;
|
||||
struct nf_conntrack *nfct;
|
||||
#ifdef CONFIG_NETFILTER_DEBUG
|
||||
unsigned int nf_debug;
|
||||
#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
|
||||
__u8 ipvs_property:1;
|
||||
#endif
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
struct nf_bridge_info *nf_bridge;
|
||||
#endif
|
||||
#endif /* CONFIG_NETFILTER */
|
||||
#if defined(CONFIG_HIPPI)
|
||||
union {
|
||||
__u32 ifield;
|
||||
} private;
|
||||
#endif
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
__u32 tc_index; /* traffic control index */
|
||||
__u16 tc_index; /* traffic control index */
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
__u32 tc_verd; /* traffic control verdict */
|
||||
__u32 tc_classid; /* traffic control classid */
|
||||
__u16 tc_verd; /* traffic control verdict */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -310,20 +310,39 @@ struct sk_buff {
|
||||
#include <asm/system.h>
|
||||
|
||||
extern void __kfree_skb(struct sk_buff *skb);
|
||||
extern struct sk_buff *alloc_skb(unsigned int size, int priority);
|
||||
extern struct sk_buff *__alloc_skb(unsigned int size,
|
||||
gfp_t priority, int fclone);
|
||||
static inline struct sk_buff *alloc_skb(unsigned int size,
|
||||
gfp_t priority)
|
||||
{
|
||||
return __alloc_skb(size, priority, 0);
|
||||
}
|
||||
|
||||
static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
|
||||
gfp_t priority)
|
||||
{
|
||||
return __alloc_skb(size, priority, 1);
|
||||
}
|
||||
|
||||
extern struct sk_buff *alloc_skb_from_cache(kmem_cache_t *cp,
|
||||
unsigned int size, int priority);
|
||||
unsigned int size,
|
||||
gfp_t priority,
|
||||
int fclone);
|
||||
extern void kfree_skbmem(struct sk_buff *skb);
|
||||
extern struct sk_buff *skb_clone(struct sk_buff *skb, int priority);
|
||||
extern struct sk_buff *skb_copy(const struct sk_buff *skb, int priority);
|
||||
extern struct sk_buff *pskb_copy(struct sk_buff *skb, int gfp_mask);
|
||||
extern struct sk_buff *skb_clone(struct sk_buff *skb,
|
||||
gfp_t priority);
|
||||
extern struct sk_buff *skb_copy(const struct sk_buff *skb,
|
||||
gfp_t priority);
|
||||
extern struct sk_buff *pskb_copy(struct sk_buff *skb,
|
||||
gfp_t gfp_mask);
|
||||
extern int pskb_expand_head(struct sk_buff *skb,
|
||||
int nhead, int ntail, int gfp_mask);
|
||||
int nhead, int ntail,
|
||||
gfp_t gfp_mask);
|
||||
extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
|
||||
unsigned int headroom);
|
||||
extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
|
||||
int newheadroom, int newtailroom,
|
||||
int priority);
|
||||
gfp_t priority);
|
||||
extern struct sk_buff * skb_pad(struct sk_buff *skb, int pad);
|
||||
#define dev_kfree_skb(a) kfree_skb(a)
|
||||
extern void skb_over_panic(struct sk_buff *skb, int len,
|
||||
@@ -331,6 +350,28 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
|
||||
extern void skb_under_panic(struct sk_buff *skb, int len,
|
||||
void *here);
|
||||
|
||||
struct skb_seq_state
|
||||
{
|
||||
__u32 lower_offset;
|
||||
__u32 upper_offset;
|
||||
__u32 frag_idx;
|
||||
__u32 stepped_offset;
|
||||
struct sk_buff *root_skb;
|
||||
struct sk_buff *cur_skb;
|
||||
__u8 *frag_data;
|
||||
};
|
||||
|
||||
extern void skb_prepare_seq_read(struct sk_buff *skb,
|
||||
unsigned int from, unsigned int to,
|
||||
struct skb_seq_state *st);
|
||||
extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
|
||||
struct skb_seq_state *st);
|
||||
extern void skb_abort_seq_read(struct skb_seq_state *st);
|
||||
|
||||
extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
|
||||
unsigned int to, struct ts_config *config,
|
||||
struct ts_state *state);
|
||||
|
||||
/* Internal */
|
||||
#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end))
|
||||
|
||||
@@ -452,7 +493,8 @@ static inline int skb_shared(const struct sk_buff *skb)
|
||||
*
|
||||
* NULL is returned on a memory allocation failure.
|
||||
*/
|
||||
static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri)
|
||||
static inline struct sk_buff *skb_share_check(struct sk_buff *skb,
|
||||
gfp_t pri)
|
||||
{
|
||||
might_sleep_if(pri & __GFP_WAIT);
|
||||
if (skb_shared(skb)) {
|
||||
@@ -483,7 +525,8 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, int pri)
|
||||
*
|
||||
* %NULL is returned on a memory allocation failure.
|
||||
*/
|
||||
static inline struct sk_buff *skb_unshare(struct sk_buff *skb, int pri)
|
||||
static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
|
||||
gfp_t pri)
|
||||
{
|
||||
might_sleep_if(pri & __GFP_WAIT);
|
||||
if (skb_cloned(skb)) {
|
||||
@@ -577,7 +620,6 @@ static inline void __skb_queue_head(struct sk_buff_head *list,
|
||||
{
|
||||
struct sk_buff *prev, *next;
|
||||
|
||||
newsk->list = list;
|
||||
list->qlen++;
|
||||
prev = (struct sk_buff *)list;
|
||||
next = prev->next;
|
||||
@@ -602,7 +644,6 @@ static inline void __skb_queue_tail(struct sk_buff_head *list,
|
||||
{
|
||||
struct sk_buff *prev, *next;
|
||||
|
||||
newsk->list = list;
|
||||
list->qlen++;
|
||||
next = (struct sk_buff *)list;
|
||||
prev = next->prev;
|
||||
@@ -635,7 +676,6 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
result->next = result->prev = NULL;
|
||||
result->list = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -644,7 +684,7 @@ static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
|
||||
/*
|
||||
* Insert a packet on a list.
|
||||
*/
|
||||
extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk);
|
||||
extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
|
||||
static inline void __skb_insert(struct sk_buff *newsk,
|
||||
struct sk_buff *prev, struct sk_buff *next,
|
||||
struct sk_buff_head *list)
|
||||
@@ -652,24 +692,23 @@ static inline void __skb_insert(struct sk_buff *newsk,
|
||||
newsk->next = next;
|
||||
newsk->prev = prev;
|
||||
next->prev = prev->next = newsk;
|
||||
newsk->list = list;
|
||||
list->qlen++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Place a packet after a given packet in a list.
|
||||
*/
|
||||
extern void skb_append(struct sk_buff *old, struct sk_buff *newsk);
|
||||
static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk)
|
||||
extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
|
||||
static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
|
||||
{
|
||||
__skb_insert(newsk, old, old->next, old->list);
|
||||
__skb_insert(newsk, old, old->next, list);
|
||||
}
|
||||
|
||||
/*
|
||||
* remove sk_buff from list. _Must_ be called atomically, and with
|
||||
* the list known..
|
||||
*/
|
||||
extern void skb_unlink(struct sk_buff *skb);
|
||||
extern void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
|
||||
static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
|
||||
{
|
||||
struct sk_buff *next, *prev;
|
||||
@@ -678,7 +717,6 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
|
||||
next = skb->next;
|
||||
prev = skb->prev;
|
||||
skb->next = skb->prev = NULL;
|
||||
skb->list = NULL;
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
}
|
||||
@@ -989,7 +1027,7 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
|
||||
* %NULL is returned in there is no free memory.
|
||||
*/
|
||||
static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
|
||||
int gfp_mask)
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
struct sk_buff *skb = alloc_skb(length + 16, gfp_mask);
|
||||
if (likely(skb))
|
||||
@@ -997,7 +1035,7 @@ static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
|
||||
return skb;
|
||||
}
|
||||
#else
|
||||
extern struct sk_buff *__dev_alloc_skb(unsigned int length, int gfp_mask);
|
||||
extern struct sk_buff *__dev_alloc_skb(unsigned int length, gfp_t gfp_mask);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -1102,8 +1140,8 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
|
||||
* If there is no free memory -ENOMEM is returned, otherwise zero
|
||||
* is returned and the old skb data released.
|
||||
*/
|
||||
extern int __skb_linearize(struct sk_buff *skb, int gfp);
|
||||
static inline int skb_linearize(struct sk_buff *skb, int gfp)
|
||||
extern int __skb_linearize(struct sk_buff *skb, gfp_t gfp);
|
||||
static inline int skb_linearize(struct sk_buff *skb, gfp_t gfp)
|
||||
{
|
||||
return __skb_linearize(skb, gfp);
|
||||
}
|
||||
@@ -1137,7 +1175,7 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
|
||||
|
||||
static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
|
||||
{
|
||||
if (len >= skb->len)
|
||||
if (likely(len >= skb->len))
|
||||
return 0;
|
||||
if (skb->ip_summed == CHECKSUM_HW)
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
@@ -1193,12 +1231,14 @@ extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
|
||||
extern void skb_split(struct sk_buff *skb,
|
||||
struct sk_buff *skb1, const u32 len);
|
||||
|
||||
extern void skb_release_data(struct sk_buff *skb);
|
||||
|
||||
static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
|
||||
int len, void *buffer)
|
||||
{
|
||||
int hlen = skb_headlen(skb);
|
||||
|
||||
if (offset + len <= hlen)
|
||||
if (hlen - offset >= len)
|
||||
return skb->data + offset;
|
||||
|
||||
if (skb_copy_bits(skb, offset, buffer, len) < 0)
|
||||
@@ -1210,6 +1250,38 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
|
||||
extern void skb_init(void);
|
||||
extern void skb_add_mtu(int mtu);
|
||||
|
||||
/**
|
||||
* skb_get_timestamp - get timestamp from a skb
|
||||
* @skb: skb to get stamp from
|
||||
* @stamp: pointer to struct timeval to store stamp in
|
||||
*
|
||||
* Timestamps are stored in the skb as offsets to a base timestamp.
|
||||
* This function converts the offset back to a struct timeval and stores
|
||||
* it in stamp.
|
||||
*/
|
||||
static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
|
||||
{
|
||||
stamp->tv_sec = skb->tstamp.off_sec;
|
||||
stamp->tv_usec = skb->tstamp.off_usec;
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_set_timestamp - set timestamp of a skb
|
||||
* @skb: skb to set stamp of
|
||||
* @stamp: pointer to struct timeval to get stamp from
|
||||
*
|
||||
* Timestamps are stored in the skb as offsets to a base timestamp.
|
||||
* This function converts a struct timeval to an offset and stores
|
||||
* it in the skb.
|
||||
*/
|
||||
static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp)
|
||||
{
|
||||
skb->tstamp.off_sec = stamp->tv_sec;
|
||||
skb->tstamp.off_usec = stamp->tv_usec;
|
||||
}
|
||||
|
||||
extern void __net_timestamp(struct sk_buff *skb);
|
||||
|
||||
#ifdef CONFIG_NETFILTER
|
||||
static inline void nf_conntrack_put(struct nf_conntrack *nfct)
|
||||
{
|
||||
@@ -1225,15 +1297,6 @@ static inline void nf_reset(struct sk_buff *skb)
|
||||
{
|
||||
nf_conntrack_put(skb->nfct);
|
||||
skb->nfct = NULL;
|
||||
#ifdef CONFIG_NETFILTER_DEBUG
|
||||
skb->nf_debug = 0;
|
||||
#endif
|
||||
}
|
||||
static inline void nf_reset_debug(struct sk_buff *skb)
|
||||
{
|
||||
#ifdef CONFIG_NETFILTER_DEBUG
|
||||
skb->nf_debug = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
|
||||