aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorJesse Brandeburg <jesse.brandeburg@intel.com>2010-04-26 21:37:20 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-27 15:53:27 -0400
commitf8d1dcaf88bddc7f282722ec1fdddbcb06a72f18 (patch)
tree3bd62a02d6a024cf022a4a129607ca08716e26d0 /drivers/net/ixgbe
parentec857fd40da41d7c50d9a97e07e364c93b8b8e05 (diff)
ixgbe: enable extremely low latency
82598/82599 can support EITR == 0, which allows for the absolutely lowest latency setting in the hardware. This disables writeback batching and anything else that relies upon a delayed interrupt. This patch enables the feature of "override" when a user sets rx-usecs to zero, the driver will respect that setting over using RSC, and automatically disable RSC. If rx-usecs is used to set the EITR value to 0, then the driver should disable LRO (aka RSC) internally until EITR is set to non-zero again. Signed-off-by: Jesse Brandeburg <jesse.brandeburg@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')
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c87
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c9
2 files changed, 87 insertions, 9 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 8f461d5cee77..1ae0201f5aa6 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -2079,6 +2079,27 @@ static int ixgbe_get_coalesce(struct net_device *netdev,
2079 return 0; 2079 return 0;
2080} 2080}
2081 2081
2082/*
2083 * this function must be called before setting the new value of
2084 * rx_itr_setting
2085 */
2086static void ixgbe_reenable_rsc(struct ixgbe_adapter *adapter,
2087 struct ethtool_coalesce *ec)
2088{
2089 /* check the old value and enable RSC if necessary */
2090 if ((adapter->rx_itr_setting == 0) &&
2091 (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) {
2092 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
2093 adapter->netdev->features |= NETIF_F_LRO;
2094 DPRINTK(PROBE, INFO, "rx-usecs set to %d, re-enabling RSC\n",
2095 ec->rx_coalesce_usecs);
2096 if (netif_running(adapter->netdev))
2097 ixgbe_reinit_locked(adapter);
2098 else
2099 ixgbe_reset(adapter);
2100 }
2101}
2102
2082static int ixgbe_set_coalesce(struct net_device *netdev, 2103static int ixgbe_set_coalesce(struct net_device *netdev,
2083 struct ethtool_coalesce *ec) 2104 struct ethtool_coalesce *ec)
2084{ 2105{
@@ -2095,11 +2116,20 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
2095 adapter->tx_ring[0]->work_limit = ec->tx_max_coalesced_frames_irq; 2116 adapter->tx_ring[0]->work_limit = ec->tx_max_coalesced_frames_irq;
2096 2117
2097 if (ec->rx_coalesce_usecs > 1) { 2118 if (ec->rx_coalesce_usecs > 1) {
2119 u32 max_int;
2120 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
2121 max_int = IXGBE_MAX_RSC_INT_RATE;
2122 else
2123 max_int = IXGBE_MAX_INT_RATE;
2124
2098 /* check the limits */ 2125 /* check the limits */
2099 if ((1000000/ec->rx_coalesce_usecs > IXGBE_MAX_INT_RATE) || 2126 if ((1000000/ec->rx_coalesce_usecs > max_int) ||
2100 (1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE)) 2127 (1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE))
2101 return -EINVAL; 2128 return -EINVAL;
2102 2129
2130 /* check the old value and enable RSC if necessary */
2131 ixgbe_reenable_rsc(adapter, ec);
2132
2103 /* store the value in ints/second */ 2133 /* store the value in ints/second */
2104 adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; 2134 adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs;
2105 2135
@@ -2108,6 +2138,9 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
2108 /* clear the lower bit as its used for dynamic state */ 2138 /* clear the lower bit as its used for dynamic state */
2109 adapter->rx_itr_setting &= ~1; 2139 adapter->rx_itr_setting &= ~1;
2110 } else if (ec->rx_coalesce_usecs == 1) { 2140 } else if (ec->rx_coalesce_usecs == 1) {
2141 /* check the old value and enable RSC if necessary */
2142 ixgbe_reenable_rsc(adapter, ec);
2143
2111 /* 1 means dynamic mode */ 2144 /* 1 means dynamic mode */
2112 adapter->rx_eitr_param = 20000; 2145 adapter->rx_eitr_param = 20000;
2113 adapter->rx_itr_setting = 1; 2146 adapter->rx_itr_setting = 1;
@@ -2116,14 +2149,34 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
2116 * any other value means disable eitr, which is best 2149 * any other value means disable eitr, which is best
2117 * served by setting the interrupt rate very high 2150 * served by setting the interrupt rate very high
2118 */ 2151 */
2119 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) 2152 adapter->rx_eitr_param = IXGBE_MAX_INT_RATE;
2120 adapter->rx_eitr_param = IXGBE_MAX_RSC_INT_RATE;
2121 else
2122 adapter->rx_eitr_param = IXGBE_MAX_INT_RATE;
2123 adapter->rx_itr_setting = 0; 2153 adapter->rx_itr_setting = 0;
2154
2155 /*
2156 * if hardware RSC is enabled, disable it when
2157 * setting low latency mode, to avoid errata, assuming
2158 * that when the user set low latency mode they want
2159 * it at the cost of anything else
2160 */
2161 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
2162 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
2163 netdev->features &= ~NETIF_F_LRO;
2164 DPRINTK(PROBE, INFO,
2165 "rx-usecs set to 0, disabling RSC\n");
2166
2167 if (netif_running(netdev))
2168 ixgbe_reinit_locked(adapter);
2169 else
2170 ixgbe_reset(adapter);
2171 return 0;
2172 }
2124 } 2173 }
2125 2174
2126 if (ec->tx_coalesce_usecs > 1) { 2175 if (ec->tx_coalesce_usecs > 1) {
2176 /*
2177 * don't have to worry about max_int as above because
2178 * tx vectors don't do hardware RSC (an rx function)
2179 */
2127 /* check the limits */ 2180 /* check the limits */
2128 if ((1000000/ec->tx_coalesce_usecs > IXGBE_MAX_INT_RATE) || 2181 if ((1000000/ec->tx_coalesce_usecs > IXGBE_MAX_INT_RATE) ||
2129 (1000000/ec->tx_coalesce_usecs < IXGBE_MIN_INT_RATE)) 2182 (1000000/ec->tx_coalesce_usecs < IXGBE_MIN_INT_RATE))
@@ -2178,10 +2231,26 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
2178 ethtool_op_set_flags(netdev, data); 2231 ethtool_op_set_flags(netdev, data);
2179 2232
2180 /* if state changes we need to update adapter->flags and reset */ 2233 /* if state changes we need to update adapter->flags and reset */
2181 if ((!!(data & ETH_FLAG_LRO)) != 2234 if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) {
2182 (!!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) { 2235 /*
2183 adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED; 2236 * cast both to bool and verify if they are set the same
2184 need_reset = true; 2237 * but only enable RSC if itr is non-zero, as
2238 * itr=0 and RSC are mutually exclusive
2239 */
2240 if (((!!(data & ETH_FLAG_LRO)) !=
2241 (!!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))) &&
2242 adapter->rx_itr_setting) {
2243 adapter->flags2 ^= IXGBE_FLAG2_RSC_ENABLED;
2244 switch (adapter->hw.mac.type) {
2245 case ixgbe_mac_82599EB:
2246 need_reset = true;
2247 break;
2248 default:
2249 break;
2250 }
2251 } else if (!adapter->rx_itr_setting) {
2252 netdev->features &= ~ETH_FLAG_LRO;
2253 }
2185 } 2254 }
2186 2255
2187 /* 2256 /*
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 32781b3f8964..0c4ca6822b70 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1190,6 +1190,15 @@ void ixgbe_write_eitr(struct ixgbe_q_vector *q_vector)
1190 itr_reg |= (itr_reg << 16); 1190 itr_reg |= (itr_reg << 16);
1191 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 1191 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
1192 /* 1192 /*
1193 * 82599 can support a value of zero, so allow it for
1194 * max interrupt rate, but there is an errata where it can
1195 * not be zero with RSC
1196 */
1197 if (itr_reg == 8 &&
1198 !(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED))
1199 itr_reg = 0;
1200
1201 /*
1193 * set the WDIS bit to not clear the timer bits and cause an 1202 * set the WDIS bit to not clear the timer bits and cause an
1194 * immediate assertion of the interrupt 1203 * immediate assertion of the interrupt
1195 */ 1204 */