LWMAC: avoid receiving duplicate broadcast packet.#7442
LWMAC: avoid receiving duplicate broadcast packet.#7442zhuoshuguo wants to merge 3 commits intoRIOT-OS:masterfrom
Conversation
|
I think this functionality is rather useful for more than LWMAC. I need something like this in ContikiMAC as well. |
|
In IEEE 802.15.4, the (source address, sequence number) tuple should be enough to determine if a packet is a dup, since the standard specifies that the sequence number (DSN) shall increment on each new packet transmitted, but not for retransmissions. |
That is it, agreed. But not enough, see below.
That is a good idea, but I currently foresee it maybe a little bit complicated if we merge this functionality into The only way to avoid this bug is that, node-B should understand that, the two packets, both from node-A, both with sequence 0x25, are not the same packet, which we should use some kind of |
Or rather invest in the future and do it as a follow-up to #7409 instead ;-). |
|
By the way, just to make it clear. ;-) the issues I mentioned here, for unicast and broadcast, are not the same, they are two different problems. This PR solves LWMAC duplicate bcast packet problem that I guess many low duty-cycle MACs will encounter. LWMAC doesn't have duplicate unicast packet problem due to its |
|
@zhuoshuguo I think your example is a classical case of over-complicating the situation. For a MAC protocol this might be something to consider, but just as a measure of keeping duplicated packets at bay this sounds like overkill (or: if a wrong packet get's accidentally in dropped in a corner-case: so what, upper layers may resend). Also: since @gebart is proposing to add this to the |
|
OK, so I leave it to you. ;-) |
|
Done. See #7577 |
|
(or 787dff1 just for the change ;-)) |
|
Off-topic: lwMAC needs to be ported to |
|
Hi, Martine. Actually, I would like to keep this PR. I understand that #7577 does solve similar problems, but not completely for LWMAC broadcasting. sender-1 may wake up to the receiver's (second wakeup, in the above figure) wake-up period and sends its data just ahead of a repeated packet from sender-2 to the receiver (refresh the sequence number recorded in #7577 ). In this case, #7577 will not work to release the duplicate broadcast packet from sender-1, while the revisions in this PR can. I totally understand that this case is with little chance, and rarely to happen. But, it did happens sometimes.. I know I may be over-complicating again... :-\ |
|
Ok, then can you maybe base this PR on the other one? |
|
Yes, definitely, I need to rebase. But, actually I am not sure how sensitive I should be when dealing with this kind of problems. Since, #7577 has already eliminated a very hug portion of the duplicate problem. So, maybe we can close this PR, without costing extra memory introduced by this PR. It depends on how careful we want LWMAC to be when dealing with duplicate broadcast packets. :-) |
|
Do as you like it best :-) |
|
OK, so let me keep it here. :-) |
|
@zhuoshuguo now that you are leaving, are there any plans for this PR? |
|
Ping @zhuoshuguo? |
|
@miri64 Will handle it soon~ |
49fbad4 to
f29bd5c
Compare
|
@miri64 Rebased~ |
|
Ping~ locally tested through on samr21-xpro boards, it works for the designed |
|
Needs rebase again... Sorry :(. |
|
Ping @zhuoshuguo? |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
This PR solves the problem of LWMAC that nodes will sometimes receive duplicate broadcast packet.
When broadcasting a packet in LWMAC, the sender keep transmitting the same frame for fully a
GNRC_LWMAC_BROADCAST_DURATION_USduration which is slightly longer than a LWMAC cycle duration, to guarantee that all neighbour node will at least receive a copy. However, in case the start of the broadcast duration is right with the start of a neighbour receiver's wake-up period, this neighbour receiver may receive duplicate broadcasting frames in their adjacent two cycles' wake-up periods. Namely:This PR solves this problem by introducing some parameters to record recent broadcasting information, e.g., the ID and bcast sequence of the broadcasting sender. Once the receiver indicates receiving duplicate broadcast frames (i.e.,
bcast-node-IDandbcast-sequenceare the same as in the last cycle), it ignores the duplicate copy.