Commit 3f9d4e3c authored by Thomas Bogendoerfer's avatar Thomas Bogendoerfer Committed by Greg Kroah-Hartman

net: i82596: fix dma_alloc_attr for sni_82596

[ Upstream commit 61c1d33d ]

Commit 7f683b92 ("i825xx: switch to switch to dma_alloc_attrs")
switched dma allocation over to dma_alloc_attr, but didn't convert
the SNI part to request consistent DMA memory. This broke sni_82596
since driver doesn't do dma_cache_sync for performance reasons.
Fix this by using different DMA_ATTRs for lasi_82596 and sni_82596.

Fixes: 7f683b92 ("i825xx: switch to switch to dma_alloc_attrs")
Signed-off-by: default avatarThomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent da0baae9
...@@ -96,6 +96,8 @@ ...@@ -96,6 +96,8 @@
#define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */ #define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */
#define LIB82596_DMA_ATTR DMA_ATTR_NON_CONSISTENT
#define DMA_WBACK(ndev, addr, len) \ #define DMA_WBACK(ndev, addr, len) \
do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0) do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0)
...@@ -199,7 +201,7 @@ static int __exit lan_remove_chip(struct parisc_device *pdev) ...@@ -199,7 +201,7 @@ static int __exit lan_remove_chip(struct parisc_device *pdev)
unregister_netdev (dev); unregister_netdev (dev);
dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma, dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma,
lp->dma_addr, DMA_ATTR_NON_CONSISTENT); lp->dma_addr, LIB82596_DMA_ATTR);
free_netdev (dev); free_netdev (dev);
return 0; return 0;
} }
......
...@@ -1065,7 +1065,7 @@ static int i82596_probe(struct net_device *dev) ...@@ -1065,7 +1065,7 @@ static int i82596_probe(struct net_device *dev)
dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma), dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma),
&lp->dma_addr, GFP_KERNEL, &lp->dma_addr, GFP_KERNEL,
DMA_ATTR_NON_CONSISTENT); LIB82596_DMA_ATTR);
if (!dma) { if (!dma) {
printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__); printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__);
return -ENOMEM; return -ENOMEM;
...@@ -1087,7 +1087,7 @@ static int i82596_probe(struct net_device *dev) ...@@ -1087,7 +1087,7 @@ static int i82596_probe(struct net_device *dev)
i = register_netdev(dev); i = register_netdev(dev);
if (i) { if (i) {
dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma), dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma),
dma, lp->dma_addr, DMA_ATTR_NON_CONSISTENT); dma, lp->dma_addr, LIB82596_DMA_ATTR);
return i; return i;
} }
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
static const char sni_82596_string[] = "snirm_82596"; static const char sni_82596_string[] = "snirm_82596";
#define LIB82596_DMA_ATTR 0
#define DMA_WBACK(priv, addr, len) do { } while (0) #define DMA_WBACK(priv, addr, len) do { } while (0)
#define DMA_INV(priv, addr, len) do { } while (0) #define DMA_INV(priv, addr, len) do { } while (0)
#define DMA_WBACK_INV(priv, addr, len) do { } while (0) #define DMA_WBACK_INV(priv, addr, len) do { } while (0)
...@@ -151,7 +153,7 @@ static int sni_82596_driver_remove(struct platform_device *pdev) ...@@ -151,7 +153,7 @@ static int sni_82596_driver_remove(struct platform_device *pdev)
unregister_netdev(dev); unregister_netdev(dev);
dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma, dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma,
lp->dma_addr, DMA_ATTR_NON_CONSISTENT); lp->dma_addr, LIB82596_DMA_ATTR);
iounmap(lp->ca); iounmap(lp->ca);
iounmap(lp->mpu_port); iounmap(lp->mpu_port);
free_netdev (dev); free_netdev (dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment