aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/oki-semi
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-10-07 13:38:43 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-07 13:38:43 -0400
commit88c5100c28b02c4b2b2c6f6fafbbd76d90f698b9 (patch)
tree08c4399e0341f7eb0ccb24e15f2cab687275c2a4 /drivers/net/ethernet/oki-semi
parent8083f0fc969d9b5353061a7a6f963405057e26b1 (diff)
parent3ee72ca99288f1de95ec9c570e43f531c8799f06 (diff)
Merge branch 'master' of github.com:davem330/net
Conflicts: net/batman-adv/soft-interface.c
Diffstat (limited to 'drivers/net/ethernet/oki-semi')
-rw-r--r--drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 5dc61b4ef3cd..b89f3a684aec 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -1198,6 +1198,8 @@ static irqreturn_t pch_gbe_intr(int irq, void *data)
1198 iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR), 1198 iowrite32((int_en & ~PCH_GBE_INT_RX_FIFO_ERR),
1199 &hw->reg->INT_EN); 1199 &hw->reg->INT_EN);
1200 pch_gbe_stop_receive(adapter); 1200 pch_gbe_stop_receive(adapter);
1201 int_st |= ioread32(&hw->reg->INT_ST);
1202 int_st = int_st & ioread32(&hw->reg->INT_EN);
1201 } 1203 }
1202 if (int_st & PCH_GBE_INT_RX_DMA_ERR) 1204 if (int_st & PCH_GBE_INT_RX_DMA_ERR)
1203 adapter->stats.intr_rx_dma_err_count++; 1205 adapter->stats.intr_rx_dma_err_count++;
@@ -1217,14 +1219,11 @@ static irqreturn_t pch_gbe_intr(int irq, void *data)
1217 /* Set Pause packet */ 1219 /* Set Pause packet */
1218 pch_gbe_mac_set_pause_packet(hw); 1220 pch_gbe_mac_set_pause_packet(hw);
1219 } 1221 }
1220 if ((int_en & (PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT))
1221 == 0) {
1222 return IRQ_HANDLED;
1223 }
1224 } 1222 }
1225 1223
1226 /* When request status is Receive interruption */ 1224 /* When request status is Receive interruption */
1227 if ((int_st & (PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT))) { 1225 if ((int_st & (PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT)) ||
1226 (adapter->rx_stop_flag == true)) {
1228 if (likely(napi_schedule_prep(&adapter->napi))) { 1227 if (likely(napi_schedule_prep(&adapter->napi))) {
1229 /* Enable only Rx Descriptor empty */ 1228 /* Enable only Rx Descriptor empty */
1230 atomic_inc(&adapter->irq_sem); 1229 atomic_inc(&adapter->irq_sem);
@@ -1384,7 +1383,7 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
1384 struct sk_buff *skb; 1383 struct sk_buff *skb;
1385 unsigned int i; 1384 unsigned int i;
1386 unsigned int cleaned_count = 0; 1385 unsigned int cleaned_count = 0;
1387 bool cleaned = false; 1386 bool cleaned = true;
1388 1387
1389 pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean); 1388 pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean);
1390 1389
@@ -1395,7 +1394,6 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
1395 1394
1396 while ((tx_desc->gbec_status & DSC_INIT16) == 0x0000) { 1395 while ((tx_desc->gbec_status & DSC_INIT16) == 0x0000) {
1397 pr_debug("gbec_status:0x%04x\n", tx_desc->gbec_status); 1396 pr_debug("gbec_status:0x%04x\n", tx_desc->gbec_status);
1398 cleaned = true;
1399 buffer_info = &tx_ring->buffer_info[i]; 1397 buffer_info = &tx_ring->buffer_info[i];
1400 skb = buffer_info->skb; 1398 skb = buffer_info->skb;
1401 1399
@@ -1438,8 +1436,10 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
1438 tx_desc = PCH_GBE_TX_DESC(*tx_ring, i); 1436 tx_desc = PCH_GBE_TX_DESC(*tx_ring, i);
1439 1437
1440 /* weight of a sort for tx, to avoid endless transmit cleanup */ 1438 /* weight of a sort for tx, to avoid endless transmit cleanup */
1441 if (cleaned_count++ == PCH_GBE_TX_WEIGHT) 1439 if (cleaned_count++ == PCH_GBE_TX_WEIGHT) {
1440 cleaned = false;
1442 break; 1441 break;
1442 }
1443 } 1443 }
1444 pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n", 1444 pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n",
1445 cleaned_count); 1445 cleaned_count);
@@ -2167,7 +2167,6 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget)
2167{ 2167{
2168 struct pch_gbe_adapter *adapter = 2168 struct pch_gbe_adapter *adapter =
2169 container_of(napi, struct pch_gbe_adapter, napi); 2169 container_of(napi, struct pch_gbe_adapter, napi);
2170 struct net_device *netdev = adapter->netdev;
2171 int work_done = 0; 2170 int work_done = 0;
2172 bool poll_end_flag = false; 2171 bool poll_end_flag = false;
2173 bool cleaned = false; 2172 bool cleaned = false;
@@ -2175,33 +2174,32 @@ static int pch_gbe_napi_poll(struct napi_struct *napi, int budget)
2175 2174
2176 pr_debug("budget : %d\n", budget); 2175 pr_debug("budget : %d\n", budget);
2177 2176
2178 /* Keep link state information with original netdev */ 2177 pch_gbe_clean_rx(adapter, adapter->rx_ring, &work_done, budget);
2179 if (!netif_carrier_ok(netdev)) { 2178 cleaned = pch_gbe_clean_tx(adapter, adapter->tx_ring);
2179
2180 if (!cleaned)
2181 work_done = budget;
2182 /* If no Tx and not enough Rx work done,
2183 * exit the polling mode
2184 */
2185 if (work_done < budget)
2180 poll_end_flag = true; 2186 poll_end_flag = true;
2181 } else { 2187
2182 pch_gbe_clean_rx(adapter, adapter->rx_ring, &work_done, budget); 2188 if (poll_end_flag) {
2189 napi_complete(napi);
2190 if (adapter->rx_stop_flag) {
2191 adapter->rx_stop_flag = false;
2192 pch_gbe_start_receive(&adapter->hw);
2193 }
2194 pch_gbe_irq_enable(adapter);
2195 } else
2183 if (adapter->rx_stop_flag) { 2196 if (adapter->rx_stop_flag) {
2184 adapter->rx_stop_flag = false; 2197 adapter->rx_stop_flag = false;
2185 pch_gbe_start_receive(&adapter->hw); 2198 pch_gbe_start_receive(&adapter->hw);
2186 int_en = ioread32(&adapter->hw.reg->INT_EN); 2199 int_en = ioread32(&adapter->hw.reg->INT_EN);
2187 iowrite32((int_en | PCH_GBE_INT_RX_FIFO_ERR), 2200 iowrite32((int_en | PCH_GBE_INT_RX_FIFO_ERR),
2188 &adapter->hw.reg->INT_EN); 2201 &adapter->hw.reg->INT_EN);
2189 } 2202 }
2190 cleaned = pch_gbe_clean_tx(adapter, adapter->tx_ring);
2191
2192 if (cleaned)
2193 work_done = budget;
2194 /* If no Tx and not enough Rx work done,
2195 * exit the polling mode
2196 */
2197 if ((work_done < budget) || !netif_running(netdev))
2198 poll_end_flag = true;
2199 }
2200
2201 if (poll_end_flag) {
2202 napi_complete(napi);
2203 pch_gbe_irq_enable(adapter);
2204 }
2205 2203
2206 pr_debug("poll_end_flag : %d work_done : %d budget : %d\n", 2204 pr_debug("poll_end_flag : %d work_done : %d budget : %d\n",
2207 poll_end_flag, work_done, budget); 2205 poll_end_flag, work_done, budget);