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 91955A00DA for ; Thu, 31 Oct 2019 11:11:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5CC2F1C214; Thu, 31 Oct 2019 11:11:09 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 759011C1FE; Thu, 31 Oct 2019 11:11:06 +0100 (CET) From: Xiaoyu Min To: orika@mellanox.com, Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 31 Oct 2019 12:11:02 +0200 Message-Id: X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] app/testpmd: fix IP next proto in set raw decap/encap X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The IP's next protocol will be specified by user when set IP-in-IP tunnel header via set raw decap/encap commands. Currently this field is wrongly set to zero if there is no upper layer. This leads to the encapsulated IP-in-IP tunnel header is not correct. This next protocol field should be leave it as-is if there is no upper layer or value is already set. Fixes: 30626def03d6 ("app/testpmd: support raw encap/decap actions") Cc: stable@dpdk.org Signed-off-by: Xiaoyu Min --- app/test-pmd/cmdline_flow.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 0d0bc0a5b2..d5ad64bc8b 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -5996,11 +5996,13 @@ update_fields(uint8_t *buf, struct rte_flow_item *item, uint16_t next_proto) case RTE_FLOW_ITEM_TYPE_IPV4: ipv4 = (struct rte_flow_item_ipv4 *)buf; ipv4->hdr.version_ihl = 0x45; - ipv4->hdr.next_proto_id = (uint8_t)next_proto; + if (next_proto && ipv4->hdr.next_proto_id == 0) + ipv4->hdr.next_proto_id = (uint8_t)next_proto; break; case RTE_FLOW_ITEM_TYPE_IPV6: ipv6 = (struct rte_flow_item_ipv6 *)buf; - ipv6->hdr.proto = (uint8_t)next_proto; + if (next_proto && ipv6->hdr.proto == 0) + ipv6->hdr.proto = (uint8_t)next_proto; ipv6_vtc_flow = rte_be_to_cpu_32(ipv6->hdr.vtc_flow); ipv6_vtc_flow &= 0x0FFFFFFF; /*< reset version bits. */ ipv6_vtc_flow |= 0x60000000; /*< set ipv6 version. */ @@ -6182,9 +6184,11 @@ cmd_set_raw_parsed(const struct buffer *in) break; case RTE_FLOW_ITEM_TYPE_GRE_KEY: size = sizeof(rte_be32_t); + proto = 0x0; break; case RTE_FLOW_ITEM_TYPE_MPLS: size = sizeof(struct rte_flow_item_mpls); + proto = 0x0; break; case RTE_FLOW_ITEM_TYPE_NVGRE: size = sizeof(struct rte_flow_item_nvgre); -- 2.24.0.rc0.3.g12a4aeaad8