aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c124
1 files changed, 68 insertions, 56 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index f689aa1b5a37..b1863531e03f 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -204,6 +204,7 @@ static struct pci_error_handlers igb_err_handler = {
204 .resume = igb_io_resume, 204 .resume = igb_io_resume,
205}; 205};
206 206
207static void igb_init_dmac(struct igb_adapter *adapter, u32 pba);
207 208
208static struct pci_driver igb_driver = { 209static struct pci_driver igb_driver = {
209 .name = igb_driver_name, 210 .name = igb_driver_name,
@@ -1728,63 +1729,8 @@ void igb_reset(struct igb_adapter *adapter)
1728 1729
1729 if (hw->mac.ops.init_hw(hw)) 1730 if (hw->mac.ops.init_hw(hw))
1730 dev_err(&pdev->dev, "Hardware Error\n"); 1731 dev_err(&pdev->dev, "Hardware Error\n");
1731 if (hw->mac.type > e1000_82580) {
1732 if (adapter->flags & IGB_FLAG_DMAC) {
1733 u32 reg;
1734
1735 /*
1736 * DMA Coalescing high water mark needs to be higher
1737 * than * the * Rx threshold. The Rx threshold is
1738 * currently * pba - 6, so we * should use a high water
1739 * mark of pba * - 4. */
1740 hwm = (pba - 4) << 10;
1741
1742 reg = (((pba-6) << E1000_DMACR_DMACTHR_SHIFT)
1743 & E1000_DMACR_DMACTHR_MASK);
1744
1745 /* transition to L0x or L1 if available..*/
1746 reg |= (E1000_DMACR_DMAC_EN | E1000_DMACR_DMAC_LX_MASK);
1747
1748 /* watchdog timer= +-1000 usec in 32usec intervals */
1749 reg |= (1000 >> 5);
1750 wr32(E1000_DMACR, reg);
1751
1752 /* no lower threshold to disable coalescing(smart fifb)
1753 * -UTRESH=0*/
1754 wr32(E1000_DMCRTRH, 0);
1755
1756 /* set hwm to PBA - 2 * max frame size */
1757 wr32(E1000_FCRTC, hwm);
1758 1732
1759 /* 1733 igb_init_dmac(adapter, pba);
1760 * This sets the time to wait before requesting tran-
1761 * sition to * low power state to number of usecs needed
1762 * to receive 1 512 * byte frame at gigabit line rate
1763 */
1764 reg = rd32(E1000_DMCTLX);
1765 reg |= IGB_DMCTLX_DCFLUSH_DIS;
1766
1767 /* Delay 255 usec before entering Lx state. */
1768 reg |= 0xFF;
1769 wr32(E1000_DMCTLX, reg);
1770
1771 /* free space in Tx packet buffer to wake from DMAC */
1772 wr32(E1000_DMCTXTH,
1773 (IGB_MIN_TXPBSIZE -
1774 (IGB_TX_BUF_4096 + adapter->max_frame_size))
1775 >> 6);
1776
1777 /* make low power state decision controlled by DMAC */
1778 reg = rd32(E1000_PCIEMISC);
1779 reg |= E1000_PCIEMISC_LX_DECISION;
1780 wr32(E1000_PCIEMISC, reg);
1781 } /* end if IGB_FLAG_DMAC set */
1782 }
1783 if (hw->mac.type == e1000_82580) {
1784 u32 reg = rd32(E1000_PCIEMISC);
1785 wr32(E1000_PCIEMISC,
1786 reg & ~E1000_PCIEMISC_LX_DECISION);
1787 }
1788 if (!netif_running(adapter->netdev)) 1734 if (!netif_running(adapter->netdev))
1789 igb_power_down_link(adapter); 1735 igb_power_down_link(adapter);
1790 1736
@@ -7098,4 +7044,70 @@ static void igb_vmm_control(struct igb_adapter *adapter)
7098 } 7044 }
7099} 7045}
7100 7046
7047static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
7048{
7049 struct e1000_hw *hw = &adapter->hw;
7050 u32 dmac_thr;
7051 u16 hwm;
7052
7053 if (hw->mac.type > e1000_82580) {
7054 if (adapter->flags & IGB_FLAG_DMAC) {
7055 u32 reg;
7056
7057 /* force threshold to 0. */
7058 wr32(E1000_DMCTXTH, 0);
7059
7060 /*
7061 * DMA Coalescing high water mark needs to be higher
7062 * than the RX threshold. set hwm to PBA - 2 * max
7063 * frame size
7064 */
7065 hwm = pba - (2 * adapter->max_frame_size);
7066 reg = rd32(E1000_DMACR);
7067 reg &= ~E1000_DMACR_DMACTHR_MASK;
7068 dmac_thr = pba - 4;
7069
7070 reg |= ((dmac_thr << E1000_DMACR_DMACTHR_SHIFT)
7071 & E1000_DMACR_DMACTHR_MASK);
7072
7073 /* transition to L0x or L1 if available..*/
7074 reg |= (E1000_DMACR_DMAC_EN | E1000_DMACR_DMAC_LX_MASK);
7075
7076 /* watchdog timer= +-1000 usec in 32usec intervals */
7077 reg |= (1000 >> 5);
7078 wr32(E1000_DMACR, reg);
7079
7080 /*
7081 * no lower threshold to disable
7082 * coalescing(smart fifb)-UTRESH=0
7083 */
7084 wr32(E1000_DMCRTRH, 0);
7085 wr32(E1000_FCRTC, hwm);
7086
7087 reg = (IGB_DMCTLX_DCFLUSH_DIS | 0x4);
7088
7089 wr32(E1000_DMCTLX, reg);
7090
7091 /*
7092 * free space in tx packet buffer to wake from
7093 * DMA coal
7094 */
7095 wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE -
7096 (IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6);
7097
7098 /*
7099 * make low power state decision controlled
7100 * by DMA coal
7101 */
7102 reg = rd32(E1000_PCIEMISC);
7103 reg &= ~E1000_PCIEMISC_LX_DECISION;
7104 wr32(E1000_PCIEMISC, reg);
7105 } /* endif adapter->dmac is not disabled */
7106 } else if (hw->mac.type == e1000_82580) {
7107 u32 reg = rd32(E1000_PCIEMISC);
7108 wr32(E1000_PCIEMISC, reg & ~E1000_PCIEMISC_LX_DECISION);
7109 wr32(E1000_DMACR, 0);
7110 }
7111}
7112
7101/* igb_main.c */ 7113/* igb_main.c */