Merge branch 'hns3-next'
Huazhong Tan says: ==================== code optimizations & bugfixes for HNS3 driver This patchset includes bugfixes and code optimizations for the HNS3 ethernet controller driver. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
5af82f5205
@ -3718,13 +3718,13 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
|
||||
struct hns3_nic_priv *priv = netdev_priv(netdev);
|
||||
int ret;
|
||||
|
||||
hns3_client_stop(handle);
|
||||
|
||||
hns3_remove_hw_addr(netdev);
|
||||
|
||||
if (netdev->reg_state != NETREG_UNINITIALIZED)
|
||||
unregister_netdev(netdev);
|
||||
|
||||
hns3_client_stop(handle);
|
||||
|
||||
if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
|
||||
netdev_warn(netdev, "already uninitialized\n");
|
||||
goto out_netdev_free;
|
||||
@ -4075,10 +4075,18 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle)
|
||||
if (ret)
|
||||
goto err_uninit_vector;
|
||||
|
||||
ret = hns3_client_start(handle);
|
||||
if (ret) {
|
||||
dev_err(priv->dev, "hns3_client_start fail! ret=%d\n", ret);
|
||||
goto err_uninit_ring;
|
||||
}
|
||||
|
||||
set_bit(HNS3_NIC_STATE_INITED, &priv->state);
|
||||
|
||||
return ret;
|
||||
|
||||
err_uninit_ring:
|
||||
hns3_uninit_all_ring(priv);
|
||||
err_uninit_vector:
|
||||
hns3_nic_uninit_vector_data(priv);
|
||||
priv->ring_data = NULL;
|
||||
|
@ -373,21 +373,26 @@ int hclge_cmd_init(struct hclge_dev *hdev)
|
||||
* reset may happen when lower level reset is being processed.
|
||||
*/
|
||||
if ((hclge_is_reset_pending(hdev))) {
|
||||
set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);
|
||||
return -EBUSY;
|
||||
ret = -EBUSY;
|
||||
goto err_cmd_init;
|
||||
}
|
||||
|
||||
ret = hclge_cmd_query_firmware_version(&hdev->hw, &version);
|
||||
if (ret) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"firmware version query failed %d\n", ret);
|
||||
return ret;
|
||||
goto err_cmd_init;
|
||||
}
|
||||
hdev->fw_version = version;
|
||||
|
||||
dev_info(&hdev->pdev->dev, "The firmware version is %08x\n", version);
|
||||
|
||||
return 0;
|
||||
|
||||
err_cmd_init:
|
||||
set_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void hclge_cmd_uninit_regs(struct hclge_hw *hw)
|
||||
|
@ -32,6 +32,7 @@
|
||||
static int hclge_set_mac_mtu(struct hclge_dev *hdev, int new_mps);
|
||||
static int hclge_init_vlan_config(struct hclge_dev *hdev);
|
||||
static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev);
|
||||
static bool hclge_get_hw_reset_stat(struct hnae3_handle *handle);
|
||||
static int hclge_set_umv_space(struct hclge_dev *hdev, u16 space_size,
|
||||
u16 *allocated_size, bool is_alloc);
|
||||
|
||||
@ -2163,7 +2164,8 @@ static int hclge_mac_init(struct hclge_dev *hdev)
|
||||
|
||||
static void hclge_mbx_task_schedule(struct hclge_dev *hdev)
|
||||
{
|
||||
if (!test_and_set_bit(HCLGE_STATE_MBX_SERVICE_SCHED, &hdev->state))
|
||||
if (!test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state) &&
|
||||
!test_and_set_bit(HCLGE_STATE_MBX_SERVICE_SCHED, &hdev->state))
|
||||
schedule_work(&hdev->mbx_service_task);
|
||||
}
|
||||
|
||||
@ -2677,7 +2679,7 @@ static int hclge_set_all_vf_rst(struct hclge_dev *hdev, bool reset)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!reset)
|
||||
if (!reset || !test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state))
|
||||
continue;
|
||||
|
||||
/* Inform VF to process the reset.
|
||||
@ -2714,9 +2716,18 @@ int hclge_func_reset_cmd(struct hclge_dev *hdev, int func_id)
|
||||
|
||||
static void hclge_do_reset(struct hclge_dev *hdev)
|
||||
{
|
||||
struct hnae3_handle *handle = &hdev->vport[0].nic;
|
||||
struct pci_dev *pdev = hdev->pdev;
|
||||
u32 val;
|
||||
|
||||
if (hclge_get_hw_reset_stat(handle)) {
|
||||
dev_info(&pdev->dev, "Hardware reset not finish\n");
|
||||
dev_info(&pdev->dev, "func_rst_reg:0x%x, global_rst_reg:0x%x\n",
|
||||
hclge_read_dev(&hdev->hw, HCLGE_FUN_RST_ING),
|
||||
hclge_read_dev(&hdev->hw, HCLGE_GLOBAL_RESET_REG));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (hdev->reset_type) {
|
||||
case HNAE3_GLOBAL_RESET:
|
||||
val = hclge_read_dev(&hdev->hw, HCLGE_GLOBAL_RESET_REG);
|
||||
@ -2795,6 +2806,10 @@ static enum hnae3_reset_type hclge_get_reset_level(struct hclge_dev *hdev,
|
||||
clear_bit(HNAE3_FLR_RESET, addr);
|
||||
}
|
||||
|
||||
if (hdev->reset_type != HNAE3_NONE_RESET &&
|
||||
rst_level < hdev->reset_type)
|
||||
return HNAE3_NONE_RESET;
|
||||
|
||||
return rst_level;
|
||||
}
|
||||
|
||||
@ -3022,6 +3037,7 @@ static void hclge_reset(struct hclge_dev *hdev)
|
||||
hdev->last_reset_time = jiffies;
|
||||
hdev->reset_fail_cnt = 0;
|
||||
ae_dev->reset_type = HNAE3_NONE_RESET;
|
||||
del_timer(&hdev->reset_timer);
|
||||
|
||||
return;
|
||||
|
||||
@ -7732,7 +7748,7 @@ static void hclge_reset_vport_state(struct hclge_dev *hdev)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < hdev->num_alloc_vport; i++) {
|
||||
hclge_vport_start(vport);
|
||||
hclge_vport_stop(vport);
|
||||
vport++;
|
||||
}
|
||||
}
|
||||
|
@ -357,8 +357,8 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev)
|
||||
* reset may happen when lower level reset is being processed.
|
||||
*/
|
||||
if (hclgevf_is_reset_pending(hdev)) {
|
||||
set_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state);
|
||||
return -EBUSY;
|
||||
ret = -EBUSY;
|
||||
goto err_cmd_init;
|
||||
}
|
||||
|
||||
/* get firmware version */
|
||||
@ -366,13 +366,18 @@ int hclgevf_cmd_init(struct hclgevf_dev *hdev)
|
||||
if (ret) {
|
||||
dev_err(&hdev->pdev->dev,
|
||||
"failed(%d) to query firmware version\n", ret);
|
||||
return ret;
|
||||
goto err_cmd_init;
|
||||
}
|
||||
hdev->fw_version = version;
|
||||
|
||||
dev_info(&hdev->pdev->dev, "The firmware version is %08x\n", version);
|
||||
|
||||
return 0;
|
||||
|
||||
err_cmd_init:
|
||||
set_bit(HCLGEVF_STATE_CMD_DISABLE, &hdev->state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void hclgevf_cmd_uninit_regs(struct hclgevf_hw *hw)
|
||||
|
@ -1474,6 +1474,8 @@ err_reset:
|
||||
*/
|
||||
hclgevf_cmd_init(hdev);
|
||||
dev_err(&hdev->pdev->dev, "failed to reset VF\n");
|
||||
if (hclgevf_is_reset_pending(hdev))
|
||||
hclgevf_reset_task_schedule(hdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1583,8 +1585,7 @@ static void hclgevf_get_misc_vector(struct hclgevf_dev *hdev)
|
||||
|
||||
void hclgevf_reset_task_schedule(struct hclgevf_dev *hdev)
|
||||
{
|
||||
if (!test_bit(HCLGEVF_STATE_RST_SERVICE_SCHED, &hdev->state) &&
|
||||
!test_bit(HCLGEVF_STATE_RST_HANDLING, &hdev->state)) {
|
||||
if (!test_bit(HCLGEVF_STATE_RST_SERVICE_SCHED, &hdev->state)) {
|
||||
set_bit(HCLGEVF_STATE_RST_SERVICE_SCHED, &hdev->state);
|
||||
schedule_work(&hdev->rst_service_task);
|
||||
}
|
||||
@ -2030,9 +2031,15 @@ static int hclgevf_set_alive(struct hnae3_handle *handle, bool alive)
|
||||
static int hclgevf_client_start(struct hnae3_handle *handle)
|
||||
{
|
||||
struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
|
||||
int ret;
|
||||
|
||||
ret = hclgevf_set_alive(handle, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mod_timer(&hdev->keep_alive_timer, jiffies + 2 * HZ);
|
||||
return hclgevf_set_alive(handle, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hclgevf_client_stop(struct hnae3_handle *handle)
|
||||
@ -2074,6 +2081,10 @@ static void hclgevf_state_uninit(struct hclgevf_dev *hdev)
|
||||
{
|
||||
set_bit(HCLGEVF_STATE_DOWN, &hdev->state);
|
||||
|
||||
if (hdev->keep_alive_timer.function)
|
||||
del_timer_sync(&hdev->keep_alive_timer);
|
||||
if (hdev->keep_alive_task.func)
|
||||
cancel_work_sync(&hdev->keep_alive_task);
|
||||
if (hdev->service_timer.function)
|
||||
del_timer_sync(&hdev->service_timer);
|
||||
if (hdev->service_task.func)
|
||||
|
Loading…
Reference in New Issue
Block a user