linux-2.6.37-macb-hsr/drivers/net//macb.c
@@ -376,8 +379,9 @@ static void macb_tx(struct macb *bp)
rmb();
- dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
- DMA_TO_DEVICE);
+ dma_unmap_single(&bp->pdev->dev, rp->mapping,
+ max(skb->len, (unsigned int) ETH_ZLEN),
+ DMA_TO_DEVICE);
rp->skb = NULL;
dev_kfree_skb_irq(skb);
}
@@ -413,7 +417,8 @@ static void macb_tx(struct macb *bp)
dev_dbg(&bp->pdev->dev, "skb %u (data %p) TX complete\n",
tail, skb->data);
- dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
+ dma_unmap_single(&bp->pdev->dev, rp->mapping,
+ max(skb->len, (unsigned int) ETH_ZLEN),
DMA_TO_DEVICE);
bp->stats.tx_packets++;
bp->stats.tx_bytes += skb->len;
@@ -675,7 +680,10 @@ static int macb_start_xmit(struct sk_buf
printk("\n");
#endif
- len = skb->len;
+ if (skb_padto(skb, ETH_ZLEN) != 0)
+ return NETDEV_TX_OK; /* There is no NETDEV_TX_FAIL... */
+
+ len = max(skb->len, (unsigned int) ETH_ZLEN);
spin_lock_irqsave(&bp->lock, flags);
/* This is a hard error, log it. */