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


Groups > linux.kernel > #1435198 > unrolled thread

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

Started byYisen Zhuang <Yisen.Zhuang@huawei.com>
First post2016-07-01 11:30 +0200
Last post2016-07-01 23:00 +0200
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 net-next 0/9] net: hns: fix the typo of hns Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-07-01 11:30 +0200
    [PATCH v3 net-next 6/9] net: hns: normalize two different loop Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-07-01 11:30 +0200
    [PATCH v3 net-next 4/9] net: hns: delete redundant parenthese Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-07-01 11:30 +0200
    [PATCH v3 net-next 7/9] net: hns: remove redundant hns_mac_dev_to_enet_if() Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-07-01 11:30 +0200
    [PATCH v3 net-next 1/9] MAINTAINERS: add maintainers for hns driver Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-07-01 11:30 +0200
    [PATCH v3 net-next 2/9] net: hns: fix code style about hns driver Yisen Zhuang <Yisen.Zhuang@huawei.com> - 2016-07-01 11:30 +0200
    Re: [PATCH v3 net-next 0/9] net: hns: fix the typo of hns David Miller <davem@davemloft.net> - 2016-07-01 23:00 +0200

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

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-07-01 11:30 +0200
Subject[PATCH v3 net-next 0/9] net: hns: fix the typo of hns
Message-ID<rQ2M9-4Op-21@gated-at.bofh.it>
This series includes typo fixes which review by Andy, adding
the hns maintainer to MAINTAINERS, as below:

 > from Daode: adds the maintainer for hns driver;

 > 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.

changlog:
 v2 -> v3:
  match all files in and below drivers/net/ethernet/hisilicon/

 v1 -> v2:
  fix the indentations reviewed by David.

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 parenthese
  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]


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

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-07-01 11:30 +0200
Subject[PATCH v3 net-next 6/9] net: hns: normalize two different loop
Message-ID<rQ2VQ-4RO-5@gated-at.bofh.it>
In reply to#1435198
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

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


#1435201 — [PATCH v3 net-next 4/9] net: hns: delete redundant parenthese

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-07-01 11:30 +0200
Subject[PATCH v3 net-next 4/9] net: hns: delete redundant parenthese
Message-ID<rQ2VQ-4RO-3@gated-at.bofh.it>
In reply to#1435198
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>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.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]


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

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-07-01 11:30 +0200
Subject[PATCH v3 net-next 7/9] net: hns: remove redundant hns_mac_dev_to_enet_if()
Message-ID<rQ2VQ-4RO-15@gated-at.bofh.it>
In reply to#1435198
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>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@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] | [next] | [standalone]


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

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-07-01 11:30 +0200
Subject[PATCH v3 net-next 1/9] MAINTAINERS: add maintainers for hns driver
Message-ID<rQ2VQ-4RO-17@gated-at.bofh.it>
In reply to#1435198
From: Daode Huang <huangdaode@hisilicon.com>

This patch adds maintainers for hisilicon network subsystem driver

Signed-off-by: Daode Huang <huangdaode@hisilicon.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
---
change log:
 v3: match all files in and below drivers/net/ethernet/hisilicon/

 v2: the same as v1

 v1: first submit
  Link: https://lkml.org/lkml/2016/6/27/184
---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index d8c0784..772c9ff 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5437,6 +5437,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]


#1435208 — [PATCH v3 net-next 2/9] net: hns: fix code style about hns driver

FromYisen Zhuang <Yisen.Zhuang@huawei.com>
Date2016-07-01 11:30 +0200
Subject[PATCH v3 net-next 2/9] net: hns: fix code style about hns driver
Message-ID<rQ2VQ-4RO-27@gated-at.bofh.it>
In reply to#1435198
From: Daode Huang <huangdaode@hisilicon.com>

This patch fixes code sytle of hns driver to make it
simple.

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

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index 8473287..611b67b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -253,10 +253,9 @@ static void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port,
 		reg_val_1  = 0x1 << port;
 		port_rst_off = dsaf_dev->mac_cb[port]->port_rst_off;
 		/* there is difference between V1 and V2 in register.*/
-		if (AE_IS_VER1(dsaf_dev->dsaf_ver))
-			reg_val_2  = 0x1041041 << port_rst_off;
-		else
-			reg_val_2  = 0x2082082 << port_rst_off;
+		reg_val_2 = AE_IS_VER1(dsaf_dev->dsaf_ver) ?
+				0x1041041 : 0x2082082;
+		reg_val_2 <<= port_rst_off;
 
 		if (!dereset) {
 			dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_GE_RESET_REQ1_REG,
@@ -272,12 +271,11 @@ static void hns_dsaf_ge_srst_by_port(struct dsaf_device *dsaf_dev, u32 port,
 				       reg_val_1);
 		}
 	} else {
-		reg_val_1 = 0x15540 << dsaf_dev->reset_offset;
+		reg_val_1 = 0x15540;
+		reg_val_2 = AE_IS_VER1(dsaf_dev->dsaf_ver) ? 0x100 : 0x40;
 
-		if (AE_IS_VER1(dsaf_dev->dsaf_ver))
-			reg_val_2 = 0x100 << dsaf_dev->reset_offset;
-		else
-			reg_val_2 = 0x40 << dsaf_dev->reset_offset;
+		reg_val_1 <<= dsaf_dev->reset_offset;
+		reg_val_2 <<= dsaf_dev->reset_offset;
 
 		if (!dereset) {
 			dsaf_write_sub(dsaf_dev, DSAF_SUB_SC_GE_RESET_REQ1_REG,
-- 
1.9.1

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


#1435619

FromDavid Miller <davem@davemloft.net>
Date2016-07-01 23:00 +0200
Message-ID<rQdHz-2R6-1@gated-at.bofh.it>
In reply to#1435198
From: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Date: Fri, 1 Jul 2016 17:34:04 +0800

> This series includes typo fixes which review by Andy, adding
> the hns maintainer to MAINTAINERS, as below:
> 
>  > from Daode: adds the maintainer for hns driver;
> 
>  > 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.
> 
> changlog:
>  v2 -> v3:
>   match all files in and below drivers/net/ethernet/hisilicon/
> 
>  v1 -> v2:
>   fix the indentations reviewed by David.

Series applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web