2017-11-08 07:54:12

by Lipeng

[permalink] [raw]
Subject: [PATCH net-next 0/2] net: hns3: Bug fixes & Code improvements in HNS3 driver

This patch-set introduces some bug fixes and code improvements.
As [patch 1/2] depends on the patch {5392902 net: hns3: Consistently using
GENMASK in hns3 driver}, which exists in net-next, not exists in net, so
push this serise to nex-next.

Fuyun Liang (2):
{topost} net: hns3: fix a bug when getting phy address from NCL_config
file
{topost} net: hns3: cleanup mac auto-negotiation state query in
hclge_update_speed_duplex

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 2 +-
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 13 +------------
2 files changed, 2 insertions(+), 13 deletions(-)

--
1.9.1


From 1583483566479131942@xxx Wed Nov 08 07:53:27 +0000 2017
X-GM-THRID: 1583483566479131942
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread


2017-11-08 07:54:07

by Lipeng

[permalink] [raw]
Subject: [PATCH net-next 1/2] net: hns3: fix a bug when getting phy address from NCL_config file

From: Fuyun Liang <[email protected]>

Driver gets phy address from NCL_config file and uses the phy address
to initialize phydev. There are 5 bits for phy address. And C22 phy
address has 5 bits. So 0-31 are all valid address for phy. If there
is no phy, it will crash. Because driver always get a valid phy address.

This patch fixes the phy address to 8 bits, and use 0xff to indicate
invalid phy address.

Fixes: 46a3df9f9718 (net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support)
Signed-off-by: Fuyun Liang <[email protected]>
Signed-off-by: Lipeng <[email protected]>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
index 844c83e..ce5ed88 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h
@@ -390,7 +390,7 @@ struct hclge_pf_res_cmd {
#define HCLGE_CFG_TQP_DESC_N_S 16
#define HCLGE_CFG_TQP_DESC_N_M GENMASK(31, 16)
#define HCLGE_CFG_PHY_ADDR_S 0
-#define HCLGE_CFG_PHY_ADDR_M GENMASK(4, 0)
+#define HCLGE_CFG_PHY_ADDR_M GENMASK(7, 0)
#define HCLGE_CFG_MEDIA_TP_S 8
#define HCLGE_CFG_MEDIA_TP_M GENMASK(15, 8)
#define HCLGE_CFG_RX_BUF_LEN_S 16
--
1.9.1


From 1583708817137942320@xxx Fri Nov 10 19:33:43 +0000 2017
X-GM-THRID: 1583708817137942320
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-08 07:55:17

by Lipeng

[permalink] [raw]
Subject: [PATCH net-next 2/2] net: hns3: cleanup mac auto-negotiation state query in hclge_update_speed_duplex

From: Fuyun Liang <[email protected]>

When checking whether auto-negotiation is on, driver only needs to
check the value of mac.autoneg(SW) directly, and does not need to
query it from hardware. Because this value is always synchronized
with the auto-negotiation state of hardware.

This patch removes mac auto-negotiation state query in
hclge_update_speed_duplex().

Fixes: 46a3df9f9718 (net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support)
Signed-off-by: Fuyun Liang <[email protected]>
Signed-off-by: Lipeng <[email protected]>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index c6ba890..781d5a8 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2325,18 +2325,7 @@ static int hclge_update_speed_duplex(struct hclge_dev *hdev)
/* get the speed and duplex as autoneg'result from mac cmd when phy
* doesn't exit.
*/
- if (mac.phydev)
- return 0;
-
- /* update mac->antoneg. */
- ret = hclge_query_autoneg_result(hdev);
- if (ret) {
- dev_err(&hdev->pdev->dev,
- "autoneg result query failed %d\n", ret);
- return ret;
- }
-
- if (!mac.autoneg)
+ if (mac.phydev || !mac.autoneg)
return 0;

ret = hclge_query_mac_an_speed_dup(hdev, &speed, &duplex);
--
1.9.1


From 1583411081984362228@xxx Tue Nov 07 12:41:21 +0000 2017
X-GM-THRID: 1583407895593019071
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread