From: Pravin B Shelar Date: Tue, 27 Aug 2013 06:43:29 +0000 (-0700) Subject: datapath: Cleanup compat support. X-Git-Tag: sliver-openvswitch-2.0.90-1~16^2~4 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=053fe543d90cde3c01ee7f34ecab73100e9ed8ba;p=sliver-openvswitch.git datapath: Cleanup compat support. cleanup various header file. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- diff --git a/datapath/linux/compat/include/linux/if_ether.h b/datapath/linux/compat/include/linux/if_ether.h index e22ea9605..25f63cab6 100644 --- a/datapath/linux/compat/include/linux/if_ether.h +++ b/datapath/linux/compat/include/linux/if_ether.h @@ -3,19 +3,6 @@ #include_next -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) - -#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */ - -#endif /* linux kernel < 2.6.28 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) - -#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ - -#endif /* linux kernel < 2.6.30 */ - #ifndef ETH_P_802_3_MIN #define ETH_P_802_3_MIN 0x0600 #endif diff --git a/datapath/linux/compat/include/linux/kernel.h b/datapath/linux/compat/include/linux/kernel.h index 6e248c572..5dfe08e91 100644 --- a/datapath/linux/compat/include/linux/kernel.h +++ b/datapath/linux/compat/include/linux/kernel.h @@ -8,33 +8,6 @@ #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) -#undef pr_emerg -#define pr_emerg(fmt, ...) \ - printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) -#undef pr_alert -#define pr_alert(fmt, ...) \ - printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) -#undef pr_crit -#define pr_crit(fmt, ...) \ - printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) -#undef pr_err -#define pr_err(fmt, ...) \ - printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) -#undef pr_warning -#define pr_warning(fmt, ...) \ - printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) -#undef pr_notice -#define pr_notice(fmt, ...) \ - printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) -#undef pr_info -#define pr_info(fmt, ...) \ - printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) -#undef pr_cont -#define pr_cont(fmt, ...) \ - printk(KERN_CONT fmt, ##__VA_ARGS__) -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) #define pr_warn pr_warning #endif @@ -73,10 +46,6 @@ #endif -#if defined(CONFIG_PREEMPT) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) -#error "CONFIG_PREEMPT is broken before 2.6.21--see commit 4498121ca3, \"[NET]: Handle disabled preemption in gfp_any()\"" -#endif - #ifndef USHRT_MAX #define USHRT_MAX ((u16)(~0U)) #define SHRT_MAX ((s16)(USHRT_MAX>>1)) diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h index bd7a4b059..4e2b7f55a 100644 --- a/datapath/linux/compat/include/linux/netdevice.h +++ b/datapath/linux/compat/include/linux/netdevice.h @@ -6,15 +6,6 @@ struct net; #include -/* Before 2.6.21, struct net_device has a "struct class_device" member named - * class_dev. Beginning with 2.6.21, struct net_device instead has a "struct - * device" member named dev. Otherwise the usage of these members is pretty - * much the same. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) -#define NETDEV_DEV_MEMBER class_dev -#else -#define NETDEV_DEV_MEMBER dev -#endif #ifndef to_net_dev #define to_net_dev(class) container_of(class, struct net_device, NETDEV_DEV_MEMBER) @@ -25,53 +16,6 @@ extern struct sk_buff *(*openvswitch_handle_frame_hook)(struct sk_buff *skb); extern int nr_bridges; #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) -static inline -struct net *dev_net(const struct net_device *dev) -{ -#ifdef CONFIG_NET_NS - return dev->nd_net; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) - return &init_net; -#else - return NULL; -#endif -} - -static inline -void dev_net_set(struct net_device *dev, const struct net *net) -{ -#ifdef CONFIG_NET_NS - dev->nd_dev = net; -#endif -} -#endif /* linux kernel < 2.6.26 */ - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -#define NETIF_F_NETNS_LOCAL 0 -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -#define proc_net init_net.proc_net -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) -typedef int netdev_tx_t; -#endif - -#ifndef for_each_netdev -/* Linux before 2.6.22 didn't have for_each_netdev at all. */ -#define for_each_netdev(net, d) for (d = dev_base; d; d = d->next) -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -/* Linux 2.6.24 added a network namespace pointer to the macro. */ -#undef for_each_netdev -#define for_each_netdev(net, d) list_for_each_entry(d, &dev_base_head, dev_list) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -#define net_xmit_eval(e) ((e) == NET_XMIT_CN ? 0 : (e)) -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) extern void unregister_netdevice_queue(struct net_device *dev, struct list_head *head); @@ -112,20 +56,6 @@ static inline void netdev_rx_handler_unregister(struct net_device *dev) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -#undef SET_ETHTOOL_OPS -#define SET_ETHTOOL_OPS(netdev, ops) \ - ((netdev)->ethtool_ops = (struct ethtool_ops *)(ops)) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -#define dev_get_by_name(net, name) dev_get_by_name(name) -#define dev_get_by_index(net, ifindex) dev_get_by_index(ifindex) -#define __dev_get_by_name(net, name) __dev_get_by_name(name) -#define __dev_get_by_index(net, ifindex) __dev_get_by_index(ifindex) -#define dev_get_by_index_rcu(net, ifindex) dev_get_by_index_rcu(ifindex) -#endif - #ifndef HAVE_DEV_GET_BY_INDEX_RCU static inline struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex) { @@ -143,17 +73,6 @@ static inline struct net_device *dev_get_by_index_rcu(struct net *net, int ifind #define NETIF_F_FSO 0 #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) -#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) -#define NETIF_F_IPV6_CSUM 16 /* Can checksum TCP/UDP over IPV6 */ - -#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM) -#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) #define skb_gso_segment rpl_skb_gso_segment struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb, u32 features); diff --git a/datapath/linux/compat/include/linux/rculist.h b/datapath/linux/compat/include/linux/rculist.h index 365d1263e..8df8ad8a2 100644 --- a/datapath/linux/compat/include/linux/rculist.h +++ b/datapath/linux/compat/include/linux/rculist.h @@ -1,25 +1,7 @@ #ifndef __LINUX_RCULIST_WRAPPER_H #define __LINUX_RCULIST_WRAPPER_H -#include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) #include_next -#else -/* Prior to 2.6.26, the contents of rculist.h were part of list.h. */ -#include -#include -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) -#define hlist_del_init_rcu rpl_hlist_del_init_rcu -static inline void hlist_del_init_rcu(struct hlist_node *n) -{ - if (!hlist_unhashed(n)) { - __hlist_del(n); - n->pprev = NULL; - } -} -#endif #ifndef hlist_first_rcu #define hlist_first_rcu(head) (*((struct hlist_node __rcu **)(&(head)->first))) diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h index 461e07cfb..a48609641 100644 --- a/datapath/linux/compat/include/linux/skbuff.h +++ b/datapath/linux/compat/include/linux/skbuff.h @@ -5,17 +5,6 @@ #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -/* In version 2.6.24 the return type of skb_headroom() changed from 'int' to - * 'unsigned int'. We use skb_headroom() as one arm of a min(a,b) invocation - * in make_writable() in actions.c, so we need the correct type. */ -#define skb_headroom rpl_skb_headroom -static inline unsigned int rpl_skb_headroom(const struct sk_buff *skb) -{ - return skb->data - skb->head; -} -#endif - #ifndef HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, const int offset, void *to, @@ -82,13 +71,6 @@ static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom) } #endif /* !HAVE_SKB_COW_HEAD */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) -static inline int skb_clone_writable(struct sk_buff *skb, int len) -{ - return false; -} -#endif - #ifndef HAVE_SKB_DST_ACCESSOR_FUNCS static inline struct dst_entry *skb_dst(const struct sk_buff *skb) { @@ -106,18 +88,6 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) -/* Emulate Linux 2.6.17 and later behavior, in which kfree_skb silently ignores - * null pointer arguments. */ -#define kfree_skb(skb) kfree_skb_maybe_null(skb) -static inline void kfree_skb_maybe_null(struct sk_buff *skb) -{ - if (likely(skb != NULL)) - (kfree_skb)(skb); -} -#endif - - #ifndef CHECKSUM_PARTIAL #define CHECKSUM_PARTIAL CHECKSUM_HW #endif @@ -196,21 +166,6 @@ static inline void skb_copy_to_linear_data(struct sk_buff *skb, } #endif /* !HAVE_SKBUFF_HEADER_HELPERS */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) -#warning "TSO/UFO not supported on kernels earlier than 2.6.18" - -static inline int skb_is_gso(const struct sk_buff *skb) -{ - return 0; -} - -static inline struct sk_buff *skb_gso_segment(struct sk_buff *skb, - int features) -{ - return NULL; -} -#endif /* before 2.6.18 */ - #ifndef HAVE_SKB_WARN_LRO #ifndef NETIF_F_LRO static inline bool skb_warn_if_lro(const struct sk_buff *skb)