diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2010-04-26 21:37:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-27 15:53:28 -0400 |
commit | ef021194d262bdfa706dc5755596e252175a6bbc (patch) | |
tree | 4c5b3febfe32226173d08572d95a41693bbca712 | |
parent | f8d1dcaf88bddc7f282722ec1fdddbcb06a72f18 (diff) |
ixgbe: fix bug when EITR=0 causing no writebacks
writebacks can be held indefinitely by hardware if EITR=0, when
combined with TXDCTL.WTHRESH=8. When EITR=0, WTHRESH should be
set back to zero.
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>
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 31 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 9 |
2 files changed, 26 insertions, 14 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 1ae0201f5aa6..5f8c6ab7a98a 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -2083,7 +2083,7 @@ static int ixgbe_get_coalesce(struct net_device *netdev, | |||
2083 | * this function must be called before setting the new value of | 2083 | * this function must be called before setting the new value of |
2084 | * rx_itr_setting | 2084 | * rx_itr_setting |
2085 | */ | 2085 | */ |
2086 | static void ixgbe_reenable_rsc(struct ixgbe_adapter *adapter, | 2086 | static bool ixgbe_reenable_rsc(struct ixgbe_adapter *adapter, |
2087 | struct ethtool_coalesce *ec) | 2087 | struct ethtool_coalesce *ec) |
2088 | { | 2088 | { |
2089 | /* check the old value and enable RSC if necessary */ | 2089 | /* check the old value and enable RSC if necessary */ |
@@ -2093,11 +2093,9 @@ static void ixgbe_reenable_rsc(struct ixgbe_adapter *adapter, | |||
2093 | adapter->netdev->features |= NETIF_F_LRO; | 2093 | adapter->netdev->features |= NETIF_F_LRO; |
2094 | DPRINTK(PROBE, INFO, "rx-usecs set to %d, re-enabling RSC\n", | 2094 | DPRINTK(PROBE, INFO, "rx-usecs set to %d, re-enabling RSC\n", |
2095 | ec->rx_coalesce_usecs); | 2095 | ec->rx_coalesce_usecs); |
2096 | if (netif_running(adapter->netdev)) | 2096 | return true; |
2097 | ixgbe_reinit_locked(adapter); | ||
2098 | else | ||
2099 | ixgbe_reset(adapter); | ||
2100 | } | 2097 | } |
2098 | return false; | ||
2101 | } | 2099 | } |
2102 | 2100 | ||
2103 | static int ixgbe_set_coalesce(struct net_device *netdev, | 2101 | static int ixgbe_set_coalesce(struct net_device *netdev, |
@@ -2106,6 +2104,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2106 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 2104 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
2107 | struct ixgbe_q_vector *q_vector; | 2105 | struct ixgbe_q_vector *q_vector; |
2108 | int i; | 2106 | int i; |
2107 | bool need_reset = false; | ||
2109 | 2108 | ||
2110 | /* don't accept tx specific changes if we've got mixed RxTx vectors */ | 2109 | /* don't accept tx specific changes if we've got mixed RxTx vectors */ |
2111 | if (adapter->q_vector[0]->txr_count && adapter->q_vector[0]->rxr_count | 2110 | if (adapter->q_vector[0]->txr_count && adapter->q_vector[0]->rxr_count |
@@ -2128,7 +2127,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2128 | return -EINVAL; | 2127 | return -EINVAL; |
2129 | 2128 | ||
2130 | /* check the old value and enable RSC if necessary */ | 2129 | /* check the old value and enable RSC if necessary */ |
2131 | ixgbe_reenable_rsc(adapter, ec); | 2130 | need_reset = ixgbe_reenable_rsc(adapter, ec); |
2132 | 2131 | ||
2133 | /* store the value in ints/second */ | 2132 | /* store the value in ints/second */ |
2134 | adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; | 2133 | adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; |
@@ -2139,7 +2138,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2139 | adapter->rx_itr_setting &= ~1; | 2138 | adapter->rx_itr_setting &= ~1; |
2140 | } else if (ec->rx_coalesce_usecs == 1) { | 2139 | } else if (ec->rx_coalesce_usecs == 1) { |
2141 | /* check the old value and enable RSC if necessary */ | 2140 | /* check the old value and enable RSC if necessary */ |
2142 | ixgbe_reenable_rsc(adapter, ec); | 2141 | need_reset = ixgbe_reenable_rsc(adapter, ec); |
2143 | 2142 | ||
2144 | /* 1 means dynamic mode */ | 2143 | /* 1 means dynamic mode */ |
2145 | adapter->rx_eitr_param = 20000; | 2144 | adapter->rx_eitr_param = 20000; |
@@ -2164,11 +2163,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2164 | DPRINTK(PROBE, INFO, | 2163 | DPRINTK(PROBE, INFO, |
2165 | "rx-usecs set to 0, disabling RSC\n"); | 2164 | "rx-usecs set to 0, disabling RSC\n"); |
2166 | 2165 | ||
2167 | if (netif_running(netdev)) | 2166 | need_reset = true; |
2168 | ixgbe_reinit_locked(adapter); | ||
2169 | else | ||
2170 | ixgbe_reset(adapter); | ||
2171 | return 0; | ||
2172 | } | 2167 | } |
2173 | } | 2168 | } |
2174 | 2169 | ||
@@ -2220,6 +2215,18 @@ static int ixgbe_set_coalesce(struct net_device *netdev, | |||
2220 | ixgbe_write_eitr(q_vector); | 2215 | ixgbe_write_eitr(q_vector); |
2221 | } | 2216 | } |
2222 | 2217 | ||
2218 | /* | ||
2219 | * do reset here at the end to make sure EITR==0 case is handled | ||
2220 | * correctly w.r.t stopping tx, and changing TXDCTL.WTHRESH settings | ||
2221 | * also locks in RSC enable/disable which requires reset | ||
2222 | */ | ||
2223 | if (need_reset) { | ||
2224 | if (netif_running(netdev)) | ||
2225 | ixgbe_reinit_locked(adapter); | ||
2226 | else | ||
2227 | ixgbe_reset(adapter); | ||
2228 | } | ||
2229 | |||
2223 | return 0; | 2230 | return 0; |
2224 | } | 2231 | } |
2225 | 2232 | ||
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 0c4ca6822b70..fe7e260e0157 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2945,8 +2945,13 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
2945 | for (i = 0; i < adapter->num_tx_queues; i++) { | 2945 | for (i = 0; i < adapter->num_tx_queues; i++) { |
2946 | j = adapter->tx_ring[i]->reg_idx; | 2946 | j = adapter->tx_ring[i]->reg_idx; |
2947 | txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(j)); | 2947 | txdctl = IXGBE_READ_REG(hw, IXGBE_TXDCTL(j)); |
2948 | /* enable WTHRESH=8 descriptors, to encourage burst writeback */ | 2948 | if (adapter->rx_itr_setting == 0) { |
2949 | txdctl |= (8 << 16); | 2949 | /* cannot set wthresh when itr==0 */ |
2950 | txdctl &= ~0x007F0000; | ||
2951 | } else { | ||
2952 | /* enable WTHRESH=8 descriptors, to encourage burst writeback */ | ||
2953 | txdctl |= (8 << 16); | ||
2954 | } | ||
2950 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(j), txdctl); | 2955 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(j), txdctl); |
2951 | } | 2956 | } |
2952 | 2957 | ||