Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / drivers / net / e1000e / netdev.c
index 1aa4228..ec8cf3f 100644 (file)
@@ -2290,6 +2290,11 @@ static void e1000_set_itr(struct e1000_adapter *adapter)
                goto set_itr_now;
        }
 
+       if (adapter->flags2 & FLAG2_DISABLE_AIM) {
+               new_itr = 0;
+               goto set_itr_now;
+       }
+
        adapter->tx_itr = e1000_update_itr(adapter,
                                    adapter->tx_itr,
                                    adapter->total_tx_packets,
@@ -2338,7 +2343,10 @@ set_itr_now:
                if (adapter->msix_entries)
                        adapter->rx_ring->set_itr = 1;
                else
-                       ew32(ITR, 1000000000 / (new_itr * 256));
+                       if (new_itr)
+                               ew32(ITR, 1000000000 / (new_itr * 256));
+                       else
+                               ew32(ITR, 0);
        }
 }
 
@@ -2537,7 +2545,7 @@ static void e1000_restore_vlan(struct e1000_adapter *adapter)
        if (!adapter->vlgrp)
                return;
 
-       for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
+       for (vid = 0; vid < VLAN_N_VID; vid++) {
                if (!vlan_group_get_device(adapter->vlgrp, vid))
                        continue;
                e1000_vlan_rx_add_vid(adapter->netdev, vid);
@@ -2920,7 +2928,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
 
        /* irq moderation */
        ew32(RADV, adapter->rx_abs_int_delay);
-       if (adapter->itr_setting != 0)
+       if ((adapter->itr_setting != 0) && (adapter->itr != 0))
                ew32(ITR, 1000000000 / (adapter->itr * 256));
 
        ctrl_ext = er32(CTRL_EXT);
@@ -2965,11 +2973,13 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
         * packet size is equal or larger than the specified value (in 8 byte
         * units), e.g. using jumbo frames when setting to E1000_ERT_2048
         */
-       if (adapter->flags & FLAG_HAS_ERT) {
+       if ((adapter->flags & FLAG_HAS_ERT) ||
+           (adapter->hw.mac.type == e1000_pch2lan)) {
                if (adapter->netdev->mtu > ETH_DATA_LEN) {
                        u32 rxdctl = er32(RXDCTL(0));
                        ew32(RXDCTL(0), rxdctl | 0x3);
-                       ew32(ERT, E1000_ERT_2048 | (1 << 13));
+                       if (adapter->flags & FLAG_HAS_ERT)
+                               ew32(ERT, E1000_ERT_2048 | (1 << 13));
                        /*
                         * With jumbo frames and early-receive enabled,
                         * excessive C-state transition latencies result in
@@ -3232,9 +3242,35 @@ void e1000e_reset(struct e1000_adapter *adapter)
                fc->low_water = 0x05048;
                fc->pause_time = 0x0650;
                fc->refresh_time = 0x0400;
+               if (adapter->netdev->mtu > ETH_DATA_LEN) {
+                       pba = 14;
+                       ew32(PBA, pba);
+               }
                break;
        }
 
+       /*
+        * Disable Adaptive Interrupt Moderation if 2 full packets cannot
+        * fit in receive buffer and early-receive not supported.
+        */
+       if (adapter->itr_setting & 0x3) {
+               if (((adapter->max_frame_size * 2) > (pba << 10)) &&
+                   !(adapter->flags & FLAG_HAS_ERT)) {
+                       if (!(adapter->flags2 & FLAG2_DISABLE_AIM)) {
+                               dev_info(&adapter->pdev->dev,
+                                       "Interrupt Throttle Rate turned off\n");
+                               adapter->flags2 |= FLAG2_DISABLE_AIM;
+                               ew32(ITR, 0);
+                       }
+               } else if (adapter->flags2 & FLAG2_DISABLE_AIM) {
+                       dev_info(&adapter->pdev->dev,
+                                "Interrupt Throttle Rate turned on\n");
+                       adapter->flags2 &= ~FLAG2_DISABLE_AIM;
+                       adapter->itr = 20000;
+                       ew32(ITR, 1000000000 / (adapter->itr * 256));
+               }
+       }
+
        /* Allow time for pending master requests to run */
        mac->ops.reset_hw(hw);
 
@@ -3553,7 +3589,8 @@ static int e1000_open(struct net_device *netdev)
                e1000_update_mng_vlan(adapter);
 
        /* DMA latency requirement to workaround early-receive/jumbo issue */
-       if (adapter->flags & FLAG_HAS_ERT)
+       if ((adapter->flags & FLAG_HAS_ERT) ||
+           (adapter->hw.mac.type == e1000_pch2lan))
                pm_qos_add_request(&adapter->netdev->pm_qos_req,
                                   PM_QOS_CPU_DMA_LATENCY,
                                   PM_QOS_DEFAULT_VALUE);
@@ -3662,7 +3699,8 @@ static int e1000_close(struct net_device *netdev)
        if (adapter->flags & FLAG_HAS_AMT)
                e1000_release_hw_control(adapter);
 
-       if (adapter->flags & FLAG_HAS_ERT)
+       if ((adapter->flags & FLAG_HAS_ERT) ||
+           (adapter->hw.mac.type == e1000_pch2lan))
                pm_qos_remove_request(&adapter->netdev->pm_qos_req);
 
        pm_runtime_put_sync(&pdev->dev);
@@ -4762,7 +4800,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
        if (e1000_maybe_stop_tx(netdev, count + 2))
                return NETDEV_TX_BUSY;
 
-       if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
+       if (vlan_tx_tag_present(skb)) {
                tx_flags |= E1000_TX_FLAGS_VLAN;
                tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
        }