at86rf2xx: do not set src pan compression on init#5759
at86rf2xx: do not set src pan compression on init#5759cgundogan wants to merge 2 commits intoRIOT-OS:masterfrom
Conversation
According to section 7.5.6.1 of 802.15.4-2003, packets destined for the same PAN from which they were sent must have their intra-PAN flag set, and the source PAN omitted from the transmitted frame.
|
Do you mean #5685? Also: What happens if the flag is set? |
|
yes #5685
Can you rephrase? The flag is set by default currently and this leads to the src pan being compressed (elided from the header). This is no problem for now (and correct), because there is no case where iff |
|
You unset it, yes. But what happens now, if someone sets it later on? |
If you set it later, then you have the same functionality as before. |
|
as a side note, |
|
I don't really understand how PAN compression is relevant to the driver at all... is the |
If src_pan == dst_pan but the compression shouldn't be used eg. I already had the problem, that there is a bug in lwIP that it just ignores that bit and always skips the source PAN. |
That would be an invalid frame though, according to the 802.15.4 spec. |
|
Yes, but for Interop its sometimes necessary to provide behavior beyond the spec until a bug is fixed ;-) (I don't say that its not wrong, just that lwIP is doing it wrong atm). |
|
I don't really know enough about lwIP to comment, but if lwIP is doing it wrong then it needs to be fixed in lwIP, not broken in RIOT - two wrongs don't make a right :) |
@aeneby Could you point me to where in the 802.15.4 spec this is specified? Or which version of 802.15.4? As far as I read point 5.2.1.1.5 it is possible to have the two PAN IDs set to the same value without the need to use compression. |
|
@thomaseichinger, you have a point. In the 2003 spec it was quite clear, since it was called the "Intra-PAN" field. With this definition, it simply doesn't make sense to have src and dst PANs the same without this bit being set (and therefore the src PAN removed). However in the 2011 spec, the name has changed to "PAN ID Compression" field, even though the functional definition remains basically the same. I guess this would allow Intra-PAN packets to be sent with both src and dst PANs specified, according to the semantic definition of this field...? Now I'm not 100% sure, I will think over it. |
I agree with you and I finally came around to open an issue on the lwIP side, but I know enough about lwIP to say that changes to mainline are quite slow (6lowpan took 1.5 years to get to master, my issue about the incorrect fragmentation [a very pressing issue] is still open after ~6 month and the last non-RC release was nearly 4 years ago). So as a workaround I would still have this kind of option provided (in case they provide the fragmentation fix first ^^).
To me it reads that the compression is basically optional. Yes it makes sense to compress the source PAN away if it is identical, but I wouldn't say its completely wrong to include it regardless. |
|
Referencing the 2011 802.15.4 spec
I think the argumentation is just the other way around. If the bit is set there must only be one PAN ID while there are no rules constraining the usage of PAN IDs if the bit is not set. At least in the 2011 version. (I also didn't get my hands on the most recent 2015 version yet.) The interesting part I think is however, as, at least the at86rf231, to my knowledge implements IEEE 802.15.4 2006, how behavior of the hardware frame filters looks like in that case. (I don't have the 2006 version around right now.) |
|
(to be clear: the faulty behavior of lwIP in my eyes is that they completely ignore the compression bit, not that they include the source PAN, even if it is identical to the destination PAN). |
|
@miri64 This is undisputed and the discussion not necessarily prevents from moving forward with this PR as AFAIK RIOT should be able to deal with two same PAN IDs anyways. |
|
@miri64 I think it's totally standard conform if RIOT does PAN ID compression, my note was more about the receiving side. RIOT should be able to process a frame that doesn't have the compression bit set and two identical PAN IDs. |
|
After doing some careful reading, here is my interpretation (I'll try to stay relevant to this PR):
What does this mean for this PR?
The main issue is that, since each version of the 802.15.4 supersedes the ones before it, 802.15.4-2015 should be the one we are following. So there is still a missing piece of the puzzle here. |
According to my interpretation of the 2011 spec, yes, this is correct. Interesting to note though that Linux will drop such frames. |
|
See #5685 (comment). So in short, it looks like frames with identical src and dst PAN IDs are invalid again in the 2015 spec. Further, it's clear that the MAC layer should be automatically handling PAN ID compression. So actually, provided the linked text is accurate, I don't see any reason for the |
| at86rf2xx_set_txpower(dev, AT86RF2XX_DEFAULT_TXPOWER); | ||
| /* set default options */ | ||
| at86rf2xx_set_option(dev, NETDEV2_IEEE802154_PAN_COMP, true); | ||
| at86rf2xx_set_option(dev, NETDEV2_IEEE802154_PAN_COMP, false); |
There was a problem hiding this comment.
If this option is ignored anyway, shouldn't the code for at86rf2xx_set_option be disabled anyway?
There was a problem hiding this comment.
@miri64 I think you're right. There is no explicit implementation behind this option, so simply removing this line would probably be the most logical thing?
|
How about me use this PR just for removing |
|
|
||
| if (dst_pan.u16 == src_pan.u16) { | ||
| flags |= IEEE802154_FCF_PAN_COMP; | ||
| } |
|
Alternative in #5897 |
|
No objection to close once #5897 is merged. |
|
Closing in favour of #5897. |
Depends on
#5525#5685Currently, the at86rf2xx driver sets the src pan compression on initialization. Doing this when building the 802.15.4 header instead (like e.g. proposed by @aeneby in
#5525#5685 ) is more dynamic, so that the flag is still set/unset correctly iff the pan id changes.