4 #include <linux/config.h>
8 static inline int INET_ECN_is_ce(__u8 dsfield
)
10 return (dsfield
&3) == 3;
13 static inline int INET_ECN_is_not_ce(__u8 dsfield
)
15 return (dsfield
&3) == 2;
18 static inline int INET_ECN_is_capable(__u8 dsfield
)
23 static inline __u8
INET_ECN_encapsulate(__u8 outer
, __u8 inner
)
26 if (INET_ECN_is_capable(inner
))
31 #define INET_ECN_xmit(sk) do { (sk)->protinfo.af_inet.tos |= 2; } while (0)
32 #define INET_ECN_dontxmit(sk) do { (sk)->protinfo.af_inet.tos &= ~3; } while (0)
34 #define IP6_ECN_flow_init(label) do { \
35 (label) &= ~htonl(3<<20); \
38 #define IP6_ECN_flow_xmit(sk, label) do { \
39 if (INET_ECN_is_capable((sk)->protinfo.af_inet.tos)) \
40 (label) |= __constant_htons(2 << 4); \
45 #define INET_ECN_is_ce(x...) (0)
46 #define INET_ECN_is_not_ce(x...) (0)
47 #define INET_ECN_is_capable(x...) (0)
48 #define INET_ECN_encapsulate(x, y) (x)
49 #define IP6_ECN_flow_init(x...) do { } while (0)
50 #define IP6_ECN_flow_xmit(x...) do { } while (0)
51 #define INET_ECN_xmit(x...) do { } while (0)
52 #define INET_ECN_dontxmit(x...) do { } while (0)
55 static inline void IP_ECN_set_ce(struct iphdr
*iph
)
57 u32 check
= iph
->check
;
58 check
+= __constant_htons(0xFFFE);
59 iph
->check
= check
+ (check
>=0xFFFF);
65 static inline void IP6_ECN_set_ce(struct ipv6hdr
*iph
)
67 *(u32
*)iph
|= htonl(1<<20);
70 #define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF)