From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 274F5A00C4 for ; Wed, 16 Feb 2022 13:37:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DD2B4115A; Wed, 16 Feb 2022 13:37:50 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2048.outbound.protection.outlook.com [40.107.93.48]) by mails.dpdk.org (Postfix) with ESMTP id 5A1A540150; Wed, 16 Feb 2022 13:37:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OW7cCZRODA8fWZmggF2V5sQEL6O7jUiOS547NJNSzNXyAUv58YsnEyaSMYs3kp1i9KT+BoXZ0bdoZSDEju1757nQ6DXLarLDcZpZyC4ffalQKxNWx84p/zfK4/H2ZFw4vtk0Ir8V6aKCVPTko5wNcTiFbSwrHKEHizhr5OE1C0Rneloug6Oq/6nVTSAZadA90wssLPvChcj3ouGTKojHjQOWJX+3rts6opRedwIIATac862i2DOzOrDXCD1IlFRA8p1pwzCtEksFJoncaKKmEjDxcf6YFy2yOQlmTNAQdetnSRWwUBTPpGVOxogKWECYs9E1IfYU31UN6u0ZJX90kQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KUQ/MQiyxJg9qJna05NHsCOAsTByzasrk4GCwBepCwA=; b=HKyrvGS0GRzlrPKxbCJ83BL/kGDNZczem4irTx+pTzSvXMnR3/W0YziTui7DtYDdyxQwvHueQOD6Wj8oVXCFYj4eVknMg/jADfulOh2fZeIUe5lS9avADvvpFNWB1PtN6L6lEf+vj/iYKLbJavbNDtxMFLz3XsoS/JvmyD8kNgIYwt6F3P/Bq/taYF/q596iJlu2d5WaJjxWQz/Gw0ihRNslzP7L6r+u4FB+M0guYNngxoQK/e6rguasn3gJrF9xmnq9DT1z1HKS1f5qB5x/pDrMkOznHi5WavzBlWkkarPmlGZFpA6YHP0b2N8NMqOzJiQGN3pixflu0RURYXCrhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KUQ/MQiyxJg9qJna05NHsCOAsTByzasrk4GCwBepCwA=; b=qTOhrs5qyjdUZqdYUQsD9/dEDJhVWIrPM5l+eUGEs7CJkZPOic9oW42VR20F6tnzK4cWqLtAP+PoE5uEFp7QOcPh96bGEHA+b9+7rJb7bOT9rj5trxpj/iTACO2pmKOOBjoJNzfa0ZbvIA0995udNpMRCnaq0PhWB6d9Xpu4M1SiCyZBNiPA1UhMouSZnPaFRu+b0I4JwepUDrecg6hKv6i34fl7cpdxysrDldC+ptLrseB0iSsyFVpe7C5rF6N2fEN/rwj1vXd/iXqf3Wlnbu1IF/jYppZvoh7uXktD8YwZYsqew9aSMAU3K0EctDP2+cukcZUPbQoN5TlhvFWIUQ== Received: from BN9PR03CA0370.namprd03.prod.outlook.com (2603:10b6:408:f7::15) by BN7PR12MB2802.namprd12.prod.outlook.com (2603:10b6:408:25::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Wed, 16 Feb 2022 12:37:45 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f7:cafe::2) by BN9PR03CA0370.outlook.office365.com (2603:10b6:408:f7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18 via Frontend Transport; Wed, 16 Feb 2022 12:37:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4975.11 via Frontend Transport; Wed, 16 Feb 2022 12:37:43 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 16 Feb 2022 12:37:42 +0000 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Wed, 16 Feb 2022 04:37:40 -0800 From: Raja Zidane To: CC: Matan Azrad , Subject: [PATCH V2] app/testpmd: fix GENEVE parsing in csum forward mode Date: Wed, 16 Feb 2022 14:37:32 +0200 Message-ID: <20220216123732.32617-1-rzidane@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20211205034450.7888-1-rzidane@nvidia.com> References: <20211205034450.7888-1-rzidane@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f940b1f-44ce-487e-5697-08d9f14920d4 X-MS-TrafficTypeDiagnostic: BN7PR12MB2802:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0dDW8DPN/5ViXIoDHA2HBaHFYkPsVozRH/icx+lAtKuQ2ukt/beAaP6xhXOe5twat40qmQdfXD+OMnt9AmbhsfOLpnbOGePcnG8faP/tAy2xlO1mRIoHqjhzJGGcIqk/E1SZiLkJlJNes0gagLc5rhVpWlxdHhYyqv0J2aeSfR+IVNq6o1oSbmXtzPcl6V9cQc+0uW7nErC6azNuc82sSXaVl7eSggzhQbMomdbnieFbEGarJS8nBoBDJ/YMBxhm+1Ol6DVxxzHUGlIpX5hs3k5c1NyZmainAu9kqKHsqy7a+ydSH1qUubqh2Vlx9t6TaYndwYsYNU6O5LTe8TbVkcPyyLMk/cJpkNbz+hZHULMQNsbPebPeETgufA9CsyrWzg2iZdO56N0VromM2ybOfuMpU5r5qkYMTFBECAVSIN6RZVmDak626XWpfKJW9K8Bz8ukCRuog7sDpZtywTZ2WtWpEakxsuIAyfcBILAg4TubvYmp62Q3dBAWZBjOXrtJR0/YjJstWcrqViGytWmd7dN9Ap74XrDcNHErPEmin3Uo63XE0THYoOEKRT5N0GfQ89/SD+CdppEOYN8M8TduZ1ur83TYmBRrKSf9EILXpbL6vuOR+ZGcYSb7FsA3nXP7Gqu+QNIWivSWqmplzgG5MuD30+OaLjWg6v2gXknPrHxPpiTCmUYcilXzGBLqeCneYi1rYoWAxqUQvIaxEYp0Wg== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:ErrorRetry; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(55016003)(36860700001)(47076005)(356005)(81166007)(82310400004)(8936002)(6666004)(7696005)(4326008)(336012)(316002)(70586007)(8676002)(70206006)(6286002)(508600001)(426003)(2906002)(16526019)(186003)(450100002)(2616005)(26005)(40460700003)(83380400001)(1076003)(6916009)(54906003)(36756003)(86362001)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 12:37:43.3454 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f940b1f-44ce-487e-5697-08d9f14920d4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2802 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org The csum FWD mode parses any received packet to set mbuf offloads for the transmitting burst, mainly in the checksum/TSO areas. In the case of a tunnel header, the csum FWD tries to detect known tunnels by the standard definition using the header'sdata and fallback to check the packet type in the mbuf to see if the Rx port driver already sign the packet as a tunnel. In the fallback case, the csum assumes the tunnel is VXLAN and parses the tunnel as VXLAN. When the GENEVE tunnel was added to the known tunnels in csum, its parsing trial was wrongly located after the pkt type detection, causing the csum to parse the GENEVE header as VXLAN when the Rx port set the tunnel packet type. Remove the fall back case to VxLan. Log error of unrecognized tunnel if no tunnel was parsed successfully. Fixes: ea0e711b8ae0 ("app/testpmd: add GENEVE parsing") Cc: stable@dpdk.org Signed-off-by: Raja Zidane --- V2: Log error when an unrecognized tunnel is found (unknown UDP dst port), instead of parsing it as VxLan by default. app/test-pmd/csumonly.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 02bc3929c7..210f4263f8 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -255,11 +255,10 @@ parse_gtp(struct rte_udp_hdr *udp_hdr, info->l2_len += RTE_ETHER_GTP_HLEN; } -/* Parse a vxlan header */ +/* Parse a vxlan header. */ static void parse_vxlan(struct rte_udp_hdr *udp_hdr, - struct testpmd_offload_info *info, - uint32_t pkt_type) + struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; @@ -267,8 +266,7 @@ parse_vxlan(struct rte_udp_hdr *udp_hdr, * default vxlan port (rfc7348) or that the rx offload flag is set * (i40e only currently) */ - if (udp_hdr->dst_port != _htons(RTE_VXLAN_DEFAULT_PORT) && - RTE_ETH_IS_TUNNEL_PKT(pkt_type) == 0) + if (udp_hdr->dst_port != _htons(RTE_VXLAN_DEFAULT_PORT)) return; update_tunnel_outer(info); @@ -922,19 +920,24 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) RTE_MBUF_F_TX_TUNNEL_VXLAN_GPE; goto tunnel_update; } - parse_vxlan(udp_hdr, &info, - m->packet_type); + parse_geneve(udp_hdr, &info); if (info.is_tunnel) { tx_ol_flags |= - RTE_MBUF_F_TX_TUNNEL_VXLAN; + RTE_MBUF_F_TX_TUNNEL_GENEVE; goto tunnel_update; } - parse_geneve(udp_hdr, &info); + parse_vxlan(udp_hdr, &info); if (info.is_tunnel) { tx_ol_flags |= - RTE_MBUF_F_TX_TUNNEL_GENEVE; + RTE_MBUF_F_TX_TUNNEL_VXLAN; goto tunnel_update; } + /* Always keep last. */ + if (unlikely(RTE_ETH_IS_TUNNEL_PKT( + m->packet_type) != 0)) { + TESTPMD_LOG(ERR, "Unknown tunnel packet. UDP dst port: %hu", + udp_hdr->dst_port); + } } else if (info.l4_proto == IPPROTO_GRE) { struct simple_gre_hdr *gre_hdr; -- 2.21.0