From patchwork Tue Dec 4 13:52:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dekel Peled X-Patchwork-Id: 48521 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7C5D61B39C; Tue, 4 Dec 2018 14:54:22 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id D6E0A1B399 for ; Tue, 4 Dec 2018 14:54:20 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 4 Dec 2018 16:00:16 +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 wB4DsGK0024878; Tue, 4 Dec 2018 15:54:16 +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:52:02 +0200 Message-Id: <1543931522-58709-1-git-send-email-dekelp@mellanox.com> X-Mailer: git-send-email 1.7.1 Subject: [dpdk-dev] [PATCH] app/testpmd: fix MPLSoGRE 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In function cmd_set_mplsogre_encap_parsed(), MPLS label value was set in mplsogre_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 mplsogre_encap_conf struct, so it is correctly copied to rte_flow_item_mpls struct. Fixes: 3e77031be855 ("app/testpmd: add MPLSoGRE encapsulation") Cc: orika@mellanox.com Signed-off-by: Dekel Peled Acked-by: Ori Kam --- 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 8630be6..3ddc3e0 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -15567,10 +15567,9 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, struct cmd_set_mplsogre_encap_result *res = parsed_result; union { uint32_t mplsogre_label; - uint8_t label[3]; + uint8_t label[4]; } id = { - .mplsogre_label = - rte_cpu_to_be_32(res->label) & RTE_BE32(0x00ffffff), + .mplsogre_label = rte_cpu_to_be_32(res->label<<12), }; if (strcmp(res->mplsogre, "mplsogre_encap") == 0) @@ -15583,7 +15582,7 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, mplsogre_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(mplsogre_encap_conf.label, &id.label[1], 3); + rte_memcpy(mplsogre_encap_conf.label, &id.label, 3); if (mplsogre_encap_conf.select_ipv4) { IPV4_ADDR_TO_UINT(res->ip_src, mplsogre_encap_conf.ipv4_src); IPV4_ADDR_TO_UINT(res->ip_dst, mplsogre_encap_conf.ipv4_dst);