lkml.org 
[lkml]   [2019]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.20 033/171] net: hns: Restart autoneg need return failed when autoneg off
    Date
    4.20-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    [ Upstream commit ed29ca8b9592562559c64d027fb5eb126e463e2c ]

    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>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 774beda040a1..e2710ff48fb0 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
    --
    2.19.1


    \
     
     \ /
      Last update: 2019-03-12 19:10    [W:5.089 / U:1.460 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site