From: Pravin B Shelar Date: Mon, 26 Aug 2013 18:19:10 +0000 (-0700) Subject: datapath: Remove compat files. X-Git-Tag: sliver-openvswitch-2.0.90-1~16^2~1 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=5804fb7b8472ae3384792076099311a14ca7183e datapath: Remove compat files. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- diff --git a/acinclude.m4 b/acinclude.m4 index 4d36d8f74..071fe54b4 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -260,9 +260,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_reset_mac_len]) OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [skb_unclone]) - OVS_GREP_IFELSE([$KSRC/include/linux/string.h], [kmemdup], [], - [OVS_GREP_IFELSE([$KSRC/include/linux/slab.h], [kmemdup])]) - OVS_GREP_IFELSE([$KSRC/include/linux/types.h], [bool], [OVS_DEFINE([HAVE_BOOL_TYPE])]) OVS_GREP_IFELSE([$KSRC/include/linux/types.h], [__wsum], diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk index 92cd52068..e3c42cde7 100644 --- a/datapath/linux/Modules.mk +++ b/datapath/linux/Modules.mk @@ -1,5 +1,4 @@ openvswitch_sources += \ - linux/compat/addrconf_core-openvswitch.c \ linux/compat/dev-openvswitch.c \ linux/compat/exthdrs_core.c \ linux/compat/flex_array.c \ @@ -7,14 +6,11 @@ openvswitch_sources += \ linux/compat/gre.c \ linux/compat/gso.c \ linux/compat/genetlink-openvswitch.c \ - linux/compat/ip_output-openvswitch.c \ linux/compat/ip_tunnels_core.c \ - linux/compat/kmemdup.c \ linux/compat/netdevice.c \ linux/compat/net_namespace.c \ linux/compat/reciprocal_div.c \ linux/compat/skbuff-openvswitch.c \ - linux/compat/time.c \ linux/compat/vxlan.c \ linux/compat/workqueue.c \ linux/compat/utils.c @@ -24,7 +20,6 @@ openvswitch_headers += \ linux/compat/include/linux/compiler.h \ linux/compat/include/linux/compiler-gcc.h \ linux/compat/include/linux/cpumask.h \ - linux/compat/include/linux/dmi.h \ linux/compat/include/linux/err.h \ linux/compat/include/linux/etherdevice.h \ linux/compat/include/linux/flex_array.h \ @@ -36,22 +31,16 @@ openvswitch_headers += \ linux/compat/include/linux/if_tunnel.h \ linux/compat/include/linux/if_vlan.h \ linux/compat/include/linux/in.h \ - linux/compat/include/linux/inetdevice.h \ linux/compat/include/linux/ip.h \ linux/compat/include/linux/ipv6.h \ linux/compat/include/linux/jiffies.h \ linux/compat/include/linux/kconfig.h \ linux/compat/include/linux/kernel.h \ - linux/compat/include/linux/kobject.h \ linux/compat/include/linux/list.h \ - linux/compat/include/linux/lockdep.h \ linux/compat/include/linux/log2.h \ - linux/compat/include/linux/mutex.h \ linux/compat/include/linux/net.h \ linux/compat/include/linux/netdevice.h \ linux/compat/include/linux/netdev_features.h \ - linux/compat/include/linux/netfilter_bridge.h \ - linux/compat/include/linux/netfilter_ipv4.h \ linux/compat/include/linux/netlink.h \ linux/compat/include/linux/poison.h \ linux/compat/include/linux/rculist.h \ @@ -59,10 +48,8 @@ openvswitch_headers += \ linux/compat/include/linux/rtnetlink.h \ linux/compat/include/linux/sctp.h \ linux/compat/include/linux/skbuff.h \ - linux/compat/include/linux/slab.h \ linux/compat/include/linux/stddef.h \ linux/compat/include/linux/tcp.h \ - linux/compat/include/linux/timer.h \ linux/compat/include/linux/types.h \ linux/compat/include/linux/u64_stats_sync.h \ linux/compat/include/linux/udp.h \ @@ -78,8 +65,5 @@ openvswitch_headers += \ linux/compat/include/net/ipv6.h \ linux/compat/include/net/net_namespace.h \ linux/compat/include/net/netlink.h \ - linux/compat/include/net/protocol.h \ - linux/compat/include/net/route.h \ - linux/compat/include/net/sock.h \ linux/compat/include/net/vxlan.h \ linux/compat/include/net/sctp/checksum.h diff --git a/datapath/linux/compat/addrconf_core-openvswitch.c b/datapath/linux/compat/addrconf_core-openvswitch.c deleted file mode 100644 index 35e36120b..000000000 --- a/datapath/linux/compat/addrconf_core-openvswitch.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) - -/* - * IPv6 library code, needed by static components when full IPv6 support is - * not configured or static. - */ - -#include - -#define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) - -static inline unsigned ipv6_addr_scope2type(unsigned scope) -{ - switch (scope) { - case IPV6_ADDR_SCOPE_NODELOCAL: - return (IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_NODELOCAL) | - IPV6_ADDR_LOOPBACK); - case IPV6_ADDR_SCOPE_LINKLOCAL: - return (IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL) | - IPV6_ADDR_LINKLOCAL); - case IPV6_ADDR_SCOPE_SITELOCAL: - return (IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL) | - IPV6_ADDR_SITELOCAL); - } - return IPV6_ADDR_SCOPE_TYPE(scope); -} - -int __ipv6_addr_type(const struct in6_addr *addr) -{ - __be32 st; - - st = addr->s6_addr32[0]; - - /* Consider all addresses with the first three bits different of - 000 and 111 as unicasts. - */ - if ((st & htonl(0xE0000000)) != htonl(0x00000000) && - (st & htonl(0xE0000000)) != htonl(0xE0000000)) - return (IPV6_ADDR_UNICAST | - IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); - - if ((st & htonl(0xFF000000)) == htonl(0xFF000000)) { - /* multicast */ - /* addr-select 3.1 */ - return (IPV6_ADDR_MULTICAST | - ipv6_addr_scope2type(IPV6_ADDR_MC_SCOPE(addr))); - } - - if ((st & htonl(0xFFC00000)) == htonl(0xFE800000)) - return (IPV6_ADDR_LINKLOCAL | IPV6_ADDR_UNICAST | - IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL)); /* addr-select 3.1 */ - if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000)) - return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST | - IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL)); /* addr-select 3.1 */ - if ((st & htonl(0xFE000000)) == htonl(0xFC000000)) - return (IPV6_ADDR_UNICAST | - IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* RFC 4193 */ - - if ((addr->s6_addr32[0] | addr->s6_addr32[1]) == 0) { - if (addr->s6_addr32[2] == 0) { - if (addr->s6_addr32[3] == 0) - return IPV6_ADDR_ANY; - - if (addr->s6_addr32[3] == htonl(0x00000001)) - return (IPV6_ADDR_LOOPBACK | IPV6_ADDR_UNICAST | - IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_LINKLOCAL)); /* addr-select 3.4 */ - - return (IPV6_ADDR_COMPATv4 | IPV6_ADDR_UNICAST | - IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.3 */ - } - - if (addr->s6_addr32[2] == htonl(0x0000ffff)) - return (IPV6_ADDR_MAPPED | - IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.3 */ - } - - return (IPV6_ADDR_RESERVED | - IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL)); /* addr-select 3.4 */ -} - -#endif /* kernel < 2.6.21 */ diff --git a/datapath/linux/compat/include/linux/dmi.h b/datapath/linux/compat/include/linux/dmi.h deleted file mode 100644 index 20945d3c0..000000000 --- a/datapath/linux/compat/include/linux/dmi.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef __LINUX_DMI_WRAPPER_H -#define __LINUX_DMI_WRAPPER_H 1 - -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) - -#include_next - -#else /* linux version >= 2.6.23 */ - -#ifndef __DMI_H__ -#define __DMI_H__ - -#include - -enum dmi_field { - DMI_NONE, - DMI_BIOS_VENDOR, - DMI_BIOS_VERSION, - DMI_BIOS_DATE, - DMI_SYS_VENDOR, - DMI_PRODUCT_NAME, - DMI_PRODUCT_VERSION, - DMI_PRODUCT_SERIAL, - DMI_PRODUCT_UUID, - DMI_BOARD_VENDOR, - DMI_BOARD_NAME, - DMI_BOARD_VERSION, - DMI_BOARD_SERIAL, - DMI_BOARD_ASSET_TAG, - DMI_CHASSIS_VENDOR, - DMI_CHASSIS_TYPE, - DMI_CHASSIS_VERSION, - DMI_CHASSIS_SERIAL, - DMI_CHASSIS_ASSET_TAG, - DMI_STRING_MAX, -}; - -enum dmi_device_type { - DMI_DEV_TYPE_ANY = 0, - DMI_DEV_TYPE_OTHER, - DMI_DEV_TYPE_UNKNOWN, - DMI_DEV_TYPE_VIDEO, - DMI_DEV_TYPE_SCSI, - DMI_DEV_TYPE_ETHERNET, - DMI_DEV_TYPE_TOKENRING, - DMI_DEV_TYPE_SOUND, - DMI_DEV_TYPE_IPMI = -1, - DMI_DEV_TYPE_OEM_STRING = -2 -}; - -struct dmi_header { - u8 type; - u8 length; - u16 handle; -}; - -/* - * DMI callbacks for problem boards - */ -struct dmi_strmatch { - u8 slot; - char *substr; -}; - -struct dmi_system_id { - int (*callback)(struct dmi_system_id *); - const char *ident; - struct dmi_strmatch matches[4]; - void *driver_data; -}; - -#define DMI_MATCH(a, b) { a, b } - -struct dmi_device { - struct list_head list; - int type; - const char *name; - void *device_data; /* Type specific data */ -}; - -/* No CONFIG_DMI before 2.6.16 */ -#if defined(CONFIG_DMI) || defined(CONFIG_X86_32) - -extern int dmi_check_system(struct dmi_system_id *list); -extern char *dmi_get_system_info(int field); -extern struct dmi_device *dmi_find_device(int type, const char *name, - struct dmi_device *from); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) -extern void dmi_scan_machine(void); -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) -extern int dmi_get_year(int field); -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) -extern int dmi_name_in_vendors(char *str); -#endif - -#else - -static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } -static inline char *dmi_get_system_info(int field) { return NULL; } -static inline struct dmi_device *dmi_find_device(int type, const char *name, - struct dmi_device *from) { return NULL; } -static inline int dmi_get_year(int year) { return 0; } -static inline int dmi_name_in_vendors(char *s) { return 0; } - -#endif - -#endif /* __DMI_H__ */ - -#endif /* linux kernel < 2.6.22 */ - -#endif diff --git a/datapath/linux/compat/include/linux/inetdevice.h b/datapath/linux/compat/include/linux/inetdevice.h deleted file mode 100644 index 813a70ad0..000000000 --- a/datapath/linux/compat/include/linux/inetdevice.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __LINUX_INETDEVICE_WRAPPER_H -#define __LINUX_INETDEVICE_WRAPPER_H 1 - -#include_next - -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - -#define inetdev_by_index(net, ifindex) \ - inetdev_by_index((ifindex)) - -#endif /* linux kernel < 2.6.25 */ - -#endif diff --git a/datapath/linux/compat/include/linux/kobject.h b/datapath/linux/compat/include/linux/kobject.h deleted file mode 100644 index 4cf797e36..000000000 --- a/datapath/linux/compat/include/linux/kobject.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __LINUX_KOBJECT_WRAPPER_H -#define __LINUX_KOBJECT_WRAPPER_H 1 - -#include_next - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) -#define kobject_init(kobj, ktype) rpl_kobject_init(kobj, ktype) -static inline void rpl_kobject_init(struct kobject *kobj, struct kobj_type *ktype) -{ - kobj->ktype = ktype; - (kobject_init)(kobj); -} - -#define kobject_add(kobj, parent, name) rpl_kobject_add(kobj, parent, name) -static inline int rpl_kobject_add(struct kobject *kobj, - struct kobject *parent, - const char *name) -{ - int err = kobject_set_name(kobj, "%s", name); - if (err) - return err; - kobj->parent = parent; - return (kobject_add)(kobj); -} -#endif - - -#endif /* linux/kobject.h wrapper */ diff --git a/datapath/linux/compat/include/linux/lockdep.h b/datapath/linux/compat/include/linux/lockdep.h deleted file mode 100644 index da3dfe8da..000000000 --- a/datapath/linux/compat/include/linux/lockdep.h +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Runtime locking correctness validator - * - * Copyright (C) 2006,2007 Red Hat, Inc., Ingo Molnar - * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra - * - * see Documentation/lockdep-design.txt for more details. - */ -#ifndef __LINUX_LOCKDEP_WRAPPER_H -#define __LINUX_LOCKDEP_WRAPPER_H - -#include_next - -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) - -struct task_struct; -struct lockdep_map; - -#ifdef CONFIG_LOCKDEP - -#include -#include -#include -#include - -/* - * Lock-class usage-state bits: - */ -enum lock_usage_bit { - LOCK_USED = 0, - LOCK_USED_IN_HARDIRQ, - LOCK_USED_IN_SOFTIRQ, - LOCK_ENABLED_SOFTIRQS, - LOCK_ENABLED_HARDIRQS, - LOCK_USED_IN_HARDIRQ_READ, - LOCK_USED_IN_SOFTIRQ_READ, - LOCK_ENABLED_SOFTIRQS_READ, - LOCK_ENABLED_HARDIRQS_READ, - LOCK_USAGE_STATES -}; - -/* - * Usage-state bitmasks: - */ -#define LOCKF_USED (1 << LOCK_USED) -#define LOCKF_USED_IN_HARDIRQ (1 << LOCK_USED_IN_HARDIRQ) -#define LOCKF_USED_IN_SOFTIRQ (1 << LOCK_USED_IN_SOFTIRQ) -#define LOCKF_ENABLED_HARDIRQS (1 << LOCK_ENABLED_HARDIRQS) -#define LOCKF_ENABLED_SOFTIRQS (1 << LOCK_ENABLED_SOFTIRQS) - -#define LOCKF_ENABLED_IRQS (LOCKF_ENABLED_HARDIRQS | LOCKF_ENABLED_SOFTIRQS) -#define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ) - -#define LOCKF_USED_IN_HARDIRQ_READ (1 << LOCK_USED_IN_HARDIRQ_READ) -#define LOCKF_USED_IN_SOFTIRQ_READ (1 << LOCK_USED_IN_SOFTIRQ_READ) -#define LOCKF_ENABLED_HARDIRQS_READ (1 << LOCK_ENABLED_HARDIRQS_READ) -#define LOCKF_ENABLED_SOFTIRQS_READ (1 << LOCK_ENABLED_SOFTIRQS_READ) - -#define LOCKF_ENABLED_IRQS_READ \ - (LOCKF_ENABLED_HARDIRQS_READ | LOCKF_ENABLED_SOFTIRQS_READ) -#define LOCKF_USED_IN_IRQ_READ \ - (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ) - -#define MAX_LOCKDEP_SUBCLASSES 8UL - -/* - * Lock-classes are keyed via unique addresses, by embedding the - * lockclass-key into the kernel (or module) .data section. (For - * static locks we use the lock address itself as the key.) - */ -struct lockdep_subclass_key { - char __one_byte; -} __attribute__ ((__packed__)); - -struct lock_class_key { - struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; -}; - -/* - * The lock-class itself: - */ -struct lock_class { - /* - * class-hash: - */ - struct list_head hash_entry; - - /* - * global list of all lock-classes: - */ - struct list_head lock_entry; - - struct lockdep_subclass_key *key; - unsigned int subclass; - - /* - * IRQ/softirq usage tracking bits: - */ - unsigned long usage_mask; - struct stack_trace usage_traces[LOCK_USAGE_STATES]; - - /* - * These fields represent a directed graph of lock dependencies, - * to every node we attach a list of "forward" and a list of - * "backward" graph nodes. - */ - struct list_head locks_after, locks_before; - - /* - * Generation counter, when doing certain classes of graph walking, - * to ensure that we check one node only once: - */ - unsigned int version; - - /* - * Statistics counter: - */ - unsigned long ops; - - const char *name; - int name_version; - -#ifdef CONFIG_LOCK_STAT - unsigned long contention_point[4]; -#endif -}; - -#ifdef CONFIG_LOCK_STAT -struct lock_time { - s64 min; - s64 max; - s64 total; - unsigned long nr; -}; - -enum bounce_type { - bounce_acquired_write, - bounce_acquired_read, - bounce_contended_write, - bounce_contended_read, - nr_bounce_types, - - bounce_acquired = bounce_acquired_write, - bounce_contended = bounce_contended_write, -}; - -struct lock_class_stats { - unsigned long contention_point[4]; - struct lock_time read_waittime; - struct lock_time write_waittime; - struct lock_time read_holdtime; - struct lock_time write_holdtime; - unsigned long bounces[nr_bounce_types]; -}; - -struct lock_class_stats lock_stats(struct lock_class *class); -void clear_lock_stats(struct lock_class *class); -#endif - -/* - * Map the lock object (the lock instance) to the lock-class object. - * This is embedded into specific lock instances: - */ -struct lockdep_map { - struct lock_class_key *key; - struct lock_class *class_cache; - const char *name; -#ifdef CONFIG_LOCK_STAT - int cpu; -#endif -}; - -/* - * Every lock has a list of other locks that were taken after it. - * We only grow the list, never remove from it: - */ -struct lock_list { - struct list_head entry; - struct lock_class *class; - struct stack_trace trace; - int distance; -}; - -/* - * We record lock dependency chains, so that we can cache them: - */ -struct lock_chain { - struct list_head entry; - u64 chain_key; -}; - -struct held_lock { - /* - * One-way hash of the dependency chain up to this point. We - * hash the hashes step by step as the dependency chain grows. - * - * We use it for dependency-caching and we skip detection - * passes and dependency-updates if there is a cache-hit, so - * it is absolutely critical for 100% coverage of the validator - * to have a unique key value for every unique dependency path - * that can occur in the system, to make a unique hash value - * as likely as possible - hence the 64-bit width. - * - * The task struct holds the current hash value (initialized - * with zero), here we store the previous hash value: - */ - u64 prev_chain_key; - struct lock_class *class; - unsigned long acquire_ip; - struct lockdep_map *instance; - -#ifdef CONFIG_LOCK_STAT - u64 waittime_stamp; - u64 holdtime_stamp; -#endif - /* - * The lock-stack is unified in that the lock chains of interrupt - * contexts nest ontop of process context chains, but we 'separate' - * the hashes by starting with 0 if we cross into an interrupt - * context, and we also keep do not add cross-context lock - * dependencies - the lock usage graph walking covers that area - * anyway, and we'd just unnecessarily increase the number of - * dependencies otherwise. [Note: hardirq and softirq contexts - * are separated from each other too.] - * - * The following field is used to detect when we cross into an - * interrupt context: - */ - int irq_context; - int trylock; - int read; - int check; - int hardirqs_off; -}; - -/* - * Initialization, self-test and debugging-output methods: - */ -extern void lockdep_init(void); -extern void lockdep_info(void); -extern void lockdep_reset(void); -extern void lockdep_reset_lock(struct lockdep_map *lock); -extern void lockdep_free_key_range(void *start, unsigned long size); - -extern void lockdep_off(void); -extern void lockdep_on(void); - -/* - * These methods are used by specific locking variants (spinlocks, - * rwlocks, mutexes and rwsems) to pass init/acquire/release events - * to lockdep: - */ - -extern void lockdep_init_map(struct lockdep_map *lock, const char *name, - struct lock_class_key *key, int subclass); - -/* - * Reinitialize a lock key - for cases where there is special locking or - * special initialization of locks so that the validator gets the scope - * of dependencies wrong: they are either too broad (they need a class-split) - * or they are too narrow (they suffer from a false class-split): - */ -#define lockdep_set_class(lock, key) \ - lockdep_init_map(&(lock)->dep_map, #key, key, 0) -#define lockdep_set_class_and_name(lock, key, name) \ - lockdep_init_map(&(lock)->dep_map, name, key, 0) -#define lockdep_set_class_and_subclass(lock, key, sub) \ - lockdep_init_map(&(lock)->dep_map, #key, key, sub) -#define lockdep_set_subclass(lock, sub) \ - lockdep_init_map(&(lock)->dep_map, #lock, \ - (lock)->dep_map.key, sub) - -/* - * Acquire a lock. - * - * Values for "read": - * - * 0: exclusive (write) acquire - * 1: read-acquire (no recursion allowed) - * 2: read-acquire with same-instance recursion allowed - * - * Values for check: - * - * 0: disabled - * 1: simple checks (freeing, held-at-exit-time, etc.) - * 2: full validation - */ -extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass, - int trylock, int read, int check, unsigned long ip); - -extern void lock_release(struct lockdep_map *lock, int nested, - unsigned long ip); - -# define INIT_LOCKDEP .lockdep_recursion = 0, - -#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) - -#else /* !LOCKDEP */ - -static inline void lockdep_off(void) -{ -} - -static inline void lockdep_on(void) -{ -} - -# define lock_acquire(l, s, t, r, c, i) do { } while (0) -# define lock_release(l, n, i) do { } while (0) -# define lockdep_init() do { } while (0) -# define lockdep_info() do { } while (0) -# define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0) -# define lockdep_set_class(lock, key) do { (void)(key); } while (0) -# define lockdep_set_class_and_name(lock, key, name) \ - do { (void)(key); } while (0) -#define lockdep_set_class_and_subclass(lock, key, sub) \ - do { (void)(key); } while (0) -#define lockdep_set_subclass(lock, sub) do { } while (0) - -# define INIT_LOCKDEP -# define lockdep_reset() do { debug_locks = 1; } while (0) -# define lockdep_free_key_range(start, size) do { } while (0) -/* - * The class key takes no space if lockdep is disabled: - */ -struct lock_class_key { }; - -#define lockdep_depth(tsk) (0) - -#endif /* !LOCKDEP */ - -#ifdef CONFIG_LOCK_STAT - -extern void lock_contended(struct lockdep_map *lock, unsigned long ip); -extern void lock_acquired(struct lockdep_map *lock); - -#define LOCK_CONTENDED(_lock, try, lock) \ -do { \ - if (!try(_lock)) { \ - lock_contended(&(_lock)->dep_map, _RET_IP_); \ - lock(_lock); \ - } \ - lock_acquired(&(_lock)->dep_map); \ -} while (0) - -#else /* CONFIG_LOCK_STAT */ - -#define lock_contended(lockdep_map, ip) do {} while (0) -#define lock_acquired(lockdep_map) do {} while (0) - -#define LOCK_CONTENDED(_lock, try, lock) \ - lock(_lock) - -#endif /* CONFIG_LOCK_STAT */ - -#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS) -extern void early_init_irq_lock_class(void); -#else -static inline void early_init_irq_lock_class(void) -{ -} -#endif - -#ifdef CONFIG_TRACE_IRQFLAGS -extern void early_boot_irqs_off(void); -extern void early_boot_irqs_on(void); -extern void print_irqtrace_events(struct task_struct *curr); -#else -static inline void early_boot_irqs_off(void) -{ -} -static inline void early_boot_irqs_on(void) -{ -} -static inline void print_irqtrace_events(struct task_struct *curr) -{ -} -#endif - -/* - * For trivial one-depth nesting of a lock-class, the following - * global define can be used. (Subsystems with multiple levels - * of nesting should define their own lock-nesting subclasses.) - */ -#define SINGLE_DEPTH_NESTING 1 - -/* - * Map the dependency ops to NOP or to real lockdep ops, depending - * on the per lock-class debug mode: - */ - -#ifdef CONFIG_DEBUG_LOCK_ALLOC -# ifdef CONFIG_PROVE_LOCKING -# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) -# else -# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) -# endif -# define spin_release(l, n, i) lock_release(l, n, i) -#else -# define spin_acquire(l, s, t, i) do { } while (0) -# define spin_release(l, n, i) do { } while (0) -#endif - -#ifdef CONFIG_DEBUG_LOCK_ALLOC -# ifdef CONFIG_PROVE_LOCKING -# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) -# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, i) -# else -# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) -# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, i) -# endif -# define rwlock_release(l, n, i) lock_release(l, n, i) -#else -# define rwlock_acquire(l, s, t, i) do { } while (0) -# define rwlock_acquire_read(l, s, t, i) do { } while (0) -# define rwlock_release(l, n, i) do { } while (0) -#endif - -#ifdef CONFIG_DEBUG_LOCK_ALLOC -# ifdef CONFIG_PROVE_LOCKING -# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) -# else -# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) -# endif -# define mutex_release(l, n, i) lock_release(l, n, i) -#else -# define mutex_acquire(l, s, t, i) do { } while (0) -# define mutex_release(l, n, i) do { } while (0) -#endif - -#ifdef CONFIG_DEBUG_LOCK_ALLOC -# ifdef CONFIG_PROVE_LOCKING -# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) -# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, i) -# else -# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) -# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, i) -# endif -# define rwsem_release(l, n, i) lock_release(l, n, i) -#else -# define rwsem_acquire(l, s, t, i) do { } while (0) -# define rwsem_acquire_read(l, s, t, i) do { } while (0) -# define rwsem_release(l, n, i) do { } while (0) -#endif - -#endif /* linux kernel < 2.6.18 */ - -#endif /* __LINUX_LOCKDEP_WRAPPER_H */ diff --git a/datapath/linux/compat/include/linux/mutex.h b/datapath/linux/compat/include/linux/mutex.h deleted file mode 100644 index 38a3d0d53..000000000 --- a/datapath/linux/compat/include/linux/mutex.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __LINUX_MUTEX_WRAPPER_H -#define __LINUX_MUTEX_WRAPPER_H - - -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) - -#include - -struct mutex { - struct semaphore sema; -}; - -#define mutex_init(mutex) init_MUTEX(&(mutex)->sema) -#define mutex_destroy(mutex) do { } while (0) - -#define __MUTEX_INITIALIZER(name) \ - __SEMAPHORE_INITIALIZER(name, 1) - -#define DEFINE_MUTEX(mutexname) \ - struct mutex mutexname = { __MUTEX_INITIALIZER(mutexname.sema) } - -/* - * See kernel/mutex.c for detailed documentation of these APIs. - * Also see Documentation/mutex-design.txt. - */ -static inline void mutex_lock(struct mutex *lock) -{ - down(&lock->sema); -} - -static inline int mutex_lock_interruptible(struct mutex *lock) -{ - return down_interruptible(&lock->sema); -} - -#define mutex_lock_nested(lock, subclass) mutex_lock(lock) -#define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) - -/* - * NOTE: mutex_trylock() follows the spin_trylock() convention, - * not the down_trylock() convention! - */ -static inline int mutex_trylock(struct mutex *lock) -{ - return !down_trylock(&lock->sema); -} - -static inline void mutex_unlock(struct mutex *lock) -{ - up(&lock->sema); -} -#else - -#include_next - -#endif /* linux version < 2.6.16 */ - -#endif diff --git a/datapath/linux/compat/include/linux/netfilter_bridge.h b/datapath/linux/compat/include/linux/netfilter_bridge.h deleted file mode 100644 index c526537e1..000000000 --- a/datapath/linux/compat/include/linux/netfilter_bridge.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __LINUX_NETFILTER_BRIDGE_WRAPPER_H -#define __LINUX_NETFILTER_BRIDGE_WRAPPER_H - -#include_next - -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - -#include -#include - -static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb) -{ - switch (skb->protocol) { - case __constant_htons(ETH_P_8021Q): - return VLAN_HLEN; - default: - return 0; - } -} - -#endif /* linux version < 2.6.22 */ - -#endif diff --git a/datapath/linux/compat/include/linux/netfilter_ipv4.h b/datapath/linux/compat/include/linux/netfilter_ipv4.h deleted file mode 100644 index ed8a5d948..000000000 --- a/datapath/linux/compat/include/linux/netfilter_ipv4.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __LINUX_NETFILTER_IPV4_WRAPPER_H -#define __LINUX_NETFILTER_IPV4_WRAPPER_H 1 - -#include_next - -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - -#ifdef __KERNEL__ - -#define NF_INET_PRE_ROUTING NF_IP_PRE_ROUTING -#define NF_INET_POST_ROUTING NF_IP_POST_ROUTING -#define NF_INET_FORWARD NF_IP_FORWARD - -#endif /* __KERNEL__ */ - -#endif /* linux kernel < 2.6.25 */ - -#endif diff --git a/datapath/linux/compat/include/linux/slab.h b/datapath/linux/compat/include/linux/slab.h deleted file mode 100644 index 9d6ad1f99..000000000 --- a/datapath/linux/compat/include/linux/slab.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __LINUX_SLAB_WRAPPER_H -#define __LINUX_SLAB_WRAPPER_H 1 - -#include_next - -#ifndef HAVE_KMEMDUP -extern void *kmemdup(const void *src, size_t len, gfp_t gfp); -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) -#define kmem_cache_create(n, s, a, f, c) kmem_cache_create(n, s, a, f, c, NULL) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) -static inline void *rpl_kzalloc(size_t size, gfp_t flags) -{ - return kzalloc(size, flags & ~__GFP_ZERO); -} -#define kzalloc rpl_kzalloc - -static inline void *rpl_kmalloc(size_t size, gfp_t flags) -{ - if (flags & __GFP_ZERO) - return kzalloc(size, flags); - - return kmalloc(size, flags); -} -#define kmalloc rpl_kmalloc -#endif - -#endif diff --git a/datapath/linux/compat/include/linux/timer.h b/datapath/linux/compat/include/linux/timer.h deleted file mode 100644 index b9954a525..000000000 --- a/datapath/linux/compat/include/linux/timer.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __LINUX_TIMER_WRAPPER_H -#define __LINUX_TIMER_WRAPPER_H 1 - -#include_next - -#include - -#ifndef RHEL_RELEASE_VERSION -#define RHEL_RELEASE_VERSION(X, Y) (0) -#endif -#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) && \ - (!defined(RHEL_RELEASE_CODE) || \ - (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5, 1)))) - -extern unsigned long volatile jiffies; - -/** - * __round_jiffies - function to round jiffies to a full second - * @j: the time in (absolute) jiffies that should be rounded - * @cpu: the processor number on which the timeout will happen - * - * __round_jiffies() rounds an absolute time in the future (in jiffies) - * up or down to (approximately) full seconds. This is useful for timers - * for which the exact time they fire does not matter too much, as long as - * they fire approximately every X seconds. - * - * By rounding these timers to whole seconds, all such timers will fire - * at the same time, rather than at various times spread out. The goal - * of this is to have the CPU wake up less, which saves power. - * - * The exact rounding is skewed for each processor to avoid all - * processors firing at the exact same time, which could lead - * to lock contention or spurious cache line bouncing. - * - * The return value is the rounded version of the @j parameter. - */ -static inline unsigned long __round_jiffies(unsigned long j, int cpu) -{ - int rem; - unsigned long original = j; - - /* - * We don't want all cpus firing their timers at once hitting the - * same lock or cachelines, so we skew each extra cpu with an extra - * 3 jiffies. This 3 jiffies came originally from the mm/ code which - * already did this. - * The skew is done by adding 3*cpunr, then round, then subtract this - * extra offset again. - */ - j += cpu * 3; - - rem = j % HZ; - - /* - * If the target jiffie is just after a whole second (which can happen - * due to delays of the timer irq, long irq off times etc etc) then - * we should round down to the whole second, not up. Use 1/4th second - * as cutoff for this rounding as an extreme upper bound for this. - */ - if (rem < HZ/4) /* round down */ - j = j - rem; - else /* round up */ - j = j - rem + HZ; - - /* now that we have rounded, subtract the extra skew again */ - j -= cpu * 3; - - if (j <= jiffies) /* rounding ate our timeout entirely; */ - return original; - return j; -} - - -/** - * round_jiffies - function to round jiffies to a full second - * @j: the time in (absolute) jiffies that should be rounded - * - * round_jiffies() rounds an absolute time in the future (in jiffies) - * up or down to (approximately) full seconds. This is useful for timers - * for which the exact time they fire does not matter too much, as long as - * they fire approximately every X seconds. - * - * By rounding these timers to whole seconds, all such timers will fire - * at the same time, rather than at various times spread out. The goal - * of this is to have the CPU wake up less, which saves power. - * - * The return value is the rounded version of the @j parameter. - */ -static inline unsigned long round_jiffies(unsigned long j) -{ - return __round_jiffies(j, 0); /* FIXME */ -} - -#endif /* linux kernel < 2.6.20 */ - -#endif diff --git a/datapath/linux/compat/include/net/protocol.h b/datapath/linux/compat/include/net/protocol.h deleted file mode 100644 index 6ffe0cb0b..000000000 --- a/datapath/linux/compat/include/net/protocol.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __NET_PROTOCOL_WRAPPER_H -#define __NET_PROTOCOL_WRAPPER_H 1 - -#include_next - -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) -#define inet_add_protocol(prot, num) inet_add_protocol((struct net_protocol *)(prot), num) -#define inet_del_protocol(prot, num) inet_del_protocol((struct net_protocol *)(prot), num) -#endif - -#endif diff --git a/datapath/linux/compat/include/net/route.h b/datapath/linux/compat/include/net/route.h deleted file mode 100644 index 86e8e5bab..000000000 --- a/datapath/linux/compat/include/net/route.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __NET_ROUTE_WRAPPER_H -#define __NET_ROUTE_WRAPPER_H 1 - -#include_next - -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - -#define ip_route_output_key(net, rp, flp) \ - ip_route_output_key((rp), (flp)) - -#endif /* linux kernel < 2.6.25 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) -static inline int ip4_dst_hoplimit(const struct dst_entry *dst) -{ - return dst_metric(dst, RTAX_HOPLIMIT); -} -#endif - -#endif diff --git a/datapath/linux/compat/include/net/sock.h b/datapath/linux/compat/include/net/sock.h deleted file mode 100644 index 513489aeb..000000000 --- a/datapath/linux/compat/include/net/sock.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __NET_SOCK_WRAPPER_H -#define __NET_SOCK_WRAPPER_H 1 - -#include_next -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -struct net; - -static inline struct net *sock_net(const struct sock *sk) -{ - return NULL; -} - -#endif - -#endif /* net/sock.h wrapper */ diff --git a/datapath/linux/compat/ip_output-openvswitch.c b/datapath/linux/compat/ip_output-openvswitch.c deleted file mode 100644 index a09fcbce4..000000000 --- a/datapath/linux/compat/ip_output-openvswitch.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - -#include -#include - -int __ip_local_out(struct sk_buff *skb) -{ - struct iphdr *iph = ip_hdr(skb); - - iph->tot_len = htons(skb->len); - ip_send_check(iph); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - return nf_hook(PF_INET, NF_IP_LOCAL_OUT, &skb, NULL, skb->dst->dev, - dst_output); -#else - return nf_hook(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, skb->dst->dev, - dst_output); -#endif /* kernel < 2.6.24 */ -} - -int ip_local_out(struct sk_buff *skb) -{ - int err; - - err = __ip_local_out(skb); - if (likely(err == 1)) - err = dst_output(skb); - - return err; -} - -#endif /* kernel < 2.6.25 */ diff --git a/datapath/linux/compat/kmemdup.c b/datapath/linux/compat/kmemdup.c deleted file mode 100644 index b5188fdb8..000000000 --- a/datapath/linux/compat/kmemdup.c +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef HAVE_KMEMDUP - -#include -#include - -/** - * kmemdup - duplicate region of memory - * - * @src: memory region to duplicate - * @len: memory region length - * @gfp: GFP mask to use - */ -void *kmemdup(const void *src, size_t len, gfp_t gfp) -{ - void *p; - - p = kmalloc(len, gfp); - if (p) - memcpy(p, src, len); - return p; -} -#endif diff --git a/datapath/linux/compat/time.c b/datapath/linux/compat/time.c deleted file mode 100644 index 490e1a4f7..000000000 --- a/datapath/linux/compat/time.c +++ /dev/null @@ -1,39 +0,0 @@ -#include - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) - -/* "set_normalized_timespec" is defined but not exported in kernels - * before 2.6.26. */ - -/** - * set_normalized_timespec - set timespec sec and nsec parts and normalize - * - * @ts: pointer to timespec variable to be set - * @sec: seconds to set - * @nsec: nanoseconds to set - * - * Set seconds and nanoseconds field of a timespec variable and - * normalize to the timespec storage format - * - * Note: The tv_nsec part is always in the range of - * 0 <= tv_nsec < NSEC_PER_SEC - * For negative values only the tv_sec field is negative ! - */ -void set_normalized_timespec(struct timespec *ts, - time_t sec, long nsec) -{ - while (nsec >= NSEC_PER_SEC) { - nsec -= NSEC_PER_SEC; - ++sec; - } - while (nsec < 0) { - nsec += NSEC_PER_SEC; - --sec; - } - ts->tv_sec = sec; - ts->tv_nsec = nsec; -} - -#endif /* linux kernel < 2.6.26 */