blob: 1dbc669b770e8c6e13f0d53424bedc5a20b851cf [file] [log] [blame]
Simon Horman25cd9ba2014-10-06 05:05:13 -07001/*
2 * Copyright (c) 2014 Nicira, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13
14#ifndef _NET_MPLS_H
15#define _NET_MPLS_H 1
16
17#include <linux/if_ether.h>
18#include <linux/netdevice.h>
19
20#define MPLS_HLEN 4
21
Jiri Benc9095e102016-09-30 19:08:06 +020022struct mpls_shim_hdr {
23 __be32 label_stack_entry;
24};
25
Simon Horman25cd9ba2014-10-06 05:05:13 -070026static inline bool eth_p_mpls(__be16 eth_type)
27{
28 return eth_type == htons(ETH_P_MPLS_UC) ||
29 eth_type == htons(ETH_P_MPLS_MC);
30}
31
Jiri Benc9095e102016-09-30 19:08:06 +020032static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb)
33{
34 return (struct mpls_shim_hdr *)skb_network_header(skb);
35}
Simon Horman25cd9ba2014-10-06 05:05:13 -070036#endif