compat: Add support for 3.12
authorVladimir Sokolovsky <vlad@mellanox.com>
Tue, 3 Sep 2013 15:27:12 +0000 (18:27 +0300)
committerVladimir Sokolovsky <vlad@mellanox.com>
Mon, 30 Sep 2013 10:31:05 +0000 (13:31 +0300)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
include/linux/compat-2.6.h
include/linux/compat-3.10.h [new file with mode: 0644]
include/linux/compat-3.11.h [new file with mode: 0644]
include/linux/compat-3.12.h [new file with mode: 0644]
include/linux/compat-3.6.h [new file with mode: 0644]
include/linux/compat-3.7.h [new file with mode: 0644]
include/net/busy_poll.h [new file with mode: 0644]

index 0ea0190..6d6624b 100644 (file)
@@ -64,5 +64,10 @@ void compat_dependency_symbol(void);
 #include <linux/compat-3.3.h>
 #include <linux/compat-3.4.h>
 #include <linux/compat-3.5.h>
 #include <linux/compat-3.3.h>
 #include <linux/compat-3.4.h>
 #include <linux/compat-3.5.h>
+#include <linux/compat-3.6.h>
+#include <linux/compat-3.7.h>
+#include <linux/compat-3.10.h>
+#include <linux/compat-3.11.h>
+#include <linux/compat-3.12.h>
 
 #endif /* LINUX_26_COMPAT_H */
 
 #endif /* LINUX_26_COMPAT_H */
