]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: lwip: ensure alignment of packet buffers
authorTim Harvey <tharvey@gateworks.com>
Mon, 29 Sep 2025 19:21:49 +0000 (12:21 -0700)
committerJerome Forissier <jerome.forissier@linaro.org>
Tue, 30 Sep 2025 11:08:38 +0000 (13:08 +0200)
Network packet buffers should be aligned to PKTALIGN. Add a compiler
attribute to ensure this.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
[jf: use __aligned(x) from <linux/compiler_attributes.h>]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
net/lwip/net-lwip.c

index 1a70cedfb5863f41a106b9dbaba28d5536b05402..8741f65fe12e23cc30068506453a762533f8a67f 100644 (file)
@@ -7,6 +7,7 @@
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <hexdump.h>
+#include <linux/compiler_attributes.h>
 #include <linux/kernel.h>
 #include <lwip/ip4_addr.h>
 #include <lwip/dns.h>
@@ -30,7 +31,8 @@ void (*push_packet)(void *, int len) = 0;
 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]
+       __aligned(PKTALIGN);
 uchar *net_rx_packets[PKTBUFSRX];
 uchar *net_rx_packet;
 const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };