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 CE6C0A0540 for ; Fri, 8 Jul 2022 10:08:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C82AA406B4; Fri, 8 Jul 2022 10:08:38 +0200 (CEST) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id D48B1406B4 for ; Fri, 8 Jul 2022 10:08:37 +0200 (CEST) Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) (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-internal-0.canonical.com (Postfix) with ESMTPS id 3969D3F496 for ; Fri, 8 Jul 2022 08:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1657267717; bh=uyLD6UQ1le2lEsnT1C1jRDYYewNaAf8s4Vk+NL3FYWU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=KmM2niS2M1rituGtDiy9DeNtmYyJ84112MPC1vQFCjy1s9zOYjvsDpds1VxmLHVox 9wdY+5pfJYvmd4d0W1ksjoto9lau6esCokW9qyO2MbSlx5NfEafGPT8UziPKR44gGq 7LDDl1G0a/gzxb1Y/07aOgGh3EgITc/aj/tnCf/E3X35D24ZTCdRc7NPNqRfqxkNPF W3kGEZXCG9LDesBWkUrq1mr1i7w0B9E4x7CqEmqMjvTZ3QvH31lK0aEIS3H79GY+WG Io5XvMztuSFTN+U4+ifl6jh4J+gk1d73YXnViEe2C0zQYsZA8P8qWWyxrawHPH/OhD H22q3rOQQ01aQ== Received: by mail-lf1-f71.google.com with SMTP id br6-20020a056512400600b00482af9d63faso5248331lfb.22 for ; Fri, 08 Jul 2022 01:08:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uyLD6UQ1le2lEsnT1C1jRDYYewNaAf8s4Vk+NL3FYWU=; b=v7YOMBeHKWMTkWdjrZaidzN/vOBoXcRk4Jv17TuBmY6YJ+f9YjMXdGfc3jxiykjI44 cfB1IbPcryCJmuUAaf4YdWTDyKVXKyGlrUz2uVJbC3THITbrPyJ/sZ5nBlAtZq3811ti SIgV502trKwZleTBSAPRx+dvkNPDa1QAkHteNXUZ+gvM/p7X1yie96m7WmnStZUQVYWP eAUOSwIdl35yiM/GxgYYKkL/F0dkeyqZwJxTRRmsYO6MO9E9/K9OV+36GccI5iVcC77+ vlH2pceeidXRRld0M4k1pJFK9jayzTwas/b/PBLhY+J84CGlcqb4EGR26XDlqRghHWea YcVA== X-Gm-Message-State: AJIora+WT3MdqFE9tqH7R96XGE4OdRhzbmnTZiaBkU5jtTzrzKI0jtRI 5hdw4L1TzggXJKcCA+p+HpzLV1Qyq/ri7wvYwahRfz5QRwOGGyqGXIPycaRqdmLLKBxA2Xjyucq hCSzYyD2jN632dgi4566gj4nnF4fAEBzloTxkeX3p X-Received: by 2002:a05:651c:1542:b0:249:a87f:8a34 with SMTP id y2-20020a05651c154200b00249a87f8a34mr1232274ljp.442.1657267715963; Fri, 08 Jul 2022 01:08:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vamwcKpPaOIaEIGurGMXUuvPaNDcHj9G6+jZiWXuG6uzcGqoM3PJWU2gFaEhKZezgF2++I98XxyEtfMJauMAY= X-Received: by 2002:a05:651c:1542:b0:249:a87f:8a34 with SMTP id y2-20020a05651c154200b00249a87f8a34mr1232219ljp.442.1657267714307; Fri, 08 Jul 2022 01:08:34 -0700 (PDT) MIME-Version: 1.0 References: <20220708025343.344065-1-wenwux.ma@intel.com> In-Reply-To: <20220708025343.344065-1-wenwux.ma@intel.com> From: Christian Ehrhardt Date: Fri, 8 Jul 2022 10:08:08 +0200 Message-ID: Subject: Re: [PATCH 19.11] app/testpmd: perform SW IP checksum for GRO/GSO packets To: Wenwu Ma Cc: stable@dpdk.org, Jiayu Hu , Wei Ling , Yuying Zhang Content-Type: text/plain; charset="UTF-8" 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 On Fri, Jul 8, 2022 at 4:58 AM Wenwu Ma wrote: > > upstream commit 1945c64674b2b9ad55af0ef31f8a02ae0b747400 Thank you, applied to the WIP branch for 19.11.13 > The GRO/GSO library doesn't re-calculate checksums for > merged/fragmented packets. If users want the packets to > have correct IP checksums, they should select HW IP > checksum calculation for the port which the packets are > transmitted to. But if the port doesn't support HW IP > checksum, users may perform a SW IP checksum. > > Fixes: b7091f1dcfbc ("app/testpmd: enable the heavyweight mode TCP/IPv4 GRO") > Fixes: 52f38a2055ed ("app/testpmd: enable TCP/IPv4 VxLAN and GRE GSO") > > Signed-off-by: Wenwu Ma > Reviewed-by: Jiayu Hu > Tested-by: Wei Ling > Acked-by: Yuying Zhang > --- > app/test-pmd/csumonly.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c > index 25091de881..117f14451d 100644 > --- a/app/test-pmd/csumonly.c > +++ b/app/test-pmd/csumonly.c > @@ -731,6 +731,26 @@ pkt_copy_split(const struct rte_mbuf *pkt) > return md[0]; > } > > +/* > + * Re-calculate IP checksum for merged/fragmented packets. > + */ > +static void > +pkts_ip_csum_recalc(struct rte_mbuf **pkts_burst, const uint16_t nb_pkts, uint64_t tx_offloads) > +{ > + int i; > + struct rte_ipv4_hdr *ipv4_hdr; > + for (i = 0; i < nb_pkts; i++) { > + if ((pkts_burst[i]->ol_flags & PKT_TX_IPV4) && > + (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) { > + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts_burst[i], > + struct rte_ipv4_hdr *, > + pkts_burst[i]->l2_len); > + ipv4_hdr->hdr_checksum = 0; > + ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); > + } > + } > +} > + > /* > * Receive a burst of packets, and for each packet: > * - parse packet, and try to recognize a supported packet type (1) > @@ -1038,6 +1058,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) > fs->gro_times = 0; > } > } > + > + pkts_ip_csum_recalc(pkts_burst, nb_rx, tx_offloads); > } > > if (gso_ports[fs->tx_port].enable == 0) > @@ -1059,6 +1081,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) > > tx_pkts_burst = gso_segments; > nb_rx = nb_segments; > + > + pkts_ip_csum_recalc(tx_pkts_burst, nb_rx, tx_offloads); > } > > nb_prep = rte_eth_tx_prepare(fs->tx_port, fs->tx_queue, > -- > 2.25.1 > -- Christian Ehrhardt Senior Staff Engineer, Ubuntu Server Canonical Ltd