i40e ndo_get_vf_config poll for out of vf reset

It can take up to 200 mS for a vf to come out of reset.  Poll
for it being ready rather than just abandoning the request.

Change-Id: I76a93029e155fada3ef8f652a562552031c06a41
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
This commit is contained in:
Jim Somerville 2018-04-13 14:53:38 -04:00 committed by Scott Little
parent e3a113abf5
commit fda572c53e
2 changed files with 48 additions and 0 deletions

View File

@ -25,6 +25,7 @@ Source11: modules-load.conf
Patch01: i40e-Enable-getting-link-status-from-VF.patch
Patch02: i40e-add-more-debug-info-for-VFs-still-in-reset.patch
Patch03: ndo_get_vf_config-poll-for-out-of-vf-reset.patch
%define kversion %(rpm -q kernel%{?bt_ext}-devel | sort --version-sort | tail -1 | sed 's/kernel%{?bt_ext}-devel-//')

View File

@ -0,0 +1,47 @@
From 3147c6198571464749af94f0fbf6986a932ed8c7 Mon Sep 17 00:00:00 2001
Message-Id: <3147c6198571464749af94f0fbf6986a932ed8c7.1522697994.git.Jim.Somerville@windriver.com>
From: Jim Somerville <Jim.Somerville@windriver.com>
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 <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 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