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


Groups > linux.kernel > #1431865 > unrolled thread

[PATCH net-next 0/9] net: hns: fix the typo of hns

Started byYisen Zhuang <Yisen.Zhuang@huawei.com>
First post2016-06-27 11:40 +0200
Last post2016-06-27 11:40 +0200
Articles 11 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [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

#1431865 — [PATCH net-next 0/9] net: hns: fix the typo of hns

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-06-27 11:40 +0200
Subject[PATCH net-next 0/9] net: hns: fix the typo of hns
Message-ID<rOBbj-6NY-3@gated-at.bofh.it>
This series includes typo fixes which review by Andy, adding
the hns maintainer to MAINTAINERS,

 > adds the maintainer for hns driver from Daode;

 > from Daode: fix the typo of hns reviewed by Andy Shevchenko;

 > from Kejian: one remove redundant function and two fix to get 
configuration from DT.

Daode Huang (6):
  MAINTAINERS: add maintainers for hns driver
  net: hns: fix code style about hns driver
  net: hns: change code style from a = a + x to a += x
  net: hns: delete redundant parens
  net: hns: add a space before "*/"
  net: hns: normalize two different loop

Kejian Yan (3):
  net: hns: remove redundant hns_mac_dev_to_enet_if()
  net: hns: add media-type property for hns
  net: hns: get reset registers from DT

 MAINTAINERS                                        |  9 +++
 drivers/net/ethernet/hisilicon/hns/hnae.h          |  9 +++
 drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c  |  1 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c  | 41 +++++++----
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h  |  1 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 52 +++++++-------
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 16 ++---
 drivers/net/ethernet/hisilicon/hns/hns_enet.c      |  4 +-
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c   | 14 +++-
 drivers/net/ethernet/hisilicon/hns_mdio.c          | 80 ++++++++++++++++++----
 10 files changed, 158 insertions(+), 69 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1431866 — [PATCH net-next 1/9] MAINTAINERS: add maintainers for hns driver

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-06-27 11:40 +0200
Subject[PATCH net-next 1/9] MAINTAINERS: add maintainers for hns driver
Message-ID<rOBbk-6NY-25@gated-at.bofh.it>
In reply to#1431865
From: Daode Huang <huangdaode@hisilicon.com>

This patch adds maintainers for hisilicon network subsystem driver

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3a171a9..c819659 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5421,6 +5421,15 @@ F:	include/uapi/linux/if_hippi.h
 F:	net/802/hippi.c
 F:	drivers/net/hippi/
 
+HISILICON NETWORK SUBSYSTEM DRIVER
+M:	Yisen Zhuang <yisen.zhuang@huawei.com>
+M:	Salil Mehta <salil.mehta@huawei.com>
+L:	netdev@vger.kernel.org
+W:	http://www.hisilicon.com
+S:	Maintained
+F:	drivers/net/ethernet/hisilicon/*
+F:	Documentation/devicetree/bindings/net/hisilicon*.txt
+
 HISILICON SAS Controller
 M:	John Garry <john.garry@huawei.com>
 W:	http://www.hisilicon.com
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1431867 — [PATCH net-next 6/9] net: hns: normalize two different loop

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-06-27 11:40 +0200
Subject[PATCH net-next 6/9] net: hns: normalize two different loop
Message-ID<rOBbk-6NY-29@gated-at.bofh.it>
In reply to#1431865
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>
---
 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

[toc] | [prev] | [next] | [standalone]


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

FromJoe Perches <joe@perches.com>
Date2016-06-27 13:50 +0200
SubjectRe: [PATCH net-next 6/9] net: hns: normalize two different loop
Message-ID<rODd7-86Z-1@gated-at.bofh.it>
In reply to#1431867
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;
>  	}

[toc] | [prev] | [next] | [standalone]


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

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-06-27 14:10 +0200
SubjectRe: [PATCH net-next 6/9] net: hns: normalize two different loop
Message-ID<rODwt-8tq-1@gated-at.bofh.it>
In reply to#1431970
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

[toc] | [prev] | [next] | [standalone]


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

FromJoe Perches <joe@perches.com>
Date2016-06-27 14:10 +0200
SubjectRe: [PATCH net-next 6/9] net: hns: normalize two different loop
Message-ID<rODwt-8tq-5@gated-at.bofh.it>
In reply to#1431978
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 <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.

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.

[toc] | [prev] | [next] | [standalone]


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

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-06-27 14:20 +0200
SubjectRe: [PATCH net-next 6/9] net: hns: normalize two different loop
Message-ID<rODGa-5q-1@gated-at.bofh.it>
In reply to#1431979
On Mon, 2016-06-27 at 05:08 -0700, Joe Perches wrote:
> 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 <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.
> 
> It changes the order of the strings in buff.

I don't see how.

> Is a bug fix or a style fix?
> 
> If it's a bug fix, then it should likely be added
> to the stable trees.

I doubt it's a bug fix.

-- 

Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [next] | [standalone]


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

FromDaode Huang <huangdaode@hisilicon.com>
Date2016-06-28 07:50 +0200
SubjectRe: [PATCH net-next 6/9] net: hns: normalize two different loop
Message-ID<rOU4h-2F5-3@gated-at.bofh.it>
In reply to#1431981

On 2016/6/27 20:13, Andy Shevchenko wrote:
> On Mon, 2016-06-27 at 05:08 -0700, Joe Perches wrote:
>> 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 <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.
>> It changes the order of the strings in buff.
> I don't see how.
Hi Andy,
The patch has been tested when sent out.

>> Is a bug fix or a style fix?
>>
>> If it's a bug fix, then it should likely be added
>> to the stable trees.
> I doubt it's a bug fix.

Because the previous patch is accepted in net-next, and this set is
an appendix to the series, in order to avoid merge conflict, we also
send this bug fix to net-next.

thanks.

>

[toc] | [prev] | [next] | [standalone]


#1431871 — [PATCH net-next 4/9] net: hns: delete redundant parens

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-06-27 11:40 +0200
Subject[PATCH net-next 4/9] net: hns: delete redundant parens
Message-ID<rOBbk-6NY-33@gated-at.bofh.it>
In reply to#1431865
From: Daode Huang <huangdaode@hisilicon.com>

According to the previous review comments from Andy, this patch
deletes the redundant parens in the patch.

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

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index b9d01ea..e36ee22 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
@@ -2565,7 +2565,7 @@ static char *hns_dsaf_get_node_stats_strings(char *data, int node,
 	buff += ETH_GSTRING_LEN;
 	snprintf(buff, ETH_GSTRING_LEN, "innod%d_stp_drop_pkts", node);
 	buff += ETH_GSTRING_LEN;
-	if ((node < DSAF_SERVICE_NW_NUM) && (!is_ver1)) {
+	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);
@@ -2604,7 +2604,7 @@ static u64 *hns_dsaf_get_node_stats(struct dsaf_device *ddev, u64 *data,
 	p[10] = hw_stats->local_addr_false;
 	p[11] = hw_stats->vlan_drop;
 	p[12] = hw_stats->stp_drop;
-	if ((node_num < DSAF_SERVICE_NW_NUM) && (!is_ver1)) {
+	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];
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1431872 — [PATCH net-next 8/9] net: hns: add media-type property for hns

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-06-27 11:40 +0200
Subject[PATCH net-next 8/9] net: hns: add media-type property for hns
Message-ID<rOBbk-6NY-37@gated-at.bofh.it>
In reply to#1431865
From: Kejian Yan <yankejian@huawei.com>

It is PORT_TP type if the service port is GE mode. It is wrong to
judge the port type by using if it is service port. Adding the media
type to know port type.

Reported-by: Jinchuan Tian <tianjinchuan1@huawei.com>
Signed-off-by: Kejian Yan <yankejian@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hnae.h         |  9 ++++++++
 drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c |  1 +
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 26 +++++++++++++++++++++++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h |  1 +
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c  | 14 +++++++++---
 5 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
index 3869322..e093cbf 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
@@ -363,6 +363,14 @@ enum hnae_port_type {
 	HNAE_PORT_DEBUG
 };
 
+/* mac media type */
+enum hnae_media_type {
+	HNAE_MEDIA_TYPE_UNKNOWN = 0,
+	HNAE_MEDIA_TYPE_FIBER,
+	HNAE_MEDIA_TYPE_COPPER,
+	HNAE_MEDIA_TYPE_BACKPLANE,
+};
+
 /* This struct defines the operation on the handle.
  *
  * get_handle(): (mandatory)
@@ -525,6 +533,7 @@ struct hnae_handle {
 	u32 eport_id;
 	u32 dport_id;	/* v2 tx bd should fill the dport_id */
 	enum hnae_port_type port_type;
+	enum hnae_media_type media_type;
 	struct list_head node;    /* list to hnae_ae_dev->handle_list */
 	struct hnae_buf_ops *bops; /* operation for the buffer */
 	struct hnae_queue **qs;  /* array base of all queues */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index 835521b..e28d960 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -134,6 +134,7 @@ struct hnae_handle *hns_ae_get_handle(struct hnae_ae_dev *dev,
 	ae_handle->phy_dev = vf_cb->mac_cb->phy_dev;
 	ae_handle->if_support = vf_cb->mac_cb->if_support;
 	ae_handle->port_type = vf_cb->mac_cb->mac_type;
+	ae_handle->media_type = vf_cb->mac_cb->media_type;
 	ae_handle->dport_id = port_id;
 
 	return ae_handle;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index d2effcc..3fb87e2 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -733,6 +733,18 @@ static void hns_mac_register_phy(struct hns_mac_cb *mac_cb)
 			mac_cb->mac_id, addr);
 }
 
