Add AC rules and macros for Chelsio backports
[~tnikolova/compat/.git] / include / linux / compat-3.6.h
1 #ifndef LINUX_3_6_COMPAT_H
2 #define LINUX_3_6_COMPAT_H
3
4 #include <linux/version.h>
5
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0))
7
8 #include <linux/scatterlist.h>
9
10 #define memweight LINUX_BACKPORT(memweight)
11 extern size_t memweight(const void *ptr, size_t bytes);
12
13 /* backports efc42bc9 */
14 #define sg_alloc_table_from_pages LINUX_BACKPORT(sg_alloc_table_from_pages)
15 int sg_alloc_table_from_pages(struct sg_table *sgt,
16                               struct page **pages, unsigned int n_pages,
17                               unsigned long offset, unsigned long size,
18                               gfp_t gfp_mask);
19
20 /**
21  * Backports
22  *
23  * commit d81a5d1956731c453b85c141458d4ff5d6cc5366
24  * Author: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
25  * Date:   Tue Jul 10 19:10:06 2012 -0300
26  *
27  *      USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
28  */
29 #include <linux/usb.h>
30 #define USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \
31        .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
32                | USB_DEVICE_ID_MATCH_VENDOR, \
33        .idVendor = (vend), \
34        .bInterfaceClass = (cl), \
35        .bInterfaceSubClass = (sc), \
36        .bInterfaceProtocol = (pr)
37
38 /**
39  * Backports
40  *
41  * commit cdcac9cd7741af2c2b9255cbf060f772596907bb
42  * Author: Dave Airlie <airlied@redhat.com>
43  * Date:   Wed Jun 27 08:35:52 2012 +0100
44  *
45  *      pci_regs: define LNKSTA2 pcie cap + bits.
46  *
47  *      We need these for detecting the max link speed for drm drivers.
48  *
49  *      Acked-by: Bjorn Helgaas <bhelgass@google.com>
50  *      Signed-off-by: Dave Airlie <airlied@redhat.com>
51  */
52
53 #ifndef  PCI_EXP_LNKCAP2
54 #define  PCI_EXP_LNKCAP2                44      /* Link Capability 2 */
55 #define  PCI_EXP_LNKCAP2_SLS_2_5GB      0x01    /* Current Link Speed 2.5GT/s */
56 #define  PCI_EXP_LNKCAP2_SLS_5_0GB      0x02    /* Current Link Speed 5.0GT/s */
57 #define  PCI_EXP_LNKCAP2_SLS_8_0GB      0x04    /* Current Link Speed 8.0GT/s */
58 #define  PCI_EXP_LNKCAP2_CROSSLINK      0x100 /* Crosslink supported */
59 #endif
60
61 #include <net/genetlink.h>
62 #include <linux/etherdevice.h>
63
64 /**
65  * eth_broadcast_addr - Assign broadcast address
66  * @addr: Pointer to a six-byte array containing the Ethernet address
67  *
68  * Assign the broadcast address to the given address array.
69  */
70 #define eth_broadcast_addr LINUX_BACKPORT(eth_broadcast_addr)
71 static inline void eth_broadcast_addr(u8 *addr)
72 {
73         memset(addr, 0xff, ETH_ALEN);
74 }
75
76 #define GENLMSG_DEFAULT_SIZE (NLMSG_DEFAULT_SIZE - GENL_HDRLEN)
77
78 /*
79  * Backports 
80  * 
81  * commit 959d62fa865d2e616b61a509e1cc5b88741f065e
82  * Author: Shuah Khan <shuahkhan@gmail.com>
83  * Date:   Thu Jun 14 04:34:30 2012 +0800
84  *
85  *   leds: Rename led_brightness_set() to led_set_brightness()
86  *   
87  *   Rename leds external interface led_brightness_set() to led_set_brightness().
88  *   This is the second phase of the change to reduce confusion between the
89  *   leds internal and external interfaces that set brightness. With this change,
90  *   now the external interface is led_set_brightness(). The first phase renamed
91  *   the internal interface led_set_brightness() to __led_set_brightness().
92  *   There are no changes to the interface implementations.
93  *   
94  *   Signed-off-by: Shuah Khan <shuahkhan@gmail.com>
95  *   Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
96  */
97 #define led_set_brightness(_dev, _switch) led_brightness_set(_dev, _switch)
98
99 #define netif_get_num_default_rss_queues LINUX_BACKPORT(netif_get_num_default_rss_queues)
100 extern int netif_get_num_default_rss_queues(void);
101
102 #ifndef DEFAULT_MAX_NUM_RSS_QUEUES
103 #define DEFAULT_MAX_NUM_RSS_QUEUES      (8)
104 #endif
105
106 #ifndef SUPPORTED_40000baseSR4_Full
107 #define SUPPORTED_40000baseSR4_Full     (1 << 25)
108 #endif
109 #ifndef ADVERTISED_40000baseSR4_Full
110 #define ADVERTISED_40000baseSR4_Full    (1 << 25)
111 #endif
112
113 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) */
114
115 #endif /* LINUX_3_6_COMPAT_H */