From: Vladimir Sokolovsky Date: Sun, 10 Jun 2012 07:30:03 +0000 (+0300) Subject: Merge branch 'master' into ofed X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=cf43b593af2c078116efbed1a0cabc3e85e51fbf;p=~aditr%2Fcompat.git Merge branch 'master' into ofed Conflicts: compat/Makefile compat/compat-3.2.c include/linux/compat-2.6.35.h include/linux/compat-3.1.h --- cf43b593af2c078116efbed1a0cabc3e85e51fbf diff --cc compat/compat-3.2.c index ee3d192,55ae6af..79a0e91 --- a/compat/compat-3.2.c +++ b/compat/compat-3.2.c @@@ -35,79 -31,4 +35,79 @@@ int __netdev_printk(const char *level, return r; } - EXPORT_SYMBOL(__netdev_printk); + EXPORT_SYMBOL_GPL(__netdev_printk); + +int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + ASSERT_RTNL(); + + if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings) + return -EOPNOTSUPP; + + memset(cmd, 0, sizeof(struct ethtool_cmd)); + cmd->cmd = ETHTOOL_GSET; + return dev->ethtool_ops->get_settings(dev, cmd); +} +EXPORT_SYMBOL(__ethtool_get_settings); + +#ifndef CONFIG_COMPAT_SLES_11_2 +/** + * llist_add_batch - add several linked entries in batch + * @new_first: first entry in batch to be added + * @new_last: last entry in batch to be added + * @head: the head for your lock-less list + * + * Return whether list is empty before adding. + */ +bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, + struct llist_head *head) +{ + struct llist_node *entry, *old_entry; + + entry = head->first; + for (;;) { + old_entry = entry; + new_last->next = entry; + entry = cmpxchg(&head->first, old_entry, new_first); + if (entry == old_entry) + break; + } + + return old_entry == NULL; +} +EXPORT_SYMBOL_GPL(llist_add_batch); + +/** + * llist_del_first - delete the first entry of lock-less list + * @head: the head for your lock-less list + * + * If list is empty, return NULL, otherwise, return the first entry + * deleted, this is the newest added one. + * + * Only one llist_del_first user can be used simultaneously with + * multiple llist_add users without lock. Because otherwise + * llist_del_first, llist_add, llist_add (or llist_del_all, llist_add, + * llist_add) sequence in another user may change @head->first->next, + * but keep @head->first. If multiple consumers are needed, please + * use llist_del_all or use lock between consumers. + */ +struct llist_node *llist_del_first(struct llist_head *head) +{ + struct llist_node *entry, *old_entry, *next; + + entry = head->first; + for (;;) { + if (entry == NULL) + return NULL; + old_entry = entry; + next = entry->next; + entry = cmpxchg(&head->first, old_entry, next); + if (entry == old_entry) + break; + } + + return entry; +} +EXPORT_SYMBOL_GPL(llist_del_first); + +#endif /* CONFIG_COMPAT_SLES_11_2 */ diff --cc include/linux/compat-2.6.33.h index 6ffc1cb,0c71af9..441a331 --- a/include/linux/compat-2.6.33.h +++ b/include/linux/compat-2.6.33.h @@@ -14,9 -14,8 +14,9 @@@ #endif #include #include +#include - #if defined(CONFIG_COMPAT_FIRMWARE_CLASS) + #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) #define release_firmware compat_release_firmware #define request_firmware compat_request_firmware #define request_firmware_nowait compat_request_firmware_nowait diff --cc include/linux/compat-2.6.35.h index 0640973,5814123..5798b41 --- a/include/linux/compat-2.6.35.h +++ b/include/linux/compat-2.6.35.h @@@ -17,6 -17,19 +17,17 @@@ #define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */ #define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */ -#define netdev_hw_addr dev_mc_list - + /* + * We cannot backport this guy as the IRQ data structure + * was modified in the kernel itself to support this. We + * treat the system as uni-processor in this case. + */ + static inline int irq_set_affinity_hint(unsigned int irq, + const struct cpumask *m) + { + return -EINVAL; + } + static inline wait_queue_head_t *sk_sleep(struct sock *sk) { return sk->sk_sleep; diff --cc include/linux/compat-3.1.h index 164ab6f,da8e971..cfe166a --- a/include/linux/compat-3.1.h +++ b/include/linux/compat-3.1.h @@@ -6,31 -6,49 +6,71 @@@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) #include + #include + #include + #include +#include + +static inline struct neighbour *dst_get_neighbour(struct dst_entry *dst) +{ + return dst->neighbour; +} + +static inline void dst_set_neighbour(struct dst_entry *dst, struct neighbour *neigh) +{ + dst->neighbour = neigh; +} + +static inline struct neighbour *dst_get_neighbour_raw(struct dst_entry *dst) +{ + return rcu_dereference_raw(dst->neighbour); +} + /* Backports 56f8a75c */ + static inline bool ip_is_fragment(const struct iphdr *iph) + { + return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; + } + + static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, + unsigned int length, gfp_t gfp) + { + struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); + + if (NET_IP_ALIGN && skb) + skb_reserve(skb, NET_IP_ALIGN); + return skb; + } + +#ifndef NEED_MIN_DUMP_ALLOC_ARG +#include +/* remove last arg */ +#define netlink_dump_start(a, b, c, d, e, f) netlink_dump_start(a, b, c, d, e) +#endif + + /* + * Getting something that works in C and CPP for an arg that may or may + * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1" + * we match on the placeholder define, insert the "0," for arg1 and generate + * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one). + * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when + * the last step cherry picks the 2nd arg, we get a zero. + */ + #define __ARG_PLACEHOLDER_1 0, + #define config_enabled(cfg) _config_enabled(cfg) + #define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) + #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) + #define ___config_enabled(__ignored, val, ...) val #define genl_dump_check_consistent(cb, user_hdr, family) + /* + * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', + * 0 otherwise. + * + */ + #define IS_ENABLED(option) \ + (config_enabled(option) || config_enabled(option##_MODULE)) + #define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing * skbs on transmit */