mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
Support matching on tos and ttl of ip tunnels for the TC data-path. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
219 lines
5.8 KiB
C
219 lines
5.8 KiB
C
#ifndef __LINUX_PKT_CLS_WRAPPER_H
|
|
#define __LINUX_PKT_CLS_WRAPPER_H 1
|
|
|
|
#if defined(__KERNEL__) || defined(HAVE_TCA_FLOWER_KEY_ENC_IP_TTL_MASK)
|
|
#include_next <linux/pkt_cls.h>
|
|
#else
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/pkt_sched.h>
|
|
|
|
/* Action attributes */
|
|
enum {
|
|
TCA_ACT_UNSPEC,
|
|
TCA_ACT_KIND,
|
|
TCA_ACT_OPTIONS,
|
|
TCA_ACT_INDEX,
|
|
TCA_ACT_STATS,
|
|
TCA_ACT_PAD,
|
|
TCA_ACT_COOKIE,
|
|
__TCA_ACT_MAX
|
|
};
|
|
|
|
#define TCA_ACT_MAX __TCA_ACT_MAX
|
|
#define TCA_OLD_COMPAT (TCA_ACT_MAX+1)
|
|
#define TCA_ACT_MAX_PRIO 32
|
|
#define TCA_ACT_BIND 1
|
|
#define TCA_ACT_NOBIND 0
|
|
#define TCA_ACT_UNBIND 1
|
|
#define TCA_ACT_NOUNBIND 0
|
|
#define TCA_ACT_REPLACE 1
|
|
#define TCA_ACT_NOREPLACE 0
|
|
|
|
#define TC_ACT_UNSPEC (-1)
|
|
#define TC_ACT_OK 0
|
|
#define TC_ACT_RECLASSIFY 1
|
|
#define TC_ACT_SHOT 2
|
|
#define TC_ACT_PIPE 3
|
|
#define TC_ACT_STOLEN 4
|
|
#define TC_ACT_QUEUED 5
|
|
#define TC_ACT_REPEAT 6
|
|
#define TC_ACT_REDIRECT 7
|
|
#define TC_ACT_JUMP 0x10000000
|
|
|
|
struct tc_police {
|
|
__u32 index;
|
|
int action;
|
|
#define TC_POLICE_UNSPEC TC_ACT_UNSPEC
|
|
#define TC_POLICE_OK TC_ACT_OK
|
|
#define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY
|
|
#define TC_POLICE_SHOT TC_ACT_SHOT
|
|
#define TC_POLICE_PIPE TC_ACT_PIPE
|
|
|
|
__u32 limit;
|
|
__u32 burst;
|
|
__u32 mtu;
|
|
struct tc_ratespec rate;
|
|
struct tc_ratespec peakrate;
|
|
int refcnt;
|
|
int bindcnt;
|
|
__u32 capab;
|
|
};
|
|
|
|
struct tcf_t {
|
|
__u64 install;
|
|
__u64 lastuse;
|
|
__u64 expires;
|
|
__u64 firstuse;
|
|
};
|
|
|
|
#define tc_gen \
|
|
__u32 index; \
|
|
__u32 capab; \
|
|
int action; \
|
|
int refcnt; \
|
|
int bindcnt
|
|
|
|
enum {
|
|
TCA_POLICE_UNSPEC,
|
|
TCA_POLICE_TBF,
|
|
TCA_POLICE_RATE,
|
|
TCA_POLICE_PEAKRATE,
|
|
TCA_POLICE_AVRATE,
|
|
TCA_POLICE_RESULT,
|
|
TCA_POLICE_TM,
|
|
TCA_POLICE_PAD,
|
|
__TCA_POLICE_MAX
|
|
#define TCA_POLICE_RESULT TCA_POLICE_RESULT
|
|
};
|
|
|
|
/* tca flags definitions */
|
|
#define TCA_CLS_FLAGS_SKIP_HW (1 << 0) /* don't offload filter to HW */
|
|
#define TCA_CLS_FLAGS_SKIP_SW (1 << 1) /* don't use filter in SW */
|
|
#define TCA_CLS_FLAGS_IN_HW (1 << 2) /* filter is offloaded to HW */
|
|
#define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */
|
|
|
|
/* Basic filter */
|
|
|
|
enum {
|
|
TCA_BASIC_UNSPEC,
|
|
TCA_BASIC_CLASSID,
|
|
TCA_BASIC_EMATCHES,
|
|
TCA_BASIC_ACT,
|
|
TCA_BASIC_POLICE,
|
|
__TCA_BASIC_MAX
|
|
};
|
|
|
|
/* Flower classifier */
|
|
|
|
enum {
|
|
TCA_FLOWER_UNSPEC,
|
|
TCA_FLOWER_CLASSID,
|
|
TCA_FLOWER_INDEV,
|
|
TCA_FLOWER_ACT,
|
|
TCA_FLOWER_KEY_ETH_DST, /* ETH_ALEN */
|
|
TCA_FLOWER_KEY_ETH_DST_MASK, /* ETH_ALEN */
|
|
TCA_FLOWER_KEY_ETH_SRC, /* ETH_ALEN */
|
|
TCA_FLOWER_KEY_ETH_SRC_MASK, /* ETH_ALEN */
|
|
TCA_FLOWER_KEY_ETH_TYPE, /* be16 */
|
|
TCA_FLOWER_KEY_IP_PROTO, /* u8 */
|
|
TCA_FLOWER_KEY_IPV4_SRC, /* be32 */
|
|
TCA_FLOWER_KEY_IPV4_SRC_MASK, /* be32 */
|
|
TCA_FLOWER_KEY_IPV4_DST, /* be32 */
|
|
TCA_FLOWER_KEY_IPV4_DST_MASK, /* be32 */
|
|
TCA_FLOWER_KEY_IPV6_SRC, /* struct in6_addr */
|
|
TCA_FLOWER_KEY_IPV6_SRC_MASK, /* struct in6_addr */
|
|
TCA_FLOWER_KEY_IPV6_DST, /* struct in6_addr */
|
|
TCA_FLOWER_KEY_IPV6_DST_MASK, /* struct in6_addr */
|
|
TCA_FLOWER_KEY_TCP_SRC, /* be16 */
|
|
TCA_FLOWER_KEY_TCP_DST, /* be16 */
|
|
TCA_FLOWER_KEY_UDP_SRC, /* be16 */
|
|
TCA_FLOWER_KEY_UDP_DST, /* be16 */
|
|
|
|
TCA_FLOWER_FLAGS,
|
|
TCA_FLOWER_KEY_VLAN_ID, /* be16 */
|
|
TCA_FLOWER_KEY_VLAN_PRIO, /* u8 */
|
|
TCA_FLOWER_KEY_VLAN_ETH_TYPE, /* be16 */
|
|
|
|
TCA_FLOWER_KEY_ENC_KEY_ID, /* be32 */
|
|
TCA_FLOWER_KEY_ENC_IPV4_SRC, /* be32 */
|
|
TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK,/* be32 */
|
|
TCA_FLOWER_KEY_ENC_IPV4_DST, /* be32 */
|
|
TCA_FLOWER_KEY_ENC_IPV4_DST_MASK,/* be32 */
|
|
TCA_FLOWER_KEY_ENC_IPV6_SRC, /* struct in6_addr */
|
|
TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK,/* struct in6_addr */
|
|
TCA_FLOWER_KEY_ENC_IPV6_DST, /* struct in6_addr */
|
|
TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */
|
|
|
|
TCA_FLOWER_KEY_TCP_SRC_MASK, /* be16 */
|
|
TCA_FLOWER_KEY_TCP_DST_MASK, /* be16 */
|
|
TCA_FLOWER_KEY_UDP_SRC_MASK, /* be16 */
|
|
TCA_FLOWER_KEY_UDP_DST_MASK, /* be16 */
|
|
TCA_FLOWER_KEY_SCTP_SRC_MASK, /* be16 */
|
|
TCA_FLOWER_KEY_SCTP_DST_MASK, /* be16 */
|
|
|
|
TCA_FLOWER_KEY_SCTP_SRC, /* be16 */
|
|
TCA_FLOWER_KEY_SCTP_DST, /* be16 */
|
|
|
|
TCA_FLOWER_KEY_ENC_UDP_SRC_PORT, /* be16 */
|
|
TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK, /* be16 */
|
|
TCA_FLOWER_KEY_ENC_UDP_DST_PORT, /* be16 */
|
|
TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK, /* be16 */
|
|
|
|
TCA_FLOWER_KEY_FLAGS, /* be32 */
|
|
TCA_FLOWER_KEY_FLAGS_MASK, /* be32 */
|
|
|
|
TCA_FLOWER_KEY_ICMPV4_CODE, /* u8 */
|
|
TCA_FLOWER_KEY_ICMPV4_CODE_MASK,/* u8 */
|
|
TCA_FLOWER_KEY_ICMPV4_TYPE, /* u8 */
|
|
TCA_FLOWER_KEY_ICMPV4_TYPE_MASK,/* u8 */
|
|
TCA_FLOWER_KEY_ICMPV6_CODE, /* u8 */
|
|
TCA_FLOWER_KEY_ICMPV6_CODE_MASK,/* u8 */
|
|
TCA_FLOWER_KEY_ICMPV6_TYPE, /* u8 */
|
|
TCA_FLOWER_KEY_ICMPV6_TYPE_MASK,/* u8 */
|
|
|
|
TCA_FLOWER_KEY_ARP_SIP, /* be32 */
|
|
TCA_FLOWER_KEY_ARP_SIP_MASK, /* be32 */
|
|
TCA_FLOWER_KEY_ARP_TIP, /* be32 */
|
|
TCA_FLOWER_KEY_ARP_TIP_MASK, /* be32 */
|
|
TCA_FLOWER_KEY_ARP_OP, /* u8 */
|
|
TCA_FLOWER_KEY_ARP_OP_MASK, /* u8 */
|
|
TCA_FLOWER_KEY_ARP_SHA, /* ETH_ALEN */
|
|
TCA_FLOWER_KEY_ARP_SHA_MASK, /* ETH_ALEN */
|
|
TCA_FLOWER_KEY_ARP_THA, /* ETH_ALEN */
|
|
TCA_FLOWER_KEY_ARP_THA_MASK, /* ETH_ALEN */
|
|
|
|
TCA_FLOWER_KEY_MPLS_TTL, /* u8 - 8 bits */
|
|
TCA_FLOWER_KEY_MPLS_BOS, /* u8 - 1 bit */
|
|
TCA_FLOWER_KEY_MPLS_TC, /* u8 - 3 bits */
|
|
TCA_FLOWER_KEY_MPLS_LABEL, /* be32 - 20 bits */
|
|
|
|
TCA_FLOWER_KEY_TCP_FLAGS, /* be16 */
|
|
TCA_FLOWER_KEY_TCP_FLAGS_MASK, /* be16 */
|
|
|
|
TCA_FLOWER_KEY_IP_TOS, /* u8 */
|
|
TCA_FLOWER_KEY_IP_TOS_MASK, /* u8 */
|
|
TCA_FLOWER_KEY_IP_TTL, /* u8 */
|
|
TCA_FLOWER_KEY_IP_TTL_MASK, /* u8 */
|
|
|
|
TCA_FLOWER_KEY_CVLAN_ID, /* be16 */
|
|
TCA_FLOWER_KEY_CVLAN_PRIO, /* u8 */
|
|
TCA_FLOWER_KEY_CVLAN_ETH_TYPE, /* be16 */
|
|
|
|
TCA_FLOWER_KEY_ENC_IP_TOS, /* u8 */
|
|
TCA_FLOWER_KEY_ENC_IP_TOS_MASK, /* u8 */
|
|
TCA_FLOWER_KEY_ENC_IP_TTL, /* u8 */
|
|
TCA_FLOWER_KEY_ENC_IP_TTL_MASK, /* u8 */
|
|
|
|
__TCA_FLOWER_MAX,
|
|
};
|
|
|
|
enum {
|
|
TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0),
|
|
TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1),
|
|
};
|
|
|
|
#endif /* __KERNEL__ || !HAVE_TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST */
|
|
|
|
#endif /* __LINUX_PKT_CLS_WRAPPER_H */
|