]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: Clear Linux: reduce e1000e boot time by tightening sleep ranges
authorArjan van de Ven <arjan@linux.intel.com>
Thu, 7 Jul 2016 21:26:54 +0000 (15:26 -0600)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 5 Sep 2017 12:33:16 +0000 (07:33 -0500)
The e1000e driver is a great user of the usleep_range() API,
and has any nice ranges that in principle help power management.

However the ranges that are used only during system startup are
very long (and can add easily 100 msec to the boot time) while
the power savings of such long ranges is irrelevant due to the
one-off, boot only, nature of these functions.

This patch shrinks some of the longest ranges to be shorter
(while still using a power friendly 1 msec range); this saves
100msec+ of boot time on my BDW NUCs

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/net/ethernet/intel/e1000e/80003es2lan.c
drivers/net/ethernet/intel/e1000e/82571.c
drivers/net/ethernet/intel/e1000e/ethtool.c
drivers/net/ethernet/intel/e1000e/ich8lan.c
drivers/net/ethernet/intel/e1000e/mac.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/e1000e/nvm.c

index cd391376036c9c6e2045f8e9dbf1c3a2c6d921da..b5759899eeb88352968db1c0ca11e151f79f723e 100644 (file)
@@ -698,7 +698,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
        ew32(TCTL, E1000_TCTL_PSP);
        e1e_flush();
 
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        ctrl = er32(CTRL);
 
index 6b03c8553e59710b5cad2cb903f0e4e05d0cae5e..d31145269dd969990d07e4555c79fe073c3336d8 100644 (file)
@@ -977,7 +977,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
        ew32(TCTL, tctl);
        e1e_flush();
 
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        /* Must acquire the MDIO ownership before MAC reset.
         * Ownership defaults to firmware after a reset.
index 003cbd6057990050dd3bda971b9ad77ee6c5e17e..6295b607c55549357a715d6aecdd2695e8d46478 100644 (file)
@@ -1032,7 +1032,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
        /* Disable all the interrupts */
        ew32(IMC, 0xFFFFFFFF);
        e1e_flush();
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        /* Test each interrupt */
        for (i = 0; i < 10; i++) {
@@ -1064,7 +1064,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
                        ew32(IMC, mask);
                        ew32(ICS, mask);
                        e1e_flush();
-                       usleep_range(10000, 20000);
+                       usleep_range(10000, 11000);
 
                        if (adapter->test_icr & mask) {
                                *data = 3;
@@ -1082,7 +1082,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
                ew32(IMS, mask);
                ew32(ICS, mask);
                e1e_flush();
-               usleep_range(10000, 20000);
+               usleep_range(10000, 11000);
 
                if (!(adapter->test_icr & mask)) {
                        *data = 4;
@@ -1100,7 +1100,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
                        ew32(IMC, ~mask & 0x00007FFF);
                        ew32(ICS, ~mask & 0x00007FFF);
                        e1e_flush();
-                       usleep_range(10000, 20000);
+                       usleep_range(10000, 11000);
 
                        if (adapter->test_icr) {
                                *data = 5;
@@ -1112,7 +1112,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
        /* Disable all the interrupts */
        ew32(IMC, 0xFFFFFFFF);
        e1e_flush();
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        /* Unhook test interrupt handler */
        free_irq(irq, netdev);
@@ -1488,7 +1488,7 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
         */
        ew32(SCTL, E1000_SCTL_ENABLE_SERDES_LOOPBACK);
        e1e_flush();
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        return 0;
 }
@@ -1602,7 +1602,7 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
                    hw->phy.media_type == e1000_media_type_internal_serdes) {
                        ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
                        e1e_flush();
-                       usleep_range(10000, 20000);
+                       usleep_range(10000, 11000);
                        break;
                }
                /* Fall Through */
index 68ea8b4555ab479e43cee9381769d7f8a59ba5e9..cb4f23f2f41b6288f4b7b9a60691f3db93f5d91b 100644 (file)
@@ -289,7 +289,7 @@ static void e1000_toggle_lanphypc_pch_lpt(struct e1000_hw *hw)
                u16 count = 20;
 
                do {
-                       usleep_range(5000, 10000);
+                       usleep_range(5000, 6000);
                } while (!(er32(CTRL_EXT) & E1000_CTRL_EXT_LPCD) && count--);
 
                msleep(30);
@@ -423,7 +423,7 @@ out:
        /* Ungate automatic PHY configuration on non-managed 82579 */
        if ((hw->mac.type == e1000_pch2lan) &&
            !(fwsm & E1000_ICH_FWSM_FW_VALID)) {
-               usleep_range(10000, 20000);
+               usleep_range(10000, 11000);
                e1000_gate_hw_phy_config_ich8lan(hw, false);
        }
 
@@ -549,7 +549,7 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
        phy->id = 0;
        while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) &&
               (i++ < 100)) {
-               usleep_range(1000, 2000);
+               usleep_range(1000, 1100);
                ret_val = e1000e_get_phy_id(hw);
                if (ret_val)
                        return ret_val;
@@ -1262,7 +1262,7 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)
                                goto out;
                        }
 
-                       usleep_range(10000, 20000);
+                       usleep_range(10000, 11000);
                }
                e_dbg("ULP_CONFIG_DONE cleared after %dmsec\n", i * 10);
 
@@ -2014,7 +2014,7 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)
 
        while ((blocked = !(er32(FWSM) & E1000_ICH_FWSM_RSPCIPHY)) &&
               (i++ < 30))
-               usleep_range(10000, 20000);
+               usleep_range(10000, 11000);
        return blocked ? E1000_BLK_PHY_RESET : 0;
 }
 
@@ -2831,7 +2831,7 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
                return 0;
 
        /* Allow time for h/w to get to quiescent state after reset */
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        /* Perform any necessary post-reset workarounds */
        switch (hw->mac.type) {
@@ -2867,7 +2867,7 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
        if (hw->mac.type == e1000_pch2lan) {
                /* Ungate automatic PHY configuration on non-managed 82579 */
                if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
-                       usleep_range(10000, 20000);
+                       usleep_range(10000, 11000);
                        e1000_gate_hw_phy_config_ich8lan(hw, false);
                }
 
@@ -3888,7 +3888,7 @@ release:
         */
        if (!ret_val) {
                nvm->ops.reload(hw);
-               usleep_range(10000, 20000);
+               usleep_range(10000, 11000);
        }
 
 out:
@@ -4039,7 +4039,7 @@ release:
         */
        if (!ret_val) {
                nvm->ops.reload(hw);
-               usleep_range(10000, 20000);
+               usleep_range(10000, 11000);
        }
 
 out:
@@ -4663,7 +4663,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
        ew32(TCTL, E1000_TCTL_PSP);
        e1e_flush();
 
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        /* Workaround for ICH8 bit corruption issue in FIFO memory */
        if (hw->mac.type == e1000_ich8lan) {
index b322011ec2828a704fcac2acf9b949f8c955df48..eecbf7a12735b66c394df43a98bebdd3cf252cf5 100644 (file)
@@ -815,7 +815,7 @@ static s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw)
         * milliseconds even if the other end is doing it in SW).
         */
        for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) {
-               usleep_range(10000, 20000);
+               usleep_range(10000, 11000);
                status = er32(STATUS);
                if (status & E1000_STATUS_LU)
                        break;
index 2dcb5463d9b86176e5d915a5e602f52cab43ae1f..f89453597b1ecd718cfd7d42b2abf126f3c99cd0 100644 (file)
@@ -3210,7 +3210,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
        if (!(adapter->flags2 & FLAG2_NO_DISABLE_RX))
                ew32(RCTL, rctl & ~E1000_RCTL_EN);
        e1e_flush();
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        if (adapter->flags2 & FLAG2_DMA_BURST) {
                /* set the writeback threshold (only takes effect if the RDTR
@@ -4284,7 +4284,7 @@ void e1000e_down(struct e1000_adapter *adapter, bool reset)
 
        /* flush both disables and wait for them to finish */
        e1e_flush();
-       usleep_range(10000, 20000);
+       usleep_range(10000, 11000);
 
        e1000_irq_disable(adapter);
 
@@ -4322,7 +4322,7 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter)
 {
        might_sleep();
        while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
-               usleep_range(1000, 2000);
+               usleep_range(1000, 1100);
        e1000e_down(adapter, true);
        e1000e_up(adapter);
        clear_bit(__E1000_RESETTING, &adapter->state);
@@ -4697,7 +4697,7 @@ int e1000e_close(struct net_device *netdev)
        int count = E1000_CHECK_RESET_COUNT;
 
        while (test_bit(__E1000_RESETTING, &adapter->state) && count--)
-               usleep_range(10000, 20000);
+               usleep_range(10000, 11000);
 
        WARN_ON(test_bit(__E1000_RESETTING, &adapter->state));
 
@@ -6015,7 +6015,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
        }
 
        while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
-               usleep_range(1000, 2000);
+               usleep_range(1000, 1100);
        /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */
        adapter->max_frame_size = max_frame;
        e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
@@ -6295,7 +6295,7 @@ static int e1000e_pm_freeze(struct device *dev)
                int count = E1000_CHECK_RESET_COUNT;
 
                while (test_bit(__E1000_RESETTING, &adapter->state) && count--)
-                       usleep_range(10000, 20000);
+                       usleep_range(10000, 11000);
 
                WARN_ON(test_bit(__E1000_RESETTING, &adapter->state));
 
@@ -6710,7 +6710,7 @@ static int e1000e_pm_runtime_suspend(struct device *dev)
                int count = E1000_CHECK_RESET_COUNT;
 
                while (test_bit(__E1000_RESETTING, &adapter->state) && count--)
-                       usleep_range(10000, 20000);
+                       usleep_range(10000, 11000);
 
                WARN_ON(test_bit(__E1000_RESETTING, &adapter->state));
 
index 2efd80dfd88e8dfbbc942fc12d926ab8e4718084..38f7c8fb3061a3bbb892089ed315cc3f398d120a 100644 (file)
@@ -410,7 +410,7 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
                                break;
                        }
                }
-               usleep_range(10000, 20000);
+               usleep_range(10000, 11000);
                nvm->ops.release(hw);
        }