wifi: shift BA window when sequence is next to the window end

According to the 802.11-2016 standard, 10.24.7.8,
the originator may send the packet with
SN > WinStart + WinSize – 1
and the recipient should move the window forward.

If SN is equal to WinStart + WinSize + 1 == WinEnd,
delta is equal to 0, and window is not moved.

This commit makes recipient shift the window in this case.
This commit is contained in:
Alexander Krotov
2019-04-09 14:06:02 +03:00
committed by Sébastien Deronne
parent 81db931bdc
commit fd3ef84b6e

View File

@@ -2174,13 +2174,11 @@ MacLow::ReceiveMpdu (Ptr<Packet> packet, WifiMacHeader hdr)
if (!IsInWindow (hdr.GetSequenceNumber (), (*it).second.first.GetStartingSequence (), (*it).second.first.GetBufferSize ()))
{
uint16_t delta = (seqNumber - (*it).second.first.GetWinEnd () + 4096) % 4096;
if (delta > 1)
{
uint16_t bufferSize = (*it).second.first.GetBufferSize ();
uint16_t startingSeq = (seqNumber - bufferSize + 1 + 4096) % 4096;
(*it).second.first.SetStartingSequence (startingSeq);
RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequenceControl (), originator, tid);
}
NS_ASSERT (delta > 0);
uint16_t bufferSize = (*it).second.first.GetBufferSize ();
uint16_t startingSeq = (seqNumber - bufferSize + 1 + 4096) % 4096;
(*it).second.first.SetStartingSequence (startingSeq);
RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequenceControl (), originator, tid);
}
RxCompleteBufferedPacketsUntilFirstLost (originator, tid); //forwards up packets starting from winstart and set winstart to last +1
}