From mboxrd@z Thu Jan 1 00:00:00 1970 From: joe@perches.com (Joe Perches) Date: Mon, 27 Jun 2016 05:08:58 -0700 Subject: [PATCH net-next 6/9] net: hns: normalize two different loop In-Reply-To: <1467028835.30123.287.camel@linux.intel.com> References: <1467021255-95900-1-git-send-email-Yisen.Zhuang@huawei.com> <1467021255-95900-7-git-send-email-Yisen.Zhuang@huawei.com> <1467028161.1847.101.camel@perches.com> <1467028835.30123.287.camel@linux.intel.com> Message-ID: <1467029338.1847.106.camel@perches.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, 2016-06-27 at 15:00 +0300, Andy Shevchenko wrote: > On Mon, 2016-06-27 at 04:49 -0700, Joe Perches wrote: > > > > On Mon, 2016-06-27 at 17:54 +0800, Yisen Zhuang wrote: > > > > > > From: Daode Huang > > > > > > There are two approaches to assign data, one does 2 loops, another > > > does 1 loop. This patch normalize the different methods to 1 loop. > > [] > > > > > > diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c > > > b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c > > [] > > > > > > @@ -2567,15 +2567,15 @@ static char > > > *hns_dsaf_get_node_stats_strings(char *data, int node, > > > ? buff += ETH_GSTRING_LEN; > > > ? if (node < DSAF_SERVICE_NW_NUM && !is_ver1) { > > > ? for (i = 0; i < DSAF_PRIO_NR; i++) { > > > - snprintf(buff, ETH_GSTRING_LEN, > > > - ?"inod%d_pfc_prio%d_pkts", node, > > > i); > > > - buff += ETH_GSTRING_LEN; > > > - } > > > - for (i = 0; i < DSAF_PRIO_NR; i++) { > > > - snprintf(buff, ETH_GSTRING_LEN, > > > - ?"onod%d_pfc_prio%d_pkts", node, > > > i); > > > + snprintf(buff + 0 * ETH_GSTRING_LEN * > > > DSAF_PRIO_NR, > > > + ?ETH_GSTRING_LEN, > > > "inod%d_pfc_prio%d_pkts", > > > + ?node, i); > > > + snprintf(buff + 1 * ETH_GSTRING_LEN * > > > DSAF_PRIO_NR, > > > + ?ETH_GSTRING_LEN, > > > "onod%d_pfc_prio%d_pkts", > > > + ?node, i); > > > ? buff += ETH_GSTRING_LEN; > > This looks odd and likely incorrect. > Why? the idea is to print stats for Rx and Tx at once. > > I hope it was tested. It changes the order of the strings in buff. Is a bug fix or a style fix? If it's a bug fix, then it should likely be added to the stable trees. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751767AbcF0MJI (ORCPT ); Mon, 27 Jun 2016 08:09:08 -0400 Received: from smtprelay0145.hostedemail.com ([216.40.44.145]:32930 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750894AbcF0MJH (ORCPT ); Mon, 27 Jun 2016 08:09:07 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2559:2562:2729:2731:2828:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:4225:4321:5007:6742:7576:10004:10400:10848:11026:11232:11473:11657:11658:11914:12043:12048:12438:12517:12519:12740:13069:13311:13357:13439:13894:14181:14659:14721:21080:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: bat71_316d4f793fc5f X-Filterd-Recvd-Size: 3015 Message-ID: <1467029338.1847.106.camel@perches.com> Subject: Re: [PATCH net-next 6/9] net: hns: normalize two different loop From: Joe Perches To: Andy Shevchenko , Yisen Zhuang , davem@davemloft.net, salil.mehta@huawei.com, yankejian@huawei.com Cc: liguozhu@huawei.com, huangdaode@hisilicon.com, arnd@arndb.de, andrew@lunn.ch, geliangtang@163.com, ivecera@redhat.com, fengguang.wu@intel.com, charles.chenxin@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com Date: Mon, 27 Jun 2016 05:08:58 -0700 In-Reply-To: <1467028835.30123.287.camel@linux.intel.com> References: <1467021255-95900-1-git-send-email-Yisen.Zhuang@huawei.com> <1467021255-95900-7-git-send-email-Yisen.Zhuang@huawei.com> <1467028161.1847.101.camel@perches.com> <1467028835.30123.287.camel@linux.intel.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-06-27 at 15:00 +0300, Andy Shevchenko wrote: > On Mon, 2016-06-27 at 04:49 -0700, Joe Perches wrote: > > > > On Mon, 2016-06-27 at 17:54 +0800, Yisen Zhuang wrote: > > > > > > From: Daode Huang > > > > > > There are two approaches to assign data, one does 2 loops, another > > > does 1 loop. This patch normalize the different methods to 1 loop. > > [] > > > > > > diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c > > > b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c > > [] > > > > > > @@ -2567,15 +2567,15 @@ static char > > > *hns_dsaf_get_node_stats_strings(char *data, int node, > > >   buff += ETH_GSTRING_LEN; > > >   if (node < DSAF_SERVICE_NW_NUM && !is_ver1) { > > >   for (i = 0; i < DSAF_PRIO_NR; i++) { > > > - snprintf(buff, ETH_GSTRING_LEN, > > > -  "inod%d_pfc_prio%d_pkts", node, > > > i); > > > - buff += ETH_GSTRING_LEN; > > > - } > > > - for (i = 0; i < DSAF_PRIO_NR; i++) { > > > - snprintf(buff, ETH_GSTRING_LEN, > > > -  "onod%d_pfc_prio%d_pkts", node, > > > i); > > > + snprintf(buff + 0 * ETH_GSTRING_LEN * > > > DSAF_PRIO_NR, > > > +  ETH_GSTRING_LEN, > > > "inod%d_pfc_prio%d_pkts", > > > +  node, i); > > > + snprintf(buff + 1 * ETH_GSTRING_LEN * > > > DSAF_PRIO_NR, > > > +  ETH_GSTRING_LEN, > > > "onod%d_pfc_prio%d_pkts", > > > +  node, i); > > >   buff += ETH_GSTRING_LEN; > > This looks odd and likely incorrect. > Why? the idea is to print stats for Rx and Tx at once. > > I hope it was tested. It changes the order of the strings in buff. Is a bug fix or a style fix? If it's a bug fix, then it should likely be added to the stable trees.