-
Notifications
You must be signed in to change notification settings - Fork 2.1k
gnrc_netif2: add IEEE 802.15.4 support #7409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
763d0b5
to
3f26117
Compare
3f26117
to
eab9e4d
Compare
eab9e4d
to
c73b6d7
Compare
Rebased to current master and current dependencies |
91c1c27
to
fbadffe
Compare
(also adapted for changes in #7370) |
63b9000
to
d3a314a
Compare
Rebased to and adapted for changes in master and dependencies |
d3a314a
to
a190862
Compare
Rebased to current master, no longer waiting for other PR |
I couldn't find anything comment worthy here. Changes between the old |
@kaspar030 made some comments about my usage of |
if ((dst_len < 0) || (src_len < 0)) { | ||
DEBUG("_make_netif_hdr: unable to get addresses\n"); | ||
return NULL; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a valid reason this should happen at runtime or could we go with an assert here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, if the address mode field in the network received mhr
is of an unexpected value (not 2 or 3) the functions above return a negative value.
size_t n, src_len, dst_len; | ||
uint8_t mhr[IEEE802154_MAX_HDR_LEN]; | ||
uint8_t flags = (uint8_t)(state->flags & NETDEV_IEEE802154_SEND_MASK); | ||
le_uint16_t dev_pan = byteorder_btols(byteorder_htons(state->pan)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the idea behind this double-swap?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting it from host byte order to definitely little-endian (ideally it is optimized to 0-1 swaps).
if (pkt == NULL) { | ||
DEBUG("_send_ieee802154: pkt was NULL\n"); | ||
return -EINVAL; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other (and gnrc_netdev
equivalents) don't do that as well, so there might be a reason to not do it.
} | ||
netif_hdr = pkt->data; | ||
/* prepare destination address */ | ||
if (netif_hdr->flags & /* If any of these flags is set so this is correct */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Not an excuse, but) most of this was just copy-pasta'd from the already reviewed gnrc_netdev
's IEEE 802.15.4 glue-code
if ((dst_len < 0) || (src_len < 0)) { | ||
DEBUG("_make_netif_hdr: unable to get addresses\n"); | ||
return NULL; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, if the address mode field in the network received mhr
is of an unexpected value (not 2 or 3) the functions above return a negative value.
size_t n, src_len, dst_len; | ||
uint8_t mhr[IEEE802154_MAX_HDR_LEN]; | ||
uint8_t flags = (uint8_t)(state->flags & NETDEV_IEEE802154_SEND_MASK); | ||
le_uint16_t dev_pan = byteorder_btols(byteorder_htons(state->pan)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting it from host byte order to definitely little-endian (ideally it is optimized to 0-1 swaps).
if (pkt == NULL) { | ||
DEBUG("_send_ieee802154: pkt was NULL\n"); | ||
return -EINVAL; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other (and gnrc_netdev
equivalents) don't do that as well, so there might be a reason to not do it.
} | ||
netif_hdr = pkt->data; | ||
/* prepare destination address */ | ||
if (netif_hdr->flags & /* If any of these flags is set so this is correct */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
6e97db1
to
9f9737d
Compare
ACK & GO |
IEEE 802.15.4 support for
gnrc_netif2
.Requires #7370.This PR is part of the network layer remodelling effort:
