From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0370BA00C2; Thu, 23 Apr 2020 10:41:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C38881D526; Thu, 23 Apr 2020 10:41:29 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by dpdk.org (Postfix) with ESMTP id 335FF1D513; Thu, 23 Apr 2020 10:41:28 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ltj4xXKz115JEVVQtmFAcQxPsDE7MTKmE84x6LIFhFYnbVK442Ju5FqCgqyBweWUZLDU16XdpUaxZp0G2XCu59X7YUwgo5S4keiF3rBc00Jpt1noyVxeovAzUC9ijtUa1GIhh1+rF+vVpdiFsRxtH5BZ5CQ/Pz7M40Nfr/kUEpRDbig/DzjDyuOIheiW7XFuhkoO61I4cPpiqAeyLDvOgNxMm0pekZJ+m/OeBrgDXfqLow/FTGEezlVfBJE/qy7x/hkbgoLKYvpNdyitzNaPiejKYgrraH390zuI1cweWV28QtGWptoGLA6cpCIokmO/pa+MXZUn752ZTCoU3aO7uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tRQnUce6YFRELngdR/k9WHOic8KLlaOckREVHUgYNPs=; b=FFg4RYTftU+d1/GPmmR9+3JxlnIESIbt/9zMNuxIEh3yQWXN2PQH8V8dmWzdAmfTyHnQmp5at9ajtxTw5g0z9JyZ9D3vftCtGVE/6MFboB+ZMPnxdpX3UmNTZcJ9WHQdXoo1USui7wUn/o1w7arpu1uYavlsDBu7dxWKtOV2ULvLYcPfJZkQiHfAiL+H6Q6q9cC50mnWFgCo+YDxSmepoFYjz4VuRhDtDPmi0qVdgGIxhv8f3hECNtLEtDVYp1RqOoEd+uZzh295dIDnJ6L7e2QcyisYKCQCDVFtuEAZrw7NrTfvITMjremgdwWRSwVhcXN7+LDcaO/lx6VojA/x+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=tRQnUce6YFRELngdR/k9WHOic8KLlaOckREVHUgYNPs=; b=i1WR5b9+PqocttoQbmV9OBk4oTYCU1F3ryg1CLVFEilzZCTiQulwc7BrtgoJEfcfGWPZ10PyAjpOWjnUX0NDKnyXuULSpJoxHlKkLXf2QEX2c6gVNt43hWpmVjkmnl+AoWuj9Z92Wf6huebeudh1dTVfaFvc0zWHUzgzBK6TWxQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) by AM0PR05MB6612.eurprd05.prod.outlook.com (2603:10a6:208:12e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 23 Apr 2020 08:41:25 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::508:747b:cc12:5f6e%6]) with mapi id 15.20.2921.032; Thu, 23 Apr 2020 08:41:25 +0000 From: Raslan Darawsheh To: bernard.iremonger@intel.com, jingjing.wu@intel.com, wenzhuo.lu@intel.com Cc: ferruh.yigit@intel.com, dev@dpdk.org, stable@dpdk.org Date: Thu, 23 Apr 2020 11:41:15 +0300 Message-Id: <1587631275-25710-1-git-send-email-rasland@mellanox.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587396746-409-1-git-send-email-rasland@mellanox.com> References: <1587396746-409-1-git-send-email-rasland@mellanox.com> Content-Type: text/plain X-ClientProxiedBy: PR1PR01CA0033.eurprd01.prod.exchangelabs.com (2603:10a6:102::46) To AM0PR05MB6707.eurprd05.prod.outlook.com (2603:10a6:20b:15b::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by PR1PR01CA0033.eurprd01.prod.exchangelabs.com (2603:10a6:102::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2937.13 via Frontend Transport; Thu, 23 Apr 2020 08:41:24 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dfcae6b1-2650-416e-e0fc-08d7e7621bab X-MS-TrafficTypeDiagnostic: AM0PR05MB6612: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 03827AF76E X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB6707.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(39860400002)(396003)(136003)(346002)(376002)(366004)(186003)(5660300002)(52116002)(8936002)(81156014)(478600001)(55016002)(316002)(36756003)(26005)(7696005)(2906002)(956004)(2616005)(86362001)(16526019)(8886007)(66476007)(4326008)(6666004)(66556008)(66946007)(8676002); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5v6lfxmq98E+Lj7SmxvmZmX2J/HzQPrHYU9CGW49G5btJxll0tvmPGvzyTIDy+GvQ6xma9Gb2he/dH8AizZif9Mb/upQrr8dlm7vWvsqM96G5C7XyTsMoedmGZWMIAlJ/Y3dCE66yU+av/wCgqQscRL3Yf7JpyQ5Ri0Zb4DyzIXX4IlgxH4ay+bha6hdUrYKh9jTrGgoutk0iEksLmL8MFV7haFz9sbCPOjYefwDfFb694lcPd7TCdUdfhWldKKYk9P3wgejTLiHoXV2NkFZQVtRiHWzGiarQ59xNc6pPHCbAOp+goOeqiI9QTHaFE+RlJ2otr4Yc9Q2HggVeE861hzusiP4uQ9pZstslqJefntGXCJuYt1K63UVd5mALvvu7WVaVTd7013cN+irxuHew0MVz/cjp1J1gW7WKKCp4Tm9br7Si0F1ki8QZs98xecL X-MS-Exchange-AntiSpam-MessageData: HzZ0lpttHOP4isdAr0A0Xlkg0ojFEijpGw09GDMMkFvyjvArfTCWIefR2DXY2wWy+rXfA/WM1+evt16MdQT2Wz/C1eGcpUL1vohla6WuMnxg53jqPvdWXBvXzXYVMhRseWjs+UZE5zmdluN3PKuQEg== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: dfcae6b1-2650-416e-e0fc-08d7e7621bab X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2020 08:41:25.5315 (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: a9gJeVSXLiGk0gY1ku6mjG3LmJTa79/4GQ3ZqSTDnGxucjXOBeq2IPPXQJZEuR0qfNXcEuGbT3JneTFZt6O85w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6612 Subject: [dpdk-dev] [PATCH v2] app/testpmd: add parsing for multiple VLAN headers 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" When having multiple VLANs in the packet, parse_ethernet is cabable of parsing only the first vlan. add parsing for mutliple VLAN headers in the packet. Fixes: 51f694dd40f5 ("app/testpmd: rework checksum forward engine") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh Acked-by: Ori Kam Acked-by: Bernard Iremonger --- v2: added QinQ to check for multiple vlan's --- app/test-pmd/csumonly.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index fe19615..8626223 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -139,22 +139,23 @@ parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) /* * Parse an ethernet header to fill the ethertype, l2_len, l3_len and - * ipproto. This function is able to recognize IPv4/IPv6 with one optional vlan - * header. The l4_len argument is only set in case of TCP (useful for TSO). + * ipproto. This function is able to recognize IPv4/IPv6 with optional VLAN + * headers. The l4_len argument is only set in case of TCP (useful for TSO). */ static void parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; + struct rte_vlan_hdr *vlan_hdr; info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; - if (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN)) { - struct rte_vlan_hdr *vlan_hdr = ( - struct rte_vlan_hdr *)(eth_hdr + 1); - + while (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN) || + info->ethertype == _htons(RTE_ETHER_TYPE_QINQ)) { + vlan_hdr = (struct rte_vlan_hdr *) + ((char *)eth_hdr + info->l2_len); info->l2_len += sizeof(struct rte_vlan_hdr); info->ethertype = vlan_hdr->eth_proto; } -- 2.7.4