linux/drivers/net
Mika Westerberg f1c089e319 net: ep93xx_eth: fix DMA API violations
Russell King said:
>
> So, to summarize what its doing:
>
> 1. It allocates buffers for rx and tx.
> 2. It maps them with dma_map_single().
>       This transfers ownership of the buffer to the DMA device.
> 3. In ep93xx_xmit,
> 3a. It copies the data into the buffer with skb_copy_and_csum_dev()
>       This violates the DMA buffer ownership rules - the CPU should
>       not be writing to this buffer while it is (in principle) owned
>       by the DMA device.
> 3b. It then calls dma_sync_single_for_cpu() for the buffer.
>       This transfers ownership of the buffer to the CPU, which surely
>       is the wrong direction.
> 4. In ep93xx_rx,
> 4a. It calls dma_sync_single_for_cpu() for the buffer.
>       This at least transfers the DMA buffer ownership to the CPU
>       before the CPU reads the buffer
> 4b. It then uses skb_copy_to_linear_data() to copy the data out.
>       At no point does it transfer ownership back to the DMA device.
> 5. When the driver is removed, it dma_unmap_single()'s the buffer.
>       This transfers ownership of the buffer to the CPU.
> 6. It frees the buffer.
>
> While it may work on ep93xx, it's not respecting the DMA API rules,
> and with DMA debugging enabled it will probably encounter quite a few
> warnings.

