Re: [PATCH V2 net-next 4/7] net: hns3: fix port setting handle for fibre port

From: tanhuazhong
Date: Wed Sep 11 2019 - 20:56:27 EST




On 2019/9/11 18:16, Sergei Shtylyov wrote:
Hello!

On 11.09.2019 5:40, Huazhong Tan wrote:

From: Guangbin Huang <huangguangbin2@xxxxxxxxxx>

For hardware doesn't support use specified speed and duplex

ÂÂ Can't pasre that. "For hardware that does not support using", perhaps?

Yes, thanks. Will check the grammar more carefully next time.


to negotiate, it's unnecessary to check and modify the port
speed and duplex for fibre port when autoneg is on.

Fixes: 22f48e24a23d ("net: hns3: add autoneg and change speed support for fibre port")
Signed-off-by: Guangbin Huang <huangguangbin2@xxxxxxxxxx>
Signed-off-by: Huazhong Tan <tanhuazhong@xxxxxxxxxx>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
index f5a681d..680c350 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
@@ -726,6 +726,12 @@ static int hns3_check_ksettings_param(const struct net_device *netdev,
ÂÂÂÂÂ u8 duplex;
ÂÂÂÂÂ int ret;
+ÂÂÂ /* hw doesn't support use specified speed and duplex to negotiate,

ÂÂ I can't parse that, did you mean "using"?

yes, thanks.


+ÂÂÂÂ * unnecessary to check them when autoneg on.
+ÂÂÂÂ */
+ÂÂÂ if (cmd->base.autoneg)
+ÂÂÂÂÂÂÂ return 0;
+
ÂÂÂÂÂ if (ops->get_ksettings_an_result) {
ÂÂÂÂÂÂÂÂÂ ops->get_ksettings_an_result(handle, &autoneg, &speed, &duplex);
ÂÂÂÂÂÂÂÂÂ if (cmd->base.autoneg == autoneg && cmd->base.speed == speed &&
@@ -787,6 +793,15 @@ static int hns3_set_link_ksettings(struct net_device *netdev,
ÂÂÂÂÂÂÂÂÂÂÂÂÂ return ret;
ÂÂÂÂÂ }
+ÂÂÂ /* hw doesn't support use specified speed and duplex to negotiate,

ÂÂ Here too...



yes, thanks.

+ÂÂÂÂ * ignore them when autoneg on.
+ÂÂÂÂ */
+ÂÂÂ if (cmd->base.autoneg) {
+ÂÂÂÂÂÂÂ netdev_info(netdev,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ "autoneg is on, ignore the speed and duplex\n");
+ÂÂÂÂÂÂÂ return 0;
+ÂÂÂ }
+
ÂÂÂÂÂ if (ops->cfg_mac_speed_dup_h)
ÂÂÂÂÂÂÂÂÂ ret = ops->cfg_mac_speed_dup_h(handle, cmd->base.speed,
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ cmd->base.duplex);

MBR, Sergei

.