diff options
author | Li RongQing <roy.qing.li@gmail.com> | 2014-01-15 04:03:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-15 18:53:18 -0500 |
commit | d76ed22b225c02228c643ae336f76e086fdc32f0 (patch) | |
tree | e420a54624555e185458c2d8a443820ef9a276e5 /include/net | |
parent | e96a41ebde3b66dbb59d3ffa0a38dff6e5ca25a9 (diff) |
ipv6: move IPV6_TCLASS_SHIFT into ipv6.h and define a helper
Two places defined IPV6_TCLASS_SHIFT, so we should move it into ipv6.h,
and use this macro as possible. And define ip6_tclass helper to return
tclass
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/ipv6.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 12079c65ea3e..6d80f51897a5 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -239,6 +239,7 @@ struct ip6_flowlabel { | |||
239 | #define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF) | 239 | #define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF) |
240 | #define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) | 240 | #define IPV6_FLOWLABEL_MASK cpu_to_be32(0x000FFFFF) |
241 | #define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK) | 241 | #define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK) |
242 | #define IPV6_TCLASS_SHIFT 20 | ||
242 | 243 | ||
243 | struct ipv6_fl_socklist { | 244 | struct ipv6_fl_socklist { |
244 | struct ipv6_fl_socklist __rcu *next; | 245 | struct ipv6_fl_socklist __rcu *next; |
@@ -681,6 +682,10 @@ static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr) | |||
681 | return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK; | 682 | return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK; |
682 | } | 683 | } |
683 | 684 | ||
685 | static inline u8 ip6_tclass(__be32 flowinfo) | ||
686 | { | ||
687 | return ntohl(flowinfo & IPV6_TCLASS_MASK) >> IPV6_TCLASS_SHIFT; | ||
688 | } | ||
684 | /* | 689 | /* |
685 | * Prototypes exported by ipv6 | 690 | * Prototypes exported by ipv6 |
686 | */ | 691 | */ |