Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9095e10e authored by Jiri Benc's avatar Jiri Benc Committed by David S. Miller
Browse files

mpls: move mpls_hdr to a common location



This will be also used by openvswitch.

Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
Acked-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f7d49bce
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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
+1 −9
Original line number Diff line number Diff line
#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;
@@ -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;