1 #ifndef LINUX_3_5_COMPAT_H
2 #define LINUX_3_5_COMPAT_H
4 #include <linux/version.h>
6 #include <linux/etherdevice.h>
9 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
11 /* switcheroo is available on >= 2.6.34 */
12 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
13 #include <linux/vga_switcheroo.h>
17 * From 26ec685ff9d9c16525d8ec4c97e52fcdb187b302 Mon Sep 17 00:00:00 2001
18 * From: Takashi Iwai <tiwai@suse.de>
19 * Date: Fri, 11 May 2012 07:51:17 +0200
20 * Subject: [PATCH] vga_switcheroo: Introduce struct vga_switcheroo_client_ops
24 struct vga_switcheroo_client_ops {
25 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
26 void (*reprobe)(struct pci_dev *dev);
27 bool (*can_switch)(struct pci_dev *dev);
34 * From a3860c1c5dd1137db23d7786d284939c5761d517 Mon Sep 17 00:00:00 2001
35 * From: Xi Wang <xi.wang@gmail.com>
36 * Date: Thu, 31 May 2012 16:26:04 -0700
37 * Subject: [PATCH] introduce SIZE_MAX
40 #define SIZE_MAX (~(size_t)0)
43 #include <linux/pkt_sched.h>
48 * From 76e3cc126bb223013a6b9a0e2a51238d1ef2e409 Mon Sep 17 00:00:00 2001
49 * From: Eric Dumazet <edumazet@google.com>
50 * Date: Thu, 10 May 2012 07:51:25 +0000
51 * Subject: [PATCH] codel: Controlled Delay AQM
65 #define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1)
67 struct tc_codel_xstats {
68 __u32 maxpacket; /* largest packet we've seen so far */
69 __u32 count; /* how many drops we've done since the last time we
70 * entered dropping state
72 __u32 lastcount; /* count at entry to dropping state */
73 __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */
74 __s32 drop_next; /* time to drop next packet */
75 __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */
76 __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */
77 __u32 dropping; /* are we in dropping state ? */
82 * commit 4b549a2ef4bef9965d97cbd992ba67930cd3e0fe
83 * Author: Eric Dumazet <edumazet@google.com>
84 * Date: Fri May 11 09:30:50 2012 +0000
85 * fq_codel: Fair Queue Codel AQM
94 TCA_FQ_CODEL_INTERVAL,
101 #define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1)
104 TCA_FQ_CODEL_XSTATS_QDISC,
105 TCA_FQ_CODEL_XSTATS_CLASS,
108 struct tc_fq_codel_qd_stats {
109 __u32 maxpacket; /* largest packet we've seen so far */
110 __u32 drop_overlimit; /* number of time max qdisc
111 * packet limit was hit
113 __u32 ecn_mark; /* number of packets we ECN marked
114 * instead of being dropped
116 __u32 new_flow_count; /* number of time packets
117 * created a 'new flow'
119 __u32 new_flows_len; /* count of flows in new list */
120 __u32 old_flows_len; /* count of flows in old list */
123 struct tc_fq_codel_cl_stats {
125 __u32 ldelay; /* in-queue delay seen by most recently
134 struct tc_fq_codel_xstats {
137 struct tc_fq_codel_qd_stats qdisc_stats;
138 struct tc_fq_codel_cl_stats class_stats;
143 /* Backports tty_lock: Localise the lock */
144 #define tty_lock(__tty) tty_lock()
145 #define tty_unlock(__tty) tty_unlock()
147 /* Backport ether_addr_equal */
148 static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
150 return !compare_ether_addr(addr1, addr2);
153 #define net_ratelimited_function(function, ...) \
155 if (net_ratelimit()) \
156 function(__VA_ARGS__); \
159 #define net_emerg_ratelimited(fmt, ...) \
160 net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
161 #define net_alert_ratelimited(fmt, ...) \
162 net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
163 #define net_crit_ratelimited(fmt, ...) \
164 net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
165 #define net_err_ratelimited(fmt, ...) \
166 net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
167 #define net_notice_ratelimited(fmt, ...) \
168 net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
169 #define net_warn_ratelimited(fmt, ...) \
170 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
171 #define net_info_ratelimited(fmt, ...) \
172 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
173 #define net_dbg_ratelimited(fmt, ...) \
174 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
176 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
178 #endif /* LINUX_3_5_COMPAT_H */