From 2c9ee62eb0432583e134abf9e1f3abe21f0b2549 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Thu, 14 Jun 2018 17:34:06 +0200 Subject: [PATCH] gnrc_sixlowpan: fix order of gnrc_sixlowpan_msg_frag_t While working on #9352 I noticed that the order of members in the `gnrc_sixlowpan_msg_frag_t` struct costs us 4 bytes in RAM due to byte alignment. This PR fixes the order of members, so they are the most packed. --- sys/include/net/gnrc/sixlowpan/frag.h | 2 +- sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/frag.h b/sys/include/net/gnrc/sixlowpan/frag.h index 68f2c4d9bf..0f2d057324 100644 --- a/sys/include/net/gnrc/sixlowpan/frag.h +++ b/sys/include/net/gnrc/sixlowpan/frag.h @@ -46,11 +46,11 @@ extern "C" { * @brief Definition of 6LoWPAN fragmentation type. */ typedef struct { - kernel_pid_t pid; /**< PID of the interface */ gnrc_pktsnip_t *pkt; /**< Pointer to the IPv6 packet to be fragmented */ size_t datagram_size; /**< Length of just the IPv6 packet to be fragmented */ uint16_t offset; /**< Offset of the Nth fragment from the beginning of the * payload datagram */ + kernel_pid_t pid; /**< PID of the interface */ } gnrc_sixlowpan_msg_frag_t; /** diff --git a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c index ff69d1ba21..cd744dd051 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c +++ b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c @@ -35,7 +35,7 @@ static kernel_pid_t _pid = KERNEL_PID_UNDEF; #ifdef MODULE_GNRC_SIXLOWPAN_FRAG -static gnrc_sixlowpan_msg_frag_t fragment_msg = {KERNEL_PID_UNDEF, NULL, 0, 0}; +static gnrc_sixlowpan_msg_frag_t fragment_msg = {NULL, 0, 0, KERNEL_PID_UNDEF}; #endif #if ENABLE_DEBUG