2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00

compat: Add act_pedit compatibility for old kernels

Added compatibility for action pedit.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
This commit is contained in:
Paul Blakey 2017-09-18 07:16:01 +03:00 committed by Simon Horman
parent fa54741ea5
commit e5b1657e6f
3 changed files with 80 additions and 0 deletions

View File

@ -188,6 +188,13 @@ AC_DEFUN([OVS_CHECK_LINUX_TC], [
])],
[AC_DEFINE([HAVE_TCA_TUNNEL_KEY_ENC_DST_PORT], [1],
[Define to 1 if TCA_TUNNEL_KEY_ENC_DST_PORT is avaiable.])])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([#include <linux/tc_act/tc_pedit.h>], [
int x = TCA_PEDIT_KEY_EX_HDR_TYPE_UDP;
])],
[AC_DEFINE([HAVE_TCA_PEDIT_KEY_EX_HDR_TYPE_UDP], [1],
[Define to 1 if TCA_PEDIT_KEY_EX_HDR_TYPE_UDP is avaiable.])])
])
dnl OVS_CHECK_DPDK

View File

@ -1,4 +1,5 @@
noinst_HEADERS += \
include/linux/pkt_cls.h \
include/linux/tc_act/tc_pedit.h \
include/linux/tc_act/tc_tunnel_key.h \
include/linux/tc_act/tc_vlan.h

View File

@ -0,0 +1,72 @@
#ifndef __LINUX_TC_ACT_TC_PEDIT_WRAPPER_H
#define __LINUX_TC_ACT_TC_PEDIT_WRAPPER_H 1
#if defined(__KERNEL__) || defined(HAVE_TCA_PEDIT_KEY_EX_HDR_TYPE_UDP)
#include_next <linux/tc_act/tc_pedit.h>
#else
#include <linux/types.h>
#include <linux/pkt_cls.h>
#define TCA_ACT_PEDIT 7
enum {
TCA_PEDIT_UNSPEC,
TCA_PEDIT_TM,
TCA_PEDIT_PARMS,
TCA_PEDIT_PAD,
TCA_PEDIT_PARMS_EX,
TCA_PEDIT_KEYS_EX,
TCA_PEDIT_KEY_EX,
__TCA_PEDIT_MAX
};
#define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1)
enum {
TCA_PEDIT_KEY_EX_HTYPE = 1,
TCA_PEDIT_KEY_EX_CMD = 2,
__TCA_PEDIT_KEY_EX_MAX
};
#define TCA_PEDIT_KEY_EX_MAX (__TCA_PEDIT_KEY_EX_MAX - 1)
/* TCA_PEDIT_KEY_EX_HDR_TYPE_NETWROK is a special case for legacy users. It
* means no specific header type - offset is relative to the network layer
*/
enum pedit_header_type {
TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0,
TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1,
TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2,
TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3,
TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4,
TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5,
__PEDIT_HDR_TYPE_MAX,
};
#define TCA_PEDIT_HDR_TYPE_MAX (__PEDIT_HDR_TYPE_MAX - 1)
enum pedit_cmd {
TCA_PEDIT_KEY_EX_CMD_SET = 0,
TCA_PEDIT_KEY_EX_CMD_ADD = 1,
__PEDIT_CMD_MAX,
};
#define TCA_PEDIT_CMD_MAX (__PEDIT_CMD_MAX - 1)
struct tc_pedit_key {
__u32 mask; /* AND */
__u32 val; /*XOR */
__u32 off; /*offset */
__u32 at;
__u32 offmask;
__u32 shift;
};
struct tc_pedit_sel {
tc_gen;
unsigned char nkeys;
unsigned char flags;
struct tc_pedit_key keys[0];
};
#define tc_pedit tc_pedit_sel
#endif /* __KERNEL__ || HAVE_TCA_PEDIT_KEY_EX_HDR_TYPE_UDP */
#endif /* __LINUX_TC_ACT_TC_PEDIT_WRAPPER_H */