Skip to content
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

ng_sixlowpan: Initial import of datagram fragmentation #2781

Merged
merged 1 commit into from Apr 26, 2015

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Apr 10, 2015

This adds (optional) 6LoWPAN fragmentation to ng_sixlowpan.

Depends on #2614 (merged)

@miri64 miri64 added Area: network Area: Networking Type: new feature The issue requests / The PR implemements a new feature for RIOT NSTF labels Apr 10, 2015
@miri64 miri64 added this to the Network Stack Task Force milestone Apr 10, 2015
@miri64 miri64 mentioned this pull request Apr 10, 2015
36 tasks
@miri64 miri64 force-pushed the ng_sixlowpan_frag/feat/initial branch from 0bd16b7 to d17b108 Compare April 10, 2015 06:00
@OlegHahm OlegHahm added the State: waiting for other PR State: The PR requires another PR to be merged first label Apr 10, 2015
@miri64 miri64 force-pushed the ng_sixlowpan_frag/feat/initial branch from f1c9481 to 07bbf7c Compare April 13, 2015 23:08
@miri64
Copy link
Member Author

miri64 commented Apr 13, 2015

Rebased to current #2781.

@miri64 miri64 force-pushed the ng_sixlowpan_frag/feat/initial branch from 07bbf7c to 19c90dc Compare April 16, 2015 16:38
@miri64
Copy link
Member Author

miri64 commented Apr 16, 2015

Rebased to current #2614

@miri64 miri64 force-pushed the ng_sixlowpan_frag/feat/initial branch from 19c90dc to c404f4e Compare April 21, 2015 16:10
@miri64
Copy link
Member Author

miri64 commented Apr 21, 2015

Rebased to current #2614

@miri64 miri64 force-pushed the ng_sixlowpan_frag/feat/initial branch from c404f4e to d0236df Compare April 22, 2015 23:17
@miri64
Copy link
Member Author

miri64 commented Apr 22, 2015

Rebased to current #2614 and squashed

@miri64 miri64 force-pushed the ng_sixlowpan_frag/feat/initial branch from d0236df to 5be6bfd Compare April 23, 2015 14:33
@miri64 miri64 removed the State: waiting for other PR State: The PR requires another PR to be merged first label Apr 23, 2015
@miri64
Copy link
Member Author

miri64 commented Apr 23, 2015

Rebased to current master

@OlegHahm OlegHahm added the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Apr 23, 2015
#define NG_SIXLOWPAN_FRAG_1_DISP (0xc0) /**< dispatch for 1st fragment */
#define NG_SIXLOWPAN_FRAG_N_DISP (0xe0) /**< dispatch for subsequent
* fragments */
#define NG_SIXLOWPAN_FRAG_SIZE_MASK (0x07ff) /**< mask for datagram size */
Copy link
Member

Choose a reason for hiding this comment

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

Matter of taste, but I find upper case letters for hex values better readable.

/* move already inserted fragments 1 to the right */
for (int i = pkt->size - 1; i > 0; i--) {
uint8_t *d = ((uint8_t *)(pkt->data)) + i;
*d = *(d - 1);
Copy link
Member

Choose a reason for hiding this comment

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

memmove()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Takes a lot of stack space, if I understand its doc correctly. From memmove(3)

DESCRIPTION
       The memmove() function copies n bytes from memory area src to memory area dest.  The memory areas may overlap: copy‐
       ing takes place as though the bytes in src are first copied into a temporary array that  does  not  overlap  src  or
       dest, and the bytes are then copied from the temporary array to dest.

Copy link
Member

Choose a reason for hiding this comment

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

Could be interesting to do some benchmarking, but again out of scope of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

I ran a benchmark on native, iot-lab_M3, and SAMR21-xpro. Results were quite surprising:
Memory consumption is the same for both solutions on all platforms. But libc memmove more than 20 times faster on native, but significantly slower on both ARM platforms (+25% on SAMR21 and +500% on iot-LAB_M3).

Copy link
Member Author

@miri64 miri64 May 7, 2015 via email

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

That you were completely right and we should avoid memmove().

Copy link
Member Author

@miri64 miri64 May 8, 2015 via email

Choose a reason for hiding this comment

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

Copy link
Member

@OlegHahm OlegHahm May 8, 2015 via email

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Which PR?

Copy link
Member

@OlegHahm OlegHahm May 8, 2015 via email

Choose a reason for hiding this comment

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

@miri64
Copy link
Member Author

miri64 commented Apr 24, 2015

Addressed comments

rbuf[i].pkt->size, rbuf[i].tag);

ng_pktbuf_release(rbuf[i].pkt);
_rbuf_rem(rbuf + i);
Copy link
Member

Choose a reason for hiding this comment

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

I still think that &(rbuf[i]) is more readable, but I won't NACK.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@OlegHahm
Copy link
Member

All "mandatory" comments are addressed (except for the typo). Ready to squash and merge after Travis is fine. I will open a bunch of follow-up issues. (Please remind me to do so.)

@OlegHahm
Copy link
Member

That's an ACK.

@miri64 miri64 force-pushed the ng_sixlowpan_frag/feat/initial branch from 5ed282f to bbed05e Compare April 25, 2015 20:02
@miri64
Copy link
Member Author

miri64 commented Apr 25, 2015

Fixed the typo and squashed

@miri64 miri64 removed the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Apr 25, 2015
@miri64
Copy link
Member Author

miri64 commented Apr 25, 2015

There were documentation errors. Since I don't trust my spelling skills, I decided against immediate squashing.

@OlegHahm
Copy link
Member

looks good, go squashing again.

@miri64 miri64 force-pushed the ng_sixlowpan_frag/feat/initial branch from 2a2bdb6 to 73d9739 Compare April 26, 2015 00:21
@miri64
Copy link
Member Author

miri64 commented Apr 26, 2015

Squashed again

miri64 added a commit that referenced this pull request Apr 26, 2015
…tial

ng_sixlowpan: Initial import of datagram fragmentation
@miri64 miri64 merged commit 8a5e0d7 into RIOT-OS:master Apr 26, 2015
@miri64 miri64 deleted the ng_sixlowpan_frag/feat/initial branch April 26, 2015 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants