-
Notifications
You must be signed in to change notification settings - Fork 2.1k
at86rf2xx: detect broadcast and set NETIF flag when receiving #4078
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
at86rf2xx: detect broadcast and set NETIF flag when receiving #4078
Conversation
@@ -187,10 +188,17 @@ static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) | |||
hdr = (gnrc_netif_hdr_t *)snip->data; | |||
gnrc_netif_hdr_init(hdr, src_len, dst_len); | |||
if (dst_len > 0) { | |||
broadcast = true; | |||
tmp = 5 + dst_len; |
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.
tmp is unused
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.
@DipSwitch tmp
is used in line 205 (or 213 with this change).
@@ -187,10 +188,17 @@ static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) | |||
hdr = (gnrc_netif_hdr_t *)snip->data; | |||
gnrc_netif_hdr_init(hdr, src_len, dst_len); | |||
if (dst_len > 0) { | |||
broadcast = true; |
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 that this code is optimised by any means, but as a proposal, you could set the flag here and remove it below if not applicable. Saves us one byte on stack, one assignment and one if-statement. \o/ 😊
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.
Less code to maintain. I like it!
Code looks good, one proposal for consideration above. Added the CI label. |
fe8ced1
to
0b160a4
Compare
@thomaseichinger |
@@ -191,6 +191,9 @@ static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) | |||
addr = gnrc_netif_hdr_get_dst_addr(hdr); | |||
for (int i = 0; i < dst_len; i++) { | |||
addr[i] = mhr[5 + (dst_len - i) - 1]; | |||
if(addr[i] != 0xff) { | |||
hdr->flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST; |
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.
@daniel-k That's the wrong way around. Isn't it? In this case it is not a broadcast address... I thought about setting the flag where you set broadcast = true;
before and hdr->flags &= ~GNRC_NETIF_HRD_FLAGS_BROADCAST;
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.
That's why you really want to have code reviews facepalm. Fixed in 78192eb
43f66e9
to
78192eb
Compare
Ok changes look good. I can't get a rf233 and a rf231 transceiver talk to each other with txtsnd though. This is unrelated to this change as it is the same with master from yesterday. @daniel-k can do you get link layer packet dumps? I see they are receiving, did I miss something? |
Ok, this is independent from this PR. Code looks good, Travis is green, ACK and go. |
at86rf2xx: detect broadcast and set NETIF flag when receiving
The driver should set the broadcast flag (GNRC_NETIF_HDR_FLAGS_BROADCAST) for incoming packets.