aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2010-08-19 09:36:05 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 19:40:51 -0400
commitacd37177cc2e034ecb6cbb784a8b998229fa85c4 (patch)
tree775e9f9bdda2aaefca76f180e5828c1cf05a838c /drivers
parent05abb126c148b081ee9da5a611960e2a80205ea2 (diff)
ixgbe: pull ring configuration into it's own function
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index f5d890239ac6..ddabe14bbbca 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)
2655 IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(j), rscctrl); 2655 IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(j), rscctrl);
2656} 2656}
2657 2657
2658static void ixgbe_configure_rx_ring(struct ixgbe_adapter *adapter,
2659 struct ixgbe_ring *ring)
2660{
2661 struct ixgbe_hw *hw = &adapter->hw;
2662 u64 rdba = ring->dma;
2663 u16 reg_idx = ring->reg_idx;
2664
2665 IXGBE_WRITE_REG(hw, IXGBE_RDBAL(reg_idx), (rdba & DMA_BIT_MASK(32)));
2666 IXGBE_WRITE_REG(hw, IXGBE_RDBAH(reg_idx), (rdba >> 32));
2667 IXGBE_WRITE_REG(hw, IXGBE_RDLEN(reg_idx),
2668 ring->count * sizeof(union ixgbe_adv_rx_desc));
2669 IXGBE_WRITE_REG(hw, IXGBE_RDH(reg_idx), 0);
2670 IXGBE_WRITE_REG(hw, IXGBE_RDT(reg_idx), 0);
2671 ring->head = IXGBE_RDH(reg_idx);
2672 ring->tail = IXGBE_RDT(reg_idx);
2673}
2674
2658/** 2675/**
2659 * ixgbe_configure_rx - Configure 8259x Receive Unit after Reset 2676 * ixgbe_configure_rx - Configure 8259x Receive Unit after Reset
2660 * @adapter: board private structure 2677 * @adapter: board private structure
@@ -2663,13 +2680,12 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, int index)
2663 **/ 2680 **/
2664static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) 2681static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2665{ 2682{
2666 u64 rdba;
2667 struct ixgbe_hw *hw = &adapter->hw; 2683 struct ixgbe_hw *hw = &adapter->hw;
2668 struct ixgbe_ring *rx_ring; 2684 struct ixgbe_ring *rx_ring;
2669 struct net_device *netdev = adapter->netdev; 2685 struct net_device *netdev = adapter->netdev;
2670 int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 2686 int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
2671 int i, j; 2687 int i;
2672 u32 rdlen, rxctrl; 2688 u32 rxctrl;
2673 u32 fctrl, hlreg0; 2689 u32 fctrl, hlreg0;
2674 u32 rdrxctl; 2690 u32 rdrxctl;
2675 int rx_buf_len; 2691 int rx_buf_len;
@@ -2718,7 +2734,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2718#endif 2734#endif
2719 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0); 2735 IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
2720 2736
2721 rdlen = adapter->rx_ring[0]->count * sizeof(union ixgbe_adv_rx_desc);
2722 /* disable receives while setting up the descriptors */ 2737 /* disable receives while setting up the descriptors */
2723 rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); 2738 rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
2724 IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl & ~IXGBE_RXCTRL_RXEN); 2739 IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, rxctrl & ~IXGBE_RXCTRL_RXEN);
@@ -2729,15 +2744,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2729 */ 2744 */
2730 for (i = 0; i < adapter->num_rx_queues; i++) { 2745 for (i = 0; i < adapter->num_rx_queues; i++) {
2731 rx_ring = adapter->rx_ring[i]; 2746 rx_ring = adapter->rx_ring[i];
2732 rdba = rx_ring->dma;
2733 j = rx_ring->reg_idx;
2734 IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32)));
2735 IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32));
2736 IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen);
2737 IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0);
2738 IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0);
2739 rx_ring->head = IXGBE_RDH(j);
2740 rx_ring->tail = IXGBE_RDT(j);
2741 rx_ring->rx_buf_len = rx_buf_len; 2747 rx_ring->rx_buf_len = rx_buf_len;
2742 2748
2743 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) 2749 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)
@@ -2758,6 +2764,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2758 } 2764 }
2759 2765
2760#endif /* IXGBE_FCOE */ 2766#endif /* IXGBE_FCOE */
2767 ixgbe_configure_rx_ring(adapter, rx_ring);
2761 ixgbe_configure_srrctl(adapter, rx_ring); 2768 ixgbe_configure_srrctl(adapter, rx_ring);
2762 } 2769 }
2763 2770