Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1431970

Re: [PATCH net-next 6/9] net: hns: normalize two different loop

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH net-next 6/9] net: hns: normalize two different loop
Date 2016-06-27 13:50 +0200
Message-ID <rODd7-86Z-1@gated-at.bofh.it> (permalink)
References <rOBbj-6NY-3@gated-at.bofh.it> <rOBbk-6NY-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

>  		}
> +		buff += 1 * DSAF_PRIO_NR * ETH_GSTRING_LEN;
>  	}

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/9] net: hns: fix the typo of hns Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-27 11:40 +0200
  [PATCH net-next 1/9] MAINTAINERS: add maintainers for hns driver Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-27 11:40 +0200
  [PATCH net-next 6/9] net: hns: normalize two different loop Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-27 11:40 +0200
    Re: [PATCH net-next 6/9] net: hns: normalize two different loop Joe Perches <joe@perches.com> - 2016-06-27 13:50 +0200
      Re: [PATCH net-next 6/9] net: hns: normalize two different loop Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-27 14:10 +0200
        Re: [PATCH net-next 6/9] net: hns: normalize two different loop Joe Perches <joe@perches.com> - 2016-06-27 14:10 +0200
          Re: [PATCH net-next 6/9] net: hns: normalize two different loop Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-06-27 14:20 +0200
            Re: [PATCH net-next 6/9] net: hns: normalize two different loop Daode Huang <huangdaode@hisilicon.com> - 2016-06-28 07:50 +0200
  [PATCH net-next 4/9] net: hns: delete redundant parens Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-27 11:40 +0200
  [PATCH net-next 8/9] net: hns: add media-type property for hns Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-27 11:40 +0200
  [PATCH net-next 7/9] net: hns: remove redundant hns_mac_dev_to_enet_if() Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-06-27 11:40 +0200

csiph-web