linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver
@ 2019-01-26  9:18 Peng Li
  2019-01-26  9:18 ` [PATCH net 1/3] net: hns: Fix for missing of_node_put() after of_parse_phandle() Peng Li
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Peng Li @ 2019-01-26  9:18 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, linuxarm, yisen.zhuang, salil.mehta, lipeng321

This patchset includes bugfixes and code optimizations for the HNS
ethernet controller driver

Yonglong Liu (3):
  net: hns: Fix for missing of_node_put() after of_parse_phandle()
  net: hns: Restart autoneg need return failed when autoneg off
  net: hns: Fix wrong read accesses via Clause 45 MDIO protocol

 drivers/net/ethernet/hisilicon/hns/hns_enet.c    |  5 +++++
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 16 +++++++++-------
 drivers/net/ethernet/hisilicon/hns_mdio.c        |  2 +-
 3 files changed, 15 insertions(+), 8 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/3] net: hns: Fix for missing of_node_put() after of_parse_phandle()
  2019-01-26  9:18 [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver Peng Li
@ 2019-01-26  9:18 ` Peng Li
  2019-01-26  9:18 ` [PATCH net 2/3] net: hns: Restart autoneg need return failed when autoneg off Peng Li
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Peng Li @ 2019-01-26  9:18 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, linuxarm, yisen.zhuang, salil.mehta, lipeng321

From: Yonglong Liu <liuyonglong@huawei.com>

In hns enet driver, we use of_parse_handle() to get hold of the
device node related to "ae-handle" but we have missed to put
the node reference using of_node_put() after we are done using
the node. This patch fixes it.

Note:
This problem is stated in Link: https://lkml.org/lkml/2018/12/22/217

Fixes: 48189d6aaf1e ("net: hns: enet specifies a reference to dsaf")
Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_enet.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 5b33238..60e7d7a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -2418,6 +2418,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
 out_notify_fail:
 	(void)cancel_work_sync(&priv->service_task);
 out_read_prop_fail:
+	/* safe for ACPI FW */
+	of_node_put(to_of_node(priv->fwnode));
 	free_netdev(ndev);
 	return ret;
 }
@@ -2447,6 +2449,9 @@ static int hns_nic_dev_remove(struct platform_device *pdev)
 	set_bit(NIC_STATE_REMOVING, &priv->state);
 	(void)cancel_work_sync(&priv->service_task);
 
+	/* safe for ACPI FW */
+	of_node_put(to_of_node(priv->fwnode));
+
 	free_netdev(ndev);
 	return 0;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/3] net: hns: Restart autoneg need return failed when autoneg off
  2019-01-26  9:18 [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver Peng Li
  2019-01-26  9:18 ` [PATCH net 1/3] net: hns: Fix for missing of_node_put() after of_parse_phandle() Peng Li
@ 2019-01-26  9:18 ` Peng Li
  2019-01-26  9:18 ` [PATCH net 3/3] net: hns: Fix wrong read accesses via Clause 45 MDIO protocol Peng Li
  2019-01-28  7:02 ` [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Peng Li @ 2019-01-26  9:18 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, linuxarm, yisen.zhuang, salil.mehta, lipeng321

From: Yonglong Liu <liuyonglong@huawei.com>

The hns driver of earlier devices, when autoneg off, restart autoneg
will return -EINVAL, so make the hns driver for the latest devices
do the same.

Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 8e9b958..ce15d23 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -1157,16 +1157,18 @@ static int hns_get_regs_len(struct net_device *net_dev)
  */
 static int hns_nic_nway_reset(struct net_device *netdev)
 {
-	int ret = 0;
 	struct phy_device *phy = netdev->phydev;
 
-	if (netif_running(netdev)) {
-		/* if autoneg is disabled, don't restart auto-negotiation */
-		if (phy && phy->autoneg == AUTONEG_ENABLE)
-			ret = genphy_restart_aneg(phy);
-	}
+	if (!netif_running(netdev))
+		return 0;
 
-	return ret;
+	if (!phy)
+		return -EOPNOTSUPP;
+
+	if (phy->autoneg != AUTONEG_ENABLE)
+		return -EINVAL;
+
+	return genphy_restart_aneg(phy);
 }
 
 static u32
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 3/3] net: hns: Fix wrong read accesses via Clause 45 MDIO protocol
  2019-01-26  9:18 [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver Peng Li
  2019-01-26  9:18 ` [PATCH net 1/3] net: hns: Fix for missing of_node_put() after of_parse_phandle() Peng Li
  2019-01-26  9:18 ` [PATCH net 2/3] net: hns: Restart autoneg need return failed when autoneg off Peng Li
@ 2019-01-26  9:18 ` Peng Li
  2019-01-28  7:02 ` [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Peng Li @ 2019-01-26  9:18 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, linuxarm, yisen.zhuang, salil.mehta, lipeng321

From: Yonglong Liu <liuyonglong@huawei.com>

When reading phy registers via Clause 45 MDIO protocol, after write
address operation, the driver use another write address operation, so
can not read the right value of any phy registers. This patch fixes it.

Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns_mdio.c b/drivers/net/ethernet/hisilicon/hns_mdio.c
index 017e084..baf5cc2 100644
--- a/drivers/net/ethernet/hisilicon/hns_mdio.c
+++ b/drivers/net/ethernet/hisilicon/hns_mdio.c
@@ -321,7 +321,7 @@ static int hns_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
 		}
 
 		hns_mdio_cmd_write(mdio_dev, is_c45,
-				   MDIO_C45_WRITE_ADDR, phy_id, devad);
+				   MDIO_C45_READ, phy_id, devad);
 	}
 
 	/* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver
  2019-01-26  9:18 [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver Peng Li
                   ` (2 preceding siblings ...)
  2019-01-26  9:18 ` [PATCH net 3/3] net: hns: Fix wrong read accesses via Clause 45 MDIO protocol Peng Li
@ 2019-01-28  7:02 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-01-28  7:02 UTC (permalink / raw)
  To: lipeng321; +Cc: netdev, linux-kernel, linuxarm, yisen.zhuang, salil.mehta

From: Peng Li <lipeng321@huawei.com>
Date: Sat, 26 Jan 2019 17:18:24 +0800

> This patchset includes bugfixes and code optimizations for the HNS
> ethernet controller driver

Series applied, thank you.

There are only bug fixes in here, so please do not use the word
"optimizations" in such situations.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-28  7:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-26  9:18 [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver Peng Li
2019-01-26  9:18 ` [PATCH net 1/3] net: hns: Fix for missing of_node_put() after of_parse_phandle() Peng Li
2019-01-26  9:18 ` [PATCH net 2/3] net: hns: Restart autoneg need return failed when autoneg off Peng Li
2019-01-26  9:18 ` [PATCH net 3/3] net: hns: Fix wrong read accesses via Clause 45 MDIO protocol Peng Li
2019-01-28  7:02 ` [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver David Miller

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