aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshiharu Okada <toshiharu-linux@dsn.okisemi.com>2011-09-25 17:27:43 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-03 14:20:39 -0400
commit805e969f6151eda7bc1a57e9c737054230acc3cc (patch)
treec59fc305fdf15191d0b5def6697d77f76b2a4441
parent5f3a11419099d5cc010cfbfc524ca10d8fb81f89 (diff)
pch_gbe: Fixed the issue on which a network freezes
The pch_gbe driver has an issue which a network stops, when receiving traffic is high. In the case, The link down and up are necessary to return a network. This patch fixed this issue. Signed-off-by: Toshiharu Okada <toshiharu-linux@dsn.okisemi.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/pch_gbe/pch_gbe_main.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/net/pch_gbe/pch_gbe_main.c b/drivers/net/pch_gbe/pch_gbe_main.c
index 5474189d320b..b8b4ba27b0e7 100644
--- a/drivers/net/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/pch_gbe/pch_gbe_main.c
@@ -1199,6 +1199,8 @@ static irqreturn_t pch_gbe_intr(int irq, void *data)
1199 iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR), 1199 iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR),
1200 &hw->reg->INT_EN); 1200 &hw->reg->INT_EN);
1201 pch_gbe_stop_receive(adapter); 1201 pch_gbe_stop_receive(adapter);
1202 int_st |= ioread32(&hw->reg->INT_ST);
1203 int_st = int_st & ioread32(&hw->reg->INT_EN);
1202 } 1204 }
1203 if (int_st & PCH_GBE_INT_RX_DMA_ERR) 1205 if (int_st & PCH_GBE_INT_RX_DMA_ERR)
1204 adapter->stats.intr_rx_dma_err_count++; 1206 adapter->stats.intr_rx_dma_err_count++;
@@ -1218,14 +1220,11 @@ static irqreturn_t pch_gbe_intr(int irq, void *data)
1218 /* Set Pause packet */ 1220 /* Set Pause packet */
1219 pch_gbe_mac_set_pause_packet(hw); 1221 pch_gbe_mac_set_pause_packet(hw);
1220 } 1222 }
1221 if ((int_en & (PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT))
1222 == 0) {
1223 return IRQ_HANDLED;
1224 }
1225 } 1223 }
1226 1224
1227 /* When request status is Receive interruption */ 1225 /* When request status is Receive interruption */
1228 if ((int_st & (PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT))) { 1226 if ((int_st & (PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT)) ||
1227 (adapter->rx_stop_flag == true)) {
1229 if (likely(napi_schedule_prep(&adapter->napi))) { 1228 if (likely(napi_schedule_prep(&adapter->napi))) {
1230 /* Enable only Rx Descriptor empty */ 1229 /* Enable only Rx Descriptor empty */
1231 atomic_inc(&adapter->irq_sem); 1230 atomic_inc(&adapter->irq_sem);
@@ -1385,7 +1384,7 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
1385 struct sk_buff *skb; 1384 struct sk_buff *skb;
1386 unsigned int i; 1385 unsigned int i;
1387 unsigned int cleaned_count = 0; 1386 unsigned int cleaned_count = 0;
1388 bool cleaned = false; 1387 bool cleaned = true;
1389 1388
1390 pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean); 1389 pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean);
1391 1390
@@ -1396,7 +1395,6 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
1396 1395
1397 while ((tx_desc->gbec_status & DSC_INIT16) == 0x0000) { 1396 while ((tx_desc->gbec_status & DSC_INIT16) == 0x0000) {
1398 pr_debug("gbec_status:0x%04x\n", tx_desc->gbec_status); 1397 pr_debug("gbec_status:0x%04x\n", tx_desc->gbec_status);
1399 cleaned = true;
1400 buffer_info = &tx_ring->buffer_info[i]; 1398 buffer_info = &tx_ring->buffer_info[i];
1401 skb = buffer_info->skb; 1399 skb = buffer_info->skb;
1402 1400
@@ -1439,8 +1437,10 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
1439 tx_desc = PCH_GBE_TX_DESC(*tx_ring, i); 1437 tx_desc = PCH_GBE_TX_DESC(*tx_ring, i);
1440 1438
1441 /* weight of a sort for tx, to avoid endless transmit cleanup */ 1439 /* weight of a sort for tx, to avoid endless transmit cleanup */
1442 if (cleaned_count++ == PCH_GBE_TX_WEIGHT) 1440 if (cleaned_count++ == PCH_GBE_TX_WEIGHT) {
1441 cleaned = false;
1443 break; 1442 break;
1443 }
1444 } 1444 }
1445 pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n", 1445 pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n",
1446 cleaned_count); 1446 cleaned_count);
@@ -2168,7 +2168,6 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget)
2168{ 2168{
2169 struct pch_gbe_adapter *adapter = 2169 struct pch_gbe_adapter *adapter =
2170 container_of(napi, struct pch_gbe_adapter, napi); 2170 container_of(napi, struct pch_gbe_adapter, napi);
2171 struct net_device *netdev = adapter->netdev;
2172 int work_done = 0; 2171 int work_done = 0;
2173 bool poll_end_flag = false; 2172 bool poll_end_flag = false;
2174 bool cleaned = false; 2173 bool cleaned = false;
@@ -2176,33 +2175,32 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget)
2176 2175
2177 pr_debug("budget : %d\n", budget); 2176 pr_debug("budget : %d\n", budget);
2178 2177
2179 /* Keep link state information with original netdev */ 2178 pch_gbe_clean_rx(adapter, adapter->rx_ring, &work_done, budget);
2180 if (!netif_carrier_ok(netdev)) { 2179 cleaned = pch_gbe_clean_tx(adapter, adapter->tx_ring);
2180
2181 if (!cleaned)
2182 work_done = budget;
2183 /* If no Tx and not enough Rx work done,
2184 * exit the polling mode
2185 */
2186 if (work_done < budget)
2181 poll_end_flag = true; 2187 poll_end_flag = true;
2182 } else { 2188
2183 pch_gbe_clean_rx(adapter, adapter->rx_ring, &work_done, budget); 2189 if (poll_end_flag) {
2190 napi_complete(napi);
2191 if (adapter->rx_stop_flag) {
2192 adapter->rx_stop_flag = false;
2193 pch_gbe_start_receive(&adapter->hw);
2194 }
2195 pch_gbe_irq_enable(adapter);
2196 } else
2184 if (adapter->rx_stop_flag) { 2197 if (adapter->rx_stop_flag) {
2185 adapter->rx_stop_flag = false; 2198 adapter->rx_stop_flag = false;
2186 pch_gbe_start_receive(&adapter->hw); 2199 pch_gbe_start_receive(&adapter->hw);
2187 int_en = ioread32(&adapter->hw.reg->INT_EN); 2200 int_en = ioread32(&adapter->hw.reg->INT_EN);
2188 iowrite32((int_en | PCH_GBE_INT_RX_FIFO_ERR), 2201 iowrite32((int_en | PCH_GBE_INT_RX_FIFO_ERR),
2189 &adapter->hw.reg->INT_EN); 2202 &adapter->hw.reg->INT_EN);
2190 } 2203 }
2191 cleaned = pch_gbe_clean_tx(adapter, adapter->tx_ring);
2192
2193 if (cleaned)
2194 work_done = budget;
2195 /* If no Tx and not enough Rx work done,
2196 * exit the polling mode
2197 */
2198 if (work_done < budget)
2199 poll_end_flag = true;
2200 }
2201
2202 if (poll_end_flag) {
2203 napi_complete(napi);
2204 pch_gbe_irq_enable(adapter);
2205 }
2206 2204
2207 pr_debug("poll_end_flag : %d work_done : %d budget : %d\n", 2205 pr_debug("poll_end_flag : %d work_done : %d budget : %d\n",
2208 poll_end_flag, work_done, budget); 2206 poll_end_flag, work_done, budget);