From: Viacheslav Ovsiienko Date: Sun, 13 Jan 2019 14:15:22 +0000 (+0000) Subject: net/mlx5: add TOS and TTL flower match and tunnel keys X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9d6d159a3fa602935f8ac6919865cc9e17ef32e1;p=dpdk.git net/mlx5: add TOS and TTL flower match and tunnel keys This patch is a preparation for adding the type-of-service and time-to-live IP header fields support on E-Switch. There are two types of keys added - one for match pattern, other for tunnel encapsulation header. This issue is critical for some Open VSwitch configuration on overlayed (tunneled) networks, where the tos field can be inherited from outer header to inner header. Signed-off-by: Viacheslav Ovsiienko Acked-by: Shahaf Shuler --- diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 992769dad1..688678ac84 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -385,6 +385,26 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh linux/pkt_cls.h \ enum TCA_FLOWER_KEY_TCP_FLAGS_MASK \ $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_IP_TOS \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_IP_TOS \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_IP_TOS_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_IP_TOS_MASK \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_IP_TTL \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_IP_TTL \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_IP_TTL_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_IP_TTL_MASK \ + $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ HAVE_TC_ACT_GOTO_CHAIN \ linux/pkt_cls.h \ @@ -460,6 +480,26 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh linux/pkt_cls.h \ enum TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK \ $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IP_TOS \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IP_TOS \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IP_TOS_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IP_TOS_MASK \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IP_TTL \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IP_TTL \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IP_TTL_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IP_TTL_MASK \ + $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ HAVE_TC_ACT_TUNNEL_KEY \ linux/tc_act/tc_tunnel_key.h \ @@ -470,6 +510,16 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh linux/tc_act/tc_tunnel_key.h \ enum TCA_TUNNEL_KEY_ENC_DST_PORT \ $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_TUNNEL_KEY_ENC_TOS \ + linux/tc_act/tc_tunnel_key.h \ + enum TCA_TUNNEL_KEY_ENC_TOS \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_TUNNEL_KEY_ENC_TTL \ + linux/tc_act/tc_tunnel_key.h \ + enum TCA_TUNNEL_KEY_ENC_TTL \ + $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ HAVE_TCA_TUNNEL_KEY_NO_CSUM \ linux/tc_act/tc_tunnel_key.h \ diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index 84f2006609..6413cefd06 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -197,6 +197,14 @@ if build 'TCA_FLOWER_KEY_TCP_FLAGS' ], [ 'HAVE_TCA_FLOWER_KEY_TCP_FLAGS_MASK', 'linux/pkt_cls.h', 'TCA_FLOWER_KEY_TCP_FLAGS_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_IP_TOS', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_IP_TOS' ], + [ 'HAVE_TCA_FLOWER_KEY_IP_TOS_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_IP_TOS_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_IP_TTL', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_IP_TTL' ], + [ 'HAVE_TCA_FLOWER_KEY_IP_TTL_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_IP_TTL_MASK' ], [ 'HAVE_TC_ACT_GOTO_CHAIN', 'linux/pkt_cls.h', 'TC_ACT_GOTO_CHAIN' ], [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', @@ -227,10 +235,22 @@ if build 'TCA_FLOWER_KEY_ENC_UDP_DST_PORT' ], [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK', 'linux/pkt_cls.h', 'TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IP_TOS', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IP_TOS' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IP_TOS_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IP_TOS_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IP_TTL', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IP_TTL' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IP_TTL_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IP_TTL_MASK' ], [ 'HAVE_TC_ACT_TUNNEL_KEY', 'linux/tc_act/tc_tunnel_key.h', 'TCA_ACT_TUNNEL_KEY' ], [ 'HAVE_TCA_TUNNEL_KEY_ENC_DST_PORT', 'linux/tc_act/tc_tunnel_key.h', 'TCA_TUNNEL_KEY_ENC_DST_PORT' ], + [ 'HAVE_TCA_TUNNEL_KEY_ENC_TOS', 'linux/tc_act/tc_tunnel_key.h', + 'TCA_TUNNEL_KEY_ENC_TOS' ], + [ 'HAVE_TCA_TUNNEL_KEY_ENC_TTL', 'linux/tc_act/tc_tunnel_key.h', + 'TCA_TUNNEL_KEY_ENC_TTL' ], [ 'HAVE_TCA_TUNNEL_KEY_NO_CSUM', 'linux/tc_act/tc_tunnel_key.h', 'TCA_TUNNEL_KEY_NO_CSUM' ], [ 'HAVE_TC_ACT_PEDIT', 'linux/tc_act/tc_pedit.h', diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index c7adbdf8c2..f06f5d5cf9 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -125,6 +125,14 @@ struct tc_pedit_sel { #define TCA_TUNNEL_KEY_NO_CSUM 10 #endif +#ifndef HAVE_TCA_TUNNEL_KEY_ENC_TOS +#define TCA_TUNNEL_KEY_ENC_TOS 12 +#endif + +#ifndef HAVE_TCA_TUNNEL_KEY_ENC_TTL +#define TCA_TUNNEL_KEY_ENC_TTL 13 +#endif + #else /* HAVE_TC_ACT_TUNNEL_KEY */ #define TCA_ACT_TUNNEL_KEY 17 @@ -138,6 +146,8 @@ struct tc_pedit_sel { #define TCA_TUNNEL_KEY_ENC_KEY_ID 7 #define TCA_TUNNEL_KEY_ENC_DST_PORT 9 #define TCA_TUNNEL_KEY_NO_CSUM 10 +#define TCA_TUNNEL_KEY_ENC_TOS 12 +#define TCA_TUNNEL_KEY_ENC_TTL 13 struct tc_tunnel_key { tc_gen; @@ -292,6 +302,31 @@ struct tc_tunnel_key { #ifndef HAVE_TCA_FLOWER_KEY_TCP_FLAGS_MASK #define TCA_FLOWER_KEY_TCP_FLAGS_MASK 72 #endif +#ifndef HAVE_TCA_FLOWER_KEY_IP_TOS +#define TCA_FLOWER_KEY_IP_TOS 73 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_IP_TOS_MASK +#define TCA_FLOWER_KEY_IP_TOS_MASK 74 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_IP_TTL +#define TCA_FLOWER_KEY_IP_TTL 75 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_IP_TTL_MASK +#define TCA_FLOWER_KEY_IP_TTL_MASK 76 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IP_TOS +#define TCA_FLOWER_KEY_ENC_IP_TOS 80 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IP_TOS_MASK +#define TCA_FLOWER_KEY_ENC_IP_TOS_MASK 81 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IP_TTL +#define TCA_FLOWER_KEY_ENC_IP_TTL 82 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IP_TTL_MASK +#define TCA_FLOWER_KEY_ENC_IP_TTL_MASK 83 +#endif + #ifndef HAVE_TC_ACT_GOTO_CHAIN #define TC_ACT_GOTO_CHAIN 0x20000000 #endif