From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB437A04C1; Thu, 21 Nov 2019 13:09:45 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 830B02BAE; Thu, 21 Nov 2019 13:09:45 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id AD5812BA3; Thu, 21 Nov 2019 13:09:43 +0100 (CET) From: Suanming Mou To: dev@dpdk.org Cc: dekelp@mellanox.com, stable@dpdk.org Date: Thu, 21 Nov 2019 14:09:30 +0200 Message-Id: <1574338170-167657-1-git-send-email-suanmingm@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1574307071-152513-1-git-send-email-suanmingm@mellanox.com> References: <1574307071-152513-1-git-send-email-suanmingm@mellanox.com> Subject: [dpdk-dev] [PATCH v2] net/mlx5: fix incorrect L3/L4 layer chosen with tunnel X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" For tunnel mode, there maybe two L3/L4 layer match pattern items, the inner layer follows the outer layer as the latter layer item, the TTL and port modify actions should handle the outermost layer. Current the outer and inner L3/L4 layers are both regared as the outer layer in flow_dv_attr_init(), it caueses actions may use the incorrect latter inner protocal for header modifier. Check former L3/L4 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@mellanox.com Cc: stable@dpdk.org Signed-off-by: Suanming Mou --- v2: * Add L4 layer check. --- drivers/net/mlx5/mlx5_flow_dv.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index c402a8d..688291f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -73,6 +73,9 @@ /** * Initialize flow attributes structure according to flow items' types. * + * flow_dv_validate() avoids multiple L3/L4 layers cases other than tunnel + * mode. For tunnel mode, the items to be modified are the outermost ones. + * * @param[in] item * Pointer to item specification. * @param[out] attr @@ -84,16 +87,20 @@ for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { switch (item->type) { case RTE_FLOW_ITEM_TYPE_IPV4: - attr->ipv4 = 1; + if (!attr->ipv6) + attr->ipv4 = 1; break; case RTE_FLOW_ITEM_TYPE_IPV6: - attr->ipv6 = 1; + if (!attr->ipv4) + attr->ipv6 = 1; break; case RTE_FLOW_ITEM_TYPE_UDP: - attr->udp = 1; + if (!attr->tcp) + attr->udp = 1; break; case RTE_FLOW_ITEM_TYPE_TCP: - attr->tcp = 1; + if (!attr->udp) + attr->tcp = 1; break; default: break; -- 1.8.3.1