20 static inline int INET_ECN_is_ce(
__u8 dsfield)
25 static inline int INET_ECN_is_not_ect(
__u8 dsfield)
30 static inline int INET_ECN_is_capable(
__u8 dsfield)
43 static inline __u8 INET_ECN_encapsulate(
__u8 outer,
__u8 inner)
51 static inline void INET_ECN_xmit(
struct sock *
sk)
54 if (inet6_sk(sk) !=
NULL)
58 static inline void INET_ECN_dontxmit(
struct sock *sk)
61 if (inet6_sk(sk) !=
NULL)
65 #define IP6_ECN_flow_init(label) do { \
66 (label) &= ~htonl(INET_ECN_MASK << 20); \
69 #define IP6_ECN_flow_xmit(sk, label) do { \
70 if (INET_ECN_is_capable(inet6_sk(sk)->tclass)) \
71 (label) |= htonl(INET_ECN_ECT_0 << 20); \
74 static inline int IP_ECN_set_ce(
struct iphdr *iph)
101 static inline void IP_ECN_clear(
struct iphdr *iph)
106 static inline void ipv4_copy_dscp(
unsigned int dscp,
struct iphdr *inner)
114 static inline int IP6_ECN_set_ce(
struct ipv6hdr *iph)
116 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
122 static inline void IP6_ECN_clear(
struct ipv6hdr *iph)
127 static inline void ipv6_copy_dscp(
unsigned int dscp,
struct ipv6hdr *inner)
133 static inline int INET_ECN_set_ce(
struct sk_buff *
skb)
138 return IP_ECN_set_ce(ip_hdr(skb));
143 return IP6_ECN_set_ce(ipv6_hdr(skb));
174 static inline int INET_ECN_decapsulate(
struct sk_buff *skb,
177 if (INET_ECN_is_not_ect(inner)) {
189 if (INET_ECN_is_ce(outer))
190 INET_ECN_set_ce(skb);
195 static inline int IP_ECN_decapsulate(
const struct iphdr *oiph,
201 inner = ip_hdr(skb)->tos;
203 inner = ipv6_get_dsfield(ipv6_hdr(skb));
207 return INET_ECN_decapsulate(skb, oiph->
tos, inner);
210 static inline int IP6_ECN_decapsulate(
const struct ipv6hdr *oipv6h,
216 inner = ip_hdr(skb)->tos;
218 inner = ipv6_get_dsfield(ipv6_hdr(skb));
222 return INET_ECN_decapsulate(skb, ipv6_get_dsfield(oipv6h), inner);