12 static inline int INET_ECN_is_ce(__u8 dsfield)
14 return (dsfield&3) == 3;
17 static inline int INET_ECN_is_not_ce(__u8 dsfield)
19 return (dsfield&3) == 2;
22 static inline int INET_ECN_is_capable(__u8 dsfield)
27 static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
30 if (INET_ECN_is_capable(inner))
35 #define INET_ECN_xmit(sk) do { (sk)->protinfo.af_inet.tos |= 2; } while (0)
36 #define INET_ECN_dontxmit(sk) do { (sk)->protinfo.af_inet.tos &= ~3; } while (0)
38 #define IP6_ECN_flow_init(label) do { \
39 (label) &= ~htonl(3<<20); \
42 #define IP6_ECN_flow_xmit(sk, label) do { \
43 if (INET_ECN_is_capable((sk)->protinfo.af_inet.tos)) \
44 (label) |= __constant_htons(2 << 4); \
47 static inline void IP_ECN_set_ce(struct iphdr *iph)
49 u32 check = iph->check;
50 check += __constant_htons(0xFFFE);
51 iph->check = check + (check>=0xFFFF);
57 static inline void IP6_ECN_set_ce(struct ipv6hdr *iph)
59 *(u32*)iph |= htonl(1<<20);
62 #define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF)