4 static inline int INET_ECN_is_ce(__u8 dsfield)
6 return (dsfield&3) == 3;
9 static inline int INET_ECN_is_not_ce(__u8 dsfield)
11 return (dsfield&3) == 2;
14 static inline int INET_ECN_is_capable(__u8 dsfield)
19 static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
22 if (INET_ECN_is_capable(inner))
28 #define INET_ECN_xmit(sk) do { (sk)->protinfo.af_inet.tos |= 2; } while (0)
29 #define INET_ECN_dontxmit(sk) do { (sk)->protinfo.af_inet.tos &= ~3; } while (0)
31 #define INET_ECN_xmit(sk) do { } while (0)
32 #define INET_ECN_dontxmit(sk) do { } while (0)
35 #define IP6_ECN_flow_init(label) do { \
36 (label) &= ~htonl(3<<20); \
39 #define IP6_ECN_flow_xmit(sk, label) do { \
40 if (INET_ECN_is_capable((sk)->protinfo.af_inet.tos)) \
41 (label) |= __constant_htons(2 << 4); \
44 static inline void IP_ECN_set_ce(struct iphdr *iph)
46 u32 check = iph->check;
47 check += __constant_htons(0xFFFE);
48 iph->check = check + (check>=0xFFFF);
54 static inline void IP6_ECN_set_ce(struct ipv6hdr *iph)
56 *(u32*)iph |= htonl(1<<20);
59 #define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF)