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 BDB70A0C47 for ; Tue, 10 Aug 2021 17:45:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B49E44014F; Tue, 10 Aug 2021 17:45:31 +0200 (CEST) Received: from smtp-relay-canonical-1.canonical.com (smtp-relay-canonical-1.canonical.com [185.125.188.121]) by mails.dpdk.org (Postfix) with ESMTP id 035AC4014F for ; Tue, 10 Aug 2021 17:45:31 +0200 (CEST) Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id E0C0740328 for ; Tue, 10 Aug 2021 15:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628610330; bh=iGjrwHplb9UbG2+fjmlawS2ZCw/+Oy0aqENuNx1iFa0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nAsKx7ufmsqaAMRZidDnXEg48gfO7aw+n6DSPDEolh/SpLSapghryjwy7fg+Bk07J g9vN4mOtCgcNCjw9X9UIy/xrGzjxNrudWNNp6zqS8S02uDuSpehCnW4OL8eQ2OrLmo s5/2zGLgIGOdg3oHGE9m5d1N4NKuEp8PvCN8JF6PLbs4yqgGReG2hYE77BjUnQA7y7 ErCyHfSMRKjInzP1oax96V0HdrrCa3HfjE30913aKlxzp5d49tOeWR4RMtXLjydNTY v6mewdF1B++eA4K1MdQRwYyCSpipBb9SkL6JIdD8QKWPDA4zDn83vcz8H8+fhorOr9 o+KrHLF2aUZbw== Received: by mail-ej1-f72.google.com with SMTP id ja25-20020a1709079899b02905b2a2bf1a62so1715339ejc.4 for ; Tue, 10 Aug 2021 08:45:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iGjrwHplb9UbG2+fjmlawS2ZCw/+Oy0aqENuNx1iFa0=; b=emREbKCDwMROxPMjDI0GvwB304QYCSDU/TWf08t8N5uKBLr9R5/pmUX0zdNEWeDBC1 1F7CcAOODXMBkbliSbWfMQz0FPLr5nVNvlhIC/jrrNDb+dJpLybvMkTj4w2RlyQl/EgS sRHFzwLN/VweoAo+aGfV9S6Rp4MgbB1diQwj3qyKIDz5iFvxQHvYnjOuC6jgKVnlIubZ JHfGoHt8MBCma5RwKn/Z8abXxxATGJpAzqJi5hwQI0FjB3mUstwAe/GL5R3K06abydYN rDRKAi0tw+t94CuMHFj6IjLj1yjGqtF1Cs3mwmEPHwg4sRbAAqhrwv9BzpPBiRf6vAt5 RJGg== X-Gm-Message-State: AOAM533MfHuwzo1dAUOGlEr9vpkHxrTp5Iy9EMQOHPxerS+amIMcdZ5k vvV/VynoHOSmiMj9nyoVXmuxkkSagGU4NM2k8ScalIJ3IRPxUlnJnYycudcMcF/naza8xC/reGW kcX1om+v0OrmoD1h2hB7/jPE2 X-Received: by 2002:a17:906:4dd5:: with SMTP id f21mr11223771ejw.284.1628610330603; Tue, 10 Aug 2021 08:45:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztOki6fkmf9LvUUTuXOlCA3fFPunTq+GUKf6gp9kHj+e7HFqPOM3PAQGY4yr+gBS4S2xqUCw== X-Received: by 2002:a17:906:4dd5:: with SMTP id f21mr11223754ejw.284.1628610330433; Tue, 10 Aug 2021 08:45:30 -0700 (PDT) Received: from Keschdeichel.fritz.box ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id w20sm317783edu.22.2021.08.10.08.45.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 08:45:30 -0700 (PDT) From: christian.ehrhardt@canonical.com To: Gregory Etelson Cc: Ori Kam , Ajit Khaparde , Xiaoyun Li , Olivier Matz , dpdk stable Date: Tue, 10 Aug 2021 17:40:18 +0200 Message-Id: <20210810154022.749358-98-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810154022.749358-1-christian.ehrhardt@canonical.com> References: <20210810154022.749358-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'app/testpmd: fix Tx checksum calculation for tunnel' has been queued to stable release 19.11.10 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/78626ad00f9e487b8f49fd578dec8f3f6a7e501a Thanks. Christian Ehrhardt --- >From 78626ad00f9e487b8f49fd578dec8f3f6a7e501a Mon Sep 17 00:00:00 2001 From: Gregory Etelson Date: Thu, 29 Jul 2021 20:01:41 +0300 Subject: [PATCH] app/testpmd: fix Tx checksum calculation for tunnel [ upstream commit b2a9e4a855d0e5b4e3fdba5b126bcf00aa8f0ada ] csumonly engine calculates Tx checksum of a tunnelled packet for outer headers only or separately for outer and inner headers. The calculation method is determined by checksum configuration options. If Tx checksum calculation is separated, the inner headers are processed before outer headers. Inner headers processing sets checksum values to 0 unconditionally. If Tx configuration offloads inner checksums only, outer checksum calculation in software will read 0 instead of real values and produce wrong result. The patch zeroes inner checksums only before software calculation. Fixes: 6b520d54ebfe ("app/testpmd: use Tx preparation in checksum engine") Signed-off-by: Gregory Etelson Acked-by: Ori Kam Acked-by: Ajit Khaparde Acked-by: Xiaoyun Li Acked-by: Olivier Matz --- app/test-pmd/csumonly.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 7b92ab1195..7c5d54342b 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -451,17 +451,18 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->ethertype == _htons(RTE_ETHER_TYPE_IPV4)) { ipv4_hdr = l3_hdr; - ipv4_hdr->hdr_checksum = 0; ol_flags |= PKT_TX_IPV4; if (info->l4_proto == IPPROTO_TCP && tso_segsz) { ol_flags |= PKT_TX_IP_CKSUM; } else { - if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) { ol_flags |= PKT_TX_IP_CKSUM; - else + } else if (ipv4_hdr->hdr_checksum != 0) { + ipv4_hdr->hdr_checksum = 0; ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); + } } } else if (info->ethertype == _htons(RTE_ETHER_TYPE_IPV6)) ol_flags |= PKT_TX_IPV6; @@ -472,10 +473,10 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { - udp_hdr->dgram_cksum = 0; - if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) + if (tx_offloads & DEV_TX_OFFLOAD_UDP_CKSUM) { ol_flags |= PKT_TX_UDP_CKSUM; - else { + } else { + udp_hdr->dgram_cksum = 0; udp_hdr->dgram_cksum = get_udptcp_checksum(l3_hdr, udp_hdr, info->ethertype); @@ -485,12 +486,12 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, ol_flags |= PKT_TX_UDP_SEG; } else if (info->l4_proto == IPPROTO_TCP) { tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); - tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; - else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) + else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM) { ol_flags |= PKT_TX_TCP_CKSUM; - else { + } else if (tcp_hdr->cksum != 0) { + tcp_hdr->cksum = 0; tcp_hdr->cksum = get_udptcp_checksum(l3_hdr, tcp_hdr, info->ethertype); @@ -500,13 +501,13 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, } else if (info->l4_proto == IPPROTO_SCTP) { sctp_hdr = (struct rte_sctp_hdr *) ((char *)l3_hdr + info->l3_len); - sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ if ((tx_offloads & DEV_TX_OFFLOAD_SCTP_CKSUM) && ((ipv4_hdr->total_length & 0x3) == 0)) { ol_flags |= PKT_TX_SCTP_CKSUM; - } else { + } else if (sctp_hdr->cksum != 0) { + sctp_hdr->cksum = 0; /* XXX implement CRC32c, example available in * RFC3309 */ } -- 2.32.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-08-10 15:11:16.767684449 +0200 +++ 0098-app-testpmd-fix-Tx-checksum-calculation-for-tunnel.patch 2021-08-10 15:11:13.130638908 +0200 @@ -1 +1 @@ -From b2a9e4a855d0e5b4e3fdba5b126bcf00aa8f0ada Mon Sep 17 00:00:00 2001 +From 78626ad00f9e487b8f49fd578dec8f3f6a7e501a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b2a9e4a855d0e5b4e3fdba5b126bcf00aa8f0ada ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org @@ -32 +33 @@ -index 0161f72175..bd5ad64a57 100644 +index 7b92ab1195..7c5d54342b 100644 @@ -35 +36 @@ -@@ -480,17 +480,18 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, +@@ -451,17 +451,18 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, @@ -57 +58 @@ -@@ -501,10 +502,10 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, +@@ -472,10 +473,10 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, @@ -71 +72 @@ -@@ -514,12 +515,12 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, +@@ -485,12 +486,12 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, @@ -87 +88 @@ -@@ -529,13 +530,13 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, +@@ -500,13 +501,13 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,