From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by dpdk.org (Postfix) with ESMTP id 827B0592C for ; Tue, 18 Nov 2014 10:00:28 +0100 (CET) Received: by mail-wi0-f172.google.com with SMTP id n3so1067158wiv.11 for ; Tue, 18 Nov 2014 01:10:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=0Sw1Myk091H0GPbn6JcFAUqN9kl9gu+AK8oFCEJjLRM=; b=BJ6DxvuuhS+VQNF77wu8tMY8u2SmuxOG6SrYxYHn373Hm3aeAUg5k7iKRG2sl+EBOM x5nuD5Lh+Lt8dwnTglGj55PgAVsSCAYBL7M6NYN78z8wXuu8iW6+czMzoVVZu8NYlwfI 5DkovvNZF7NSte+T8dNfHbwbeWu1tdM2/x3VpuVgxvsLoSxBYoVIp79I+OBkU5VK6OQ7 ekktWZ/aYUP01UCfnz/zzkTwzYnwlO5CWVfMrQZankXjLbQ04jNWeMxwp31Pj/LCLuNR IOSA9nx1MP00d4gA4YaECQKa/u4acy9BCJod+SEl+IwUE5Yj22bSkMUfD8zlPQDNScdr tw7w== X-Gm-Message-State: ALoCoQmXJHNHrkovF4EQqc7R97YhQYAxbyby9dQF5HcHLqyt5zOxvGwmCzyhR2CouvA/+eI1t6Xe X-Received: by 10.180.90.237 with SMTP id bz13mr2140913wib.15.1416301848688; Tue, 18 Nov 2014 01:10:48 -0800 (PST) Received: from [10.16.0.195] (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id iz19sm12120877wic.8.2014.11.18.01.10.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 01:10:48 -0800 (PST) Message-ID: <546B0D17.7050503@6wind.com> Date: Tue, 18 Nov 2014 10:10:47 +0100 From: Olivier MATZ User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: "Ananyev, Konstantin" , "dev@dpdk.org" References: <1415635166-1364-1-git-send-email-olivier.matz@6wind.com> <1415984609-2484-1-git-send-email-olivier.matz@6wind.com> <1415984609-2484-10-git-send-email-olivier.matz@6wind.com> <2601191342CEEE43887BDE71AB977258213AE563@IRSMSX105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB977258213AE563@IRSMSX105.ger.corp.intel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "jigsaw@gmail.com" Subject: Re: [dpdk-dev] [PATCH v2 09/13] mbuf: introduce new checksum API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2014 09:00:28 -0000 Hi Konstantin, On 11/17/2014 07:15 PM, Ananyev, Konstantin wrote: > Just 2 nits from me: > > 1) >> +static inline uint16_t >> +rte_raw_cksum(const char *buf, size_t len) >> +{ > ... >> + while (len >= 8) { >> + sum += u16[0]; sum += u16[1]; sum += u16[2]; sum += u16[3]; > > Can you put each expression into a new line? > sum += u16[0]; > sum += u16[1]; > ... > > To make it easier to read. > Or can it be rewritten just like: > sum = (uint32_t)u16[0] + u16[1] + u16[2] + u16[3]; > here? > > 2) >> + while (len >= 8) { >> + sum += u16[0]; sum += u16[1]; sum += u16[2]; sum += u16[3]; >> + len -= 8; >> + u16 += 4; >> + } >> + while (len >= 2) { >> + sum += *u16; >> + len -= 2; >> + u16 += 1; >> + } > > In the code above, probably use sizeof(u16[0]) wherever appropriate. > To make things a bit more clearer and consistent. > ... > while (len >= 4 * sizeof(u16[0])) > len -= 4 * sizeof(u16[0]); > u16 += 4; > ... > Same for second loop OK, I push that in the todo list for the v3. Thanks, Olivier