mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: Use dma_alloc to allocate net packet
@ 2022-09-16 12:06 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2022-09-16 12:06 UTC (permalink / raw)
  To: Barebox List

network packets are often DMAed by the network drivers, so allocate
them with dma_alloc() rather than assuming that an arbitrarily chosen
alignment is sufficient

This fixes network transfers on a Rockchip RK3568 board which
occasionally sent out packets with corrupt data.

Signed-off-by: Sascha Hauer <>
 include/net.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/net.h b/include/net.h
index b50b6e76c8..310bf5169d 100644
--- a/include/net.h
+++ b/include/net.h
@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <clock.h>
 #include <led.h>
+#include <dma.h>
 #include <slice.h>
 #include <xfuncs.h>
 #include <linux/phy.h>
@@ -470,7 +471,7 @@ struct net_connection {
 static inline char *net_alloc_packet(void)
-	return xmemalign(32, PKTSIZE);
+	return dma_alloc(PKTSIZE);
 struct net_connection *net_udp_new(IPaddr_t dest, uint16_t dport,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-16 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 12:06 [PATCH] net: Use dma_alloc to allocate net packet Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox