All of lore.kernel.org
 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 08/20] ixgbe: pull ring configuration into it's own function
Date: Thu, 19 Aug 2010 16:36:05 -0700	[thread overview]
Message-ID: <20100819233602.10335.80879.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100819233052.10335.13176.stgit@localhost.localdomain>

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

These changes add ixgbe_configure_rx_ring which is used to setup the base
function pointers for the ring.

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 |   33 ++++++++++++++++++++-------------
 1 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index f5d8902..ddabe14 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2655,6 +2655,23 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, int index)
 	IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(j), rscctrl);
 }
 
+static void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
+				    struct ixgbe_ring *ring)
+{
+	struct ixgbe_hw *hw = &adapter->hw;
+	u64 rdba = ring->dma;
+	u16 reg_idx = ring->reg_idx;
+
+	IXGBE_WRITE_REG(hw, IXGBE_RDBAL(reg_idx), (rdba & DMA_BIT_MASK(32)));
+	IXGBE_WRITE_REG(hw, IXGBE_RDBAH(reg_idx), (rdba >> 32));
+	IXGBE_WRITE_REG(hw, IXGBE_RDLEN(reg_idx),
+			ring->count * sizeof(union ixgbe_adv_rx_desc));
+	IXGBE_WRITE_REG(hw, IXGBE_RDH(reg_idx), 0);
+	IXGBE_WRITE_REG(hw, IXGBE_RDT(reg_idx), 0);
+	ring->head = IXGBE_RDH(reg_idx);
+	ring->tail = IXGBE_RDT(reg_idx);
+}
+
 /**
  * ixgbe_configure_rx - Configure 8259x Receive Unit after Reset
  * @adapter: board private structure
@@ -2663,13 +2680,12 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, int index)
  **/
 static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 {
-	u64 rdba;
 	struct ixgbe_hw *hw = &adapter->hw;
 	struct ixgbe_ring *rx_ring;
 	struct net_device *netdev = adapter->netdev;
 	int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
-	int i, j;
-	u32 rdlen, rxctrl;
+	int i;
+	u32 rxctrl;
 	u32 fctrl, hlreg0;
 	u32 rdrxctl;
 	int rx_buf_len;
@@ -2718,7 +2734,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 #endif
 	IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
 
-	rdlen = adapter->rx_ring[0]->count * sizeof(union ixgbe_adv_rx_desc);
 	/* disable receives while setting up the descriptors */
 	rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
 	IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl & ~IXGBE_RXCTRL_RXEN);
@@ -2729,15 +2744,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 	 */
 	for (i = 0; i < adapter->num_rx_queues; i++) {
 		rx_ring = adapter->rx_ring[i];
-		rdba = rx_ring->dma;
-		j = rx_ring->reg_idx;
-		IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32)));
-		IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32));
-		IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen);
-		IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0);
-		IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0);
-		rx_ring->head = IXGBE_RDH(j);
-		rx_ring->tail = IXGBE_RDT(j);
 		rx_ring->rx_buf_len = rx_buf_len;
 
 		if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)
@@ -2758,6 +2764,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 		}
 
 #endif /* IXGBE_FCOE */
+		ixgbe_configure_rx_ring(adapter, rx_ring);
 		ixgbe_configure_srrctl(adapter, rx_ring);
 	}
 


  parent reply	other threads:[~2010-08-19 23:36 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 ` Jeff Kirsher [this message]
2010-08-19 23:46   ` [net-next-2.6 PATCH 08/20] ixgbe: pull ring configuration into it's own function 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 ` [net-next-2.6 PATCH 15/20] ixgbe: Move virtualization config into a separate function Jeff Kirsher
2010-08-19 23:47   ` 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=20100819233602.10335.80879.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 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.