]> git.proxmox.com Git - ovs.git/commitdiff
compat: add compatibility headers for tc mpls action
authorJohn Hurley <john.hurley@netronome.com>
Tue, 30 Jul 2019 11:05:14 +0000 (12:05 +0100)
committerSimon Horman <simon.horman@netronome.com>
Thu, 1 Aug 2019 16:09:42 +0000 (18:09 +0200)
OvS includes compat code for several TC actions including vlan, mirred and
tunnel key. MPLS actions have recently been added to TC in the kernel. In
preparation for adding TC offload code for MPLS, add the MPLS compat code.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
acinclude.m4
include/linux/automake.mk
include/linux/tc_act/tc_mpls.h [new file with mode: 0644]

index 9e1569b07c737dd97f989171e0b227bddfb66066..116ffcf9096d7b7feac3d9e2a55060e658eb3089 100644 (file)
@@ -192,6 +192,13 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [
     [AC_DEFINE([HAVE_TCA_VLAN_PUSH_VLAN_PRIORITY], [1],
                [Define to 1 if TCA_VLAN_PUSH_VLAN_PRIORITY is available.])])
 
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([#include <linux/tc_act/tc_mpls.h>], [
+        int x = TCA_MPLS_TTL;
+    ])],
+    [AC_DEFINE([HAVE_TCA_MPLS_TTL], [1],
+               [Define to 1 if HAVE_TCA_MPLS_TTL is available.])])
+
   AC_COMPILE_IFELSE([
     AC_LANG_PROGRAM([#include <linux/tc_act/tc_tunnel_key.h>], [
         int x = TCA_TUNNEL_KEY_ENC_TTL;
index 24f85200b8bc46a6a7a2f7c0ab9ddc40b105b77f..4873a6ae6c6f784d5566513928a994b8f1e34e82 100644 (file)
@@ -1,6 +1,7 @@
 noinst_HEADERS += \
        include/linux/netfilter/nf_conntrack_sctp.h \
        include/linux/pkt_cls.h \
+       include/linux/tc_act/tc_mpls.h \
        include/linux/tc_act/tc_pedit.h \
        include/linux/tc_act/tc_skbedit.h \
        include/linux/tc_act/tc_tunnel_key.h \
diff --git a/include/linux/tc_act/tc_mpls.h b/include/linux/tc_act/tc_mpls.h
new file mode 100644 (file)
index 0000000..25ebe3a
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef __LINUX_TC_ACT_TC_MPLS_WRAPPER_H
+#define __LINUX_TC_ACT_TC_MPLS_WRAPPER_H 1
+
+#if defined(__KERNEL__) || defined(HAVE_TCA_MPLS_TTL)
+#include_next <linux/tc_act/tc_mpls.h>
+#else
+
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/* Copyright (C) 2019 Netronome Systems, Inc. */
+
+#define TCA_MPLS_ACT_POP       1
+#define TCA_MPLS_ACT_PUSH      2
+#define TCA_MPLS_ACT_MODIFY    3
+#define TCA_MPLS_ACT_DEC_TTL   4
+
+struct tc_mpls {
+       tc_gen;         /* generic TC action fields. */
+       int m_action;   /* action of type TCA_MPLS_ACT_*. */
+};
+
+enum {
+       TCA_MPLS_UNSPEC,
+       TCA_MPLS_TM,    /* struct tcf_t; time values associated with action. */
+       TCA_MPLS_PARMS, /* struct tc_mpls; action type and general TC fields. */
+       TCA_MPLS_PAD,
+       TCA_MPLS_PROTO, /* be16; eth_type of pushed or next (for pop) header. */
+       TCA_MPLS_LABEL, /* u32; MPLS label. Lower 20 bits are used. */
+       TCA_MPLS_TC,    /* u8; MPLS TC field. Lower 3 bits are used. */
+       TCA_MPLS_TTL,   /* u8; MPLS TTL field. Must not be 0. */
+       TCA_MPLS_BOS,   /* u8; MPLS BOS field. Either 1 or 0. */
+       __TCA_MPLS_MAX,
+};
+#define TCA_MPLS_MAX (__TCA_MPLS_MAX - 1)
+
+#endif /* __KERNEL__ || HAVE_TCA_MPLS_TTL */
+
+#endif /* __LINUX_TC_ACT_TC_MPLS_WRAPPER_H */