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.
This exposes the parts of the reassembly buffer to be usable as context
as proposed in #8511.
I only exposed *parts of* for two reasons:
1. I don't need to expose further types (like `rbuf_int_t`), that are
not of interest outside of fragmentation.
2. This allows for an easy future extension for the virtual reassembly
buffer as proposed in [[1]].
This makes this change a little bit more involved, because instead of
just renaming the type, I also need to add the usage of the `super`
member, but I think in the end this little preparation work will be
beneficial in the future.
[1]: https://tools.ietf.org/html/draft-watteyne-6lo-minimal-fragment-01#section-3
While browsing through the rendered doc, I found the precondition of
`gnrc_netreg_register()` somewhat lacking. What is a "message queue"?
`gnrc_netreg_entry_t`s have types. Does this apply for all types?
This specifies the requirement more: The calling thread **only** needs
a message queue (also provides a link to `msg_init_queue()` now for
further information), if the provided `gnrc_netreg_entry_t` is of type
`GNRC_NETREG_TYPE_DEFAULT` (i.e. thread-wise IPC).
Reordered struct members to not waste memory due to padding.
Before:
``` C
typedef struct {
uint8_t src_l2addr_len;
uint8_t dst_l2addr_len;
kernel_pid_t if_pid; // <-- 16 bit, is aligned to 16 bit
uint8_t flags;
uint8_t __padding_byte; // <-- Inserted to fulfill padding requirements
int16_t rssi; // <-- 16 bit, is NOT aligned to 16 bit
uint8_t lqi;
uint8_t __padding_byte2;// <-- Inserted to fulfill padding requirements
} gnrc_netif_hdr_t;
```
Now:
``` C
typedef struct {
uint8_t src_l2addr_len;
uint8_t dst_l2addr_len;
kernel_pid_t if_pid; // <-- 16 bit, is aligned to 16 bit
uint8_t flags;
uint8_t lqi;
int16_t rssi; // <-- 16 bit, is aligned to 16 bit
} gnrc_netif_hdr_t;
```
When build for the `bluepill` board, the new layout reduces the size by 2 bytes.
RFC 2460 was obsoleted by RFC 8200. This PR changes the references
around, so we don't reference an obsoleted RFC ;-).
Also I'm moving these references from the old-style HTML-like format
to the newer-style Markdown-like format.
With the previous fix, we only have to register addresses that are not
VALID yet on reception of router advertisements. This removes the need
for the hacky `GNRC_NETIF_FLAGS_6LO_ADDRS_REG` flag that was only
introduced to prevent unnecessary re-registration.
`gnrc_pktsnip_t` is used in `net/gnrc/sixlowpan/nd.h` but it is not
included. There were no compile errors yet, since this file is always
included with some other GNRC headers, but it might not in the future.
Non-routing 6LN can ignore the ABRO, so we can deactivate multihop
prefix and 6LoWPAN distribution altogether (since hosts do not have a
downstream hop).
I applied the following terminology and changed the wording in the doc
accordingly:
* must not: If the parameter is of the value it *must not* be it either
hits an assert or crashes the system.
* may not: The value can be that value, but the function will return an
error.
Since especially the setter for `NETOPT_IPV6_ADDR` and the getter for
both `NETOPT_IPV6_ADDR` and `NETOPT_IPV6_GROUP` isn't that obvious, I
decided to provided a helper function for those `gnrc_netapi_get/_set`
operations.
This renames the following functions
* `gnrc_netif_ipv6_addr_add()`
* `gnrc_netif_ipv6_addr_remove()`
* `gnrc_netif_ipv6_group_join()`
* `gnrc_netif_ipv6_group_leave()`
by appending the suffix `_internal`.
\## Reasoning
I'd like to provide a helper function for the *public* equivalent using
`gnrc_netapi_set()`, and those names are to nice to not be taken for
those.
\## Procedure
I used a combination of `git grep` and `sed` to do this and fixed the
alignment in the result of some cases by hand.
```sh
git grep --name-only "\<gnrc_netif_ipv6_\(addr\|group\)_\(add\|remove\|join\|leave\)\>" | \
xargs sed -i 's/\<gnrc_netif_ipv6_\(addr\|group\)_\(add\|remove\|join\|leave\)/\0_internal/g'
```