+#define MAC_MEDIA_TYPE_MAX_LEN		16
+
+static const struct {
+	enum hnae_media_type value;
+	const char *name;
+} media_type_defs[] = {
+	{HNAE_MEDIA_TYPE_UNKNOWN,	"unknown" },
+	{HNAE_MEDIA_TYPE_FIBER,		"fiber" },
+	{HNAE_MEDIA_TYPE_COPPER,	"copper" },
+	{HNAE_MEDIA_TYPE_BACKPLANE,	"backplane" },
+};
+
 /**
  *hns_mac_get_info  - get mac information from device node
  *@mac_cb: mac device
@@ -744,10 +756,13 @@ static int  hns_mac_get_info(struct hns_mac_cb *mac_cb)
 	struct device_node *np;
 	struct regmap *syscon;
 	struct of_phandle_args cpld_args;
+	const char *media_type;
+	u32 i;
 	u32 ret;
 
 	mac_cb->link = false;
 	mac_cb->half_duplex = false;
+	mac_cb->media_type = HNAE_MEDIA_TYPE_UNKNOWN;
 	mac_cb->speed = mac_phy_to_speed[mac_cb->phy_if];
 	mac_cb->max_speed = mac_cb->speed;
 
@@ -849,6 +864,17 @@ static int  hns_mac_get_info(struct hns_mac_cb *mac_cb)
 			mac_cb->mac_id);
 	}
 
+	if (!fwnode_property_read_string(mac_cb->fw_port, "media-type",
+					 &media_type)) {
+		for (i = 0; i < ARRAY_SIZE(media_type_defs); i++) {
+			if (!strncmp(media_type_defs[i].name, media_type,
+				     MAC_MEDIA_TYPE_MAX_LEN)) {
+				mac_cb->media_type = media_type_defs[i].value;
+				break;
+			}
+		}
+	}
+
 	return 0;
 }
 
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
index 05a6e8f..4cbdf14 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
@@ -335,6 +335,7 @@ struct hns_mac_cb {
 	u64 txpkt_for_led;
 	u64 rxpkt_for_led;
 	enum hnae_port_type mac_type;
+	enum hnae_media_type media_type;
 	phy_interface_t phy_if;
 	enum hnae_loop loop_mode;
 
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index a395ca1..ab33487 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -165,13 +165,21 @@ static int hns_nic_get_settings(struct net_device *net_dev,
 		cmd->advertising |= ADVERTISED_10000baseKR_Full;
 	}
 
-	if (h->port_type == HNAE_PORT_SERVICE) {
+	switch (h->media_type) {
+	case HNAE_MEDIA_TYPE_FIBER:
 		cmd->port = PORT_FIBRE;
-		cmd->supported |= SUPPORTED_Pause;
-	} else {
+		break;
+	case HNAE_MEDIA_TYPE_COPPER:
 		cmd->port = PORT_TP;
+		break;
+	case HNAE_MEDIA_TYPE_UNKNOWN:
+	default:
+		break;
 	}
 
+	if (!(AE_IS_VER1(priv->enet_ver) && h->port_type == HNAE_PORT_DEBUG))
+		cmd->supported |= SUPPORTED_Pause;
+
 	cmd->transceiver = XCVR_EXTERNAL;
 	cmd->mdio_support = (ETH_MDIO_SUPPORTS_C45 | ETH_MDIO_SUPPORTS_C22);
 	hns_get_mdix_mode(net_dev, cmd);
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1431875 — [PATCH net-next 7/9] net: hns: remove redundant hns_mac_dev_to_enet_if()

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-06-27 11:40 +0200
Subject[PATCH net-next 7/9] net: hns: remove redundant hns_mac_dev_to_enet_if()
Message-ID<rOBbk-6NY-41@gated-at.bofh.it>
In reply to#1431865
From: Kejian Yan <yankejian@huawei.com>

The sequence of hns_mac_dev_to_enet_if() is the same as
hns_get_enet_interface(), and hns_get_enet_interface() is called
by initialization to get the mac mode. And the mode is not changed
anywhere. Thus add hns_mac_dev_to_enet_if() function to get the mac
mode is obviously redundant.

Reported-by: Jinchuan Tian <tianjinchuan1@huawei.com>
Signed-off-by: Kejian Yan <yankejian@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index c526558..d2effcc 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -56,20 +56,6 @@ static const enum mac_mode g_mac_mode_1000[] = {
 	[PHY_INTERFACE_MODE_RTBI]   = MAC_MODE_RTBI_1000
 };
 
-static enum mac_mode hns_mac_dev_to_enet_if(const struct hns_mac_cb *mac_cb)
-{
-	switch (mac_cb->max_speed) {
-	case MAC_SPEED_100:
-		return g_mac_mode_100[mac_cb->phy_if];
-	case MAC_SPEED_1000:
-		return g_mac_mode_1000[mac_cb->phy_if];
-	case MAC_SPEED_10000:
-		return MAC_MODE_XGMII_10000;
-	default:
-		return MAC_MODE_MII_100;
-	}
-}
-
 static enum mac_mode hns_get_enet_interface(const struct hns_mac_cb *mac_cb)
 {
 	switch (mac_cb->max_speed) {
@@ -134,7 +120,6 @@ void hns_mac_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex)
 
 	mac_cb->speed = speed;
 	mac_cb->half_duplex = !duplex;
-	mac_ctrl_drv->mac_mode = hns_mac_dev_to_enet_if(mac_cb);
 
 	if (mac_ctrl_drv->adjust_link) {
 		ret = mac_ctrl_drv->adjust_link(mac_ctrl_drv,
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web