6 static inline int INET_ECN_is_ce(__u8 dsfield)
8 return (dsfield&3) == 3;
11 static inline int INET_ECN_is_not_ce(__u8 dsfield)
13 return (dsfield&3) == 2;
16 static inline int INET_ECN_is_capable(__u8 dsfield)
21 static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
24 if (INET_ECN_is_capable(inner))
29 #define INET_ECN_xmit(sk) do { inet_sk(sk)->tos |= 2; } while (0)
30 #define INET_ECN_dontxmit(sk) do { inet_sk(sk)->tos &= ~3; } while (0)
32 #define IP6_ECN_flow_init(label) do { \
33 (label) &= ~htonl(3<<20); \
36 #define IP6_ECN_flow_xmit(sk, label) do { \
37 if (INET_ECN_is_capable(inet_sk(sk)->tos)) \
38 (label) |= __constant_htons(2 << 4); \
41 static inline void IP_ECN_set_ce(struct iphdr *iph)
43 u32 check = iph->check;
44 check += __constant_htons(0xFFFE);
45 iph->check = check + (check>=0xFFFF);
49 static inline void IP_ECN_clear(struct iphdr *iph)
56 static inline void IP6_ECN_set_ce(struct ipv6hdr *iph)
58 *(u32*)iph |= htonl(1<<20);
61 static inline void IP6_ECN_clear(struct ipv6hdr *iph)
63 *(u32*)iph &= ~htonl(3<<20);
66 #define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF)