-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sys: net: gnrc: only reallocate if necessary #6294
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
sys: net: gnrc: only reallocate if necessary #6294
Conversation
@@ -85,6 +87,10 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) | |||
gnrc_pktbuf_release(pkt); | |||
return NULL; | |||
} | |||
if (nread < bytes_expected) { | |||
printf("_recv_ieee802154: reallocating.\n"); |
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.
DEBUG
?
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.
Sorry, I used that for testing, will fix.
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 @cgundogan is saying
#endif | ||
#endif | ||
gnrc_pktbuf_remove_snip(pkt, ieee802154_hdr); | ||
LL_APPEND(pkt, netif_hdr); | ||
} | ||
|
||
DEBUG("_recv_ieee802154: reallocating.\n"); | ||
gnrc_pktbuf_realloc_data(pkt, nread); |
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'm not sure, but I have the glimpse of a memory that there was a reason why I moved it here (as compared to gnrc_netdev2_eth
) ⇒ this needs intensive testing before merging.
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 was wondering why it's down there...
In theory, reallocating right there should be fine?
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.
As I said: I don't know anymore why it was here... This is why we should test this PR rather intensively.
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 know when nread < bytes_expected
can occur. @miri64 you are the original author, please also review and approve this PR. Now what I can confirm is:
- ~1,5% performance improvement with my personal 'plain_udp' test application making use of the netdev2 based 'l2 reflector' driver
- Tested above mentioned application with native under high load: 10000 UDP packets for payloads 10:1:1200 Bytes
- Tested above mentioned application with an iotlab-m3 node and: 1000 UDP packets for payloads 10:10:1200 Bytes
- Successfully tested data transmission with
gnrc_networking
between iotlab-m3 and samr21-xpro in both directions
ping6 1000 <link-local address> 1200 0 0
1000 packets transmitted, 998 received
ping6 1000 <link-local address> 10 0 0
1000 packets transmitted, 1000 received
b4d251c
to
715dfea
Compare
Needs rebase and will test ASAP |
715dfea
to
47439ec
Compare
Huh… what the eff happened Oo I tried to push the rebase as @aabadie suggested in one PR of @haukepetersen. |
I reinstated this PR in #6998. |
Currently, GNRC's ieee802154 does:
This PR skips 3. if the amount read in 3. equals the expected amount.
The realloc is smart enough to skip reallocation if not needed, but needs to lock/unlock in order to safely read the pktsnip, causing ~1.5% slowdown in @PeterKietzmann's plain_udp test.