sys: net: gnrc: only reallocate if necessary#6294
sys: net: gnrc: only reallocate if necessary#6294kaspar030 wants to merge 0 commit intoRIOT-OS:masterfrom
Conversation
| return NULL; | ||
| } | ||
| if (nread < bytes_expected) { | ||
| printf("_recv_ieee802154: reallocating.\n"); |
There was a problem hiding this comment.
Sorry, I used that for testing, will fix.
| } | ||
|
|
||
| DEBUG("_recv_ieee802154: reallocating.\n"); | ||
| gnrc_pktbuf_realloc_data(pkt, nread); |
There was a problem hiding this comment.
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.
I was wondering why it's down there...
In theory, reallocating right there should be fine?
There was a problem hiding this comment.
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.
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_networkingbetween 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.