[ovs-dev] [PATCH OVS v2 1/4] compat: add compatibility headers for tc skbedit action

John Hurley john.hurley at netronome.com
Thu Apr 4 16:05:10 UTC 2019


OvS includes compat code for several TC actions including vlan, mirred and
tunnel key. Add support for using skbedit actions when compiling
user-space code against older kernel headers.

Signed-off-by: John Hurley <john.hurley at netronome.com>
---
 acinclude.m4                      |  7 +++++
 include/linux/automake.mk         |  1 +
 include/linux/tc_act/tc_skbedit.h | 57 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 include/linux/tc_act/tc_skbedit.h

diff --git a/acinclude.m4 b/acinclude.m4
index 3cd6ea7..cfc8bcd 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -203,6 +203,13 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [
     ])],
     [AC_DEFINE([HAVE_TCA_PEDIT_KEY_EX_HDR_TYPE_UDP], [1],
                [Define to 1 if TCA_PEDIT_KEY_EX_HDR_TYPE_UDP is available.])])
+
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([#include <linux/tc_act/tc_skbedit.h>], [
+        int x = TCA_SKBEDIT_FLAGS;
+    ])],
+    [AC_DEFINE([HAVE_TCA_SKBEDIT_FLAGS], [1],
+               [Define to 1 if TCA_SKBEDIT_FLAGS is available.])])
 ])
 
 dnl OVS_CHECK_DPDK
diff --git a/include/linux/automake.mk b/include/linux/automake.mk
index b464fe0..45271d1 100644
--- a/include/linux/automake.mk
+++ b/include/linux/automake.mk
@@ -1,5 +1,6 @@
 noinst_HEADERS += \
 	include/linux/pkt_cls.h \
 	include/linux/tc_act/tc_pedit.h \
+	include/linux/tc_act/tc_skbedit.h \
 	include/linux/tc_act/tc_tunnel_key.h \
 	include/linux/tc_act/tc_vlan.h
diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h
new file mode 100644
index 0000000..c75d233
--- /dev/null
+++ b/include/linux/tc_act/tc_skbedit.h
@@ -0,0 +1,57 @@
+#ifndef __LINUX_TC_ACT_TC_SKBEDIT_WRAPPER_H
+#define __LINUX_TC_ACT_TC_SKBEDIT_WRAPPER_H 1
+
+#if defined(__KERNEL__) || defined(HAVE_TCA_SKBEDIT_FLAGS)
+#include_next <linux/tc_act/tc_skbedit.h>
+#else
+
+/*
+ * Copyright (c) 2008, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * Author: Alexander Duyck <alexander.h.duyck at intel.com>
+ */
+
+#include <linux/pkt_cls.h>
+
+#define SKBEDIT_F_PRIORITY		0x1
+#define SKBEDIT_F_QUEUE_MAPPING		0x2
+#define SKBEDIT_F_MARK			0x4
+#define SKBEDIT_F_PTYPE			0x8
+#define SKBEDIT_F_MASK			0x10
+#define SKBEDIT_F_INHERITDSFIELD	0x20
+
+struct tc_skbedit {
+	tc_gen;
+};
+
+enum {
+	TCA_SKBEDIT_UNSPEC,
+	TCA_SKBEDIT_TM,
+	TCA_SKBEDIT_PARMS,
+	TCA_SKBEDIT_PRIORITY,
+	TCA_SKBEDIT_QUEUE_MAPPING,
+	TCA_SKBEDIT_MARK,
+	TCA_SKBEDIT_PAD,
+	TCA_SKBEDIT_PTYPE,
+	TCA_SKBEDIT_MASK,
+	TCA_SKBEDIT_FLAGS,
+	__TCA_SKBEDIT_MAX
+};
+#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1)
+
+#endif /* __KERNEL__ || HAVE_TCA_SKBEDIT_FLAGS */
+
+#endif /* __LINUX_TC_ACT_TC_SKBEDIT_WRAPPER_H */
-- 
2.7.4



More information about the dev mailing list