From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20087.outbound.protection.outlook.com [40.107.2.87]) by dpdk.org (Postfix) with ESMTP id 75F602C5; Tue, 24 Apr 2018 11:44:21 +0200 (CEST) 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; bh=mkueIxcydDGXHPyNrTkd8fRp9NjVOI0KizLLUxSZTeo=; b=GbAxxSUmKBDy70AEUzmAjxQzs1H26yDw//FjxaWoUWDRBonN1+s7CQjtSrboL9zDfeOFqxj4EdUj3+8LZhwUSrU6F4kW85Cou2Ojoi7ngT7jiLK/+SmN89X2DO4+A37aPU8lEqOBeufJceXQbudMXFoSvZbxYijSHDwGPGyoohs= Received: from HE1PR0501MB2314.eurprd05.prod.outlook.com (10.168.34.19) by HE1PR0501MB2361.eurprd05.prod.outlook.com (10.168.34.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.17; Tue, 24 Apr 2018 09:44:19 +0000 Received: from HE1PR0501MB2314.eurprd05.prod.outlook.com ([fe80::d405:aec8:cd2f:85cc]) by HE1PR0501MB2314.eurprd05.prod.outlook.com ([fe80::d405:aec8:cd2f:85cc%18]) with mapi id 15.20.0675.018; Tue, 24 Apr 2018 09:44:19 +0000 From: Ophir Munk To: "Hu, Jiayu" , "dev@dpdk.org" , "Ananyev, Konstantin" CC: Thomas Monjalon , Olga Shern , Pascal Mazon , "stable@dpdk.org" Thread-Topic: [PATCH v1] gso: fix marking TCP checksum flag in TCP segments Thread-Index: AQHT2kUpp26DE2UvPU2Ou46q1OX+56QNvmoAgAHdJEA= Date: Tue, 24 Apr 2018 09:44:18 +0000 Message-ID: References: <1524406859-29585-1-git-send-email-ophirmu@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0501MB2361; 7:qWCfeykl9lxrVz0Z/BNuDS8+vUOk6J6cRr98/LgKu4XylCrdk193HfkGCZ21TrkjspDLqeXiuWM0/9yaudacwnJhbrBcC84ux8y9OlDuLvXUkVHnQ2wwVnJGiqxBvf9wR1d34PQBqYAL/TbnaJFk+QsHf04+lxAfJgzN//v6KGWSYpjDw/udVZc4PlDwC3v7aY28gQLRL2RHJHEMjY8CWKX9l/6ZCKQ892xpe7mSsV26J/9Gd21cRRQNGCX2NXzx x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2361; x-ms-traffictypediagnostic: HE1PR0501MB2361: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231232)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:HE1PR0501MB2361; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2361; x-forefront-prvs: 0652EA5565 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(366004)(376002)(39380400002)(346002)(13464003)(69234005)(199004)(189003)(9686003)(6506007)(97736004)(2501003)(2900100001)(966005)(486006)(478600001)(446003)(476003)(11346002)(25786009)(5250100002)(3280700002)(2906002)(3846002)(86362001)(14454004)(3660700001)(229853002)(8676002)(81166006)(8936002)(68736007)(81156014)(6116002)(6436002)(74316002)(33656002)(5660300001)(55016002)(6306002)(4326008)(7736002)(6246003)(305945005)(106356001)(105586002)(59450400001)(99286004)(54906003)(53546011)(110136005)(102836004)(316002)(7696005)(53936002)(186003)(76176011)(66066001)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2361; H:HE1PR0501MB2314.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Pm9gWNM0Gzs2iyCcWD4VuKQDd++ybFhLx4/mcypl+w3UyJCPWqr6xi4h1k5wVVr/lbc2ziC7VlyziUlR064uv8lNvKcpMsk3C7fIfZ7/TubEZWaf670SGqtq+YU4qogwDsKEAXmao+gFusmP3NVB+U1JYZQ3yU+x2/JthDlNVNDmdUynJzwMTJB8PumM/4wI spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 995de52e-3c3d-4773-5024-08d5a9c7f370 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 995de52e-3c3d-4773-5024-08d5a9c7f370 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Apr 2018 09:44:18.9822 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2361 Subject: Re: [dpdk-stable] [PATCH v1] gso: fix marking TCP checksum flag in TCP segments X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2018 09:44:21 -0000 Hi Jiayu, Please find comments inline > -----Original Message----- > From: Hu, Jiayu [mailto:jiayu.hu@intel.com] > Sent: Monday, April 23, 2018 7:14 AM > To: Ophir Munk ; dev@dpdk.org; Ananyev, > Konstantin > Cc: Thomas Monjalon ; Olga Shern > ; Pascal Mazon ; > stable@dpdk.org > Subject: RE: [PATCH v1] gso: fix marking TCP checksum flag in TCP segment= s >=20 > Hi Ophir, >=20 > In the GSO design, the GSO library doesn't care about checksums, which > means it doesn't check if input packets have correct checksums, and it > doesn't do any checksum related work for the output GSO segments. It > depends on the callers to use HW or SW checksum calculation for output > packets. This is why the GSO library doesn't set PKT_TX_TCP_CKSUM. So I > don't think it's a bug. >=20 Can you please reconsider this design? I think the GSO library should imita= te the HW behavior where TCP segments checksum is automatically calculated = without explicitly requesting it. I am not saying that GSO library itself s= hould calculate the checksums - but at least it should mark each segment as= requiring this calculation. > In my opinion, it's not a good idea to enable HW TCP checksum calculation > silently, and without the aware of the caller. In fact, the caller always= know it > does SW TSO (i.e. GSO), instead of real HW TSO.=20 This is not correct. Consider net_failsafe with 2 sub-devices: one is a HW = PCI device, the other one is a SW TAP device. Failsafe must work transparen= tly with these two sub-devices and the caller cannot tell if TSO is done in= SW or HW.=20 > If the caller wants HW > checksum calculation, it can add PKT_TX_TCP_CKSUM to ol_flags before or > after calling the GSO library. >=20 FYI - TAP TSO patches were submitted to dpdk.org mailing list. These patche= s use the GSO library. https://dpdk.org/dev/patchwork/patch/38666/ https://dpdk.org/dev/patchwork/patch/38667/ Running testpmd with TAP TSO is currently broken without the suggested libr= te_gso patch.=20 Please note testpmd implementation (app/test-pmd/csumonly.c b/app/test-pmd/= csumonly.c) in case *both* TSO and TCP CKSUM are configured: if (tso_segsz) ol_flags |=3D PKT_TX_TCP_SEG; // *** if TSO is applicable - the pa= cket flags are only marked with PKT_TX_TCP_SEG and no PKT_TX_TCP_CKSUM *** else if (tx_offloads & DEV_TX_OFFLOAD_TCP_CKSUM)=20 ol_flags |=3D PKT_TX_TCP_CKSUM; // *** PKT_TX_TCP_CKSUM is marke= d only if TSO is not applicable *** else { tcp_hdr->cksum =3D get_udptcp_checksum(l3_hdr, tcp_hdr, In other words - testpmd does not set TCP_CKSUM along with TCP_SEG therefor= e using testpmd with TAP/TSO will result in TCP segments with 0 (incorrect)= TCP checksums. In addition - please note the comments in lib/librte_mbuf/rte_mbuf.h which = specify that PKT_TX_TCP_SEG flag implies the PKT_TX_TCP_CKSUM (hence it is = not required to be explicitly set by the caller) /** * TCP segmentation offload. To enable this offload feature for a * packet to be transmitted on hardware supporting TSO: * - set the PKT_TX_TCP_SEG flag in mbuf->ol_flags (this flag implies * PKT_TX_TCP_CKSUM) ... > Add Konstantin for more suggestions. >=20 > Thanks, > Jiayu >=20 > > -----Original Message----- > > From: Ophir Munk [mailto:ophirmu@mellanox.com] > > Sent: Sunday, April 22, 2018 10:21 PM > > To: dev@dpdk.org; Hu, Jiayu > > Cc: Thomas Monjalon ; Olga Shern > > ; Pascal Mazon ; > Ophir > > Munk ; stable@dpdk.org > > Subject: [PATCH v1] gso: fix marking TCP checksum flag in TCP segments > > > > Large TCP packets which are marked with PKT_TX_TCP_SEG flag are > > segmented and the flag is cleared in the resulting segments, however, > > the segments checksum is not updated. It is therefore required to set > > the PKT_TX_TCP_CKSUM flag in each TCP segment in order to mark for the > > sending driver the need to update the TCP checksum before transmitting > > the segment. > > > > Fixes: 119583797b6a ("gso: support TCP/IPv4 GSO") > > Cc: stable@dpdk.org > > > > Signed-off-by: Ophir Munk > > --- > > lib/librte_gso/rte_gso.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/lib/librte_gso/rte_gso.c b/lib/librte_gso/rte_gso.c index > > a44e3d4..e9ce9ce 100644 > > --- a/lib/librte_gso/rte_gso.c > > +++ b/lib/librte_gso/rte_gso.c > > @@ -50,12 +50,14 @@ rte_gso_segment(struct rte_mbuf *pkt, > > ((IS_IPV4_GRE_TCP4(pkt->ol_flags) && > > (gso_ctx->gso_types & > > DEV_TX_OFFLOAD_GRE_TNL_TSO)))) { > > pkt->ol_flags &=3D (~PKT_TX_TCP_SEG); > > + pkt->ol_flags |=3D PKT_TX_TCP_CKSUM; > > ret =3D gso_tunnel_tcp4_segment(pkt, gso_size, ipid_delta, > > direct_pool, indirect_pool, > > pkts_out, nb_pkts_out); > > } else if (IS_IPV4_TCP(pkt->ol_flags) && > > (gso_ctx->gso_types & > > DEV_TX_OFFLOAD_TCP_TSO)) { > > pkt->ol_flags &=3D (~PKT_TX_TCP_SEG); > > + pkt->ol_flags |=3D PKT_TX_TCP_CKSUM; > > ret =3D gso_tcp4_segment(pkt, gso_size, ipid_delta, > > direct_pool, indirect_pool, > > pkts_out, nb_pkts_out); > > -- > > 2.7.4