linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
To: <davem@davemloft.net>, <yisen.zhuang@huawei.com>,
	<salil.mehta@huawei.com>
Cc: <akpm@linux-foundation.org>, <gregkh@linuxfoundation.org>,
	<kvalo@codeaurora.org>, <mchehab@osg.samsung.com>,
	<linux@roeck-us.net>, <jslaby@suse.cz>, <yankejian@huawei.com>,
	<huangdaode@hisilicon.com>, <lipeng321@huawei.com>,
	<xieqianqian@huawei.com>, <arnd@arndb.de>, <andrew@lunn.ch>,
	<xypron.glpk@gmx.de>, <linux-kernel@vger.kernel.org>,
	<netdev@vger.kernel.org>, <linuxarm@huawei.com>
Subject: [PATCH v3 net-next 6/9] net: hns: normalize two different loop
Date: Fri, 1 Jul 2016 17:34:10 +0800	[thread overview]
Message-ID: <1467365653-83331-7-git-send-email-Yisen.Zhuang@huawei.com> (raw)
In-Reply-To: <1467365653-83331-1-git-send-email-Yisen.Zhuang@huawei.com>

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.

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index e36ee22..86ce28a 100644
--- 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;
 		}
+		buff += 1 * DSAF_PRIO_NR * ETH_GSTRING_LEN;
 	}
 	snprintf(buff, ETH_GSTRING_LEN, "onnod%d_tx_pkts", node);
 	buff += ETH_GSTRING_LEN;
@@ -2606,8 +2606,8 @@ static u64 *hns_dsaf_get_node_stats(struct dsaf_device *ddev, u64 *data,
 	p[12] = hw_stats->stp_drop;
 	if (node_num < DSAF_SERVICE_NW_NUM && !is_ver1) {
 		for (i = 0; i < DSAF_PRIO_NR; i++) {
-			p[13 + i] = hw_stats->rx_pfc[i];
-			p[13 + i + DSAF_PRIO_NR] = hw_stats->tx_pfc[i];
+			p[13 + i + 0 * DSAF_PRIO_NR] = hw_stats->rx_pfc[i];
+			p[13 + i + 1 * DSAF_PRIO_NR] = hw_stats->tx_pfc[i];
 		}
 		p[29] = hw_stats->tx_pkts;
 		return &p[30];
-- 
1.9.1

  parent reply	other threads:[~2016-07-01  9:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01  9:34 [PATCH v3 net-next 0/9] net: hns: fix the typo of hns Yisen Zhuang
2016-07-01  9:34 ` [PATCH v3 net-next 1/9] MAINTAINERS: add maintainers for hns driver Yisen Zhuang
2016-07-01  9:34 ` [PATCH v3 net-next 2/9] net: hns: fix code style about " Yisen Zhuang
2016-07-01  9:34 ` [PATCH v3 net-next 3/9] net: hns: change code style from a = a + x to a += x Yisen Zhuang
2016-07-01  9:34 ` [PATCH v3 net-next 4/9] net: hns: delete redundant parenthese Yisen Zhuang
2016-07-01  9:34 ` [PATCH v3 net-next 5/9] net: hns: add a space before "*/" Yisen Zhuang
2016-07-01  9:34 ` Yisen Zhuang [this message]
2016-07-01  9:34 ` [PATCH v3 net-next 7/9] net: hns: remove redundant hns_mac_dev_to_enet_if() Yisen Zhuang
2016-07-01  9:34 ` [PATCH v3 net-next 8/9] net: hns: add media-type property for hns Yisen Zhuang
2016-07-01  9:34 ` [PATCH v3 net-next 9/9] net: hns: get reset registers from DT Yisen Zhuang
2016-07-01 20:57 ` [PATCH v3 net-next 0/9] net: hns: fix the typo of hns David Miller

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=1467365653-83331-7-git-send-email-Yisen.Zhuang@huawei.com \
    --to=yisen.zhuang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrew@lunn.ch \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=huangdaode@hisilicon.com \
    --cc=jslaby@suse.cz \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=mchehab@osg.samsung.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=xieqianqian@huawei.com \
    --cc=xypron.glpk@gmx.de \
    --cc=yankejian@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).