net: lwip: ensure alignment of packet buffers
PATCH 1/1 net: lwip: ensure alignment of packet buffers
Network packet buffers should be aligned to PKTALIGN. Add a compiler attribute to ensure this.
--- net/lwip/net-lwip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/lwip/net-lwip.c +1 -1
@@ -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 };
Signature · 1 line
2.34.1
Hi Tim,
Quoted 13 lines · Tim Harvey
Network packet buffers should be aligned to PKTALIGN. Add a compiler attribute to ensure this.
Signed-off-by Tim Harvey <[email protected]>--- net/lwip/net-lwip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/lwip/net-lwip.c +0
-0
net/lwip/net-lwip.c void (*push_packet)(void *, int len) = 0; · line 36
Quoted 8 lines
net/lwip/net-lwip.c +1
-1@@ -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.
Thanks,
Signature · 1 line
Jerome
Quoted 21 lines · Jerome Forissier
Hi Tim,
Quoted 17 lines · Tim Harvey
Network packet buffers should be aligned to PKTALIGN. Add a compiler attribute to ensure this.
Signed-off-by Tim Harvey <[email protected]>--- net/lwip/net-lwip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/lwip/net-lwip.c +0
-1@@ -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 ];
Quoted 9 lines
net/lwip/net-lwip.c void (*push_packet)(void *, int len) = 0; · line 36
Quoted 4 lines
net/lwip/net-lwip.c +1
-0+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