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 17BECA0032 for ; Thu, 12 May 2022 03:40:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0652E40E64; Thu, 12 May 2022 03:40:31 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 3795E40E64; Thu, 12 May 2022 03:40:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652319629; x=1683855629; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=G9bqkywQalyGoRHzE7g+trP2cejjskMWV2asai12QP4=; b=KJx5XDYyrFJPQ1PP4/GAUeWP741K/BUnGtVF5Dk30MBxWB6AlC6Vp9KV QMxr9LqThZCHRzo3tg8KUznjI7zpEuUHGYBeQ6otqLvedhIhk1LmvRyd8 GpY6hM8i+gFFiMYAQ7/JII0LPKjTc8Ezjo8aQZ6M1n2x3qMY/CYT7VNbH tDaTjRp337y3bT4w5sXjFN1GqjSvWvZ4gVfyos3vaoZa06o2H+WU3emx/ dry+aT/w+BiVdjBqREMZhiutnFgmy1atQAbdgkfShQ8gqp+KLEIT81s2q u2xVFpA8d+07f6/mr9nkC6dx3UPShypsyW8pRUuujVnsHY5/5MbhYhZDm Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="295105456" X-IronPort-AV: E=Sophos;i="5.91,218,1647327600"; d="scan'208";a="295105456" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 18:40:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,218,1647327600"; d="scan'208";a="636646021" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga004.fm.intel.com with ESMTP; 11 May 2022 18:40:28 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 11 May 2022 18:40:26 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 11 May 2022 18:33:45 -0700 Received: from fmsmsx612.amr.corp.intel.com ([10.18.126.92]) by fmsmsx612.amr.corp.intel.com ([10.18.126.92]) with mapi id 15.01.2308.027; Wed, 11 May 2022 18:33:45 -0700 From: "Hu, Jiayu" To: "Ma, WenwuX" , "Li, Xiaoyun" , "Singh, Aman Deep" , "Zhang, Yuying" , "dev@dpdk.org" CC: "Wang, Yinan" , "He, Xingguang" , "stable@dpdk.org" Subject: RE: [PATCH v3] app/testpmd: perform SW IP checksum for GRO/GSO packets Thread-Topic: [PATCH v3] app/testpmd: perform SW IP checksum for GRO/GSO packets Thread-Index: AQHYZZ0mD3XD85Ud3Eab3WBoCnpyUK0adT4A Date: Thu, 12 May 2022 01:33:45 +0000 Message-ID: <1d60747946ec4a60bca8f6916d8a1bb5@intel.com> References: <20220511013705.24602-1-wenwux.ma@intel.com> <20220512010756.29553-1-wenwux.ma@intel.com> In-Reply-To: <20220512010756.29553-1-wenwux.ma@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.401.20 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 > -----Original Message----- > From: Ma, WenwuX > Sent: Thursday, May 12, 2022 9:08 AM > To: Li, Xiaoyun ; Singh, Aman Deep > ; Zhang, Yuying ; > dev@dpdk.org > Cc: Hu, Jiayu ; Wang, Yinan ; > He, Xingguang ; Ma, WenwuX > ; stable@dpdk.org > Subject: [PATCH v3] app/testpmd: perform SW IP checksum for GRO/GSO > packets >=20 > The GRO/GSO library doesn't re-calculate checksums for merged/fragmented > packets. If users want the packets to have correct IP checksums, they sho= uld > 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. This patch add the code about it. >=20 > Fixes: b7091f1dcfbc ("app/testpmd: enable the heavyweight mode TCP/IPv4 > GRO") > Fixes: 52f38a2055ed ("app/testpmd: enable TCP/IPv4 VxLAN and GRE GSO") > Cc: stable@dpdk.org >=20 > Signed-off-by: Wenwu Ma > --- > app/test-pmd/csumonly.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) >=20 > diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index > 8b6665d6f3..2498ee88a2 100644 > --- a/app/test-pmd/csumonly.c > +++ b/app/test-pmd/csumonly.c > @@ -778,6 +778,28 @@ pkt_copy_split(const struct rte_mbuf *pkt) > return md[0]; > } >=20 > +#if defined(RTE_LIB_GRO) || defined(RTE_LIB_GSO) > +/* > + * 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 =3D 0; i < nb_pkts; i++) { > + if ((pkts_burst[i]->ol_flags & RTE_MBUF_F_TX_IPV4) && > + (tx_offloads & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) > =3D=3D 0) { > + ipv4_hdr =3D rte_pktmbuf_mtod_offset(pkts_burst[i], > + struct rte_ipv4_hdr *, > + pkts_burst[i]->l2_len); > + ipv4_hdr->hdr_checksum =3D 0; > + ipv4_hdr->hdr_checksum =3D > rte_ipv4_cksum(ipv4_hdr); > + } > + } > +} > +#endif > + > /* > * Receive a burst of packets, and for each packet: > * - parse packet, and try to recognize a supported packet type (1) @@ = - > 1098,6 +1120,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) > fs->gro_times =3D 0; > } > } > + > + pkts_ip_csum_recalc(pkts_burst, nb_rx, tx_offloads); > } > #endif >=20 > @@ -1131,6 +1155,8 @@ pkt_burst_checksum_forward(struct fwd_stream > *fs) >=20 > tx_pkts_burst =3D gso_segments; > nb_rx =3D nb_segments; > + > + pkts_ip_csum_recalc(tx_pkts_burst, nb_rx, tx_offloads); > } else > #endif > tx_pkts_burst =3D pkts_burst; > -- > 2.25.1 Reviewed-by: Jiayu Hu Thanks, Jiayu