netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, gospo@redhat.com, bphilips@novell.com,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next-2.6 PATCH 15/20] ixgbe: Move virtualization config into a separate function
Date: Thu, 19 Aug 2010 16:38:57 -0700	[thread overview]
Message-ID: <20100819233854.10335.15538.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100819233052.10335.13176.stgit@localhost.localdomain>

From: Alexander Duyck <alexander.h.duyck@intel.com>

This change moves the configuration that was done in configure_rx into a
separate virtualization configuration function.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/ixgbe/ixgbe_main.c |   84 ++++++++++++++++++++++------------------
 1 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index f8cdc99..d358bef 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2696,6 +2696,48 @@ static void ixgbe_setup_psrtype(struct ixgbe_adapter *adapter)
 				psrtype);
 }
 
+static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter)
+{
+	struct ixgbe_hw *hw = &adapter->hw;
+	u32 gcr_ext;
+	u32 vt_reg_bits;
+	u32 reg_offset, vf_shift;
+	u32 vmdctl;
+
+	if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
+		return;
+
+	vmdctl = IXGBE_READ_REG(hw, IXGBE_VT_CTL);
+	vt_reg_bits = IXGBE_VMD_CTL_VMDQ_EN | IXGBE_VT_CTL_REPLEN;
+	vt_reg_bits |= (adapter->num_vfs << IXGBE_VT_CTL_POOL_SHIFT);
+	IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl | vt_reg_bits);
+
+	vf_shift = adapter->num_vfs % 32;
+	reg_offset = (adapter->num_vfs > 32) ? 1 : 0;
+
+	/* Enable only the PF's pool for Tx/Rx */
+	IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), (1 << vf_shift));
+	IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset ^ 1), 0);
+	IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (1 << vf_shift));
+	IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset ^ 1), 0);
+	IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
+
+	/* Map PF MAC address in RAR Entry 0 to first pool following VFs */
+	hw->mac.ops.set_vmdq(hw, 0, adapter->num_vfs);
+
+	/*
+	 * Set up VF register offsets for selected VT Mode,
+	 * i.e. 32 or 64 VFs for SR-IOV
+	 */
+	gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
+	gcr_ext |= IXGBE_GCR_EXT_MSIX_EN;
+	gcr_ext |= IXGBE_GCR_EXT_VT_MODE_64;
+	IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);
+
+	/* enable Tx loopback for VF/PF communication */
+	IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
+}
+
 static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
@@ -2820,7 +2862,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 	struct ixgbe_ring *rx_ring;
 	int i;
 	u32 rxctrl;
-	u32 gcr_ext;
 
 	/* disable receives while setting up the descriptors */
 	rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
@@ -2829,6 +2870,10 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 	ixgbe_setup_psrtype(adapter);
 	ixgbe_setup_rdrxctl(adapter);
 
+	/* Program MRQC for the distribution of queues */
+	ixgbe_setup_mrqc(adapter);
+	ixgbe_configure_virtualization(adapter);
+
 	/* set_rx_buffer_len must be called before ring initialization */
 	ixgbe_set_rx_buffer_len(adapter);
 
@@ -2843,43 +2888,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 		ixgbe_configure_rscctl(adapter, rx_ring);
 	}
 
