提交 bdcba151 编写于 作者: G Gregory CLEMENT 提交者: Jeff Garzik

MACB: clear transmit buffers properly on transmit underrun

Initially transmit buffer pointers were only reset. But buffer
descriptors were possibly still set as ready, and buffer in upper
layer was not freed. This caused driver hang under big load.  Now
reset clean properly the buffer descriptor and freed upper layer.
Signed-off-by: NGregory CLEMENT <gclement00@gmail.com>
Signed-off-by: NHaavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 61c93f4e
......@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp)
(unsigned long)status);
if (status & MACB_BIT(UND)) {
int i;
printk(KERN_ERR "%s: TX underrun, resetting buffers\n",
bp->dev->name);
bp->dev->name);
head = bp->tx_head;
/*Mark all the buffer as used to avoid sending a lost buffer*/
for (i = 0; i < TX_RING_SIZE; i++)
bp->tx_ring[i].ctrl = MACB_BIT(TX_USED);
/* free transmit buffer in upper layer*/
for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) {
struct ring_info *rp = &bp->tx_skb[tail];
struct sk_buff *skb = rp->skb;
BUG_ON(skb == NULL);
rmb();
dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
DMA_TO_DEVICE);
rp->skb = NULL;
dev_kfree_skb_irq(skb);
}
bp->tx_head = bp->tx_tail = 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册