2019-01-26 08:44:03

by Lipeng

[permalink] [raw]
Subject: [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver

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



2019-01-26 08:44:14

by Lipeng

[permalink] [raw]
Subject: [PATCH net 1/3] net: hns: Fix for missing of_node_put() after of_parse_phandle()

From: Yonglong Liu <[email protected]>

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 <[email protected]>
Signed-off-by: Yonglong Liu <[email protected]>
Signed-off-by: Peng Li <[email protected]>
---
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


2019-01-26 08:44:22

by Lipeng

[permalink] [raw]
Subject: [PATCH net 2/3] net: hns: Restart autoneg need return failed when autoneg off

From: Yonglong Liu <[email protected]>

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 <[email protected]>
Signed-off-by: Peng Li <[email protected]>
---
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


2019-01-26 08:45:17

by Lipeng

[permalink] [raw]
Subject: [PATCH net 3/3] net: hns: Fix wrong read accesses via Clause 45 MDIO protocol

From: Yonglong Liu <[email protected]>

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 <[email protected]>
Signed-off-by: Peng Li <[email protected]>
---
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


2019-01-28 07:03:14

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net 0/3] net: hns: code optimizations & bugfixes for HNS driver

From: Peng Li <[email protected]>
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.