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

We are fragmenting too aggressively #193

Closed
g-oikonomou opened this issue Apr 6, 2013 · 6 comments
Closed

We are fragmenting too aggressively #193

g-oikonomou opened this issue Apr 6, 2013 · 6 comments
Assignees

Comments

@g-oikonomou
Copy link
Contributor

I observed that DIOs are now being sent fragmented without having grown in size!

The problem is in L1463 in core/net/sicslowpan.c:

if((int)uip_len - (int)uncomp_hdr_len > (int)MAC_MAX_PAYLOAD - framer_hdrlen - (int)rime_hdr_len) {

We are leaving too little space for the L2 payload. We reduce it by 25 first inside MAC_MAX_PAYLOAD (which defaults to 127 - 25) and then we further subtract framer_hdrlen.

There was nothing wrong with the old condition, so am I right to suspect it may be related with crypto at L2?

What we should be doing is subtract the highest of 25 or framer_hdrlen, like so (obviously formatted correctly etc):

(int)127 - (framer_hdrlen > 25 ? framer_hdrlen : 25) - (int)rime_hdr_len)

There are two more instances of MAC_MAX_PAYLOAD - framer_hdrlen which would need adjustments as well.

One could argue that this is not a bug however it needs changed, since at the moment we don't have RPL in platforms which don't support 6lowpan fragmentation.

@aguirrem
Copy link

I just noticed this too! I was trying to figure out what had changed.
Could the same be said for platforms that don't have crypto or have it disabled?

@aguirrem
Copy link

👍
I have tested the changes proposed here with good results

@adamdunkels
Copy link
Member

Nice! Does anyone have a patch/pull request?

@g-oikonomou
Copy link
Contributor Author

This was more like a bug report.

If the proposed change works it's only a fluke, it was off the top of my head

On 18 Nov 2013, at 06:23, Adam Dunkels [email protected] wrote:

Nice! Does anyone have a patch/pull request?


Reply to this email directly or view it on GitHub.

@aguirrem
Copy link

I am not very familiar with that part of the code or the reasons why it changed.
Can anyone shed into @g-oikonomou speculations above? I can put a pull request together if the fix is acceptable

@laurentderu
Copy link
Member

MAC_MAX_PAYLOAD should be replaced by the maximum PHY frame size. There is one caveat though, if the framer appends bytes after the payload, they are not included in framer_hdrlen. In case of 802.15.4 the FCS is appended, so you have to replace MAC_MAX_PAYLOAD by 127 - 2. By doing that there is no need to use max(framer_hdrlen, 25)

ce99c02 from #557 fixes this as a side effect

Maybe a cleaner solution would be to add a function in framer to return the len of appended data.

@g-oikonomou g-oikonomou self-assigned this Feb 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants