From 3147c6198571464749af94f0fbf6986a932ed8c7 Mon Sep 17 00:00:00 2001 Message-Id: <3147c6198571464749af94f0fbf6986a932ed8c7.1522697994.git.Jim.Somerville@windriver.com> From: Jim Somerville Date: Mon, 2 Apr 2018 15:35:12 -0400 Subject: [PATCH 1/1] ndo_get_vf_config poll for out of vf reset Same solution as 028daf80117376b22909becd9720daaefdfceff4 from the net-next tree as supplied by Intel, but we apply it to ndo_get_vf_config instead. Signed-off-by: Jim Somerville --- src/i40e_virtchnl_pf.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/i40e_virtchnl_pf.c b/src/i40e_virtchnl_pf.c index 83f6f88..6f749b6 100644 --- a/src/i40e_virtchnl_pf.c +++ b/src/i40e_virtchnl_pf.c @@ -3358,6 +3358,7 @@ int i40e_ndo_get_vf_config(struct net_device *netdev, struct i40e_pf *pf = vsi->back; struct i40e_vf *vf; int ret = 0; + u8 i; /* validate the request */ if (vf_id >= pf->num_alloc_vfs) { @@ -3369,6 +3370,16 @@ int i40e_ndo_get_vf_config(struct net_device *netdev, vf = &(pf->vf[vf_id]); /* first vsi is always the LAN vsi */ vsi = pf->vsi[vf->lan_vsi_idx]; + + /* When the VF is resetting wait until it is done. + * It can take up to 200 milliseconds, + * but wait for up to 300 milliseconds to be safe. + */ + for (i = 0; i < 15; i++) { + if (test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) + break; + msleep(20); + } if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states)) { dev_err(&pf->pdev->dev, "%s: VF %d still in reset. Try again.\n", __func__, vf_id); -- 1.8.3.1