Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81183059 authored by Andy Fleming's avatar Andy Fleming Committed by Jeff Garzik
Browse files

gianfar: Fix DMA unmap invocations



We weren't unmapping DMA memory, which will break when gianfar gets used
on systems with more than 32-bits of memory.  Also, it's just plain wrong.

Signed-off-by: default avatarAndy Fleming <afleming@freescale.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 18acfa25
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -1407,6 +1407,10 @@ static int gfar_clean_tx_ring(struct net_device *dev)
		if (bdp->status & TXBD_DEF)
		if (bdp->status & TXBD_DEF)
			dev->stats.collisions++;
			dev->stats.collisions++;


		/* Unmap the DMA memory */
		dma_unmap_single(&priv->dev->dev, bdp->bufPtr,
				bdp->length, DMA_TO_DEVICE);

		/* Free the sk buffer associated with this TxBD */
		/* Free the sk buffer associated with this TxBD */
		dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]);
		dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]);


@@ -1666,6 +1670,9 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)


		skb = priv->rx_skbuff[priv->skb_currx];
		skb = priv->rx_skbuff[priv->skb_currx];


		dma_unmap_single(&priv->dev->dev, bdp->bufPtr,
				priv->rx_buffer_size, DMA_FROM_DEVICE);

		/* We drop the frame if we failed to allocate a new buffer */
		/* We drop the frame if we failed to allocate a new buffer */
		if (unlikely(!newskb || !(bdp->status & RXBD_LAST) ||
		if (unlikely(!newskb || !(bdp->status & RXBD_LAST) ||
				 bdp->status & RXBD_ERR)) {
				 bdp->status & RXBD_ERR)) {
@@ -1674,14 +1681,8 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
			if (unlikely(!newskb))
			if (unlikely(!newskb))
				newskb = skb;
				newskb = skb;


			if (skb) {
			if (skb)
				dma_unmap_single(&priv->dev->dev,
						bdp->bufPtr,
						priv->rx_buffer_size,
						DMA_FROM_DEVICE);

				dev_kfree_skb_any(skb);
				dev_kfree_skb_any(skb);
			}
		} else {
		} else {
			/* Increment the number of packets */
			/* Increment the number of packets */
			dev->stats.rx_packets++;
			dev->stats.rx_packets++;