[PATCH] net: lwip: ensure alignment of packet buffers
Tim Harvey
tharvey at gateworks.com
Tue Sep 30 17:18:48 CEST 2025
On Tue, Sep 30, 2025 at 2:57 AM Jerome Forissier
<jerome.forissier at linaro.org> wrote:
>
> Hi Tim,
>
> On 9/29/25 21:21, Tim Harvey wrote:
> > 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 };
>
> I'd rather use the __aligned(x) macro from <linux/compiler_attributes.h>.
> No need to resend, I will update the patch locally before sending my next
> pull request for the net subsystem.
>
Hi Jerome,
I'll make note of that - thanks for taking care of it.
Best Regards,
Tim
More information about the U-Boot
mailing list