Skip to content

Commit b2217c9

Browse files
Gateworksjforissier
authored andcommitted
net: lwip: ensure alignment of packet buffers
Network packet buffers should be aligned to PKTALIGN. Add a compiler attribute to ensure this. Signed-off-by: Tim Harvey <[email protected]> [jf: use __aligned(x) from <linux/compiler_attributes.h>] Signed-off-by: Jerome Forissier <[email protected]>
1 parent 61a6f5a commit b2217c9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

net/lwip/net-lwip.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <dm/device.h>
88
#include <dm/uclass.h>
99
#include <hexdump.h>
10+
#include <linux/compiler_attributes.h>
1011
#include <linux/kernel.h>
1112
#include <lwip/ip4_addr.h>
1213
#include <lwip/dns.h>
@@ -30,7 +31,8 @@ void (*push_packet)(void *, int len) = 0;
3031
int net_try_count;
3132
static int net_restarted;
3233
int net_restart_wrap;
33-
static uchar net_pkt_buf[(PKTBUFSRX) * PKTSIZE_ALIGN + PKTALIGN];
34+
static uchar net_pkt_buf[(PKTBUFSRX) * PKTSIZE_ALIGN + PKTALIGN]
35+
__aligned(PKTALIGN);
3436
uchar *net_rx_packets[PKTBUFSRX];
3537
uchar *net_rx_packet;
3638
const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };

0 commit comments

Comments
 (0)