diff --git a/include/linux/compat-3.10.h b/include/linux/compat-3.10.h
new file mode 100644 (file)
index 0000000..719ab71
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef LINUX_3_10_COMPAT_H
+#define LINUX_3_10_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
+
+#include <linux/if_vlan.h>
+#define __vlan_hwaccel_put_tag(a, b, c) __vlan_hwaccel_put_tag(a, c)
+
+#include <linux/netdev_features.h>
+#define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
+
+#endif /* LINUX_3_10_COMPAT_H */
diff --git a/include/linux/compat-3.11.h b/include/linux/compat-3.11.h
new file mode 100644 (file)
index 0000000..cb15185
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef LINUX_3_11_COMPAT_H
+#define LINUX_3_11_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0))
+
+#ifndef AF_IB
+#define AF_IB          27      /* Native InfiniBand address    */
+#define PF_IB          AF_IB
+#endif /* AF_IB */
+
+#define netdev_notifier_info_to_dev LINUX_BACKPORT(netdev_notifier_info_to_dev)
+static inline struct net_device *
+netdev_notifier_info_to_dev(void *ptr)
+{
+       return (struct net_device *)ptr;
+}
+
+enum {
+       IFLA_VF_LINK_STATE_AUTO,        /* link state of the uplink */
+       IFLA_VF_LINK_STATE_ENABLE,      /* link always up */
+       IFLA_VF_LINK_STATE_DISABLE,     /* link always down */
+       __IFLA_VF_LINK_STATE_MAX,
+};
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) */
+
+#endif /* LINUX_3_11_COMPAT_H */
diff --git a/include/linux/compat-3.12.h b/include/linux/compat-3.12.h
new file mode 100644 (file)
index 0000000..4890819
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef LINUX_3_12_COMPAT_H
+#define LINUX_3_12_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
+
+#define PTR_ERR_OR_ZERO LINUX_BACKPORT(PTR_ERR_OR_ZERO)
+static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
+{
+       if (IS_ERR(ptr))
+               return PTR_ERR(ptr);
+       else
+               return 0;
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0) */
+
+#endif /* LINUX_3_12_COMPAT_H */
diff --git a/include/linux/compat-3.6.h b/include/linux/compat-3.6.h
new file mode 100644 (file)
index 0000000..3d18be4
--- /dev/null
@@ -0,0 +1,105 @@
+#ifndef LINUX_3_6_COMPAT_H
+#define LINUX_3_6_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
+
+#include <linux/scatterlist.h>
+
+#define memweight LINUX_BACKPORT(memweight)
+extern size_t memweight(const void *ptr, size_t bytes);
+
+/* backports efc42bc9 */
+#define sg_alloc_table_from_pages LINUX_BACKPORT(sg_alloc_table_from_pages)
+int sg_alloc_table_from_pages(struct sg_table *sgt,
+                             struct page **pages, unsigned int n_pages,
+                             unsigned long offset, unsigned long size,
+                             gfp_t gfp_mask);
+
+/**
+ * Backports
+ *
+ * commit d81a5d1956731c453b85c141458d4ff5d6cc5366
+ * Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
+ * Date:   Tue Jul 10 19:10:06 2012 -0300
+ *
+ *     USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
+ */
+#include <linux/usb.h>
+#define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \
+       .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
+               | USB_DEVICE_ID_MATCH_VENDOR, \
+       .idVendor = (vend), \
+       .bInterfaceClass = (cl), \
+       .bInterfaceSubClass = (sc), \
+       .bInterfaceProtocol = (pr)
+
+/**
+ * Backports
+ *
+ * commit cdcac9cd7741af2c2b9255cbf060f772596907bb
+ * Author: Dave Airlie <airlied@redhat.com>
+ * Date:   Wed Jun 27 08:35:52 2012 +0100
+ *
+ *     pci_regs: define LNKSTA2 pcie cap + bits.
+ *
+ *     We need these for detecting the max link speed for drm drivers.
+ *
+ *     Acked-by: Bjorn Helgaas <bhelgass@google.com>
+ *     Signed-off-by: Dave Airlie <airlied@redhat.com>
+ */
+
+#define  PCI_EXP_LNKCAP2               44      /* Link Capability 2 */
+#define  PCI_EXP_LNKCAP2_SLS_2_5GB     0x01    /* Current Link Speed 2.5GT/s */
+#define  PCI_EXP_LNKCAP2_SLS_5_0GB     0x02    /* Current Link Speed 5.0GT/s */
+#define  PCI_EXP_LNKCAP2_SLS_8_0GB     0x04    /* Current Link Speed 8.0GT/s */
+#define  PCI_EXP_LNKCAP2_CROSSLINK     0x100 /* Crosslink supported */
+
+#include <net/genetlink.h>
+#include <linux/etherdevice.h>
+
+/**
+ * eth_broadcast_addr - Assign broadcast address
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Assign the broadcast address to the given address array.
+ */
+static inline void eth_broadcast_addr(u8 *addr)
+{
+       memset(addr, 0xff, ETH_ALEN);
+}
+
+#define GENLMSG_DEFAULT_SIZE (NLMSG_DEFAULT_SIZE - GENL_HDRLEN)
+
+/*
+ * Backports 
+ * 
+ * commit 959d62fa865d2e616b61a509e1cc5b88741f065e
+ * Author: Shuah Khan <shuahkhan@gmail.com>
+ * Date:   Thu Jun 14 04:34:30 2012 +0800
+ *
+ *   leds: Rename led_brightness_set() to led_set_brightness()
+ *   
+ *   Rename leds external interface led_brightness_set() to led_set_brightness().
+ *   This is the second phase of the change to reduce confusion between the
+ *   leds internal and external interfaces that set brightness. With this change,
+ *   now the external interface is led_set_brightness(). The first phase renamed
+ *   the internal interface led_set_brightness() to __led_set_brightness().
+ *   There are no changes to the interface implementations.
+ *   
+ *   Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
+ *   Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
+ */
+#define led_set_brightness(_dev, _switch) led_brightness_set(_dev, _switch)
+
+#define netif_get_num_default_rss_queues LINUX_BACKPORT(netif_get_num_default_rss_queues)
+extern int netif_get_num_default_rss_queues(void);
+
+#ifndef DEFAULT_MAX_NUM_RSS_QUEUES
+#define DEFAULT_MAX_NUM_RSS_QUEUES      (8)
+#endif
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) */
+
+#endif /* LINUX_3_6_COMPAT_H */
diff --git a/include/linux/compat-3.7.h b/include/linux/compat-3.7.h
new file mode 100644 (file)
index 0000000..8772d5d
--- /dev/null
@@ -0,0 +1,135 @@
+#ifndef LINUX_3_7_COMPAT_H
+#define LINUX_3_7_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
+
+#include <linux/workqueue.h>
+#include <linux/timer.h>
+#include <linux/pci.h>
+#include <linux/pci_regs.h>
+#include <linux/mm.h>
+#include <linux/user_namespace.h>
+#include <linux/file.h>
+#include <linux/fdtable.h>
+#include <linux/seq_file.h>
+
+#define VM_DONTDUMP    VM_NODUMP
+
+#ifdef CONFIG_USER_NS
+
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
+static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
+{
+       struct file *f = container_of((void *) seq, struct file, private_data);
+
+       return f->f_cred->user_ns;
+}
+#else
+static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
+{
+       return current_user_ns();
+}
+#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) */
+
+#else
+static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
+{
+       extern struct user_namespace init_user_ns;
+       return &init_user_ns;
+}
+#endif /* CONFIG_USER_NS */
+
+#define netlink_notify_portid(__notify) (__notify->pid)
+#define genl_info_snd_portid(__genl_info) (__genl_info->snd_pid)
+#define NETLINK_CB_PORTID(__skb) NETLINK_CB(cb->skb).pid
+
+#define mod_delayed_work LINUX_BACKPORT(mod_delayed_work)
+bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork,
+                     unsigned long delay);
+
+/* Backports tty_lock: Localise the lock */
+#define tty_lock(__tty) tty_lock()
+#define tty_unlock(__tty) tty_unlock()
+
+#define tty_port_register_device(port, driver, index, device) \
+       tty_register_device(driver, index, device)
+
+#define pcie_capability_read_word LINUX_BACKPORT(pcie_capability_read_word)
+int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val);
+#define pcie_capability_read_dword LINUX_BACKPORT(pcie_capability_read_dword)
+int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val);
+#define pcie_capability_write_word LINUX_BACKPORT(pcie_capability_write_word)
+int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val);
+#define pcie_capability_write_dword LINUX_BACKPORT(pcie_capability_write_dword)
+int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val);
+#define pcie_capability_clear_and_set_word LINUX_BACKPORT(pcie_capability_clear_and_set_word)
+int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos,
+                                      u16 clear, u16 set);
+#define pcie_capability_clear_and_set_dword LINUX_BACKPORT(pcie_capability_clear_and_set_dword)
+int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos,
+                                       u32 clear, u32 set);
+#define pcie_capability_set_word LINUX_BACKPORT(pcie_capability_set_word)
+static inline int pcie_capability_set_word(struct pci_dev *dev, int pos,
+                                          u16 set)
+{
+       return pcie_capability_clear_and_set_word(dev, pos, 0, set);
+}
+
+#define pcie_capability_set_dword LINUX_BACKPORT(pcie_capability_set_dword)
+static inline int pcie_capability_set_dword(struct pci_dev *dev, int pos,
+                                           u32 set)
+{
+       return pcie_capability_clear_and_set_dword(dev, pos, 0, set);
+}
+
+#define pcie_capability_clear_word LINUX_BACKPORT(pcie_capability_clear_word)
+static inline int pcie_capability_clear_word(struct pci_dev *dev, int pos,
+                                            u16 clear)
+{
+       return pcie_capability_clear_and_set_word(dev, pos, clear, 0);
+}
+
+#define pcie_capability_clear_dword LINUX_BACKPORT(pcie_capability_clear_dword)
+static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos,
+                                             u32 clear)
+{
+       return pcie_capability_clear_and_set_dword(dev, pos, clear, 0);
+}
+
+#define PCI_EXP_LNKSTA2                        50      /* Link Status 2 */
+
+#define MAX_IDR_SHIFT (sizeof(int)*8 - 1)
+#define MAX_IDR_BIT (1U << MAX_IDR_SHIFT)
+#define MAX_IDR_MASK (MAX_IDR_BIT - 1)
+
+/* IPoIB section */
+
+enum {
+       IFLA_IPOIB_UNSPEC,
+       IFLA_IPOIB_PKEY,
+       IFLA_IPOIB_MODE,
+       IFLA_IPOIB_UMCAST,
+       __IFLA_IPOIB_MAX
+};
+
+enum {
+       IPOIB_MODE_DATAGRAM  = 0, /* using unreliable datagram QPs */
+       IPOIB_MODE_CONNECTED = 1, /* using connected QPs */
+};
+
+#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
+
+#define FMODE_PATH             ((__force fmode_t)0x4000)
+
+#define fget_light LINUX_BACKPORT(fget_light)
+extern struct file *fget_light(unsigned int fd, int *fput_needed);
+
+#else /* (LINUX_VERSION_CODE > KERNEL_VERSION(3,7,0)) */
+#define netlink_notify_portid(__notify) (__notify->portid)
+#define genl_info_snd_portid(__genl_info) (__genl_info->snd_portid)
+#define NETLINK_CB_PORTID(__skb) NETLINK_CB(cb->skb).portid
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) */
+
+#endif /* LINUX_3_7_COMPAT_H */
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
new file mode 100644 (file)
index 0000000..3df402d
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef _COMPAT_LINUX_NET_BUSY_POLL_H
+#define _COMPAT_LINUX_NET_BUSY_POLL_H 1
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
+#include_next <net/busy_poll.h>
+#endif
+
+#endif /* _COMPAT_LINUX_NET_BUSY_POLL_H */