All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Yankejian (Hackim Yim)" <yankejian@huawei.com>,
	David Miller <davem@davemloft.net>
Cc: lisheng011@huawei.com, lipeng321@huawei.com,
	salil.mehta@huawei.com, huangdaode@hisilicon.com,
	xuwei5@hisilicon.com, liguozhu@huawei.com,
	haifeng.wei@huawei.com, yisen.zhuang@huawei.com,
	linuxarm@huawei.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: hns: optimize XGE capability by reducing cpu usage
Date: Mon, 07 Dec 2015 01:05:09 -0800	[thread overview]
Message-ID: <1449479109.3597.1.camel@perches.com> (raw)
In-Reply-To: <56654A36.6090106@huawei.com>

On Mon, 2015-12-07 at 16:58 +0800, Yankejian (Hackim Yim) wrote:
> On 2015/12/7 11:32, Joe Perches wrote:
> > On Sun, 2015-12-06 at 22:29 -0500, David Miller wrote:
> > > > From: yankejian <yankejian@huawei.com>
> > > > Date: Sat, 5 Dec 2015 15:32:29 +0800
> > > > 
> > > > > > +#if (PAGE_SIZE < 8192)
> > > > > > +     if (hnae_buf_size(ring) == HNS_BUFFER_SIZE_2048) {
> > > > > > +             truesize = hnae_buf_size(ring);
> > > > > > +     } else {
> > > > > > +             truesize = ALIGN(size, L1_CACHE_BYTES);
> > > > > > +             last_offset = hnae_page_size(ring) - hnae_buf_size(ring);
> > > > > > +     }
> > > > > > +
> > > > > > +#else
> > > > > > +             truesize = ALIGN(size, L1_CACHE_BYTES);
> > > > > > +             last_offset = hnae_page_size(ring) - hnae_buf_size(ring);
> > > > > > +#endif
> > > > 
> > > > This is not indented properly, and it looks terrible.
> > And it makes one curious as to why last_offset isn't set
> > in the first block.
> 
> Hi Joe,

Hello.

> if hnae_buf_size que equal to HNS_BUFFER_SIZE, last_offset is useless in the routines of this function.
> so it is ignored in the first block. thanks for your suggestion.

More to the point, last_offset is initialized to 0.

It'd be clearer not to initialize it at all and
set it to 0 in the first block and not overwrite
the initialization in each subsequent block.


  reply	other threads:[~2015-12-07  9:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-05  7:32 [PATCH net-next] net: hns: optimize XGE capability by reducing cpu usage yankejian
2015-12-07  3:29 ` David Miller
2015-12-07  3:32   ` Joe Perches
2015-12-07  8:58     ` Yankejian (Hackim Yim)
2015-12-07  9:05       ` Joe Perches [this message]
2015-12-07  9:26         ` Yankejian (Hackim Yim)
2015-12-07  8:37   ` Yankejian (Hackim Yim)
2015-12-07  8:58 ` Du, Fan
2015-12-08  6:22   ` Yankejian (Hackim Yim)
2015-12-08  6:30     ` Du, Fan
2015-12-08  6:58       ` Yankejian (Hackim Yim)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449479109.3597.1.camel@perches.com \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=haifeng.wei@huawei.com \
    --cc=huangdaode@hisilicon.com \
    --cc=liguozhu@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=lisheng011@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=xuwei5@hisilicon.com \
    --cc=yankejian@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.