diff mbox series

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

Message ID 1554197264-15502-2-git-send-email-john.hurley@netronome.com
State Superseded
Delegated to: Simon Horman
Headers show
Series ovs-tc: support OvS internal port offload | expand

Commit Message

John Hurley April 2, 2019, 9:27 a.m. UTC
OvS includes compat code for serval TC actions including vlan, mirr 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@netronome.com>
Reviewed-by: Simon Horman <simon.horman@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

Comments

Roi Dayan April 2, 2019, 2:53 p.m. UTC | #1
On 02/04/2019 12:27, John Hurley wrote:
> OvS includes compat code for serval TC actions including vlan, mirr and

typo serval/several

in mirr you mean mirred ? i would prefer mirred.

> tunnel key. Add support for using skbedit actions when compiling
> user-space code against older kernel headers.
> 
> Signed-off-by: John Hurley <john.hurley@netronome.com>
> Reviewed-by: Simon Horman <simon.horman@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@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 */
>
John Hurley April 2, 2019, 5:13 p.m. UTC | #2
On Tue, Apr 2, 2019 at 3:53 PM Roi Dayan <roid@mellanox.com> wrote:
>
>
>
> On 02/04/2019 12:27, John Hurley wrote:
> > OvS includes compat code for serval TC actions including vlan, mirr and
>
> typo serval/several
>
> in mirr you mean mirred ? i would prefer mirred.
>

good spot. Will change. Thanks

> > tunnel key. Add support for using skbedit actions when compiling
> > user-space code against older kernel headers.
> >
> > Signed-off-by: John Hurley <john.hurley@netronome.com>
> > Reviewed-by: Simon Horman <simon.horman@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@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 */
> >
>
diff mbox series

Patch

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@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 */