[1/4] net/mlx5: add tos and ttl flower match and tunnel keys

Message ID 1546109501-24865-2-git-send-email-viacheslavo@mellanox.com
State Deferred
Delegated to: Shahaf Shuler
Headers show
Series
  • net/mlx5: add tos and ttl flower match and tunnel keys
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Viacheslav Ovsiienko Dec. 29, 2018, 6:51 p.m.
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 <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/Makefile        | 50 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/mlx5/meson.build     | 20 ++++++++++++++++
 drivers/net/mlx5/mlx5_flow_tcf.c | 35 ++++++++++++++++++++++++++++
 3 files changed, 105 insertions(+)

Patch

diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 895cdfe..6246f49 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -373,6 +373,26 @@  mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
 		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 \
 		define TC_ACT_GOTO_CHAIN \
@@ -448,6 +468,26 @@  mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
 		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 \
 		define TCA_ACT_TUNNEL_KEY \
@@ -458,6 +498,16 @@  mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
 		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 \
 		enum TCA_TUNNEL_KEY_NO_CSUM \
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index 28938db..d64ae1b 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -192,6 +192,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',
@@ -222,10 +230,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 9e5d947..87585ed 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