blob: ccaf238e8ea70d6c53a14d7a8385c4ab8b2fd777 [file] [log] [blame]
Thomas Gleixner5b497af2019-05-29 07:18:09 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Simon Horman25cd9ba2014-10-06 05:05:13 -07002/*
3 * Copyright (c) 2014 Nicira, Inc.
Simon Horman25cd9ba2014-10-06 05:05:13 -07004 */
5
6#ifndef _NET_MPLS_H
7#define _NET_MPLS_H 1
8
9#include <linux/if_ether.h>
10#include <linux/netdevice.h>
11
12#define MPLS_HLEN 4
13
Jiri Benc9095e102016-09-30 19:08:06 +020014struct mpls_shim_hdr {
15 __be32 label_stack_entry;
16};
17
Simon Horman25cd9ba2014-10-06 05:05:13 -070018static inline bool eth_p_mpls(__be16 eth_type)
19{
20 return eth_type == htons(ETH_P_MPLS_UC) ||
21 eth_type == htons(ETH_P_MPLS_MC);
22}
23
Jiri Benc9095e102016-09-30 19:08:06 +020024static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb)
25{
26 return (struct mpls_shim_hdr *)skb_network_header(skb);
27}
Simon Horman25cd9ba2014-10-06 05:05:13 -070028#endif