提交 f8d4db35 编写于 作者: M Mitch Williams 提交者: Jeff Kirsher

i40evf: make early init processing more robust

In early init, if we get an unexpected message from the PF (such as link
status), we just kick an error back to the init task, causing it to
restart its state machine and delaying initialization.

Make the early init AQ message receive code more robust by handling
messages in a loop, and ignoring those that we aren't interested in.
This also gets rid of some scary log messages that really didn't
indicate a problem.

Change-ID: I620e8c72e49c49c665ef33eeab2425dd10e721cf
Signed-off-by: NMitch Williams <mitch.a.williams@intel.com>
Signed-off-by: NPatrick Lu <patrick.lu@intel.com>
Tested-by: NJim Young <jamesx.m.young@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 79442d38
...@@ -89,6 +89,7 @@ int i40evf_verify_api_ver(struct i40evf_adapter *adapter) ...@@ -89,6 +89,7 @@ int i40evf_verify_api_ver(struct i40evf_adapter *adapter)
struct i40e_virtchnl_version_info *pf_vvi; struct i40e_virtchnl_version_info *pf_vvi;
struct i40e_hw *hw = &adapter->hw; struct i40e_hw *hw = &adapter->hw;
struct i40e_arq_event_info event; struct i40e_arq_event_info event;
enum i40e_virtchnl_ops op;
i40e_status err; i40e_status err;
event.msg_size = I40EVF_MAX_AQ_BUF_SIZE; event.msg_size = I40EVF_MAX_AQ_BUF_SIZE;
...@@ -98,18 +99,27 @@ int i40evf_verify_api_ver(struct i40evf_adapter *adapter) ...@@ -98,18 +99,27 @@ int i40evf_verify_api_ver(struct i40evf_adapter *adapter)
goto out; goto out;
} }
err = i40evf_clean_arq_element(hw, &event, NULL); while (1) {
if (err == I40E_ERR_ADMIN_QUEUE_NO_WORK) err = i40evf_clean_arq_element(hw, &event, NULL);
goto out_alloc; /* When the AQ is empty, i40evf_clean_arq_element will return
* nonzero and this loop will terminate.
*/
if (err)
goto out_alloc;
op =
(enum i40e_virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
if (op == I40E_VIRTCHNL_OP_VERSION)
break;
}
err = (i40e_status)le32_to_cpu(event.desc.cookie_low); err = (i40e_status)le32_to_cpu(event.desc.cookie_low);
if (err) if (err)
goto out_alloc; goto out_alloc;
if ((enum i40e_virtchnl_ops)le32_to_cpu(event.desc.cookie_high) != if (op != I40E_VIRTCHNL_OP_VERSION) {
I40E_VIRTCHNL_OP_VERSION) {
dev_info(&adapter->pdev->dev, "Invalid reply type %d from PF\n", dev_info(&adapter->pdev->dev, "Invalid reply type %d from PF\n",
le32_to_cpu(event.desc.cookie_high)); op);
err = -EIO; err = -EIO;
goto out_alloc; goto out_alloc;
} }
...@@ -153,8 +163,9 @@ int i40evf_get_vf_config(struct i40evf_adapter *adapter) ...@@ -153,8 +163,9 @@ int i40evf_get_vf_config(struct i40evf_adapter *adapter)
{ {
struct i40e_hw *hw = &adapter->hw; struct i40e_hw *hw = &adapter->hw;
struct i40e_arq_event_info event; struct i40e_arq_event_info event;
u16 len; enum i40e_virtchnl_ops op;
i40e_status err; i40e_status err;
u16 len;
len = sizeof(struct i40e_virtchnl_vf_resource) + len = sizeof(struct i40e_virtchnl_vf_resource) +
I40E_MAX_VF_VSI * sizeof(struct i40e_virtchnl_vsi_resource); I40E_MAX_VF_VSI * sizeof(struct i40e_virtchnl_vsi_resource);
...@@ -165,29 +176,21 @@ int i40evf_get_vf_config(struct i40evf_adapter *adapter) ...@@ -165,29 +176,21 @@ int i40evf_get_vf_config(struct i40evf_adapter *adapter)
goto out; goto out;
} }
err = i40evf_clean_arq_element(hw, &event, NULL); while (1) {
if (err == I40E_ERR_ADMIN_QUEUE_NO_WORK) event.msg_size = len;
goto out_alloc; /* When the AQ is empty, i40evf_clean_arq_element will return
* nonzero and this loop will terminate.
err = (i40e_status)le32_to_cpu(event.desc.cookie_low); */
if (err) { err = i40evf_clean_arq_element(hw, &event, NULL);
dev_err(&adapter->pdev->dev, if (err)
"%s: Error returned from PF, %d, %d\n", __func__, goto out_alloc;
le32_to_cpu(event.desc.cookie_high), op =
le32_to_cpu(event.desc.cookie_low)); (enum i40e_virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
err = -EIO; if (op == I40E_VIRTCHNL_OP_GET_VF_RESOURCES)
goto out_alloc; break;
} }
if ((enum i40e_virtchnl_ops)le32_to_cpu(event.desc.cookie_high) != err = (i40e_status)le32_to_cpu(event.desc.cookie_low);
I40E_VIRTCHNL_OP_GET_VF_RESOURCES) {
dev_err(&adapter->pdev->dev,
"%s: Invalid response from PF, %d, %d\n", __func__,
le32_to_cpu(event.desc.cookie_high),
le32_to_cpu(event.desc.cookie_low));
err = -EIO;
goto out_alloc;
}
memcpy(adapter->vf_res, event.msg_buf, min(event.msg_size, len)); memcpy(adapter->vf_res, event.msg_buf, min(event.msg_size, len));
i40e_vf_parse_hw_config(hw, adapter->vf_res); i40e_vf_parse_hw_config(hw, adapter->vf_res);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册