This patch fixes these violations.

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Tested-by: Petr Stetiar <ynezz@true.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-11 16:25:16 -07:00
..
appletalk
arcnet
arm net: ep93xx_eth: fix DMA API violations 2011-06-11 16:25:16 -07:00
atl1c
atl1e
atlx Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-05-23 09:12:26 -07:00
benet be2net: hash key for rss-config cmd not set 2011-05-24 13:33:45 -04:00
bna
bnx2x bnx2x: protect sequence increment with mutex 2011-05-25 17:55:32 -04:00
bonding bonding: reset queue mapping prior to transmission to physical device (v5) 2011-06-05 14:31:25 -07:00
caif Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
can Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2011-06-04 23:16:00 +09:00
chelsio
cris
cxgb3
cxgb4
cxgb4vf
e1000
e1000e Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2011-05-23 15:39:34 -07:00
ehea ehea: Fix multicast registration on semi-promiscuous mode 2011-05-23 16:33:31 -04:00
enic
fs_enet
hamradio Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
ibm_newemac
igb igb: fix i350 SR-IOV failture 2011-06-07 14:22:57 -07:00
igbvf
irda Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
ixgb
ixgbe
ixgbevf
ixp2000
mlx4
myri10ge
netxen
octeon
pch_gbe
pcmcia Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6 2011-05-24 13:28:35 -07:00
phy ptp: Fix dp83640 build warning when building statically 2011-05-23 13:32:11 -07:00
qlcnic qlcnic: Avoid double free of skb in tx path 2011-06-05 14:18:19 -07:00
qlge
sfc Merge git://git.infradead.org/mtd-2.6 2011-05-27 20:06:53 -07:00
skfp
stmmac
tile Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile 2011-05-25 15:35:32 -07:00
tokenring Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
tulip Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
usb usbnet/cdc_ncm: add missing .reset_resume hook 2011-06-01 21:10:49 -07:00
vmxnet3
vxge
wan Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
wimax
wireless Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into for-davem 2011-06-09 14:23:30 -04:00
xen-netback
3c59x.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
3c501.c
3c501.h
3c503.c
3c503.h
3c505.c
3c505.h
3c507.c
3c509.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
3c515.c
3c523.c
3c523.h
3c527.c
3c527.h
7990.c
7990.h
8139cp.c
8139too.c
8390.c
8390.h
8390p.c
82596.c
a2065.c
a2065.h
ac3200.c
acenic.c
acenic.h
amd8111e.c
amd8111e.h
apne.c
ariadne.c
ariadne.h
at1700.c
atarilance.c
atp.c
atp.h
au1000_eth.c
au1000_eth.h
ax88796.c
b44.c
b44.h
bcm63xx_enet.c
bcm63xx_enet.h
bfin_mac.c
bfin_mac.h
bmac.c
bmac.h
bnx2.c
bnx2.h
bnx2_fw.h
bsd_comp.c
cassini.c
cassini.h
cnic.c
cnic.h
cnic_defs.h
cnic_if.h
cpmac.c
cs89x0.c
cs89x0.h
davinci_cpdma.c
davinci_cpdma.h
davinci_emac.c drivers/net/davinci_emac.c: add missing clk_put 2011-06-01 21:20:14 -07:00
davinci_mdio.c
de600.c
de600.h
de620.c
de620.h
declance.c
defxx.c
defxx.h
depca.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
depca.h
dl2k.c dl2k: EEPROM CRC calculation wrong endianess on bigendian machine 2011-06-11 16:02:00 -07:00
dl2k.h
dm9000.c net: dm9000: Get the chip in a known good state before enabling interrupts 2011-06-01 21:22:15 -07:00
dm9000.h
dnet.c
dnet.h
dummy.c
e100.c
e2100.c
eepro.c
eexpress.c
eexpress.h
enc28j60.c
enc28j60_hw.h
epic100.c
eql.c
es3210.c
eth16i.c
ethoc.c
ewrk3.c
ewrk3.h
fealnx.c
fec.c
fec.h
fec_mpc52xx.c
fec_mpc52xx.h
fec_mpc52xx_phy.c
forcedeth.c
fsl_pq_mdio.c
fsl_pq_mdio.h
ftmac100.c
ftmac100.h
gianfar.c gianfar:localized filer table 2011-06-09 00:12:57 -07:00
gianfar.h gianfar:localized filer table 2011-06-09 00:12:57 -07:00
gianfar_ethtool.c gianfar:localized filer table 2011-06-09 00:12:57 -07:00
gianfar_ptp.c ptp: Added a clock that uses the eTSEC found on the MPC85xx. 2011-05-23 13:10:14 -07:00
gianfar_sysfs.c
greth.c
greth.h
hamachi.c
hp-plus.c
hp.c
hp100.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
hp100.h
hplance.c
hplance.h
hydra.c
ibmlana.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
ibmlana.h
ibmveth.c
ibmveth.h
ifb.c
ioc3-eth.c arch, mm: filter disallowed nodes from arch specific show_mem functions 2011-05-25 08:39:03 -07:00
ipg.c
ipg.h
iseries_veth.c
jazzsonic.c
jme.c
jme.h
Kconfig
korina.c
ks8842.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2011-06-04 23:16:00 +09:00
ks8851.c
ks8851.h
ks8851_mll.c
ksz884x.c
lance.c
lantiq_etop.c
lasi_82596.c
lib8390.c
lib82596.c
LICENSE.SRC
ll_temac.h
ll_temac_main.c
ll_temac_mdio.c
lne390.c
loopback.c
lp486e.c
mac89x0.c
mac8390.c
macb.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-05-23 09:12:26 -07:00
macb.h
mace.c
mace.h
macmace.c
macsonic.c
macvlan.c
macvtap.c
Makefile ptp: Added a clock that uses the eTSEC found on the MPC85xx. 2011-05-23 13:10:14 -07:00
mdio.c
meth.c
meth.h
mii.c
mipsnet.c
mv643xx_eth.c
mvme147.c
myri_sbus.c
myri_sbus.h
natsemi.c
ne-h8300.c
ne.c
ne2.c
ne2k-pci.c
ne3210.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
netconsole.c
netx-eth.c
ni52.c
ni52.h
ni65.c
ni65.h
ni5010.c
ni5010.h
niu.c
niu.h
ns83820.c
pasemi_mac.c
pasemi_mac.h
pasemi_mac_ethtool.c
pci-skeleton.c
pcnet32.c
plip.c
ppp_async.c Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
ppp_deflate.c
ppp_generic.c
ppp_mppe.c
ppp_mppe.h
ppp_synctty.c Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
pppoe.c
pppox.c
pptp.c
ps3_gelic_net.c
ps3_gelic_net.h
ps3_gelic_wireless.c
ps3_gelic_wireless.h
pxa168_eth.c
qla3xxx.c
qla3xxx.h
r6040.c
r8169.c
rionet.c
rrunner.c
rrunner.h
s2io-regs.h
s2io.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-05-23 09:12:26 -07:00
s2io.h
s6gmac.c
sb1000.c
sb1250-mac.c
sc92031.c
seeq8005.c
seeq8005.h
sgiseeq.c
sgiseeq.h
sh_eth.c
sh_eth.h
sis190.c
sis900.c
sis900.h
skge.c
skge.h
sky2.c
sky2.h
slhc.c
slip.c Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
slip.h
smc-mca.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
smc-ultra.c
smc-ultra32.c
smc91x.c net: fix smc91x.c device tree support 2011-06-05 17:02:51 -07:00
smc91x.h
smc911x.c
smc911x.h
smc9194.c
smc9194.h
smsc911x.c
smsc911x.h
smsc9420.c
smsc9420.h
sni_82596.c
sonic.c
sonic.h
Space.c
spider_net.c
spider_net.h
spider_net_ethtool.c
starfire.c
stnic.c
sun3_82586.c
sun3_82586.h
sun3lance.c
sunbmac.c
sunbmac.h
sundance.c
sungem.c
sungem.h
sungem_phy.c
sungem_phy.h
sunhme.c
sunhme.h
sunlance.c
sunqe.c
sunqe.h
sunvnet.c
sunvnet.h
tc35815.c
tehuti.c
tehuti.h
tg3.c tg3: Fix tg3_skb_error_unmap() 2011-06-03 00:01:30 -07:00
tg3.h
tlan.c
tlan.h
tsi108_eth.c
tsi108_eth.h
tun.c
typhoon.c
typhoon.h
ucc_geth.c
ucc_geth.h
ucc_geth_ethtool.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-05-23 09:12:26 -07:00
veth.c
via-rhine.c
via-velocity.c
via-velocity.h via-velocity: don't annotate MAC registers as packed 2011-05-25 17:55:32 -04:00
virtio_net.c virtio_net: delay TX callbacks 2011-05-30 11:14:16 +09:30
wd.c
xen-netfront.c xen: netfront: hold RTNL when updating features. 2011-05-25 17:55:32 -04:00
xilinx_emaclite.c
xtsonic.c
yellowfin.c
znet.c
zorro8390.c