Currently, when performing the following test case:
1. Run testpmd application based on hns3 PF device.
2. Inject reset(global/IMP reset) repeatedly.
After the reset, the network port can't link up.
In the RESET_STAGE_DEV_INIT stage of the reset process, the driver will
reinitialize the hardware. If global/IMP reset occurs at this time
again, the operation of reinitialize the hardware will fail because that
firmware don't respond to the configuration commands issued by driver.
In current driver, when failed to reinitialize the hardware, rollback
operation is done, such as clearing the relevant configuration of the
command queue registers.
If firmware detects that the function's command queue register is not
configured correctly, it will not complete the reset related hardware
configuration for this function, resulting in that driver can't detect
that the hardware reset has been completed. And then the reset process
of the driver exit abnormally, the hardware can not work normally after
reset.
This patch fixes it by avoid clearing the command queue related
registers when failed to reinitialize the hardware in the
RESET_STAGE_DEV_INIT stage of the reset process.
Fixes:
2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
return 0;
err_cmd_init:
- hns3_cmd_uninit(hw);
+ rte_atomic16_set(&hw->reset.disable_cmd, 1);
return ret;
}
rte_intr_disable(&pci_dev->intr_handle);
hns3_intr_unregister(&pci_dev->intr_handle, hns3_interrupt_handler,
eth_dev);
-
err_intr_callback_register:
- hns3_cmd_uninit(hw);
-
err_cmd_init:
+ hns3_cmd_uninit(hw);
hns3_cmd_destroy_queue(hw);
-
err_cmd_init_queue:
hw->io_base = NULL;
ret = hns3_reset_all_queues(hns);
if (ret) {
hns3_err(hw, "Failed to reset all queues: %d", ret);
- goto err_init;
+ return ret;
}
ret = hns3_init_hardware(hns);
if (ret) {
hns3_err(hw, "Failed to init hardware: %d", ret);
- goto err_init;
+ return ret;
}
ret = hns3_enable_hw_error_intr(hns, true);
if (ret) {
hns3_err(hw, "fail to enable hw error interrupts: %d",
ret);
- goto err_mac_init;
+ return ret;
}
hns3_info(hw, "Reset done, driver initialization finished.");
return 0;
-
-err_mac_init:
- hns3_uninit_umv_space(hw);
-err_init:
- hns3_cmd_uninit(hw);
-
- return ret;
}
static bool
hns3_intr_unregister(&pci_dev->intr_handle, hns3vf_interrupt_handler,
eth_dev);
err_intr_callback_register:
- hns3_cmd_uninit(hw);
-
err_cmd_init:
+ hns3_cmd_uninit(hw);
hns3_cmd_destroy_queue(hw);
-
err_cmd_init_queue:
hw->io_base = NULL;
ret = hns3_cmd_init(hw);
if (ret) {
hns3_err(hw, "Failed to init cmd: %d", ret);
- goto err_cmd_init;
+ return ret;
}
if (hw->reset.level == HNS3_VF_FULL_RESET) {
ret = hns3_reset_all_queues(hns);
if (ret) {
hns3_err(hw, "Failed to reset all queues: %d", ret);
- goto err_init;
+ return ret;
}
ret = hns3vf_init_hardware(hns);
if (ret) {
hns3_err(hw, "Failed to init hardware: %d", ret);
- goto err_init;
+ return ret;
}
return 0;
-
-err_cmd_init:
- hns3vf_set_bus_master(pci_dev, false);
-err_init:
- hns3_cmd_uninit(hw);
- return ret;
}
static const struct eth_dev_ops hns3vf_eth_dev_ops = {