diff options
author | Jiri Benc <jbenc@redhat.com> | 2016-09-30 13:08:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-03 02:00:21 -0400 |
commit | 9095e10edd28e1e4a10ba5ca61fb54d9f74f8968 (patch) | |
tree | c0b3479b54587b1d4d8cc962f9850cd983d39500 | |
parent | f7d49bce8e741e1e6aa14ce4db1b6cea7e4be4e8 (diff) |
mpls: move mpls_hdr to a common location
This will be also used by openvswitch.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/mpls.h | 9 | ||||
-rw-r--r-- | net/mpls/internal.h | 10 |
2 files changed, 10 insertions, 9 deletions
diff --git a/include/net/mpls.h b/include/net/mpls.h index 5b3b5addfb08..3ebbc0bb57ff 100644 --- a/include/net/mpls.h +++ b/include/net/mpls.h | |||
@@ -19,12 +19,21 @@ | |||
19 | 19 | ||
20 | #define MPLS_HLEN 4 | 20 | #define MPLS_HLEN 4 |
21 | 21 | ||
22 | struct mpls_shim_hdr { | ||
23 | __be32 label_stack_entry; | ||
24 | }; | ||
25 | |||
22 | static inline bool eth_p_mpls(__be16 eth_type) | 26 | static inline bool eth_p_mpls(__be16 eth_type) |
23 | { | 27 | { |
24 | return eth_type == htons(ETH_P_MPLS_UC) || | 28 | return eth_type == htons(ETH_P_MPLS_UC) || |
25 | eth_type == htons(ETH_P_MPLS_MC); | 29 | eth_type == htons(ETH_P_MPLS_MC); |
26 | } | 30 | } |
27 | 31 | ||
32 | static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb) | ||
33 | { | ||
34 | return (struct mpls_shim_hdr *)skb_network_header(skb); | ||
35 | } | ||
36 | |||
28 | /* | 37 | /* |
29 | * For non-MPLS skbs this will correspond to the network header. | 38 | * For non-MPLS skbs this will correspond to the network header. |
30 | * For MPLS skbs it will be before the network_header as the MPLS | 39 | * For MPLS skbs it will be before the network_header as the MPLS |
diff --git a/net/mpls/internal.h b/net/mpls/internal.h index 732a5c17e986..bdfef6c3271a 100644 --- a/net/mpls/internal.h +++ b/net/mpls/internal.h | |||
@@ -1,9 +1,6 @@ | |||
1 | #ifndef MPLS_INTERNAL_H | 1 | #ifndef MPLS_INTERNAL_H |
2 | #define MPLS_INTERNAL_H | 2 | #define MPLS_INTERNAL_H |
3 | 3 | #include <net/mpls.h> | |
4 | struct mpls_shim_hdr { | ||
5 | __be32 label_stack_entry; | ||
6 | }; | ||
7 | 4 | ||
8 | struct mpls_entry_decoded { | 5 | struct mpls_entry_decoded { |
9 | u32 label; | 6 | u32 label; |
@@ -93,11 +90,6 @@ struct mpls_route { /* next hop label forwarding entry */ | |||
93 | 90 | ||
94 | #define endfor_nexthops(rt) } | 91 | #define endfor_nexthops(rt) } |
95 | 92 | ||
96 | static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb) | ||
97 | { | ||
98 | return (struct mpls_shim_hdr *)skb_network_header(skb); | ||
99 | } | ||
100 | |||
101 | static inline struct mpls_shim_hdr mpls_entry_encode(u32 label, unsigned ttl, unsigned tc, bool bos) | 93 | static inline struct mpls_shim_hdr mpls_entry_encode(u32 label, unsigned ttl, unsigned tc, bool bos) |
102 | { | 94 | { |
103 | struct mpls_shim_hdr result; | 95 | struct mpls_shim_hdr result; |