From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id B4E551B399 for ; Tue, 4 Dec 2018 14:53:50 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 Dec 2018 15:59:49 +0200 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.128.130.87]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wB4DrnU6024531; Tue, 4 Dec 2018 15:53:49 +0200 From: Dekel Peled To: wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com Cc: dev@dpdk.org, orika@mellanox.com, shahafs@mellanox.com, dekelp@mellanox.com Date: Tue, 4 Dec 2018 15:51:33 +0200 Message-Id: <1543931493-58636-1-git-send-email-dekelp@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1542646490-37406-1-git-send-email-dekelp@mellanox.com> References: <1542646490-37406-1-git-send-email-dekelp@mellanox.com> Subject: [dpdk-dev] [PATCH v2] app/testpmd: fix MPLSoUDP encapsulation 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: , X-List-Received-Date: Tue, 04 Dec 2018 13:53:51 -0000 In function cmd_set_mplsoudp_encap_parsed(), MPLS label value was set in mplsoudp_encap_conf struct without the required offset. As a result the value was copied incorrectly into rte_flow_item_mpls struct. This patch sets MPLS label value in appropriate location at mplsoudp_encap_conf struct, so it is correctly copied to rte_flow_item_mpls struct. Fixes: a1191d39cb57 ("app/testpmd: add MPLSoUDP encapsulation") Cc: orika@mellanox.com Signed-off-by: Dekel Peled --- v2: Update code fix and elaborate patch log for clarity. --- --- app/test-pmd/cmdline.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 1275074..8630be6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15804,10 +15804,9 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, struct cmd_set_mplsoudp_encap_result *res = parsed_result; union { uint32_t mplsoudp_label; - uint8_t label[3]; + uint8_t label[4]; } id = { - .mplsoudp_label = - rte_cpu_to_be_32(res->label) & RTE_BE32(0x00ffffff), + .mplsoudp_label = rte_cpu_to_be_32(res->label<<12), }; if (strcmp(res->mplsoudp, "mplsoudp_encap") == 0) @@ -15820,7 +15819,7 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, mplsoudp_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(mplsoudp_encap_conf.label, &id.label[1], 3); + rte_memcpy(mplsoudp_encap_conf.label, &id.label, 3); mplsoudp_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src); mplsoudp_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst); if (mplsoudp_encap_conf.select_ipv4) { -- 1.8.3.1