提交 6c02ad73 编写于 作者: S shenjian 提交者: Xie XiuQi

net: hns3: fix for restart autoneg

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

Previously driver enable autoneg repeatly to trigger restart
autoneg. Now we restart autoneg by stopping and starting mac.

Feature or Bugfix:Bugfix
Signed-off-by: Nshenjian (K) <shenjian15@huawei.com>
Reviewed-by: Nyisen.zhuang <yisen.zhuang@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 a88bc302
...@@ -268,6 +268,8 @@ struct hnae3_ae_dev { ...@@ -268,6 +268,8 @@ struct hnae3_ae_dev {
* set auto autonegotiation of pause frame use * set auto autonegotiation of pause frame use
* get_autoneg() * get_autoneg()
* get auto autonegotiation of pause frame use * get auto autonegotiation of pause frame use
* restart_autoneg()
* restart autonegotiation
* get_coalesce_usecs() * get_coalesce_usecs()
* get usecs to delay a TX interrupt after a packet is sent * get usecs to delay a TX interrupt after a packet is sent
* get_rx_max_coalesced_frames() * get_rx_max_coalesced_frames()
...@@ -386,6 +388,7 @@ struct hnae3_ae_ops { ...@@ -386,6 +388,7 @@ struct hnae3_ae_ops {
int (*set_autoneg)(struct hnae3_handle *handle, bool enable); int (*set_autoneg)(struct hnae3_handle *handle, bool enable);
int (*get_autoneg)(struct hnae3_handle *handle); int (*get_autoneg)(struct hnae3_handle *handle);
int (*restart_autoneg)(struct hnae3_handle *handle);
void (*get_coalesce_usecs)(struct hnae3_handle *handle, void (*get_coalesce_usecs)(struct hnae3_handle *handle,
u32 *tx_usecs, u32 *rx_usecs); u32 *tx_usecs, u32 *rx_usecs);
......
...@@ -943,7 +943,12 @@ static int hns3_nway_reset(struct net_device *netdev) ...@@ -943,7 +943,12 @@ static int hns3_nway_reset(struct net_device *netdev)
if (!netif_running(netdev)) if (!netif_running(netdev))
return 0; return 0;
if (!ops->get_autoneg || !ops->set_autoneg) if (hns3_nic_resetting(netdev)) {
netdev_err(netdev, "dev resetting!");
return -EBUSY;
}
if (!ops->get_autoneg || !ops->restart_autoneg)
return -EOPNOTSUPP; return -EOPNOTSUPP;
autoneg = ops->get_autoneg(handle); autoneg = ops->get_autoneg(handle);
...@@ -959,7 +964,7 @@ static int hns3_nway_reset(struct net_device *netdev) ...@@ -959,7 +964,7 @@ static int hns3_nway_reset(struct net_device *netdev)
if (handle->pdev->revision == 0x20) if (handle->pdev->revision == 0x20)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ops->set_autoneg(handle, true); return ops->restart_autoneg(handle);
} }
static void hns3_get_channels(struct net_device *netdev, static void hns3_get_channels(struct net_device *netdev,
......
...@@ -2267,6 +2267,18 @@ static int hclge_get_autoneg(struct hnae3_handle *handle) ...@@ -2267,6 +2267,18 @@ static int hclge_get_autoneg(struct hnae3_handle *handle)
return hdev->hw.mac.autoneg; return hdev->hw.mac.autoneg;
} }
static int hclge_restart_autoneg(struct hnae3_handle *handle)
{
struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back;
int ret;
ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
if (ret)
return ret;
return hclge_notify_client(hdev, HNAE3_UP_CLIENT);
}
static int hclge_set_fec_hw(struct hclge_dev *hdev, u32 fec_mode) static int hclge_set_fec_hw(struct hclge_dev *hdev, u32 fec_mode)
{ {
struct hclge_config_fec_cmd *req; struct hclge_config_fec_cmd *req;
...@@ -8178,7 +8190,7 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg, ...@@ -8178,7 +8190,7 @@ static int hclge_set_pauseparam(struct hnae3_handle *handle, u32 auto_neg,
if (hdev->pdev->revision == 0x20) if (hdev->pdev->revision == 0x20)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return hclge_set_autoneg(handle, true); return hclge_restart_autoneg(handle);
} }
static void hclge_get_ksettings_an_result(struct hnae3_handle *handle, static void hclge_get_ksettings_an_result(struct hnae3_handle *handle,
...@@ -9270,6 +9282,7 @@ struct hnae3_ae_ops hclge_ops = { ...@@ -9270,6 +9282,7 @@ struct hnae3_ae_ops hclge_ops = {
.rm_mc_addr = hclge_rm_mc_addr, .rm_mc_addr = hclge_rm_mc_addr,
.set_autoneg = hclge_set_autoneg, .set_autoneg = hclge_set_autoneg,
.get_autoneg = hclge_get_autoneg, .get_autoneg = hclge_get_autoneg,
.restart_autoneg = hclge_restart_autoneg,
.get_pauseparam = hclge_get_pauseparam, .get_pauseparam = hclge_get_pauseparam,
.set_pauseparam = hclge_set_pauseparam, .set_pauseparam = hclge_set_pauseparam,
.set_mtu = hclge_set_mtu, .set_mtu = hclge_set_mtu,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册