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 atl1c: atl1c_resume() is only used when CONFIG_PM_SLEEP is defined. 2011-05-19 18:44:41 -04:00
atl1e ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
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 Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
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 Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
cris
cxgb3 Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
cxgb4 Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
cxgb4vf Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
e1000 Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
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 Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
fs_enet Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2011-05-20 13:43:21 -07:00
hamradio Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
ibm_newemac net: ibm_newemac: convert to hw_features 2011-04-17 17:47:36 -07:00
igb igb: fix i350 SR-IOV failture 2011-06-07 14:22:57 -07:00
igbvf Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
irda Revert "tty: make receive_buf() return the amout of bytes received" 2011-06-04 06:33:24 +09:00
ixgb Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
ixgbe Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
ixgbevf Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
ixp2000
mlx4 ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
myri10ge Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
netxen ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
octeon
pch_gbe Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
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 Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
sfc Merge git://git.infradead.org/mtd-2.6 2011-05-27 20:06:53 -07:00
skfp
stmmac Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
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 Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2011-05-17 17:33:11 -04:00
vxge Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
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 xen: netback: use __CONST_RING_SIZE not __RING_SIZE 2011-05-17 15:27:35 -04:00
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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2011-05-20 13:43:21 -07:00
acenic.h
amd8111e.c amd8111e: trivial typo spelling: Negotitate -> Negotiate 2011-05-02 14:42:55 -07:00
amd8111e.h
apne.c
ariadne.c
ariadne.h
at1700.c
atarilance.c m68k/atari: Do not use "/" in interrupt names 2011-05-19 18:19:10 +02:00
atp.c
atp.h
au1000_eth.c
au1000_eth.h
ax88796.c
b44.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
b44.h
bcm63xx_enet.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
bcm63xx_enet.h
bfin_mac.c
bfin_mac.h
bmac.c
bmac.h
bnx2_fw.h
bnx2.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2011-05-05 14:59:02 -07:00
bnx2.h
bsd_comp.c
cassini.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
cassini.h
cnic_defs.h
cnic_if.h
cnic.c Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
cnic.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 net: call dev_alloc_name from register_netdevice 2011-05-05 10:57:45 -07:00
e100.c e100: implemenet set_phys_id 2011-05-07 03:08:38 -07:00
e2100.c
eepro.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
eexpress.c
eexpress.h
enc28j60_hw.h
enc28j60.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
epic100.c
eql.c
es3210.c
eth16i.c
ethoc.c
ewrk3.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
ewrk3.h
fealnx.c
fec_mpc52xx_phy.c
fec_mpc52xx.c
fec_mpc52xx.h
fec.c
fec.h
forcedeth.c Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
fsl_pq_mdio.c
fsl_pq_mdio.h
ftmac100.c net: ftmac100: fix scheduling while atomic during PHY link status change 2011-04-29 12:41:59 -07:00
ftmac100.h
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
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
greth.c net: greth: convert to hw_features 2011-04-17 17:47:36 -07:00
greth.h net: greth: convert to hw_features 2011-04-17 17:47:36 -07:00
hamachi.c hamachi: Put back RX_CHECKSUM 2011-05-07 22:31:35 -07:00
hp100.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
hp100.h
hp-plus.c
hp.c
hplance.c
hplance.h
hydra.c hydra: Fix regression caused during net_device_ops conversion 2011-05-12 16:59:57 -04:00
ibmlana.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
ibmlana.h
ibmveth.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
ibmveth.h
ifb.c net: call dev_alloc_name from register_netdevice 2011-05-05 10:57:45 -07:00
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 ethtool: Use full 32 bit speed range in ethtool's set_settings 2011-04-29 14:03:00 -07:00
jme.h
Kconfig MIPS: Lantiq: Add ethernet driver 2011-05-19 09:55:43 +01:00
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_mll.c
ks8851.c
ks8851.h
ksz884x.c ethtool: Use full 32 bit speed range in ethtool's set_settings 2011-04-29 14:03:00 -07:00
lance.c
lantiq_etop.c MIPS: Lantiq: Add ethernet driver 2011-05-19 09:55:43 +01:00
lasi_82596.c
lib8390.c
lib82596.c
LICENSE.SRC
ll_temac_main.c
ll_temac_mdio.c
ll_temac.h
lne390.c
loopback.c net: Allow ethtool to set interface in loopback mode. 2011-05-08 15:59:12 -07:00
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 macvlan: Forward unicast frames in bridge mode to lowerdev 2011-05-22 21:01:18 -04:00
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 ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
meth.c
meth.h
mii.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2011-05-05 14:59:02 -07:00
mipsnet.c
mv643xx_eth.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
mvme147.c
myri_sbus.c
myri_sbus.h
natsemi.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
ne2.c
ne2k-pci.c
ne3210.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
ne-h8300.c ne-h8300: Fix regression caused during net_device_ops conversion 2011-05-12 16:59:57 -04:00
ne.c
netconsole.c net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE 2011-05-22 21:01:19 -04:00
netx-eth.c
ni52.c
ni52.h
ni65.c
ni65.h
ni5010.c
ni5010.h
niu.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
niu.h
ns83820.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
pasemi_mac_ethtool.c
pasemi_mac.c Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
pasemi_mac.h
pci-skeleton.c
pcnet32.c ethtool: Call ethtool's get/set_settings callbacks with cleaned data 2011-04-29 14:01:30 -07:00
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 pptp: Use flowi4's daddr/saddr in pptp_xmit(). 2011-05-03 20:41:42 -07:00
ps3_gelic_net.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
ps3_gelic_net.h net: ps3_gelic: convert to hw_features 2011-04-12 14:50:43 -07:00
ps3_gelic_wireless.c net: ps3_gelic: convert to hw_features 2011-04-12 14:50:43 -07:00
ps3_gelic_wireless.h
pxa168_eth.c
qla3xxx.c Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
qla3xxx.h
r6040.c
r8169.c Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
rionet.c rionet: Remove pointless printk of skb pointer. 2011-05-22 20:35:54 -04:00
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 Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
sc92031.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
seeq8005.c
seeq8005.h
sgiseeq.c Merge branch 'master' into for-next 2011-04-26 10:22:59 +02:00
sgiseeq.h
sh_eth.c
sh_eth.h
sis190.c
sis900.c net/sis900: store MAC into perm_addr for SiS 900, 630E, 635 and 96x variants 2011-04-12 14:56:00 -07:00
sis900.h
skge.c Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
skge.h
sky2.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
sky2.h net: sky2: convert to hw_features 2011-04-12 14:50:42 -07:00
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
smc91x.c net: fix smc91x.c device tree support 2011-06-05 17:02:51 -07:00
smc91x.h
smc911x.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
smc911x.h
smc9194.c
smc9194.h
smc-mca.c Revert "net: fix section mismatches" 2011-05-31 19:28:32 -07:00
smc-ultra32.c
smc-ultra.c
smsc911x.c net: allow shifted access in smsc911x V2 2011-04-13 17:13:00 -07:00
smsc911x.h
smsc9420.c
smsc9420.h
sni_82596.c
sonic.c
sonic.h
Space.c
spider_net_ethtool.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
spider_net.c net: spider_net: convert to hw_features 2011-04-15 15:50:39 -07:00
spider_net.h net: spider_net: convert to hw_features 2011-04-15 15:50:39 -07:00
starfire.c
stnic.c
sun3_82586.c
sun3_82586.h
sun3lance.c
sunbmac.c
sunbmac.h
sundance.c
sungem_phy.c
sungem_phy.h
sungem.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
sungem.h
sunhme.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2011-05-20 13:43:21 -07:00
sunhme.h
sunlance.c
sunqe.c
sunqe.h
sunvnet.c
sunvnet.h
tc35815.c Add appropriate <linux/prefetch.h> include for prefetch users 2011-05-22 21:41:57 -07:00
tehuti.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
tehuti.h
tg3.c tg3: Fix tg3_skb_error_unmap() 2011-06-03 00:01:30 -07:00
tg3.h tg3: Fix stats for 5704 and later devices 2011-05-19 18:00:00 -04:00
tlan.c
tlan.h
tsi108_eth.c
tsi108_eth.h
tun.c net: call dev_alloc_name from register_netdevice 2011-05-05 10:57:45 -07:00
typhoon.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
typhoon.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
ucc_geth.c
ucc_geth.h
veth.c net: drivers: kill two unused macro definitions 2011-05-15 18:01:15 -04:00
via-rhine.c via-rhine: Assign random MAC address if necessary 2011-04-17 17:56:37 -07:00
via-velocity.c ethtool: cosmetic: Use ethtool ethtool_cmd_speed API 2011-04-29 14:03:01 -07:00
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 zorro8390: Fix regression caused during net_device_ops conversion 2011-05-12 16:59:57 -04:00