[PATCH] net: lwip: ensure alignment of packet buffers

Tim Harvey tharvey at gateworks.com
Mon Sep 29 21:21:49 CEST 2025


Network packet buffers should be aligned to PKTALIGN. Add a compiler
attribute to ensure this.

Signed-off-by: Tim Harvey <tharvey at gateworks.com>
---
 net/lwip/net-lwip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/lwip/net-lwip.c b/net/lwip/net-lwip.c
index 660ceb10cbe..aec05d55de6 100644
--- a/net/lwip/net-lwip.c
+++ b/net/lwip/net-lwip.c
@@ -30,7 +30,7 @@ void (*push_packet)(void *, int len) = 0;
 static int net_try_count;
 static int net_restarted;
 int net_restart_wrap;
-static uchar net_pkt_buf[(PKTBUFSRX) * PKTSIZE_ALIGN + PKTALIGN];
+static uchar net_pkt_buf[(PKTBUFSRX) * PKTSIZE_ALIGN + PKTALIGN] __attribute__((aligned(PKTALIGN)));
 uchar *net_rx_packets[PKTBUFSRX];
 uchar *net_rx_packet;
 const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-- 
2.34.1



More information about the U-Boot mailing list