From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 376B9A05D3 for ; Mon, 25 Mar 2019 14:30:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 83E3A3772; Mon, 25 Mar 2019 14:30:21 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 345663772; Mon, 25 Mar 2019 14:30:18 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 06:30:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,269,1549958400"; d="scan'208";a="310235895" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.46]) ([10.237.221.46]) by orsmga005.jf.intel.com with ESMTP; 25 Mar 2019 06:30:15 -0700 To: Saleh Alsouqi , "roszenrami@gmail.com" Cc: "wenzhuo.lu@intel.com" , "jingjing.wu@intel.com" , "bernard.iremonger@intel.com" , "dev@dpdk.org" , Ori Kam , "stable@dpdk.org" , "olivier.matz@6wind.com" References: <1545136604-22816-1-git-send-email-salehals@mellanox.com> <20190325130013.3737-1-salehals@mellanox.com> From: Ferruh Yigit Openpgp: preference=signencrypt Autocrypt: addr=ferruh.yigit@intel.com; prefer-encrypt=mutual; keydata= mQINBFXZCFABEADCujshBOAaqPZpwShdkzkyGpJ15lmxiSr3jVMqOtQS/sB3FYLT0/d3+bvy qbL9YnlbPyRvZfnP3pXiKwkRoR1RJwEo2BOf6hxdzTmLRtGtwWzI9MwrUPj6n/ldiD58VAGQ +iR1I/z9UBUN/ZMksElA2D7Jgg7vZ78iKwNnd+vLBD6I61kVrZ45Vjo3r+pPOByUBXOUlxp9 GWEKKIr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iMyH1+D7 llafPcK4NYy1Z4AYuVwC9nmLaoj+ozdqS3ncRo57ncRsKEJC46nDJJZYZ5LSJVn63Y3NBF86 lxQAgjj2oyZEwaLKtKbAFsXL43jv1pUGgSvWwYtDwHITXXFQto9rZEuUDRFSx4sg9OR+Q6/6 LY+nQQ3OdHlBkflzYMPcWgDcvcTAO6yasLEUf7UcYoSWTyMYjLB4QuNlXzTswzGVMssJF/vo V8lD1eqqaSUWG3STF6GVLQOr1NLvN5+kUBiEStHFxBpgSCvYY9sNV8FS6N24CAWMBl+10W+D 2h1yiiP5dOdPcBDYKsgqDD91/sP0WdyMJkwdQJtD49f9f+lYloxHnSAxMleOpyscg1pldw+i mPaUY1bmIknLhhkqfMmjywQOXpac5LRMibAAYkcB8v7y3kwELnt8mhqqZy6LUsqcWygNbH/W K3GGt5tRpeIXeJ25x8gg5EBQ0Jnvp/IbBYQfPLtXH0Myq2QuAhk/1q2yEIbVjS+7iowEZNyE 56K63WBJxsJPB2mvmLgn98GqB4G6GufP1ndS0XDti/2K0o8rep9xoY/JDGi0n0L0tk9BHyoP Y7kaEpu7UyY3nVdRLe5H1/MnFG8hdJ97WqnPS0buYZlrbTV0nRFL/NI2VABl18vEEXvNQiO+ vM8= Message-ID: <95f1467d-d93b-db22-2d60-85245fe30620@intel.com> Date: Mon, 25 Mar 2019 13:30:14 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <20190325130013.3737-1-salehals@mellanox.com> Content-Type: text/plain; charset="UTF-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v2] 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" Message-ID: <20190325133014.YN0G_OE8szCGHGBEY8srYIsR8kpLeenoB7eEpi3vsps@z> On 3/25/2019 1:01 PM, Saleh Alsouqi wrote: > 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 > --- > v2: > - Include netinet/ip.h in librte_net/rte_ip.h > to use existing definitions instead of defining > our own. > > - Move definitions from testpmd.h to librte_net/rte_ip.h > --- > app/test-pmd/cmdline_flow.c | 6 ++++++ > lib/librte_net/rte_ip.h | 5 +++++ > 2 files changed, 11 insertions(+) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 36659a64a..f536307c9 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -3767,11 +3767,14 @@ parse_vc_action_mplsogre_encap(struct context *ctx, const struct token *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, > + .time_to_live = IPDEFTTL, > }, > }; > struct rte_flow_item_ipv6 ipv6 = { > .hdr = { > .proto = IPPROTO_GRE, > + .hop_limits = IPDEFTTL, > }, > }; > struct rte_flow_item_gre gre = { > @@ -3955,11 +3958,14 @@ parse_vc_action_mplsoudp_encap(struct context *ctx, const struct token *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, > + .time_to_live = IPDEFTTL, > }, > }; > struct rte_flow_item_ipv6 ipv6 = { > .hdr = { > .proto = IPPROTO_UDP, > + .hop_limits = IPDEFTTL, > }, > }; > struct rte_flow_item_udp udp = { > diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h > index f9b909090..499a2f79c 100644 > --- a/lib/librte_net/rte_ip.h > +++ b/lib/librte_net/rte_ip.h > @@ -17,6 +17,7 @@ > > #include > #include > +#include > > #include > #include > @@ -89,6 +90,10 @@ struct ipv4_hdr { > #define IS_IPV4_MCAST(x) \ > ((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ > > +/* IPv4 default fields values */ > +#define IPV4_MIN_IHL (0x5) > +#define IPV4_VHL_DEF (IPVERSION | IPV4_MIN_IHL) There are existing defines for this [1], since we have one in public header, can you please replace them too, perhaps in two patches, first one introduces this define and replaces old ones, second one fixes the mpls issue? [1] $ git grep VHL | grep define app/test-pmd/csumonly.c:#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) app/test-pmd/flowgen.c:#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) app/test-pmd/txonly.c:#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) app/test/packet_burst_generator.c:#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) examples/tep_termination/vxlan_setup.c:#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) > + > /** > * @internal Calculate a sum of all words in the buffer. > * Helper routine for the rte_raw_cksum(). >