All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alice Michael <alice.michael@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next PATCH S70 12/12] i40e: make use of i40e_reset_all_vfs when initializing new VFs
Date: Thu, 13 Apr 2017 04:45:55 -0400	[thread overview]
Message-ID: <20170413084555.6962-12-alice.michael@intel.com> (raw)
In-Reply-To: <20170413084555.6962-1-alice.michael@intel.com>

From: Jacob Keller <jacob.e.keller@intel.com>

When allocating a large number of VFs, the driver previously used
i40e_reset_vf in a sequence. Just as when performing a normal reset,
this accumulates a large amount of delay for handling all of the VFs in
sequence. This delay is mainly due to a hardware requirement to wait
after initiating a reset on the VF.

We recently added a new function, i40e_reset_all_vfs() which can be used
to amortize the delay time, by first triggering all VF resets, then
waiting once, and finally cleaning up and allocating the VFs. This is
almost as good as truly running the resets in parallel.

In order to avoid sending a spurious reset message to a client
interface, we have a check to see whether we've assigned
pf->num_alloc_vfs yet. This was originally intended as a way to
distinquish the "initialization" case from the regular reset case.

Unfortunately, this means that we can't directly use i40e_reset_all_vfs
yet. Lets avoid this check of pf->num_alloc_vfs by replacing it with
a proper VSI state bit which we can use instead. This makes the
intention much clearer and allows us to re-use the i40e_reset_all_vfs
function directly.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Williams, Mitch A <mitch.a.williams@intel.com>
Change-ID: I694279b37eb6b5a91b6670182d0c15d10244fd6e
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 +++++++---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index b97f9f2..355821b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1007,7 +1007,8 @@ static void i40e_cleanup_reset_vf(struct i40e_vf *vf)
 		set_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states);
 		clear_bit(I40E_VF_STATE_DISABLED, &vf->vf_states);
 		/* Do not notify the client during VF init */
-		if (vf->pf->num_alloc_vfs)
+		if (test_and_clear_bit(I40E_VF_STATE_PRE_ENABLE,
+				       &vf->vf_states))
 			i40e_notify_client_of_vf_reset(pf, abs_vf_id);
 		vf->num_vlan = 0;
 	}
@@ -1283,8 +1284,8 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
 		/* assign default capabilities */
 		set_bit(I40E_VIRTCHNL_VF_CAP_L2, &vfs[i].vf_caps);
 		vfs[i].spoofchk = true;
-		/* VF resources get allocated during reset */
-		i40e_reset_vf(&vfs[i], false);
+
+		set_bit(I40E_VF_STATE_PRE_ENABLE, &vfs[i].vf_states);
 
 		if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_SWITCHDEV) {
 			ret = i40e_alloc_port_netdev(&vfs[i],
@@ -1295,6 +1296,9 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
 	}
 	pf->num_alloc_vfs = num_alloc_vfs;
 
+	/* VF resources get allocated during reset */
+	i40e_reset_all_vfs(pf, false);
+
 	i40e_notify_client_of_vf_enable(pf, num_alloc_vfs);
 
 err_alloc:
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index 7ff45df..3b122ac 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -63,6 +63,7 @@ enum i40e_vf_states {
 	I40E_VF_STATE_DISABLED,
 	I40E_VF_STATE_MC_PROMISC,
 	I40E_VF_STATE_UC_PROMISC,
+	I40E_VF_STATE_PRE_ENABLE,
 };
 
 /* VF capabilities */
-- 
2.9.3


  parent reply	other threads:[~2017-04-13  8:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  8:45 [Intel-wired-lan] [next PATCH S70 01/12] i40e/i40evf: Add tracepoints Alice Michael
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 02/12] i40e: DCR 287 new AQ commands Alice Michael
2017-04-14 19:17   ` Shannon Nelson
2017-04-17 17:34   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 03/12] i40e: don't hold RTNL lock while waiting for VF reset to finish Alice Michael
2017-04-13 17:21   ` Keller, Jacob E
2017-04-14 21:46   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 04/12] i40e: factor out queue control from i40e_vsi_control_(tx|rx) Alice Michael
2017-04-13 17:22   ` Keller, Jacob E
2017-04-14 21:47   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 05/12] i40e: fix CONFIG_BUSY checks in i40e_set_settings function Alice Michael
2017-04-13 17:21   ` Keller, Jacob E
2017-04-14 21:48   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 06/12] i40e: reduce wait time for adminq command completion Alice Michael
2017-04-14 19:06   ` Shannon Nelson
2017-04-17 17:25   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 07/12] i40e: remove I40E_FLAG_IN_NETPOLL entirely Alice Michael
2017-04-17 17:25   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 08/12] i40e: split some code in i40e_reset_vf into helpers Alice Michael
2017-04-17 17:26   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 09/12] i40e: reset all VFs in parallel when rebuilding PF Alice Michael
2017-04-17 17:31   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 10/12] i40e: use i40e_stop_rings_no_wait to implement PORT_SUSPENDED state Alice Michael
2017-04-14 19:21   ` Shannon Nelson
2017-04-17 17:32   ` Bowers, AndrewX
2017-04-13  8:45 ` [Intel-wired-lan] [next PATCH S70 11/12] i40e: properly spell I40E_VF_STATE_* flags Alice Michael
2017-04-17 17:32   ` Bowers, AndrewX
2017-04-13  8:45 ` Alice Michael [this message]
2017-04-17 17:33   ` [Intel-wired-lan] [next PATCH S70 12/12] i40e: make use of i40e_reset_all_vfs when initializing new VFs Bowers, AndrewX
2017-04-13 23:12 ` [Intel-wired-lan] [next PATCH S70 01/12] i40e/i40evf: Add tracepoints Peterson, Scott D
2017-04-14 21:42 ` Bowers, AndrewX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170413084555.6962-12-alice.michael@intel.com \
    --to=alice.michael@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.