[dpdk-dev] [PATCH] net/mlx5: fix incorrect L3 layer chosen in TTL action

Suanming Mou suanmingm at mellanox.com
Thu Nov 21 04:31:11 CET 2019


For IPINIP flow, there are two L3 layer match pattern items, the inner
layer follows the outer layer as the latter L3 layer item, the TTL action
handles the outer layer.

Current the outer and inner L3 layers are both regared as the outer L3
layer, it caueses TTL action uses the incorrect latter inner protocal in
flow_dv_convert_action_modify_ttl() for header modifier.

Check former L3 outer layer existence avoid set the incorrect inner layer
to the flow attr.

Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
Cc: dekelp at mellanox.com
Cc: stable at dpdk.org

Signed-off-by: Suanming Mou <suanmingm at mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c402a8d..7cef5d3 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -84,10 +84,18 @@
 	for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
 		switch (item->type) {
 		case RTE_FLOW_ITEM_TYPE_IPV4:
-			attr->ipv4 = 1;
+			/*
+			 * flow_dv_validate() avoids multiple L3 layers case
+			 * other than IPINIP. If attr->ipv6 set, ipv4 should
+			 * be the IPINIP inner layer.
+			 */
+			if (!attr->ipv6)
+				attr->ipv4 = 1;
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV6:
-			attr->ipv6 = 1;
+			/* If ipv4 set, ipv6 is the IPINIP inner layer. */
+			if (!attr->ipv4)
+				attr->ipv6 = 1;
 			break;
 		case RTE_FLOW_ITEM_TYPE_UDP:
 			attr->udp = 1;
-- 
1.8.3.1



More information about the dev mailing list