Commit 34dfdf21 authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'there-are-some-bugfix-for-the-hns3-ethernet-driver'

Jijie Shao says:

====================
There are some bugfix for the HNS3 ethernet driver
====================

Link: https://patch.msgid.link/20240813141024.1707252-1-shaojijie@huawei.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 7965a7f3 7660833d
...@@ -5724,6 +5724,9 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) ...@@ -5724,6 +5724,9 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
struct net_device *netdev = handle->kinfo.netdev; struct net_device *netdev = handle->kinfo.netdev;
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hns3_nic_priv *priv = netdev_priv(netdev);
if (!test_bit(HNS3_NIC_STATE_DOWN, &priv->state))
hns3_nic_net_stop(netdev);
if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) { if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
netdev_warn(netdev, "already uninitialized\n"); netdev_warn(netdev, "already uninitialized\n");
return 0; return 0;
......
...@@ -1598,8 +1598,7 @@ static void hclge_query_reg_info_of_ssu(struct hclge_dev *hdev) ...@@ -1598,8 +1598,7 @@ static void hclge_query_reg_info_of_ssu(struct hclge_dev *hdev)
{ {
u32 loop_para[HCLGE_MOD_MSG_PARA_ARRAY_MAX_SIZE] = {0}; u32 loop_para[HCLGE_MOD_MSG_PARA_ARRAY_MAX_SIZE] = {0};
struct hclge_mod_reg_common_msg msg; struct hclge_mod_reg_common_msg msg;
u8 i, j, num; u8 i, j, num, loop_time;
u32 loop_time;
num = ARRAY_SIZE(hclge_ssu_reg_common_msg); num = ARRAY_SIZE(hclge_ssu_reg_common_msg);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
...@@ -1609,7 +1608,8 @@ static void hclge_query_reg_info_of_ssu(struct hclge_dev *hdev) ...@@ -1609,7 +1608,8 @@ static void hclge_query_reg_info_of_ssu(struct hclge_dev *hdev)
loop_time = 1; loop_time = 1;
loop_para[0] = 0; loop_para[0] = 0;
if (msg.need_para) { if (msg.need_para) {
loop_time = hdev->ae_dev->dev_specs.tnl_num; loop_time = min(hdev->ae_dev->dev_specs.tnl_num,
HCLGE_MOD_MSG_PARA_ARRAY_MAX_SIZE);
for (j = 0; j < loop_time; j++) for (j = 0; j < loop_time; j++)
loop_para[j] = j + 1; loop_para[j] = j + 1;
} }
......
...@@ -2653,8 +2653,17 @@ static int hclge_cfg_mac_speed_dup_h(struct hnae3_handle *handle, int speed, ...@@ -2653,8 +2653,17 @@ static int hclge_cfg_mac_speed_dup_h(struct hnae3_handle *handle, int speed,
{ {
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
int ret;
ret = hclge_cfg_mac_speed_dup(hdev, speed, duplex, lane_num);
return hclge_cfg_mac_speed_dup(hdev, speed, duplex, lane_num); if (ret)
return ret;
hdev->hw.mac.req_speed = speed;
hdev->hw.mac.req_duplex = duplex;
return 0;
} }
static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable) static int hclge_set_autoneg_en(struct hclge_dev *hdev, bool enable)
...@@ -2956,13 +2965,16 @@ static int hclge_mac_init(struct hclge_dev *hdev) ...@@ -2956,13 +2965,16 @@ static int hclge_mac_init(struct hclge_dev *hdev)
if (!test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state)) if (!test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
hdev->hw.mac.duplex = HCLGE_MAC_FULL; hdev->hw.mac.duplex = HCLGE_MAC_FULL;
ret = hclge_cfg_mac_speed_dup_hw(hdev, hdev->hw.mac.speed, if (hdev->hw.mac.support_autoneg) {
hdev->hw.mac.duplex, hdev->hw.mac.lane_num); ret = hclge_set_autoneg_en(hdev, hdev->hw.mac.autoneg);
if (ret) if (ret)
return ret; return ret;
}
if (hdev->hw.mac.support_autoneg) { if (!hdev->hw.mac.autoneg) {
ret = hclge_set_autoneg_en(hdev, hdev->hw.mac.autoneg); ret = hclge_cfg_mac_speed_dup_hw(hdev, hdev->hw.mac.req_speed,
hdev->hw.mac.req_duplex,
hdev->hw.mac.lane_num);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -11444,7 +11456,7 @@ static void hclge_pci_uninit(struct hclge_dev *hdev) ...@@ -11444,7 +11456,7 @@ static void hclge_pci_uninit(struct hclge_dev *hdev)
pcim_iounmap(pdev, hdev->hw.hw.io_base); pcim_iounmap(pdev, hdev->hw.hw.io_base);
pci_free_irq_vectors(pdev); pci_free_irq_vectors(pdev);
pci_release_mem_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
} }
...@@ -11516,7 +11528,7 @@ static void hclge_reset_done(struct hnae3_ae_dev *ae_dev) ...@@ -11516,7 +11528,7 @@ static void hclge_reset_done(struct hnae3_ae_dev *ae_dev)
dev_err(&hdev->pdev->dev, "fail to rebuild, ret=%d\n", ret); dev_err(&hdev->pdev->dev, "fail to rebuild, ret=%d\n", ret);
hdev->reset_type = HNAE3_NONE_RESET; hdev->reset_type = HNAE3_NONE_RESET;
clear_bit(HCLGE_STATE_RST_HANDLING, &hdev->state); if (test_and_clear_bit(HCLGE_STATE_RST_HANDLING, &hdev->state))
up(&hdev->reset_sem); up(&hdev->reset_sem);
} }
......
...@@ -191,6 +191,9 @@ static void hclge_mac_adjust_link(struct net_device *netdev) ...@@ -191,6 +191,9 @@ static void hclge_mac_adjust_link(struct net_device *netdev)
if (ret) if (ret)
netdev_err(netdev, "failed to adjust link.\n"); netdev_err(netdev, "failed to adjust link.\n");
hdev->hw.mac.req_speed = (u32)speed;
hdev->hw.mac.req_duplex = (u8)duplex;
ret = hclge_cfg_flowctrl(hdev); ret = hclge_cfg_flowctrl(hdev);
if (ret) if (ret)
netdev_err(netdev, "failed to configure flow control.\n"); netdev_err(netdev, "failed to configure flow control.\n");
......
...@@ -1747,7 +1747,7 @@ static void hclgevf_reset_done(struct hnae3_ae_dev *ae_dev) ...@@ -1747,7 +1747,7 @@ static void hclgevf_reset_done(struct hnae3_ae_dev *ae_dev)
ret); ret);
hdev->reset_type = HNAE3_NONE_RESET; hdev->reset_type = HNAE3_NONE_RESET;
clear_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state); if (test_and_clear_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state))
up(&hdev->reset_sem); up(&hdev->reset_sem);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment