sh_eth: fix TX buffer byte-swapping
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sun, 13 Dec 2015 18:27:04 +0000 (21:27 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Dec 2015 05:25:00 +0000 (00:25 -0500)
For the little-endian SH771x kernels the driver has to byte-swap the RX/TX
buffers,  however yet unset physcial address from the TX descriptor is used
to call sh_eth_soft_swap(). Use 'skb->data' instead...

Fixes: 31fcb99d9958 ("net: sh_eth: remove __flush_purge_region")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c

index a5e3f9fb94488764a64117e080e7a183d42c76bd..c97b5d865bdbcae92a7d279379aa3c722389be9e 100644 (file)
@@ -2396,8 +2396,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
        txdesc = &mdp->tx_ring[entry];
        /* soft swap. */
        if (!mdp->cd->hw_swap)
-               sh_eth_soft_swap(phys_to_virt(ALIGN(txdesc->addr, 4)),
-                                skb->len + 2);
+               sh_eth_soft_swap(PTR_ALIGN(skb->data, 4), skb->len + 2);
        txdesc->addr = dma_map_single(&ndev->dev, skb->data, skb->len,
                                      DMA_TO_DEVICE);
        if (dma_mapping_error(&ndev->dev, txdesc->addr)) {