lkml.org 
[lkml]   [2015]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH net-next] net: hns: optimize XGE capability by reducing cpu usage
    From
    Date
    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.



    \
     
     \ /
      Last update: 2015-12-07 10:21    [W:4.456 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site