[PATCH] net: Use dma_alloc to allocate net packet

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 16 05:06:20 PDT 2022


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 <s.hauer at pengutronix.de>
---
 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,
-- 
2.30.2




More information about the barebox mailing list