Skip to content

Conversation

kaspar030
Copy link
Contributor

Currently, GNRC's ieee802154 does:

  1. get packet length from driver
  2. allocate length returned
  3. read packet
  4. reallocate pkt to amount read

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.

@kaspar030 kaspar030 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation GNRC labels Jan 6, 2017
@@ -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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DEBUG?

Copy link
Contributor Author

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.

Copy link
Member

@miri64 miri64 left a 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);
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Member

@PeterKietzmann PeterKietzmann left a 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

@PeterKietzmann PeterKietzmann added the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Jan 6, 2017
@kaspar030 kaspar030 force-pushed the gnrc_ieee802154_only_realloc_if_needed branch from b4d251c to 715dfea Compare January 28, 2017 15:19
@miri64
Copy link
Member

miri64 commented May 3, 2017

Needs rebase and will test ASAP

@miri64 miri64 closed this May 3, 2017
@miri64 miri64 force-pushed the gnrc_ieee802154_only_realloc_if_needed branch from 715dfea to 47439ec Compare May 3, 2017 12:39
@miri64
Copy link
Member

miri64 commented May 3, 2017

Huh… what the eff happened Oo I tried to push the rebase as @aabadie suggested in one PR of @haukepetersen.

@miri64
Copy link
Member

miri64 commented May 3, 2017

I reinstated this PR in #6998.

@miri64 miri64 added Platform: MSP Platform: This PR/issue effects MSP-based platforms Area: network Area: Networking labels Sep 30, 2018
@kaspar030 kaspar030 deleted the gnrc_ieee802154_only_realloc_if_needed branch January 22, 2019 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable Platform: MSP Platform: This PR/issue effects MSP-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants