# HG changeset patch # User Sébastien Deronne # Date 1441140291 -7200 # Node ID d0da0aa55bda72542f56b3af4516b78dc2460990 # Parent 5560c057c54a1e36fc34ba62715ccbbbbd8eb92b Bug 2104 [wifi] - Sequence Number passed to QosUtilsMapSeqControlToUniqueInteger instead of Sequence Control (initial fix from Steven Sultana) diff -r 5560c057c54a -r d0da0aa55bda src/wifi/model/block-ack-agreement.cc --- a/src/wifi/model/block-ack-agreement.cc Tue Sep 01 22:02:05 2015 +0200 +++ b/src/wifi/model/block-ack-agreement.cc Tue Sep 01 22:44:51 2015 +0200 @@ -76,6 +76,14 @@ } void +BlockAckAgreement::SetStartingSequenceControl (uint16_t seq) +{ + NS_LOG_FUNCTION (this << seq); + NS_ASSERT (((seq >> 4) & 0x0fff) < 4096); + m_startingSeq = (seq >> 4) & 0x0fff; +} + +void BlockAckAgreement::SetImmediateBlockAck (void) { NS_LOG_FUNCTION (this); @@ -135,7 +143,7 @@ BlockAckAgreement::GetStartingSequenceControl (void) const { NS_LOG_FUNCTION (this); - uint16_t seqControl = (m_startingSeq << 4) | 0xfff0; + uint16_t seqControl = (m_startingSeq << 4) & 0xfff0; return seqControl; } diff -r 5560c057c54a -r d0da0aa55bda src/wifi/model/block-ack-agreement.h --- a/src/wifi/model/block-ack-agreement.h Tue Sep 01 22:02:05 2015 +0200 +++ b/src/wifi/model/block-ack-agreement.h Tue Sep 01 22:44:51 2015 +0200 @@ -63,6 +63,12 @@ */ void SetStartingSequence (uint16_t seq); /** + * Set starting sequence control. + * + * \param seq the starting sequence control + */ + void SetStartingSequenceControl (uint16_t seq); + /** * Set Block ACK policy to immediate ACK. */ void SetImmediateBlockAck (void); @@ -113,7 +119,7 @@ */ uint16_t GetStartingSequence (void) const; /** - * Return the starting squence control + * Return the starting sequence control * * \return starting sequence control */ diff -r 5560c057c54a -r d0da0aa55bda src/wifi/model/mac-low.cc --- a/src/wifi/model/mac-low.cc Tue Sep 01 22:02:05 2015 +0200 +++ b/src/wifi/model/mac-low.cc Tue Sep 01 22:44:51 2015 +0200 @@ -1069,7 +1069,7 @@ NS_LOG_DEBUG ("rx QoS unicast/sendAck from=" << hdr.GetAddr2 ()); AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), hdr.GetQosTid ())); - RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.GetStartingSequence (), + RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.GetStartingSequenceControl (), hdr.GetAddr2 (), hdr.GetQosTid ()); RxCompleteBufferedPacketsUntilFirstLost (hdr.GetAddr2 (), hdr.GetQosTid ()); NS_ASSERT (m_sendAckEvent.IsExpired ()); @@ -2269,7 +2269,7 @@ int16_t bufferSize = (*it).second.first.GetBufferSize (); uint16_t sum = ((uint16_t)(std::abs (winEnd - bufferSize + 1))) % 4096; (*it).second.first.SetStartingSequence (sum); - RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequence (), originator, tid); + RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequenceControl (), originator, tid); } } RxCompleteBufferedPacketsUntilFirstLost (originator, tid); //forwards up packets starting from winstart and set winstart to last +1 @@ -2362,7 +2362,7 @@ AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); if (it != m_bAckAgreements.end ()) { - RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.GetStartingSequence (), originator, tid); + RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.GetStartingSequenceControl (), originator, tid); RxCompleteBufferedPacketsUntilFirstLost (originator, tid); m_bAckAgreements.erase (it); @@ -2384,11 +2384,11 @@ uint16_t guard = 0; if (last != (*it).second.second.end ()) { - guard = (*it).second.second.begin ()->second.GetSequenceControl () & 0xfff0; + guard = (*it).second.second.begin ()->second.GetSequenceControl (); } BufferedPacketI i = (*it).second.second.begin (); for (; i != (*it).second.second.end () - && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceNumber (), endSequence) < mappedStart; ) + && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceControl (), endSequence) < mappedStart; ) { if (guard == (*i).second.GetSequenceControl ()) { @@ -2402,13 +2402,13 @@ m_rxCallback ((*last).first, &(*last).second); last++; /* go to next packet */ - while (i != (*it).second.second.end () && ((guard >> 4) & 0x0fff) == (*i).second.GetSequenceNumber ()) + while (i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl ()) { i++; } if (i != (*it).second.second.end ()) { - guard = (*i).second.GetSequenceControl () & 0xfff0; + guard = (*i).second.GetSequenceControl (); last = i; } } @@ -2420,13 +2420,13 @@ else { /* go to next packet */ - while (i != (*it).second.second.end () && ((guard >> 4) & 0x0fff) == (*i).second.GetSequenceNumber ()) + while (i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl ()) { i++; } if (i != (*it).second.second.end ()) { - guard = (*i).second.GetSequenceControl () & 0xfff0; + guard = (*i).second.GetSequenceControl (); last = i; } } @@ -2441,9 +2441,7 @@ AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); if (it != m_bAckAgreements.end ()) { - uint16_t startingSeqCtrl = ((*it).second.first.GetStartingSequence () << 4) & 0xfff0; - uint16_t guard = startingSeqCtrl; - + uint16_t guard = (*it).second.first.GetStartingSequenceControl (); BufferedPacketI lastComplete = (*it).second.second.begin (); BufferedPacketI i = (*it).second.second.begin (); for (; i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl (); i++) @@ -2460,7 +2458,7 @@ } guard = (*i).second.IsMoreFragments () ? (guard + 1) : ((guard + 16) & 0xfff0); } - (*it).second.first.SetStartingSequence ((guard >> 4) & 0x0fff); + (*it).second.first.SetStartingSequenceControl (guard); /* All packets already forwarded to WifiMac must be removed from buffer: [begin (), lastComplete) */ (*it).second.second.erase ((*it).second.second.begin (), lastComplete); @@ -2593,7 +2591,7 @@ /* All packets with smaller sequence than starting sequence control must be passed up to Wifimac * See 9.10.3 in IEEE 802.11e standard. */ - RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequence (), originator, tid); + RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequenceControl (), originator, tid); RxCompleteBufferedPacketsUntilFirstLost (originator, tid); } else @@ -2602,7 +2600,7 @@ { (*it).second.first.SetStartingSequence (reqHdr.GetStartingSequence ()); (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096); - RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequence (), originator, tid); + RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequenceControl (), originator, tid); RxCompleteBufferedPacketsUntilFirstLost (originator, tid); (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096); } diff -r 5560c057c54a -r d0da0aa55bda src/wifi/model/mac-low.h --- a/src/wifi/model/mac-low.h Tue Sep 01 22:02:05 2015 +0200 +++ b/src/wifi/model/mac-low.h Tue Sep 01 22:44:51 2015 +0200 @@ -1169,7 +1169,7 @@ /** * \param originator Address of peer participating in Block Ack mechanism. * \param tid TID for which Block Ack was created. - * \param seq Starting sequence + * \param seq Starting sequence control * * This function forward up all completed "old" packets with sequence number * smaller than seq. All comparison are performed circularly mod 4096. diff -r 5560c057c54a -r d0da0aa55bda src/wifi/model/mgt-headers.cc --- a/src/wifi/model/mgt-headers.cc Tue Sep 01 22:02:05 2015 +0200 +++ b/src/wifi/model/mgt-headers.cc Tue Sep 01 22:44:51 2015 +0200 @@ -922,6 +922,12 @@ } void +MgtAddBaRequestHeader::SetStartingSequenceControl (uint16_t seqControl) +{ + m_startingSeq = (seqControl >> 4) & 0x0fff; +} + +void MgtAddBaRequestHeader::SetAmsduSupport (bool supported) { m_amsduSupport = supported; @@ -969,12 +975,6 @@ return (m_startingSeq << 4) & 0xfff0; } -void -MgtAddBaRequestHeader::SetStartingSequenceControl (uint16_t seqControl) -{ - m_startingSeq = (seqControl >> 4) & 0x0fff; -} - uint16_t MgtAddBaRequestHeader::GetParameterSet (void) const {