Skip to content

Commit

Permalink
net: hns3: Fix to support autoneg only for port attached with phy
Browse files Browse the repository at this point in the history
This patch adds a check to support autoneg(ethtool -A) only when PHY
is attached with the port.

Fixes: e2cb1de ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility
Layer) Support")
Signed-off-by: Fuyun Liang <liangfuyun1@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Fuyun Liang authored and David S. Miller committed May 1, 2018
1 parent c5ef83c commit 0c963e8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5169,12 +5169,6 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
struct phy_device *phydev = hdev->hw.mac.phydev;
u32 fc_autoneg;

/* Only support flow control negotiation for netdev with
* phy attached for now.
*/
if (!phydev)
return -EOPNOTSUPP;

fc_autoneg = hclge_get_autoneg(handle);
if (auto_neg != fc_autoneg) {
dev_info(&hdev->pdev->dev,
Expand All @@ -5193,6 +5187,12 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
if (!fc_autoneg)
return hclge_cfg_pauseparam(hdev, rx_en, tx_en);

/* Only support flow control negotiation for netdev with
* phy attached for now.
*/
if (!phydev)
return -EOPNOTSUPP;

return phy_start_aneg(phydev);
}

Expand Down

0 comments on commit 0c963e8

Please sign in to comment.