-	if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
-		u32 vt_reg_bits;
-		u32 reg_offset, vf_shift;
-		u32 vmdctl = IXGBE_READ_REG(hw, IXGBE_VT_CTL);
-		vt_reg_bits = IXGBE_VMD_CTL_VMDQ_EN
-			| IXGBE_VT_CTL_REPLEN;
-		vt_reg_bits |= (adapter->num_vfs <<
-				IXGBE_VT_CTL_POOL_SHIFT);
-		IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl | vt_reg_bits);
-		IXGBE_WRITE_REG(hw, IXGBE_MRQC, 0);
-
-		vf_shift = adapter->num_vfs % 32;
-		reg_offset = adapter->num_vfs / 32;
-		IXGBE_WRITE_REG(hw, IXGBE_VFRE(0), 0);
-		IXGBE_WRITE_REG(hw, IXGBE_VFRE(1), 0);
-		IXGBE_WRITE_REG(hw, IXGBE_VFTE(0), 0);
-		IXGBE_WRITE_REG(hw, IXGBE_VFTE(1), 0);
-		/* Enable only the PF's pool for Tx/Rx */
-		IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), (1 << vf_shift));
-		IXGBE_WRITE_REG(hw, IXGBE_VFTE(reg_offset), (1 << vf_shift));
-		IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);
-	}
-
-	/* Program MRQC for the distribution of queues */
-	ixgbe_setup_mrqc(adapter);
-
-	if (adapter->num_vfs) {
-		/* Map PF MAC address in RAR Entry 0 to first pool
-		 * following VFs */
-		hw->mac.ops.set_vmdq(hw, 0, adapter->num_vfs);
-
-		/* Set up VF register offsets for selected VT Mode, i.e.
-		 * 64 VFs for SR-IOV */
-		gcr_ext = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
-		gcr_ext |= IXGBE_GCR_EXT_SRIOV;
-		IXGBE_WRITE_REG(hw, IXGBE_GCR_EXT, gcr_ext);
-	}
 }
 
 static void ixgbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)


  parent reply	other threads:[~2010-08-19 23:39 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19 23:33 [net-next-2.6 PATCH 01/20] ixgbe: cleanup ixgbe_get_drvinfo to be extra careful with buffer boundaries Jeff Kirsher
2010-08-19 23:33 ` [net-next-2.6 PATCH 02/20] ixgbe: remove redundant DMA alignment code Jeff Kirsher
2010-08-19 23:45   ` David Miller
2010-08-19 23:34 ` [net-next-2.6 PATCH 03/20] ixgbe: move setting of GSO size for 82598 into ixgbe_configure_dcb Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:34 ` [net-next-2.6 PATCH 04/20] ixgbe: combine two modifications of TXDCTL into one Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:34 ` [net-next-2.6 PATCH 05/20] ixgbe: move configuration of the MTQC register into it's own function Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:35 ` [net-next-2.6 PATCH 06/20] ixgbe: move Tx ring configuration into a separate function Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:35 ` [net-next-2.6 PATCH 07/20] ixgbe: consolidate all setting of MRQC into one function Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:36 ` [net-next-2.6 PATCH 08/20] ixgbe: pull ring configuration into it's own function Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:36 ` [net-next-2.6 PATCH 09/20] ixgbe: pull PSRTYPE configuration into a separate function Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:36 ` [net-next-2.6 PATCH 10/20] ixgbe: combine accesses to FCTRL register into ixgbe_set_rx_mode Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:37 ` [net-next-2.6 PATCH 11/20] ixgbe: bump PS header size to 512 bytes Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:37 ` [net-next-2.6 PATCH 12/20] ixgbe: remove redundant configuration of vmolr, rename generic variable Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:38 ` [net-next-2.6 PATCH 13/20] ixgbe: Move max frame size and Rx buffer length configuration into a function Jeff Kirsher
2010-08-19 23:46   ` David Miller
2010-08-19 23:38 ` [net-next-2.6 PATCH 14/20] ixgbe: move all Rx DMA control register writes to one central location Jeff Kirsher
2010-08-19 23:47   ` David Miller
2010-08-19 23:38 ` Jeff Kirsher [this message]
2010-08-19 23:47   ` [net-next-2.6 PATCH 15/20] ixgbe: Move virtualization config into a separate function David Miller
2010-08-19 23:39 ` [net-next-2.6 PATCH 16/20] ixgbe: move all GPIE register config into a single function Jeff Kirsher
2010-08-19 23:47   ` David Miller
2010-08-19 23:39 ` [net-next-2.6 PATCH 17/20] ixgbe: pull all Tx init into ixgbe_configure_tx Jeff Kirsher
2010-08-19 23:47   ` David Miller
2010-08-19 23:40 ` [net-next-2.6 PATCH 18/20] ixgbe: combine Rx into into ixgbe_configure_rx Jeff Kirsher
2010-08-19 23:47   ` David Miller
2010-08-19 23:40 ` [net-next-2.6 PATCH 19/20] ixgbe: update all DESC_ADV macros to accept a ring pointer Jeff Kirsher
2010-08-19 23:47   ` David Miller
2010-08-19 23:40 ` [net-next-2.6 PATCH 20/20] ixgbe: rewrite ethtool test to use standard config functions Jeff Kirsher
2010-08-19 23:47   ` David Miller
2010-08-19 23:45 ` [net-next-2.6 PATCH 01/20] ixgbe: cleanup ixgbe_get_drvinfo to be extra careful with buffer boundaries David Miller

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=20100819233854.10335.15538.stgit@localhost.localdomain \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=bphilips@novell.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.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 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).