From patchwork Thu Jul 4 07:33:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saleh Alsouqi X-Patchwork-Id: 56068 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 2F61C1B950; Thu, 4 Jul 2019 09:33:24 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70079.outbound.protection.outlook.com [40.107.7.79]) by dpdk.org (Postfix) with ESMTP id 3664B5B34; Thu, 4 Jul 2019 09:33:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6BIrmHRXaWlLD9xNfQi2KZ0y8IQMWZEOVt4Ny+wr66E=; b=qb+UZ9IkYjoNxrqPp0ZInBQvKGIqA4JGEuB8FnpKADZ0F19GJ9lYcsCZA2Tkwlr+z4DA5iFBZVuLbNxNh/tqXJTSF5tvJUlLj5UWwOaBsJcnZZgT2uSBFtMBfLqdJtRQ+TGlFI07DBXUwuUCJNzAn45x6oBkKpdyvWPQmlTl2+0= Received: from DB7PR05MB5479.eurprd05.prod.outlook.com (20.177.192.84) by DB7PR05MB5177.eurprd05.prod.outlook.com (20.178.41.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.20; Thu, 4 Jul 2019 07:33:20 +0000 Received: from DB7PR05MB5479.eurprd05.prod.outlook.com ([fe80::484b:f910:ee4f:e95e]) by DB7PR05MB5479.eurprd05.prod.outlook.com ([fe80::484b:f910:ee4f:e95e%2]) with mapi id 15.20.2032.019; Thu, 4 Jul 2019 07:33:19 +0000 From: Saleh Alsouqi To: "ferruh.yigit@intel.com" , "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" , Saleh Alsouqi Thread-Topic: [PATCH v3 1/2] librte_net/rte_ip: define ipv4 ihl and vhl Thread-Index: AQHVMjrAFxAZeOX2W0aFpu2shL8G5w== Date: Thu, 4 Jul 2019 07:33:19 +0000 Message-ID: <1562225578-5818-2-git-send-email-salehals@mellanox.com> References: <1545136604-22816-1-git-send-email-salehals@mellanox.com> <1562225578-5818-1-git-send-email-salehals@mellanox.com> In-Reply-To: <1562225578-5818-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 2.7.4 x-clientproxiedby: VI1PR06CA0159.eurprd06.prod.outlook.com (2603:10a6:803:c8::16) To DB7PR05MB5479.eurprd05.prod.outlook.com (2603:10a6:10:59::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-ms-office365-filtering-correlation-id: cd5ab297-2d1b-437d-1bf5-08d70051e28a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB7PR05MB5177; x-ms-traffictypediagnostic: DB7PR05MB5177: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0088C92887 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(366004)(376002)(346002)(39860400002)(396003)(199004)(189003)(476003)(2906002)(66066001)(66476007)(486006)(99286004)(81156014)(81166006)(8676002)(446003)(6506007)(64756008)(66446008)(73956011)(6436002)(6306002)(76176011)(3846002)(305945005)(25786009)(102836004)(7736002)(2616005)(4326008)(11346002)(8936002)(66946007)(66556008)(386003)(6116002)(68736007)(186003)(54906003)(50226002)(5660300002)(14454004)(53936002)(107886003)(6512007)(26005)(2501003)(86362001)(110136005)(316002)(71200400001)(71190400001)(256004)(52116002)(6486002)(478600001)(66574012)(36756003)(966005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB5177; H:DB7PR05MB5479.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: mCH1J5HtPzWqEChbnxu+wKfUjnf42ZrtJihmLHvS2XV16qu1dCF5h0SG+cd5WhB2zNl7Az8QDEcuwyIV/I4pTjkEa8dd4Vb9E5qS4fGxqFLh9m+oi2VStPa+ExwExQ5aRVcqRhs3Qf8gioI6ZgMSMTvA1MRujCo2JqsSOBP0KXp+HNG1oTd93ilJOKrbzf7xW5CGko+vlsK7JvRpcJiD3XcFWmHCKVTM5eeJ/y4CxUtJ8WlejlJjTqipgyOwQacvjAXTcuHCUg90lQJU2wNIAwhl0sfM0qE+CAaZNZeOOVmnXiROtfOSGWUr+KxkVGrit/WsU308pLQAbV3xS0Bt6Xsini8PLQ/f1YxYvACuyiaf6RqH6GDKEY8aaKXZmuK/cmT7QWHehpsKQp0ihN0m6hzrVwxTm5bPGA224ASyz/A= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd5ab297-2d1b-437d-1bf5-08d70051e28a X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jul 2019 07:33:19.8572 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: salehals@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5177 Subject: [dpdk-dev] [PATCH v3 1/2] librte_net/rte_ip: define ipv4 ihl and vhl 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" Define IPv4 Minimum IHL and VHL according to 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." [1] https://tools.ietf.org/html/rfc791 Signed-off-by: Saleh AlSouqi --- lib/librte_net/rte_ip.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index e69b863..26b089e 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -16,7 +16,9 @@ */ #include +#include #include +#include #include #include @@ -96,6 +98,10 @@ struct rte_ipv4_hdr { ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ +/* IPv4 default fields values */ +#define RTE_IPV4_MIN_IHL (0x5) +#define RTE_IPV4_VHL_DEF (IPVERSION | RTE_IPV4_MIN_IHL) + /** * @internal Calculate a sum of all words in the buffer. * Helper routine for the rte_raw_cksum(). From patchwork Thu Jul 4 07:33:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saleh Alsouqi X-Patchwork-Id: 56069 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 3848D1B956; Thu, 4 Jul 2019 09:33:26 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00077.outbound.protection.outlook.com [40.107.0.77]) by dpdk.org (Postfix) with ESMTP id A28A81B946; Thu, 4 Jul 2019 09:33:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XXrpWFxInoOXeJkkjXLgP6kPIUu45KuhQJVTZR5aU6M=; b=q5JkXXg5z1tH63tbsKBkQDrlfDKptvVVv9jz2ifN4u+hu6JGnIhZpCNv7g//4l1MFa+o75VtNhiA68JVkOjAajRAkEKNafRgnszBgThz1yhL8Vy57VkftaD2N6G5M4+dbgT7SEaY1VnUEjU1VpuFlQUlkE15An/5rdMUjG9KAws= Received: from DB7PR05MB5479.eurprd05.prod.outlook.com (20.177.192.84) by DB7PR05MB4971.eurprd05.prod.outlook.com (20.176.236.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.20; Thu, 4 Jul 2019 07:33:22 +0000 Received: from DB7PR05MB5479.eurprd05.prod.outlook.com ([fe80::484b:f910:ee4f:e95e]) by DB7PR05MB5479.eurprd05.prod.outlook.com ([fe80::484b:f910:ee4f:e95e%2]) with mapi id 15.20.2032.019; Thu, 4 Jul 2019 07:33:22 +0000 From: Saleh Alsouqi To: "ferruh.yigit@intel.com" , "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" , Saleh Alsouqi Thread-Topic: [PATCH v3 2/2] app/testpmd: fix mpls ipv4 encap fields Thread-Index: AQHVMjrClillg/nZJUOVsIvujCSNLA== Date: Thu, 4 Jul 2019 07:33:22 +0000 Message-ID: <1562225578-5818-3-git-send-email-salehals@mellanox.com> References: <1545136604-22816-1-git-send-email-salehals@mellanox.com> <1562225578-5818-1-git-send-email-salehals@mellanox.com> In-Reply-To: <1562225578-5818-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 2.7.4 x-clientproxiedby: VI1PR06CA0159.eurprd06.prod.outlook.com (2603:10a6:803:c8::16) To DB7PR05MB5479.eurprd05.prod.outlook.com (2603:10a6:10:59::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-ms-office365-filtering-correlation-id: 783a3341-94f2-4062-db62-08d70051e3fa x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB7PR05MB4971; x-ms-traffictypediagnostic: DB7PR05MB4971: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3513; x-forefront-prvs: 0088C92887 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(39860400002)(346002)(366004)(396003)(136003)(189003)(199004)(2616005)(476003)(305945005)(486006)(386003)(7736002)(6506007)(102836004)(81156014)(81166006)(256004)(8676002)(71190400001)(71200400001)(2501003)(8936002)(66946007)(66446008)(64756008)(66556008)(66476007)(6436002)(73956011)(6486002)(68736007)(3846002)(6116002)(99286004)(110136005)(54906003)(50226002)(316002)(186003)(2906002)(53936002)(5660300002)(4326008)(66066001)(86362001)(36756003)(107886003)(76176011)(11346002)(446003)(14454004)(26005)(52116002)(6512007)(25786009)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4971; H:DB7PR05MB5479.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: E2D3kweeC/6ir4d+9UbNEfJbiAQrkqlEBsEAJ747whagS9Fy4wJl+c+fMr5OZvGh6GgHhlXAHTqkBG9oCtrbU5Y2DKn7AjlK/VGaJOMsqEHY0t5vOWoO4OZTzN/ZFBsx2+1Ryn+DNOzvFrVpiMcT+U9JR4KHL6fSetiFY30qeUiDJ8pYYs9UkeMRVPfCMlVZXZx864CG6OxqLi6T7QvpVsZkX3rf+jF3KbbqKK62ImWuEWy0TQ1TvK/UspZeeXCHbzQYDbI9hOXIsf9sBpH+oo/uyQVVHiLdpPAGtkC3WGsEYSgG1x2OzVMQwZNh9Rzt/m8PxF19oUmh1DWoMkjmPxdLq2+rDCXDXyk7IzuBkVG1i93DA67JUJCdtBDcEqpoksuYOykPQB3qs1tIzvz6RLQzWgF4bDIoD/Cizc1A65U= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 783a3341-94f2-4062-db62-08d70051e3fa X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jul 2019 07:33:22.4217 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: salehals@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4971 Subject: [dpdk-dev] [PATCH v3 2/2] app/testpmd: fix mpls ipv4 encap fields 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" 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 defined in librte_net/rte_ip.h. 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index e644efa..4e5fa7a 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3878,11 +3878,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 = RTE_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 = { @@ -4066,11 +4069,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 = RTE_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 = {