From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Mitch Williams <mitch.a.williams@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next v2 08/16] i40e: move i40e_reset_vf
Date: Fri, 20 Dec 2013 08:45:57 -0800 [thread overview]
Message-ID: <1387557965-13241-9-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1387557965-13241-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Mitch Williams <mitch.a.williams@intel.com>
The VF reset code will be refactored in future patches. Part of that
refactor required it to call i40e_alloc_vf_res and i40e_free_vf_res, so
the function must be moved. In order to make the future patches more
readable, we perform the function move here, with no other changes.
Change-Id: If6567c9c0bada6caafb2ee0227e0d9d50d05f27f
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 256 ++++++++++-----------
1 file changed, 128 insertions(+), 128 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 1ea0886..c0e3aec 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -543,6 +543,134 @@ error_alloc_vsi_res:
}
/**
+ * i40e_enable_vf_mappings
+ * @vf: pointer to the vf info
+ *
+ * enable vf mappings
+ **/
+static void i40e_enable_vf_mappings(struct i40e_vf *vf)
+{
+ struct i40e_pf *pf = vf->pf;
+ struct i40e_hw *hw = &pf->hw;
+ u32 reg, total_queue_pairs = 0;
+ int j;
+
+ /* Tell the hardware we're using noncontiguous mapping. HW requires
+ * that VF queues be mapped using this method, even when they are
+ * contiguous in real life
+ */
+ wr32(hw, I40E_VSILAN_QBASE(vf->lan_vsi_id),
+ I40E_VSILAN_QBASE_VSIQTABLE_ENA_MASK);
+
+ /* enable VF vplan_qtable mappings */
+ reg = I40E_VPLAN_MAPENA_TXRX_ENA_MASK;
+ wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), reg);
+
+ /* map PF queues to VF queues */
+ for (j = 0; j < pf->vsi[vf->lan_vsi_index]->num_queue_pairs; j++) {
+ u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_index, j);
+ reg = (qid & I40E_VPLAN_QTABLE_QINDEX_MASK);
+ wr32(hw, I40E_VPLAN_QTABLE(total_queue_pairs, vf->vf_id), reg);
+ total_queue_pairs++;
+ }
+
+ /* map PF queues to VSI */
+ for (j = 0; j < 7; j++) {
+ if (j * 2 >= pf->vsi[vf->lan_vsi_index]->num_queue_pairs) {
+ reg = 0x07FF07FF; /* unused */
+ } else {
+ u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_index,
+ j * 2);
+ reg = qid;
+ qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_index,
+ (j * 2) + 1);
+ reg |= qid << 16;
+ }
+ wr32(hw, I40E_VSILAN_QTABLE(j, vf->lan_vsi_id), reg);
+ }
+
+ i40e_flush(hw);
+}
+
+/**
+ * i40e_disable_vf_mappings
+ * @vf: pointer to the vf info
+ *
+ * disable vf mappings
+ **/
+static void i40e_disable_vf_mappings(struct i40e_vf *vf)
+{
+ struct i40e_pf *pf = vf->pf;
+ struct i40e_hw *hw = &pf->hw;
+ int i;
+
+ /* disable qp mappings */
+ wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), 0);
+ for (i = 0; i < I40E_MAX_VSI_QP; i++)
+ wr32(hw, I40E_VPLAN_QTABLE(i, vf->vf_id),
+ I40E_QUEUE_END_OF_LIST);
+ i40e_flush(hw);
+}
+
+/**
+ * i40e_free_vf_res
+ * @vf: pointer to the vf info
+ *
+ * free vf resources
+ **/
+static void i40e_free_vf_res(struct i40e_vf *vf)
+{
+ struct i40e_pf *pf = vf->pf;
+
+ /* free vsi & disconnect it from the parent uplink */
+ if (vf->lan_vsi_index) {
+ i40e_vsi_release(pf->vsi[vf->lan_vsi_index]);
+ vf->lan_vsi_index = 0;
+ vf->lan_vsi_id = 0;
+ }
+
+ /* reset some of the state varibles keeping
+ * track of the resources
+ */
+ vf->num_queue_pairs = 0;
+ vf->vf_states = 0;
+}
+
+/**
+ * i40e_alloc_vf_res
+ * @vf: pointer to the vf info
+ *
+ * allocate vf resources
+ **/
+static int i40e_alloc_vf_res(struct i40e_vf *vf)
+{
+ struct i40e_pf *pf = vf->pf;
+ int total_queue_pairs = 0;
+ int ret;
+
+ /* allocate hw vsi context & associated resources */
+ ret = i40e_alloc_vsi_res(vf, I40E_VSI_SRIOV);
+ if (ret)
+ goto error_alloc;
+ total_queue_pairs += pf->vsi[vf->lan_vsi_index]->num_queue_pairs;
+ set_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);
+
+ /* store the total qps number for the runtime
+ * vf req validation
+ */
+ vf->num_queue_pairs = total_queue_pairs;
+
+ /* vf is now completely initialized */
+ set_bit(I40E_VF_STAT_INIT, &vf->vf_states);
+
+error_alloc:
+ if (ret)
+ i40e_free_vf_res(vf);
+
+ return ret;
+}
+
+/**
* i40e_reset_vf
* @vf: pointer to the vf structure
* @flr: VFLR was issued or not
@@ -673,134 +801,6 @@ int i40e_reset_vf(struct i40e_vf *vf, bool flr)
}
/**
- * i40e_enable_vf_mappings
- * @vf: pointer to the vf info
- *
- * enable vf mappings
- **/
-static void i40e_enable_vf_mappings(struct i40e_vf *vf)
-{
- struct i40e_pf *pf = vf->pf;
- struct i40e_hw *hw = &pf->hw;
- u32 reg, total_queue_pairs = 0;
- int j;
-
- /* Tell the hardware we're using noncontiguous mapping. HW requires
- * that VF queues be mapped using this method, even when they are
- * contiguous in real life
- */
- wr32(hw, I40E_VSILAN_QBASE(vf->lan_vsi_id),
- I40E_VSILAN_QBASE_VSIQTABLE_ENA_MASK);
-
- /* enable VF vplan_qtable mappings */
- reg = I40E_VPLAN_MAPENA_TXRX_ENA_MASK;
- wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), reg);
-
- /* map PF queues to VF queues */
- for (j = 0; j < pf->vsi[vf->lan_vsi_index]->num_queue_pairs; j++) {
- u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_index, j);
- reg = (qid & I40E_VPLAN_QTABLE_QINDEX_MASK);
- wr32(hw, I40E_VPLAN_QTABLE(total_queue_pairs, vf->vf_id), reg);
- total_queue_pairs++;
- }
-
- /* map PF queues to VSI */
- for (j = 0; j < 7; j++) {
- if (j * 2 >= pf->vsi[vf->lan_vsi_index]->num_queue_pairs) {
- reg = 0x07FF07FF; /* unused */
- } else {
- u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_index,
- j * 2);
- reg = qid;
- qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_index,
- (j * 2) + 1);
- reg |= qid << 16;
- }
- wr32(hw, I40E_VSILAN_QTABLE(j, vf->lan_vsi_id), reg);
- }
-
- i40e_flush(hw);
-}
-
-/**
- * i40e_disable_vf_mappings
- * @vf: pointer to the vf info
- *
- * disable vf mappings
- **/
-static void i40e_disable_vf_mappings(struct i40e_vf *vf)
-{
- struct i40e_pf *pf = vf->pf;
- struct i40e_hw *hw = &pf->hw;
- int i;
-
- /* disable qp mappings */
- wr32(hw, I40E_VPLAN_MAPENA(vf->vf_id), 0);
- for (i = 0; i < I40E_MAX_VSI_QP; i++)
- wr32(hw, I40E_VPLAN_QTABLE(i, vf->vf_id),
- I40E_QUEUE_END_OF_LIST);
- i40e_flush(hw);
-}
-
-/**
- * i40e_free_vf_res
- * @vf: pointer to the vf info
- *
- * free vf resources
- **/
-static void i40e_free_vf_res(struct i40e_vf *vf)
-{
- struct i40e_pf *pf = vf->pf;
-
- /* free vsi & disconnect it from the parent uplink */
- if (vf->lan_vsi_index) {
- i40e_vsi_release(pf->vsi[vf->lan_vsi_index]);
- vf->lan_vsi_index = 0;
- vf->lan_vsi_id = 0;
- }
-
- /* reset some of the state varibles keeping
- * track of the resources
- */
- vf->num_queue_pairs = 0;
- vf->vf_states = 0;
-}
-
-/**
- * i40e_alloc_vf_res
- * @vf: pointer to the vf info
- *
- * allocate vf resources
- **/
-static int i40e_alloc_vf_res(struct i40e_vf *vf)
-{
- struct i40e_pf *pf = vf->pf;
- int total_queue_pairs = 0;
- int ret;
-
- /* allocate hw vsi context & associated resources */
- ret = i40e_alloc_vsi_res(vf, I40E_VSI_SRIOV);
- if (ret)
- goto error_alloc;
- total_queue_pairs += pf->vsi[vf->lan_vsi_index]->num_queue_pairs;
- set_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);
-
- /* store the total qps number for the runtime
- * vf req validation
- */
- vf->num_queue_pairs = total_queue_pairs;
-
- /* vf is now completely initialized */
- set_bit(I40E_VF_STAT_INIT, &vf->vf_states);
-
-error_alloc:
- if (ret)
- i40e_free_vf_res(vf);
-
- return ret;
-}
-
-/**
* i40e_vfs_are_assigned
* @pf: pointer to the pf structure
*
--
1.8.3.1
next prev parent reply other threads:[~2013-12-20 16:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 16:45 [net-next v2 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-12-20 16:45 ` [net-next v2 01/16] i40e: using for_each_set_bit to simplify the code Jeff Kirsher
2013-12-20 16:45 ` [net-next v2 02/16] i40e: Suppress HMC error to Interrupt message level Jeff Kirsher
2013-12-20 16:45 ` [net-next v2 03/16] i40e: Populate and check pci bus speed and width Jeff Kirsher
2013-12-20 16:45 ` [net-next v2 04/16] i40e: add wake-on-lan support Jeff Kirsher
2013-12-20 16:45 ` [net-next v2 05/16] i40e: fix curly brace use and return type Jeff Kirsher
2013-12-20 16:45 ` [net-next v2 06/16] i40e: Implementation of vxlan ndo's Jeff Kirsher
2013-12-20 16:45 ` [net-next v2 07/16] i40e: Rx checksum offload for VXLAN Jeff Kirsher
2013-12-20 16:45 ` Jeff Kirsher [this message]
2013-12-20 16:45 ` [net-next v2 09/16] i40e: refactor VF reset flow Jeff Kirsher
2013-12-20 16:45 ` [net-next v2 10/16] i40e: remove redundant code Jeff Kirsher
2013-12-20 16:46 ` [net-next v2 11/16] i40e: remove chatty log messages Jeff Kirsher
2013-12-20 18:18 ` Sergei Shtylyov
2013-12-20 17:40 ` Williams, Mitch A
2013-12-20 17:59 ` Joe Perches
2013-12-20 18:00 ` Jeff Kirsher
2013-12-20 18:04 ` Williams, Mitch A
2013-12-20 18:31 ` Joe Perches
2013-12-20 18:00 ` Williams, Mitch A
2013-12-20 16:46 ` [net-next v2 12/16] i40e: fix error return Jeff Kirsher
2013-12-20 16:46 ` [net-next v2 13/16] i40e: be more informative Jeff Kirsher
2013-12-20 16:46 ` [net-next v2 14/16] i40e: make a define from a large constant Jeff Kirsher
2013-12-20 16:46 ` [net-next v2 15/16] i40e: update led set args Jeff Kirsher
2013-12-20 16:46 ` [net-next v2 16/16] i40e: report VF MAC addresses correctly Jeff Kirsher
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=1387557965-13241-9-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=jesse.brandeburg@intel.com \
--cc=mitch.a.williams@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).