[PATCH] dmaengine: sh: rcar-dmac: Enable 1-byte transfer size for memcpy

Koichiro Den posted 1 patch 3 months, 1 week ago
drivers/dma/sh/rcar-dmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] dmaengine: sh: rcar-dmac: Enable 1-byte transfer size for memcpy
Posted by Koichiro Den 3 months, 1 week ago
Empirical testing shows that rcar-dmac engine can handle byte-aligned
addresses without issues. Relax the driver by reducing
RCAR_DMAC_MEMCPY_XFER_SIZE from 4 to 1 byte so that memcpy can run on
unaligned buffers.

One practical user is ntb_netdev + ntb_transport. On its TX path,
skb->data often ends up 2 bytes off a 4-byte boundary due to the 16-byte
headroom alignment (HH_DATA_MOD) combined with a 14-byte Ethernet header
push, yielding a 4n+2 start address, falling back to CPU memcpy. With
this change, rcar-dmac can be used there as well.

In local testing, hacking skb->data to be 4-byte aligned while keeping
RCAR_DMAC_MEMCPY_XFER_SIZE = 4 did not produce a measurable throughput
difference compared to the unaligned case with this change, suggesting
the previous 4-byte constraint was not performance-driven on the tested
systems.

Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
 drivers/dma/sh/rcar-dmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 0c45ce8c74aa..c4d6c2f9a26b 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -303,7 +303,7 @@ struct rcar_dmac_of_data {
 #define RCAR_GEN4_DMACHCLR		0x0100
 
 /* Hardcode the MEMCPY transfer size to 4 bytes. */
-#define RCAR_DMAC_MEMCPY_XFER_SIZE	4
+#define RCAR_DMAC_MEMCPY_XFER_SIZE	1
 
 /* -----------------------------------------------------------------------------
  * Device access
-- 
2.48.1