From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next 6/9] net: hns: normalize two different loop
Date: Mon, 27 Jun 2016 15:00:35 +0300 [thread overview]
Message-ID: <1467028835.30123.287.camel@linux.intel.com> (raw)
In-Reply-To: <1467028161.1847.101.camel@perches.com>
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 <huangdaode@hisilicon.com>
> >
> > 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.
>
> > ? }
> > + buff += 1 * DSAF_PRIO_NR * ETH_GSTRING_LEN;
> > ? }
>
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Joe Perches <joe@perches.com>,
Yisen Zhuang <Yisen.Zhuang@huawei.com>,
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
Subject: Re: [PATCH net-next 6/9] net: hns: normalize two different loop
Date: Mon, 27 Jun 2016 15:00:35 +0300 [thread overview]
Message-ID: <1467028835.30123.287.camel@linux.intel.com> (raw)
In-Reply-To: <1467028161.1847.101.camel@perches.com>
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 <huangdaode@hisilicon.com>
> >
> > 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.
>
> > }
> > + buff += 1 * DSAF_PRIO_NR * ETH_GSTRING_LEN;
> > }
>
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2016-06-27 12:00 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-27 9:54 [PATCH net-next 0/9] net: hns: fix the typo of hns Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` [PATCH net-next 1/9] MAINTAINERS: add maintainers for hns driver Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` [PATCH net-next 2/9] net: hns: fix code style about " Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` [PATCH net-next 3/9] net: hns: change code style from a = a + x to a += x Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` [PATCH net-next 4/9] net: hns: delete redundant parens Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` [PATCH net-next 5/9] net: hns: add a space before "*/" Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` [PATCH net-next 6/9] net: hns: normalize two different loop Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 11:49 ` Joe Perches
2016-06-27 11:49 ` Joe Perches
2016-06-27 12:00 ` Andy Shevchenko [this message]
2016-06-27 12:00 ` Andy Shevchenko
2016-06-27 12:08 ` Joe Perches
2016-06-27 12:08 ` Joe Perches
2016-06-27 12:13 ` Andy Shevchenko
2016-06-27 12:13 ` Andy Shevchenko
2016-06-28 5:41 ` Daode Huang
2016-06-28 5:41 ` Daode Huang
2016-06-27 9:54 ` [PATCH net-next 7/9] net: hns: remove redundant hns_mac_dev_to_enet_if() Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` [PATCH net-next 8/9] net: hns: add media-type property for hns Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-27 9:54 ` [PATCH net-next 9/9] net: hns: get reset registers from DT Yisen Zhuang
2016-06-27 9:54 ` Yisen Zhuang
2016-06-29 9:11 ` David Miller
2016-06-29 9:11 ` David Miller
2016-06-30 1:10 ` Yankejian (Hackim Yim)
2016-06-30 1:10 ` 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=1467028835.30123.287.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.