From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 154FCC4332B for ; Sun, 22 Mar 2020 19:54:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C38E320719 for ; Sun, 22 Mar 2020 19:54:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=herbertland-com.20150623.gappssmtp.com header.i=@herbertland-com.20150623.gappssmtp.com header.b="XcmGVj1h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726847AbgCVTyF (ORCPT ); Sun, 22 Mar 2020 15:54:05 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:41943 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726756AbgCVTyE (ORCPT ); Sun, 22 Mar 2020 15:54:04 -0400 Received: by mail-ed1-f68.google.com with SMTP id v6so13921219edw.8 for ; Sun, 22 Mar 2020 12:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=herbertland-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=M56HRF7yj/zQ5PGc20FmyrfbsQ5EgKKx23a3WTtVBJQ=; b=XcmGVj1hrdeLjEKSi5tQOUnu7ERBEz+ZF6JdVlt4uRHYtwyferdXLe66o5dGOHHDep eyecV7GiWp9JvL82R8AHqwrhdu0yjeQOrVMatDskha/rVKoIGyHsanNi5n/C5CGclEJb FouOB+HIoYUAuW+akQdJ0YDP6kTRjoX1U/BpzlWhtL8GTIeP/OOHxsR87RXI0aMNpVaC h3MGruOIwZg8aUI1TSNCy57x6QqSBPmHf3HNFboT4xu5ht0dY1DsSpD9jofUrEeL6K3s OqWVioVGM8anUn3iejw1mbpfy9VRuP7lYc+4xEnVEOTIcaGFg/yrZbSAmIl3wfeQsjbx Wp9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M56HRF7yj/zQ5PGc20FmyrfbsQ5EgKKx23a3WTtVBJQ=; b=GjtDRExtabNbIAtJO+75VJ4leD1OA/IwOMTAR5Z0sqd+Ed7PyXeJM0Ys4n/sZ/WZ3D c/nff9UkQrxVCraHRW5Efem+oLn3qDDSMJmiZh5njMw8b/pMLMSRVUA9b9r0cu0ilmLp n2Rd5TkedbPykD3RE61+9w5gkvzUVY5EGp5qHOMjukZQahecrSyFhz0D8hyAtJUQ9Mx6 sKNWoTQvenMiZlPSPOwsuNI3HMTDTdLiz9/aLhb6PUEEEQgOWY9m5YF6u0nMCDctdIQo nLqwlgBFZaOECBw/OZGLekHvL3kC4bPSfqtATcAFrwRu/vUIWwe7EBIkck5+9W74AgS4 6MDQ== X-Gm-Message-State: ANhLgQ1aIJgnprrPQH+NkCTPQLVIZyHDNCy+9J0bcExZq0H5E0HeAodq L67ZffjznihPPmNhjJmuik6cyZPZRMTud9qru8xuLzIYp2o= X-Google-Smtp-Source: ADFU+vt0zBK4ShOMlyQXa7bRCXWxpXFFTK3Dg8a3Jxf0CA/rX4o0oGGXp3bi7QC1H9DdbJO8Ims9vEB2TwGXaxT+wqA= X-Received: by 2002:a05:6402:1a27:: with SMTP id be7mr2029437edb.241.1584906842303; Sun, 22 Mar 2020 12:54:02 -0700 (PDT) MIME-Version: 1.0 References: <20200228.120150.302053489768447737.davem@davemloft.net> <1583131910-29260-1-git-send-email-kyk.segfault@gmail.com> <945f6cafc86b4f1bb18fa40e60d5c113@AcuMS.aculab.com> <817a6418ac8742e6bb872992711beb47@AcuMS.aculab.com> <91fafe40-7856-8b22-c279-55df5d06ca39@gmail.com> In-Reply-To: From: Tom Herbert Date: Sun, 22 Mar 2020 12:53:50 -0700 Message-ID: Subject: Re: [PATCH v2] net: Make skb_segment not to compute checksum if network controller supports checksumming To: David Laight Cc: Eric Dumazet , Willem de Bruijn , Yadu Kishore , David Miller , Network Development Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Mar 6, 2020 at 9:12 AM David Laight wrote: > > From: Eric Dumazet > > Sent: 05 March 2020 17:20 > > > > On 3/5/20 9:00 AM, David Laight wrote: > > > From: Willem de Bruijn > > >> Sent: 05 March 2020 16:07 > > > .. > > >> It seems do_csum is called because csum_partial_copy executes the > > >> two operations independently: > > >> > > >> __wsum > > >> csum_partial_copy(const void *src, void *dst, int len, __wsum sum) > > >> { > > >> memcpy(dst, src, len); > > >> return csum_partial(dst, len, sum); > > >> } > > > > > > And do_csum() is superbly horrid. > > > Not the least because it is 32bit on 64bit systems. > > > > There are many versions, which one is discussed here ? > > > > At least the current one seems to be 64bit optimized. > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5777eaed566a1d63e344d3dd > > 8f2b5e33be20643e > > I was looking at the generic one in $(SRC)/lib/checksum.c. > > FWIW I suspect the fastest code on pre sandy bridge 64bit intel cpus > (where adc is 2 clocks) is to do a normal 'add', shift the carries > into a 64bit register and do a software 'popcnt' every 512 bytes. > That may run at 8 bytes/clock + the popcnt. A while back, I had proposed an optimized x86 checksum function using unrolled addq a while back https://lwn.net/Articles/679137/. Also, this tries to optimize from small checksum like over header when doing skb_postpull_rcsum. Tom > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales)