diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2010-11-16 22:26:57 -0500 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2010-11-16 22:26:57 -0500 |
commit | 80fba3f4341b1c98430bee620b507d3f5b7086cd (patch) | |
tree | 9693367bb0c6fa3cd3c66e5215915582ec518038 /drivers/net/ixgbe/ixgbe_ethtool.c | |
parent | 73c4b7cdd25a8a769baf6dae5bc498400a9ddd93 (diff) |
ixgbe: Disable RSC when ITR setting is too high to allow RSC
RSC will flush its descriptors every time the interrupt throttle timer
expires. In addition there are known issues with RSC when the rx-usecs
value is set too low. As such we are forced to clear the RSC_ENABLED bit
and reset the adapter when the rx-usecs value is set too low.
However we do not need to clear the NETIF_F_LRO flag because it is used to
indicate that the user wants to leave the LRO feature enabled, and in fact
with this change we will now re-enable RSC as soon as the rx-usecs value is
increased and the flag is still set.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_ethtool.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 90 |
1 files changed, 53 insertions, 37 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index c19594a4e8f8..561d47895d82 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1975,6 +1975,41 @@ static int ixgbe_get_coalesce(struct net_device *netdev, | |||
1975 | return 0; | 1975 | return 0; |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | /* | ||
1979 | * this function must be called before setting the new value of | ||
1980 | * rx_itr_setting | ||
1981 | */ | ||
1982 | static bool ixgbe_update_rsc(struct ixgbe_adapter *adapter, | ||
1983 | struct ethtool_coalesce *ec) | ||
1984 | { | ||
1985 | struct net_device *netdev = adapter->netdev; | ||
1986 | |||
1987 | if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) | ||
1988 | return false; | ||
1989 | |||
1990 | /* if interrupt rate is too high then disable RSC */ | ||
1991 | if (ec->rx_coalesce_usecs != 1 && | ||
1992 | ec->rx_coalesce_usecs <= 1000000/IXGBE_MAX_RSC_INT_RATE) { | ||
1993 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { | ||
1994 | e_info(probe, "rx-usecs set too low, " | ||
1995 | "disabling RSC\n"); | ||
1996 | adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; | ||
1997 | return true; | ||
1998 | } | ||
1999 | } else { | ||
2000 | /* check the feature flag value and enable RSC if necessary */ | ||
2001 | if ((netdev->features & NETIF_F_LRO) && | ||
2002 | !(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)) { | ||
2003 | e_info(probe, "rx-usecs set to %d, " | ||
2004 | "re-enabling RSC\n", | ||
2005 | ec->rx_coalesce_usecs); | ||
2006 | adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED; | ||
2007 | return true; | ||
2008 | } | ||
2009 | } | ||
2010 | return false; | ||
2011 | } | ||
2012 | |||
1978 | static int ixgbe_set_coalesce(struct net_device *netdev, | 2013 | static int ixgbe_set_coalesce(struct net_device *netdev, |
1979 | struct ethtool_coalesce *ec) | 2014 | struct ethtool_coalesce *ec) |
1980 | { | 2015 | { |
@@ -1992,17 +2027,14 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
1992 | adapter->tx_ring[0]->work_limit = ec->tx_max_coalesced_frames_irq; | 2027 | adapter->tx_ring[0]->work_limit = ec->tx_max_coalesced_frames_irq; |
1993 | 2028 | ||
1994 | if (ec->rx_coalesce_usecs > 1) { | 2029 | if (ec->rx_coalesce_usecs > 1) { |
1995 | u32 max_int; | ||
1996 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) | ||
1997 | max_int = IXGBE_MAX_RSC_INT_RATE; | ||
1998 | else | ||
1999 | max_int = IXGBE_MAX_INT_RATE; | ||
2000 | |||
2001 | /* check the limits */ | 2030 | /* check the limits */ |
2002 | if ((1000000/ec->rx_coalesce_usecs > max_int) || | 2031 | if ((1000000/ec->rx_coalesce_usecs > IXGBE_MAX_INT_RATE) || |
2003 | (1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE)) | 2032 | (1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE)) |
2004 | return -EINVAL; | 2033 | return -EINVAL; |
2005 | 2034 | ||
2035 | /* check the old value and enable RSC if necessary */ | ||
2036 | need_reset = ixgbe_update_rsc(adapter, ec); | ||
2037 | |||
2006 | /* store the value in ints/second */ | 2038 | /* store the value in ints/second */ |
2007 | adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; | 2039 | adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; |
2008 | 2040 | ||
@@ -2011,32 +2043,21 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2011 | /* clear the lower bit as its used for dynamic state */ | 2043 | /* clear the lower bit as its used for dynamic state */ |
2012 | adapter->rx_itr_setting &= ~1; | 2044 | adapter->rx_itr_setting &= ~1; |
2013 | } else if (ec->rx_coalesce_usecs == 1) { | 2045 | } else if (ec->rx_coalesce_usecs == 1) { |
2046 | /* check the old value and enable RSC if necessary */ | ||
2047 | need_reset = ixgbe_update_rsc(adapter, ec); | ||
2048 | |||
2014 | /* 1 means dynamic mode */ | 2049 | /* 1 means dynamic mode */ |
2015 | adapter->rx_eitr_param = 20000; | 2050 | adapter->rx_eitr_param = 20000; |
2016 | adapter->rx_itr_setting = 1; | 2051 | adapter->rx_itr_setting = 1; |
2017 | } else { | 2052 | } else { |
2053 | /* check the old value and enable RSC if necessary */ | ||
2054 | need_reset = ixgbe_update_rsc(adapter, ec); | ||
2018 | /* | 2055 | /* |
2019 | * any other value means disable eitr, which is best | 2056 | * any other value means disable eitr, which is best |
2020 | * served by setting the interrupt rate very high | 2057 | * served by setting the interrupt rate very high |
2021 | */ | 2058 | */ |
2022 | adapter->rx_eitr_param = IXGBE_MAX_INT_RATE; | 2059 | adapter->rx_eitr_param = IXGBE_MAX_INT_RATE; |
2023 | adapter->rx_itr_setting = 0; | 2060 | adapter->rx_itr_setting = 0; |
2024 | |||
2025 | /* | ||
2026 | * if hardware RSC is enabled, disable it when | ||
2027 | * setting low latency mode, to avoid errata, assuming | ||
2028 | * that when the user set low latency mode they want | ||
2029 | * it at the cost of anything else | ||
2030 | */ | ||
2031 | if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { | ||
2032 | adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; | ||
2033 | if (netdev->features & NETIF_F_LRO) { | ||
2034 | netdev->features &= ~NETIF_F_LRO; | ||
2035 | e_info(probe, "rx-usecs set to 0, " | ||
2036 | "disabling RSC\n"); | ||
2037 | } | ||
2038 | need_reset = true; | ||
2039 | } | ||
2040 | } | 2061 | } |
2041 | 2062 | ||
2042 | if (ec->tx_coalesce_usecs > 1) { | 2063 | if (ec->tx_coalesce_usecs > 1) { |
@@ -2123,15 +2144,15 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data) | |||
2123 | return rc; | 2144 | return rc; |
2124 | 2145 | ||
2125 | /* if state changes we need to update adapter->flags and reset */ | 2146 | /* if state changes we need to update adapter->flags and reset */ |
2126 | if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) { | 2147 | if ((adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) && |
2127 | /* | 2148 | (!!(data & ETH_FLAG_LRO) != |
2128 | * cast both to bool and verify if they are set the same | 2149 | !!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) { |
2129 | * but only enable RSC if itr is non-zero, as | 2150 | if ((data & ETH_FLAG_LRO) && |
2130 | * itr=0 and RSC are mutually exclusive | 2151 | (!adapter->rx_itr_setting || |
2131 | */ | 2152 | (adapter->rx_itr_setting > IXGBE_MAX_RSC_INT_RATE))) { |
2132 | if (((!!(data & ETH_FLAG_LRO)) != | 2153 | e_info(probe, "rx-usecs set too low, " |
2133 | (!!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) && | 2154 | "not enabling RSC.\n"); |
2134 | adapter->rx_itr_setting) { | 2155 | } else { |
2135 | adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED; | 2156 | adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED; |
2136 | switch (adapter->hw.mac.type) { | 2157 | switch (adapter->hw.mac.type) { |
2137 | case ixgbe_mac_82599EB: | 2158 | case ixgbe_mac_82599EB: |
@@ -2140,11 +2161,6 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data) | |||
2140 | default: | 2161 | default: |
2141 | break; | 2162 | break; |
2142 | } | 2163 | } |
2143 | } else if (!adapter->rx_itr_setting) { | ||
2144 | netdev->features &= ~NETIF_F_LRO; | ||
2145 | if (data & ETH_FLAG_LRO) | ||
2146 | e_info(probe, "rx-usecs set to 0, " | ||
2147 | "LRO/RSC cannot be enabled.\n"); | ||
2148 | } | 2164 | } |
2149 | } | 2165 | } |
2150 | 2166 | ||