From: Shaozhengchao shaozhengchao@huawei.com
driver inclusion category: bugfix bugzilla: 4472
-----------------------------------------------------------------------
When the VF is performing the updown operation and receiving packets at the same time, the NIC may report the 5d0 error during the PF hot upgrade NIC firmware. In order to solve the problem, VF driver and PF driver must wait for the meassage that vport is disabled by NIC firmware. Then driver can release tx and rx resources. So we set Mbox timeout equals to 30 seconds, api cmd timeout equals to 25 seconds and cmdq timeout equals to 5 seconds.
Signed-off-by: Shaozhengchao shaozhengchao@huawei.com Reviewed-by: Luoshaokai luoshaokai@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/huawei/hinic/hinic_cmdq.c | 2 +- drivers/net/ethernet/huawei/hinic/hinic_nic.h | 2 ++ drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c | 22 +++++++++++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c b/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c index 23612e8..38b5486 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c @@ -37,7 +37,7 @@ #include "hinic_wq.h" #include "hinic_cmdq.h"
-#define CMDQ_CMD_TIMEOUT 1000 /* millisecond */ +#define CMDQ_CMD_TIMEOUT 5000 /* millisecond */
#define UPPER_8_BITS(data) (((data) >> 8) & 0xFF) #define LOWER_8_BITS(data) ((data) & 0xFF) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic.h b/drivers/net/ethernet/huawei/hinic/hinic_nic.h index 7e92563..5b5b094 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic.h @@ -18,6 +18,8 @@
#include "hinic_wq.h"
+#define SET_VPORT_MBOX_TIMEOUT (30 * 1000) +#define SET_VPORT_MGMT_TIMEOUT (25 * 1000) struct hinic_sq { struct hinic_wq *wq;
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c index cac0cdb..07858be 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_cfg.c @@ -1696,6 +1696,7 @@ int hinic_set_vport_enable(void *hwdev, bool enable) struct hinic_vport_state en_state = {0}; u16 out_size = sizeof(en_state); int err; + u32 timeout;
if (!hwdev) return -EINVAL; @@ -1706,9 +1707,16 @@ int hinic_set_vport_enable(void *hwdev, bool enable)
en_state.state = enable ? 1 : 0;
- err = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_SET_VPORT_ENABLE, - &en_state, sizeof(en_state), - &en_state, &out_size); + if (HINIC_IS_VF(nic_hwdev)) + timeout = SET_VPORT_MBOX_TIMEOUT; + else + timeout = SET_VPORT_MGMT_TIMEOUT; + + err = hinic_msg_to_mgmt_sync(hwdev, HINIC_MOD_L2NIC, + HINIC_PORT_CMD_SET_VPORT_ENABLE, + &en_state, sizeof(en_state), &en_state, + &out_size, timeout); + if (err || !out_size || en_state.status) { nic_err(nic_hwdev->dev_hdl, "Failed to set vport state, err: %d, status: 0x%x, out size: 0x%x\n", err, en_state.status, out_size); @@ -1897,7 +1905,7 @@ int hinic_rss_get_template_tbl(void *hwdev, u32 tmpl_idx, u8 *temp) &temp_key, sizeof(temp_key), &temp_key, &out_size); if (err || !out_size || temp_key.status) { - nic_err(nic_hwdev->dev_hdl, "Failed to set hash key, err: %d, status: 0x%x, out size: 0x%x\n", + nic_err(nic_hwdev->dev_hdl, "Failed to get hash key, err: %d, status: 0x%x, out size: 0x%x\n", err, temp_key.status, out_size); return -EINVAL; } @@ -2667,6 +2675,7 @@ int nic_pf_mbox_handler(void *hwdev, u16 vf_id, u8 cmd, void *buf_in, u8 size = sizeof(nic_cmd_support_vf) / sizeof(nic_cmd_support_vf[0]); struct hinic_nic_io *nic_io; int err = 0; + u32 timeout = 0;
if (!hwdev) return -EFAULT; @@ -2731,9 +2740,12 @@ int nic_pf_mbox_handler(void *hwdev, u16 vf_id, u8 cmd, void *buf_in,
default: /* pass through */ + if (cmd == HINIC_PORT_CMD_SET_VPORT_ENABLE) + timeout = SET_VPORT_MGMT_TIMEOUT; + err = hinic_pf_msg_to_mgmt_sync(nic_io->hwdev, HINIC_MOD_L2NIC, cmd, buf_in, in_size, - buf_out, out_size, 0); + buf_out, out_size, timeout);
break; }