Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760230AbcCEDvM (ORCPT ); Fri, 4 Mar 2016 22:51:12 -0500 Received: from host.buserror.net ([209.198.135.123]:49393 "EHLO host.buserror.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759694AbcCEDvK (ORCPT ); Fri, 4 Mar 2016 22:51:10 -0500 Date: Fri, 4 Mar 2016 21:50:54 -0600 From: Scott Wood To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , scottwood@freescale.com, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Message-ID: <20160305035054.GA5277@home.buserror.net> References: <807dbc9449077e36752c649c09ae1c0d70e45254.1442876807.git.christophe.leroy@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <807dbc9449077e36752c649c09ae1c0d70e45254.1442876807.git.christophe.leroy@c-s.fr> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 75.72.173.242 X-SA-Exim-Mail-From: oss@buserror.net X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -15 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Subject: Re: [4/9] powerpc: inline ip_fast_csum() X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:57:07 +0000) X-SA-Exim-Scanned: Yes (on host.buserror.net) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1038 Lines: 46 On Tue, Sep 22, 2015 at 04:34:25PM +0200, Christophe Leroy wrote: > @@ -137,6 +130,45 @@ static inline __wsum csum_add(__wsum csum, __wsum addend) > #endif > } > > +/* > + * This is a version of ip_compute_csum() optimized for IP headers, > + * which always checksum on 4 octet boundaries. ihl is the number > + * of 32-bit words and is always >= 5. > + */ > +static inline __wsum ip_fast_csum_nofold(const void *iph, unsigned int ihl) > +{ > + u32 *ptr = (u32 *)iph + 1; const? > +#ifdef __powerpc64__ > + unsigned int i; > + u64 s = *(__force u32 *)iph; const? Why __force? > + s += (s >> 32); > + return (__force __wsum)s; > + > +#else > + __wsum sum, tmp; > + > + asm("mtctr %3;" > + "addc %0,%4,%5;" > + "1:lwzu %1, 4(%2);" > + "adde %0,%0,%1;" > + "bdnz 1b;" > + "addze %0,%0;" > + : "=r"(sum), "=r"(tmp), "+b"(ptr) > + : "r"(ihl - 2), "r"(*(u32 *)iph), "r"(*ptr) > + : "ctr", "xer", "memory"); Space between " and ( Space after : const in cast I've fixed these up while applying. -Scott