Skip to content

Commit

Permalink
mpls: move mpls_hdr to a common location
Browse files Browse the repository at this point in the history
This will be also used by openvswitch.

Signed-off-by: Jiri Benc <[email protected]>
Acked-by: David Ahern <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jiri Benc authored and davem330 committed Oct 3, 2016
1 parent f7d49bc commit 9095e10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 9 additions & 0 deletions include/net/mpls.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@

#define MPLS_HLEN 4

struct mpls_shim_hdr {
__be32 label_stack_entry;
};

static inline bool eth_p_mpls(__be16 eth_type)
{
return eth_type == htons(ETH_P_MPLS_UC) ||
eth_type == htons(ETH_P_MPLS_MC);
}

static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb)
{
return (struct mpls_shim_hdr *)skb_network_header(skb);
}

/*
* For non-MPLS skbs this will correspond to the network header.
* For MPLS skbs it will be before the network_header as the MPLS
Expand Down
10 changes: 1 addition & 9 deletions net/mpls/internal.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifndef MPLS_INTERNAL_H
#define MPLS_INTERNAL_H

struct mpls_shim_hdr {
__be32 label_stack_entry;
};
#include <net/mpls.h>

struct mpls_entry_decoded {
u32 label;
Expand Down Expand Up @@ -93,11 +90,6 @@ struct mpls_route { /* next hop label forwarding entry */

#define endfor_nexthops(rt) }

static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb)
{
return (struct mpls_shim_hdr *)skb_network_header(skb);
}

static inline struct mpls_shim_hdr mpls_entry_encode(u32 label, unsigned ttl, unsigned tc, bool bos)
{
struct mpls_shim_hdr result;
Expand Down

0 comments on commit 9095e10

Please sign in to comment.