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))
14 * From a3860c1c5dd1137db23d7786d284939c5761d517 Mon Sep 17 00:00:00 2001
15 * From: Xi Wang <xi.wang@gmail.com>
16 * Date: Thu, 31 May 2012 16:26:04 -0700
17 * Subject: [PATCH] introduce SIZE_MAX
20 #define SIZE_MAX (~(size_t)0)
23 #include <linux/pkt_sched.h>
28 * From 76e3cc126bb223013a6b9a0e2a51238d1ef2e409 Mon Sep 17 00:00:00 2001
29 * From: Eric Dumazet <edumazet@google.com>
30 * Date: Thu, 10 May 2012 07:51:25 +0000
31 * Subject: [PATCH] codel: Controlled Delay AQM
45 #define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1)
47 struct tc_codel_xstats {
48 __u32 maxpacket; /* largest packet we've seen so far */
49 __u32 count; /* how many drops we've done since the last time we
50 * entered dropping state
52 __u32 lastcount; /* count at entry to dropping state */
53 __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */
54 __s32 drop_next; /* time to drop next packet */
55 __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */
56 __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */
57 __u32 dropping; /* are we in dropping state ? */
62 * commit 4b549a2ef4bef9965d97cbd992ba67930cd3e0fe
63 * Author: Eric Dumazet <edumazet@google.com>
64 * Date: Fri May 11 09:30:50 2012 +0000
65 * fq_codel: Fair Queue Codel AQM
74 TCA_FQ_CODEL_INTERVAL,
81 #define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1)
84 TCA_FQ_CODEL_XSTATS_QDISC,
85 TCA_FQ_CODEL_XSTATS_CLASS,
88 struct tc_fq_codel_qd_stats {
89 __u32 maxpacket; /* largest packet we've seen so far */
90 __u32 drop_overlimit; /* number of time max qdisc
91 * packet limit was hit
93 __u32 ecn_mark; /* number of packets we ECN marked
94 * instead of being dropped
96 __u32 new_flow_count; /* number of time packets
97 * created a 'new flow'
99 __u32 new_flows_len; /* count of flows in new list */
100 __u32 old_flows_len; /* count of flows in old list */
103 struct tc_fq_codel_cl_stats {
105 __u32 ldelay; /* in-queue delay seen by most recently
114 struct tc_fq_codel_xstats {
117 struct tc_fq_codel_qd_stats qdisc_stats;
118 struct tc_fq_codel_cl_stats class_stats;
122 #ifndef CONFIG_COMPAT_IS_MAXRATE
123 #ifndef IEEE_8021QAZ_MAX_TCS
124 #define IEEE_8021QAZ_MAX_TCS 8
127 struct ieee_maxrate {
128 u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS];
132 /* Backports tty_lock: Localise the lock */
133 #define tty_lock(__tty) tty_lock()
134 #define tty_unlock(__tty) tty_unlock()
136 #define net_ratelimited_function(function, ...) \
138 if (net_ratelimit()) \
139 function(__VA_ARGS__); \
142 #define net_emerg_ratelimited(fmt, ...) \
143 net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
144 #define net_alert_ratelimited(fmt, ...) \
145 net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
146 #define net_crit_ratelimited(fmt, ...) \
147 net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
148 #define net_err_ratelimited(fmt, ...) \
149 net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
150 #define net_notice_ratelimited(fmt, ...) \
151 net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
152 #define net_warn_ratelimited(fmt, ...) \
153 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
154 #define net_info_ratelimited(fmt, ...) \
155 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
156 #define net_dbg_ratelimited(fmt, ...) \
157 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
159 static inline int net_sysctl_init(void) { return 0; }
160 static inline struct ctl_table_header *register_net_sysctl(struct net *net,
161 const char *path, struct ctl_table *table)
166 #ifndef CONFIG_COMPAT_IS_IP_TOS2PRIO
167 extern const __u8 ip_tos2prio[16];
170 #define dev_uc_add_excl LINUX_BACKPORT(dev_uc_add_excl)
171 extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
173 #define dev_mc_add_excl LINUX_BACKPORT(dev_mc_add_excl)
174 extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr);
176 #define SK_CAN_REUSE 1
178 #define ether_addr_equal_64bits LINUX_BACKPORT(ether_addr_equal_64bits)
179 static inline bool ether_addr_equal_64bits(const u8 addr1[6+2],
182 return !compare_ether_addr_64bits(addr1, addr2);
185 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
187 #endif /* LINUX_3_5_COMPAT_H */