diff options
author | Dale Farnsworth <dale@farnsworth.org> | 2005-09-02 13:25:24 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-05 18:08:30 -0400 |
commit | b111ceb68ac4c44d1a6fa697c55f267fa09b1058 (patch) | |
tree | 2871ed739a146543646f0e7cf63acd5d16afd0a9 /drivers/net | |
parent | b1dd9ca177bd2ff5260376dd024dd43eb4631dc7 (diff) |
[PATCH] mv643xx: fix outstanding tx skb counter
This patch corrects the accounting of outstanding tx skbs. It fixes
a bug that causes "Error on Queue Full" messages seen since scatter-gather
was enabled by using the hardware tcp/udp checksum generator.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index ab74d4583c4..8ea00471464 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -369,15 +369,6 @@ static int mv643xx_eth_free_tx_queue(struct net_device *dev, | |||
369 | 369 | ||
370 | dev_kfree_skb_irq(pkt_info.return_info); | 370 | dev_kfree_skb_irq(pkt_info.return_info); |
371 | released = 0; | 371 | released = 0; |
372 | |||
373 | /* | ||
374 | * Decrement the number of outstanding skbs counter on | ||
375 | * the TX queue. | ||
376 | */ | ||
377 | if (mp->tx_ring_skbs == 0) | ||
378 | panic("ERROR - TX outstanding SKBs" | ||
379 | " counter is corrupted"); | ||
380 | mp->tx_ring_skbs--; | ||
381 | } else | 372 | } else |
382 | dma_unmap_page(NULL, pkt_info.buf_ptr, | 373 | dma_unmap_page(NULL, pkt_info.buf_ptr, |
383 | pkt_info.byte_cnt, DMA_TO_DEVICE); | 374 | pkt_info.byte_cnt, DMA_TO_DEVICE); |
@@ -1042,9 +1033,6 @@ static void mv643xx_tx(struct net_device *dev) | |||
1042 | DMA_TO_DEVICE); | 1033 | DMA_TO_DEVICE); |
1043 | 1034 | ||
1044 | dev_kfree_skb_irq(pkt_info.return_info); | 1035 | dev_kfree_skb_irq(pkt_info.return_info); |
1045 | |||
1046 | if (mp->tx_ring_skbs) | ||
1047 | mp->tx_ring_skbs--; | ||
1048 | } else | 1036 | } else |
1049 | dma_unmap_page(NULL, pkt_info.buf_ptr, | 1037 | dma_unmap_page(NULL, pkt_info.buf_ptr, |
1050 | pkt_info.byte_cnt, DMA_TO_DEVICE); | 1038 | pkt_info.byte_cnt, DMA_TO_DEVICE); |
@@ -1187,7 +1175,6 @@ linear: | |||
1187 | pkt_info.buf_ptr = dma_map_single(NULL, skb->data, skb->len, | 1175 | pkt_info.buf_ptr = dma_map_single(NULL, skb->data, skb->len, |
1188 | DMA_TO_DEVICE); | 1176 | DMA_TO_DEVICE); |
1189 | pkt_info.return_info = skb; | 1177 | pkt_info.return_info = skb; |
1190 | mp->tx_ring_skbs++; | ||
1191 | status = eth_port_send(mp, &pkt_info); | 1178 | status = eth_port_send(mp, &pkt_info); |
1192 | if ((status == ETH_ERROR) || (status == ETH_QUEUE_FULL)) | 1179 | if ((status == ETH_ERROR) || (status == ETH_QUEUE_FULL)) |
1193 | printk(KERN_ERR "%s: Error on transmitting packet\n", | 1180 | printk(KERN_ERR "%s: Error on transmitting packet\n", |
@@ -1272,7 +1259,6 @@ linear: | |||
1272 | pkt_info.cmd_sts |= ETH_TX_ENABLE_INTERRUPT | | 1259 | pkt_info.cmd_sts |= ETH_TX_ENABLE_INTERRUPT | |
1273 | ETH_TX_LAST_DESC; | 1260 | ETH_TX_LAST_DESC; |
1274 | pkt_info.return_info = skb; | 1261 | pkt_info.return_info = skb; |
1275 | mp->tx_ring_skbs++; | ||
1276 | } else { | 1262 | } else { |
1277 | pkt_info.return_info = 0; | 1263 | pkt_info.return_info = 0; |
1278 | } | 1264 | } |
@@ -1309,7 +1295,6 @@ linear: | |||
1309 | pkt_info.buf_ptr = dma_map_single(NULL, skb->data, skb->len, | 1295 | pkt_info.buf_ptr = dma_map_single(NULL, skb->data, skb->len, |
1310 | DMA_TO_DEVICE); | 1296 | DMA_TO_DEVICE); |
1311 | pkt_info.return_info = skb; | 1297 | pkt_info.return_info = skb; |
1312 | mp->tx_ring_skbs++; | ||
1313 | status = eth_port_send(mp, &pkt_info); | 1298 | status = eth_port_send(mp, &pkt_info); |
1314 | if ((status == ETH_ERROR) || (status == ETH_QUEUE_FULL)) | 1299 | if ((status == ETH_ERROR) || (status == ETH_QUEUE_FULL)) |
1315 | printk(KERN_ERR "%s: Error on transmitting packet\n", | 1300 | printk(KERN_ERR "%s: Error on transmitting packet\n", |
@@ -2526,6 +2511,9 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2526 | return ETH_ERROR; | 2511 | return ETH_ERROR; |
2527 | } | 2512 | } |
2528 | 2513 | ||
2514 | mp->tx_ring_skbs++; | ||
2515 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | ||
2516 | |||
2529 | /* Get the Tx Desc ring indexes */ | 2517 | /* Get the Tx Desc ring indexes */ |
2530 | tx_desc_curr = mp->tx_curr_desc_q; | 2518 | tx_desc_curr = mp->tx_curr_desc_q; |
2531 | tx_desc_used = mp->tx_used_desc_q; | 2519 | tx_desc_used = mp->tx_used_desc_q; |
@@ -2592,6 +2580,9 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2592 | if (mp->tx_resource_err) | 2580 | if (mp->tx_resource_err) |
2593 | return ETH_QUEUE_FULL; | 2581 | return ETH_QUEUE_FULL; |
2594 | 2582 | ||
2583 | mp->tx_ring_skbs++; | ||
2584 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | ||
2585 | |||
2595 | /* Get the Tx Desc ring indexes */ | 2586 | /* Get the Tx Desc ring indexes */ |
2596 | tx_desc_curr = mp->tx_curr_desc_q; | 2587 | tx_desc_curr = mp->tx_curr_desc_q; |
2597 | tx_desc_used = mp->tx_used_desc_q; | 2588 | tx_desc_used = mp->tx_used_desc_q; |
@@ -2692,6 +2683,9 @@ static ETH_FUNC_RET_STATUS eth_tx_return_desc(struct mv643xx_private *mp, | |||
2692 | /* Any Tx return cancels the Tx resource error status */ | 2683 | /* Any Tx return cancels the Tx resource error status */ |
2693 | mp->tx_resource_err = 0; | 2684 | mp->tx_resource_err = 0; |
2694 | 2685 | ||
2686 | BUG_ON(mp->tx_ring_skbs == 0); | ||
2687 | mp->tx_ring_skbs--; | ||
2688 | |||
2695 | return ETH_OK; | 2689 | return ETH_OK; |
2696 | } | 2690 | } |
2697 | 2691 | ||