From patchwork Tue Dec 18 12:36:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Saleh Alsouqi X-Patchwork-Id: 49079 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 1E5971B597; Tue, 18 Dec 2018 13:36:57 +0100 (CET) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50060.outbound.protection.outlook.com [40.107.5.60]) by dpdk.org (Postfix) with ESMTP id DAA011B479; Tue, 18 Dec 2018 13:36:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VI3dfZkURvMfIGGxEPpF649aTcGFSIYtHsD80XAHUXM=; b=owt5a6JKRqVvNUtzBzwoGGVIqxyR9kH0X664ozjbI4xn3DZ1KeOmNqCbIngeAKzej0k5yjo6PHWAKQbvh/UmmBTTOC3QdRVBLBtxpEIgw1GiE+HzV4qsZTQXEeV4N0s9oLcT4Scj/4WW2PKy0EwrC+zjidyscvk+kOA/nQfXO98= Received: from AM5PR0501MB2369.eurprd05.prod.outlook.com (10.169.149.20) by AM5PR0501MB2145.eurprd05.prod.outlook.com (10.167.215.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.19; Tue, 18 Dec 2018 12:36:54 +0000 Received: from AM5PR0501MB2369.eurprd05.prod.outlook.com ([fe80::11c9:75f5:9beb:9b65]) by AM5PR0501MB2369.eurprd05.prod.outlook.com ([fe80::11c9:75f5:9beb:9b65%5]) with mapi id 15.20.1425.023; Tue, 18 Dec 2018 12:36:54 +0000 From: Saleh Alsouqi To: "wenzhuo.lu@intel.com" , "jingjing.wu@intel.com" , "bernard.iremonger@intel.com" CC: "dev@dpdk.org" , Ori Kam , "stable@dpdk.org" Thread-Topic: [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl Thread-Index: AQHUls5bP7xxJuhT702gv6MDP1VABg== Date: Tue, 18 Dec 2018 12:36:54 +0000 Message-ID: <1545136604-22816-1-git-send-email-salehals@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 1.8.3.1 x-clientproxiedby: LNXP265CA0087.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::27) To AM5PR0501MB2369.eurprd05.prod.outlook.com (2603:10a6:203:9::20) authentication-results: spf=none (sender IP is ) smtp.mailfrom=salehals@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM5PR0501MB2145; 6:GBJ5thRUIUzhRO7KrTAI/gSMrszUjUnkq0ZkL4OgQbe9AgF3KthIRIJAtZKD8/jXCILkKr3MzWzeB7huy66FJHl3pfvTdCmBNq5a0MnJD0gTnz8C5XKBnE7Ap9NuAswBtFfenCt2pP9QMDwLv/ZChCIOIJVjjD4x750eMCJF5HUyneTI8i5ucwgioN9Ks5qe6YiBt9tr8WGsyI7xQqFzkBHG3lfknOJT60eBu2/iN8jNmoVNAR8nndPM8qlTi2go8wxM6RilqRBWQC48XsBLnHy2Itx1/2CQaN9GKvT+cydHl+X1/GTozHzVgU7jp2BKVAtR4N8GMLIKLYg1AB96OtJtfYj0dujVBCkfZYwD/v6bJOGBdxkfl6kIK3dPYTeUGDLCXzUlUhxo3mVTJU4zNGrIItNvlZsyuKsZ21dyKC+sWNnQJe4xjXJ1JPSDXb1kId1K/cO9avamgg5MYVPcdPrEIja9Rcyzy5AKavo+4b8=; 5:RoHW99P8vHEchHEKu3UOuFuwVWQ6cOlAPAcfFW67oYwsf+BzANksk1NXjn/2Pxl2ytVj191caNcN2oSlvpbS0pGZh7YAv8KEY2/W2PWb+ng0lEjpdnoKInIckHKqGanJJpdcdHQjn5Q1akfZZamCWonJHqj1+bn12NrVG22HXc8=; 7:Qt1iWAAkxDJW81MaNLLdl9SvnbtR6L8KbHj6G7dwffcVq4jBPDy9lGx20vfeaQO4eoenoYfVBmNJ5gSABs4lO/lWUuFBfaO/K8iwnCWRW7bam3PpLBgWvw0f5aHv3SUZIi6+nJHzedXejHQB1IYBSA== x-ms-office365-filtering-correlation-id: 5939ec2e-20bb-427d-1c9b-08d664e57deb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM5PR0501MB2145; x-ms-traffictypediagnostic: AM5PR0501MB2145: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(999002)(5005020)(6040522)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93001095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0501MB2145; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0501MB2145; x-forefront-prvs: 08902E536D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(396003)(39860400002)(366004)(199004)(189003)(305945005)(7736002)(186003)(486006)(6306002)(2616005)(476003)(66066001)(6512007)(53936002)(256004)(4720700003)(86362001)(5660300001)(2501003)(6436002)(71190400001)(71200400001)(2201001)(6486002)(68736007)(66574012)(14454004)(316002)(8936002)(36756003)(25786009)(110136005)(97736004)(4326008)(478600001)(966005)(105586002)(99286004)(2906002)(6506007)(386003)(52116002)(6116002)(3846002)(26005)(102836004)(54906003)(50226002)(106356001)(8676002)(81166006)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0501MB2145; H:AM5PR0501MB2369.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 3BUDfK6880kditqjUIZ3ZK2J8vPh3b2EPhSCu0N/Giodn7HT0A6yEgh6aj0MVJWY94jcxm7ii9r+C3Wz9z4DcGmhWRJe56lESInHaS+CgPu7hy5j0k1uGD/+3cEcp3Ncru94ehqv2RbgCKM+kukS+KKMlvzhCFl+SfmflmS/bW2/lyKDM/fzWLEWNE4OUkXWo5vFVtmRBclSuPsyuXIf7UWo8UKfqA4hlbtsS4s9E5ouYjJ497YA7VA3OFXEiPuGry+toJg84Xfyx1H0aGhakVkWm0/y7KxTjpjhNPq7vB3uyEM/osGu4t0fl/zojotU spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <7CFFF87D0A8151499E4F0E5E54A874FD@eurprd05.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5939ec2e-20bb-427d-1c9b-08d664e57deb X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2018 12:36:54.6102 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0501MB2145 Subject: [dpdk-dev] [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl 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" According to ietf rfc791 (see [1]) "The Version field indicates the format of the internet header."     "Internet Header Length (ihl) is the length of the     internet header in 32 bit words, and thus points     to the beginning of the data. Note that     the minimum value for a correct header is 5." Having version and ihl set to 0 would result in a corrupted/incorrect encapsulating packet for MPLS, this commit sets these fields to 4 and 5 respectively as a default value. [1] https://tools.ietf.org/html/rfc791 Fixes: 3e77031be855 ("app/testpmd: add MPLSoGRE encapsulation") Fixes: a1191d39cb57 ("app/testpmd: add MPLSoUDP encapsulation") Cc: stable@dpdk.org Signed-off-by: Saleh Alsouqi --- app/test-pmd/cmdline_flow.c | 2 ++ app/test-pmd/testpmd.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 5c0108f..c1c5fe3 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3735,6 +3735,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, .src_addr = mplsogre_encap_conf.ipv4_src, .dst_addr = mplsogre_encap_conf.ipv4_dst, .next_proto_id = IPPROTO_GRE, + .version_ihl = IPV4_VHL_DEF, }, }; struct rte_flow_item_ipv6 ipv6 = { @@ -3923,6 +3924,7 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, .src_addr = mplsoudp_encap_conf.ipv4_src, .dst_addr = mplsoudp_encap_conf.ipv4_dst, .next_proto_id = IPPROTO_UDP, + .version_ihl = IPV4_VHL_DEF, }, }; struct rte_flow_item_ipv6 ipv6 = { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3ff11e6..8b0654f 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -22,6 +22,8 @@ #define RTE_PORT_CLOSED (uint16_t)2 #define RTE_PORT_HANDLING (uint16_t)3 +#define IPV4_VHL_DEF (0x40 | 0x5) + /* * It is used to allocate the memory for hash key. * The hash key size is NIC dependent.