aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2010-08-19 09:35:12 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 19:40:49 -0400
commit43e69bf0f0df2691001dbd055ab8d4f795d1900c (patch)
treece3ca9b3e152bf7f9962b1a91fc9012558f950b3 /drivers/net/ixgbe/ixgbe_main.c
parent120ff942cc6357b08fc817d89a5458038942edeb (diff)
ixgbe: move Tx ring configuration into a separate function
This patch moves the Tx ring configuration into a separate function. In addition the function drops the setting of the head writeback RO bit since head writeback is no longer used within ixgbe. 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/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c69
1 files changed, 29 insertions, 40 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index c4e42075335a..37d1f64a34d5 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2424,6 +2424,32 @@ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter)
2424 e_info(hw, "Legacy interrupt IVAR setup done\n"); 2424 e_info(hw, "Legacy interrupt IVAR setup done\n");
2425} 2425}
2426 2426
2427/**
2428 * ixgbe_configure_tx_ring - Configure 8259x Tx ring after Reset
2429 * @adapter: board private structure
2430 * @ring: structure containing ring specific data
2431 *
2432 * Configure the Tx descriptor ring after a reset.
2433 **/
2434 static void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
2435 struct ixgbe_ring *ring)
2436{
2437 struct ixgbe_hw *hw = &adapter->hw;
2438 u64 tdba = ring->dma;
2439 u16 reg_idx = ring->reg_idx;
2440
2441 IXGBE_WRITE_REG(hw, IXGBE_TDBAL(reg_idx),
2442 (tdba & DMA_BIT_MASK(32)));
2443 IXGBE_WRITE_REG(hw, IXGBE_TDBAH(reg_idx), (tdba >> 32));
2444 IXGBE_WRITE_REG(hw, IXGBE_TDLEN(reg_idx),
2445 ring->count * sizeof(union ixgbe_adv_tx_desc));
2446 IXGBE_WRITE_REG(hw, IXGBE_TDH(reg_idx), 0);
2447 IXGBE_WRITE_REG(hw, IXGBE_TDT(reg_idx), 0);
2448 ring->head = IXGBE_TDH(reg_idx);
2449 ring->tail = IXGBE_TDT(reg_idx);
2450
2451}
2452
2427static void ixgbe_setup_mtqc(struct ixgbe_adapter *adapter) 2453static void ixgbe_setup_mtqc(struct ixgbe_adapter *adapter)
2428{ 2454{
2429 struct ixgbe_hw *hw = &adapter->hw; 2455 struct ixgbe_hw *hw = &adapter->hw;
@@ -2471,48 +2497,11 @@ static void ixgbe_setup_mtqc(struct ixgbe_adapter *adapter)
2471 **/ 2497 **/
2472static void ixgbe_configure_tx(struct ixgbe_adapter *adapter) 2498static void ixgbe_configure_tx(struct ixgbe_adapter *adapter)
2473{ 2499{
2474 u64 tdba; 2500 u32 i;
2475 struct ixgbe_hw *hw = &adapter->hw;
2476 u32 i, j, tdlen, txctrl;
2477 2501
2478 /* Setup the HW Tx Head and Tail descriptor pointers */ 2502 /* Setup the HW Tx Head and Tail descriptor pointers */
2479 for (i = 0; i < adapter->num_tx_queues; i++) { 2503 for (i = 0; i < adapter->num_tx_queues; i++)
2480 struct ixgbe_ring *ring = adapter->tx_ring[i]; 2504 ixgbe_configure_tx_ring(adapter, adapter->tx_ring[i]);
2481 j = ring->reg_idx;
2482 tdba = ring->dma;
2483 tdlen = ring->count * sizeof(union ixgbe_adv_tx_desc);
2484 IXGBE_WRITE_REG(hw, IXGBE_TDBAL(j),
2485 (tdba & DMA_BIT_MASK(32)));
2486 IXGBE_WRITE_REG(hw, IXGBE_TDBAH(j), (tdba >> 32));
2487 IXGBE_WRITE_REG(hw, IXGBE_TDLEN(j), tdlen);
2488 IXGBE_WRITE_REG(hw, IXGBE_TDH(j), 0);
2489 IXGBE_WRITE_REG(hw, IXGBE_TDT(j), 0);
2490 adapter->tx_ring[i]->head = IXGBE_TDH(j);
2491 adapter->tx_ring[i]->tail = IXGBE_TDT(j);
2492 /*
2493 * Disable Tx Head Writeback RO bit, since this hoses
2494 * bookkeeping if things aren't delivered in order.
2495 */
2496 switch (hw->mac.type) {
2497 case ixgbe_mac_82598EB:
2498 txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(j));
2499 break;
2500 case ixgbe_mac_82599EB:
2501 default:
2502 txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(j));
2503 break;
2504 }
2505 txctrl &= ~IXGBE_DCA_TXCTRL_TX_WB_RO_EN;
2506 switch (hw->mac.type) {
2507 case ixgbe_mac_82598EB:
2508 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(j), txctrl);
2509 break;
2510 case ixgbe_mac_82599EB:
2511 default:
2512 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(j), txctrl);
2513 break;
2514 }
2515 }
2516 2505
2517 ixgbe_setup_mtqc(adapter); 2506 ixgbe_setup_mtqc(adapter);
2518} 2507}