Re: [PATCH net-next 6/9] net: hns: normalize two different loop
From: Andy Shevchenko
Date: Mon Jun 27 2016 - 08:00:51 EST
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@xxxxxxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxx>
Intel Finland Oy