gplv2/intel-i40e/files/ndo_get_vf_config-poll-for-...

50 lines
1.7 KiB
Diff

From 25b521f58b33bf070c0b31d077333c13c3ad25e8 Mon Sep 17 00:00:00 2001
Message-Id: <25b521f58b33bf070c0b31d077333c13c3ad25e8.1528830095.git.Jim.Somerville@windriver.com>
In-Reply-To: <412fdc8c0d51500e42e76e788ece3ca7dd260ced.1528830095.git.Jim.Somerville@windriver.com>
References: <412fdc8c0d51500e42e76e788ece3ca7dd260ced.1528830095.git.Jim.Somerville@windriver.com>
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Mon, 2 Apr 2018 15:35:12 -0400
Subject: [PATCH 3/3] 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 <Jim.Somerville@windriver.com>
---
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 da29fc3..d5935d6 100644
--- a/src/i40e_virtchnl_pf.c
+++ b/src/i40e_virtchnl_pf.c
@@ -3431,6 +3431,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) {
@@ -3442,6 +3443,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