aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/mpls.h
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2014-10-06 08:05:13 -0400
committerPravin B Shelar <pshelar@nicira.com>2014-11-06 02:52:33 -0500
commit25cd9ba0abc0749e5cb78e6493c6f6b3311ec6c5 (patch)
treefbfb953b27fbdcc27d0a50a6e3444532f51f5ffa /include/net/mpls.h
parent59b93b41e7fa71138734a911b11b044340dd16bd (diff)
openvswitch: Add basic MPLS support to kernel
Allow datapath to recognize and extract MPLS labels into flow keys and execute actions which push, pop, and set labels on packets. Based heavily on work by Leo Alterman, Ravi K, Isaku Yamahata and Joe Stringer. Cc: Ravi K <rkerur@gmail.com> Cc: Leo Alterman <lalterman@nicira.com> Cc: Isaku Yamahata <yamahata@valinux.co.jp> Cc: Joe Stringer <joe@wand.net.nz> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'include/net/mpls.h')
-rw-r--r--include/net/mpls.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/net/mpls.h b/include/net/mpls.h
new file mode 100644
index 000000000000..5b3b5addfb08
--- /dev/null
+++ b/include/net/mpls.h
@@ -0,0 +1,39 @@
1/*
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
22static inline bool eth_p_mpls(__be16 eth_type)
23{
24 return eth_type == htons(ETH_P_MPLS_UC) ||
25 eth_type == htons(ETH_P_MPLS_MC);
26}
27
28/*
29 * 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
31 * label stack lies between the end of the mac header and the network
32 * header. That is, for MPLS skbs the end of the mac header
33 * is the top of the MPLS label stack.
34 */
35static inline unsigned char *skb_mpls_header(struct sk_buff *skb)
36{
37 return skb_mac_header(skb) + skb->mac_len;
38}
39#endif