linux_dsm_epyc7002/drivers/net/ethernet/freescale
Sebastian Siewior 2488a54e48 net: fec_main: dma_map() only the length of the skb
On tx submit the driver always dma_map_single() FEC_ENET_TX_FRSIZE (=2048)
bytes. This works because we don't overwrite any memory after the data buffer,
we remove it from cache if it was there. So we hurt performace in case the
mapping of a smaller area makes a difference.
There is also a bug: If the data area starts shortly before the end of
RAM say 0xc7fffa10 and the RAM ends at 0xc8000000 then we have enough
space to fit the data area (according to skb->len) but we would map beyond
end of ram if we are using 2048. In v2.6.31 (against which kernel this patch
made) there is the following check in dma_cache_maint():

|BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(start + size - 1));

Since the area starting at 0xc8000000 is no longer virt_addr_valid() we
BUG() during dma_map_single(). The BUG() statement was removed in v3.5-rc1 as
per 2dc6a016 ("ARM: dma-mapping: use asm-generic/dma-mapping-common.h").

This patch was tested on v2.6.31 and then forward-ported and compile
tested only against the net tree. I think it is still worth fixing
mainline even after the BUG() statement is gone.

Tested-by: Fugang Duan <B38611@freescale.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-12-02 16:59:20 -05:00
..
fs_enet Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-11-13 17:40:34 +09:00
fec_main.c net: fec_main: dma_map() only the length of the skb 2013-12-02 16:59:20 -05:00
fec_mpc52xx_phy.c
fec_mpc52xx.c
fec_mpc52xx.h
fec_ptp.c
fec.h net: fec: fix the error to get the previous BD entry 2013-09-04 14:14:54 -04:00
fsl_pq_mdio.c
gianfar_ethtool.c
gianfar_ptp.c powerpc/83xx: gianfar_ptp: select 1588 clock source through dts file 2013-09-30 21:17:16 -07:00
gianfar_sysfs.c
gianfar.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-11-13 17:40:34 +09:00
gianfar.h gianfar: Remove extern from function prototypes 2013-09-24 10:09:27 -04:00
Kconfig
Makefile
ucc_geth_ethtool.c
ucc_geth.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-11-13 17:40:34 +09:00
ucc_geth.h
xgmac_mdio.c drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00