diff --git a/examples/wireless/examples-to-run.py b/examples/wireless/examples-to-run.py index 538fc9383..b32adbd4a 100755 --- a/examples/wireless/examples-to-run.py +++ b/examples/wireless/examples-to-run.py @@ -42,13 +42,13 @@ cpp_examples = [ ("wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"), ("wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=127", "True", "True"), ("wifi-vht-network --simulationTime=0.2 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=562", "True", "True"), - ("wifi-vht-network --simulationTime=0.2 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=520", "True", "True"), + ("wifi-vht-network --simulationTime=0.2 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=524", "True", "True"), ("wifi-he-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=844", "True", "True"), ("wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033", "True", "True"), ("wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=745", "True", "True"), ("wifi-he-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238", "True", "True"), ("wifi-he-network --simulationTime=0.3 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=223", "True", "True"), - ("wifi-simple-ht-hidden-stations --simulationTime=1.5 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60", "True", "True"), + ("wifi-simple-ht-hidden-stations --simulationTime=1.5 --enableRts=0 --nMpdus=32 --minExpectedThroughput=52 --maxExpectedThroughput=53", "True", "True"), ("wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58", "True", "True"), ("wifi-mixed-network --simulationTime=1", "True", "True"), ("wifi-aggregation --simulationTime=1 --verifyResults=1", "True", "True"), diff --git a/src/aodv/test/aodv-chain-regression-test-0-0.pcap b/src/aodv/test/aodv-chain-regression-test-0-0.pcap index dd4d381ab..9c8c80047 100644 Binary files a/src/aodv/test/aodv-chain-regression-test-0-0.pcap and b/src/aodv/test/aodv-chain-regression-test-0-0.pcap differ diff --git a/src/aodv/test/aodv-chain-regression-test-1-0.pcap b/src/aodv/test/aodv-chain-regression-test-1-0.pcap index a8486eca8..4d6410f9d 100644 Binary files a/src/aodv/test/aodv-chain-regression-test-1-0.pcap and b/src/aodv/test/aodv-chain-regression-test-1-0.pcap differ diff --git a/src/aodv/test/aodv-chain-regression-test-2-0.pcap b/src/aodv/test/aodv-chain-regression-test-2-0.pcap index aa61bb29d..0ee28de79 100644 Binary files a/src/aodv/test/aodv-chain-regression-test-2-0.pcap and b/src/aodv/test/aodv-chain-regression-test-2-0.pcap differ diff --git a/src/aodv/test/bug-606-test-0-0.pcap b/src/aodv/test/bug-606-test-0-0.pcap index f3b305fbf..cf91f88e8 100644 Binary files a/src/aodv/test/bug-606-test-0-0.pcap and b/src/aodv/test/bug-606-test-0-0.pcap differ diff --git a/src/aodv/test/bug-606-test-1-0.pcap b/src/aodv/test/bug-606-test-1-0.pcap index 60a46e02e..e44c9bf1b 100644 Binary files a/src/aodv/test/bug-606-test-1-0.pcap and b/src/aodv/test/bug-606-test-1-0.pcap differ diff --git a/src/aodv/test/bug-606-test-2-0.pcap b/src/aodv/test/bug-606-test-2-0.pcap index 855705acf..d364a162f 100644 Binary files a/src/aodv/test/bug-606-test-2-0.pcap and b/src/aodv/test/bug-606-test-2-0.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap index 4177b5e96..cc158a14c 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap index 9727e56b4..cfba7e333 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap index 321308af8..6f08daddd 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-2-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap index dcb7d561b..c564399a4 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-3-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap b/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap index 6d1badc34..b9f4ac7c8 100644 Binary files a/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap and b/src/mesh/test/dot11s/hwmp-proactive-regression-test-4-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap index 9140b832c..3ec6f9c0e 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap index 9f37af638..f9e74626c 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap index 0ee9a588d..6e96c4a4d 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-2-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap index 0b7a95027..e8a702d90 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-3-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap index 23258feee..d9287df30 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-4-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap b/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap index a06a13dd5..5614e77ed 100644 Binary files a/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap and b/src/mesh/test/dot11s/hwmp-reactive-regression-test-5-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-simplest-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-simplest-regression-test-0-1.pcap index 287ed1e40..515d4b65f 100644 Binary files a/src/mesh/test/dot11s/hwmp-simplest-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-simplest-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-simplest-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-simplest-regression-test-1-1.pcap index 7c8505ff7..f18b9e0b6 100644 Binary files a/src/mesh/test/dot11s/hwmp-simplest-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-simplest-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap index a3900b418..bf5f463cd 100644 Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap index 105dc09f0..6b8b0492a 100644 Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-1-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap index 62ba0e7d4..f20aa1c2a 100644 Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-2-1.pcap differ diff --git a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap index aceb5816a..2fac0580b 100644 Binary files a/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap and b/src/mesh/test/dot11s/hwmp-target-flags-regression-test-3-1.pcap differ diff --git a/src/mesh/test/dot11s/pmp-regression-test-0-1.pcap b/src/mesh/test/dot11s/pmp-regression-test-0-1.pcap index 2de109498..15ff51c59 100644 Binary files a/src/mesh/test/dot11s/pmp-regression-test-0-1.pcap and b/src/mesh/test/dot11s/pmp-regression-test-0-1.pcap differ diff --git a/src/mesh/test/dot11s/pmp-regression-test-1-1.pcap b/src/mesh/test/dot11s/pmp-regression-test-1-1.pcap index 8a4a64298..2ef94dce4 100644 Binary files a/src/mesh/test/dot11s/pmp-regression-test-1-1.pcap and b/src/mesh/test/dot11s/pmp-regression-test-1-1.pcap differ diff --git a/src/wifi/model/channel-access-manager.cc b/src/wifi/model/channel-access-manager.cc index ab75a4a36..ee1a93651 100644 --- a/src/wifi/model/channel-access-manager.cc +++ b/src/wifi/model/channel-access-manager.cc @@ -280,38 +280,6 @@ ChannelAccessManager::RequestAccess (Ptr state, bool isCfPeriod) UpdateBackoff (); NS_ASSERT (!state->IsAccessRequested ()); state->NotifyAccessRequested (); - // If currently transmitting; end of transmission (ACK or no ACK) will cause - // a later access request if needed from EndTxNoAck, GotAck, or MissedAck - Time lastTxEnd = m_lastTxStart + m_lastTxDuration; - if (lastTxEnd > Simulator::Now ()) - { - NS_LOG_DEBUG ("Internal collision (currently transmitting)"); - state->NotifyInternalCollision (); - DoRestartAccessTimeoutIfNeeded (); - return; - } - /** - * If there is a collision, generate a backoff - * by notifying the collision to the user. - */ - if (state->GetBackoffSlots () == 0) - { - if (IsBusy ()) - { - NS_LOG_DEBUG ("medium is busy: collision"); - // someone else has accessed the medium; generate a backoff. - state->NotifyCollision (); - DoRestartAccessTimeoutIfNeeded (); - return; - } - else if (IsWithinAifs (state)) - { - NS_LOG_DEBUG ("busy within AIFS"); - state->NotifyCollision (); - DoRestartAccessTimeoutIfNeeded (); - return; - } - } DoGrantDcfAccess (); DoRestartAccessTimeoutIfNeeded (); } diff --git a/src/wifi/model/qos-txop.cc b/src/wifi/model/qos-txop.cc index 4142f3671..5a7cacebd 100644 --- a/src/wifi/model/qos-txop.cc +++ b/src/wifi/model/qos-txop.cc @@ -182,6 +182,14 @@ QosTxop::GetTypeOfStation (void) const return m_typeOfStation; } +bool +QosTxop::HasFramesToTransmit (void) +{ + bool ret = (m_currentPacket != 0 || m_baManager->HasPackets () || !m_queue->IsEmpty ()); + NS_LOG_FUNCTION (this << ret); + return ret; +} + uint16_t QosTxop::GetNextSequenceNumberFor (const WifiMacHeader *hdr) { diff --git a/src/wifi/model/qos-txop.h b/src/wifi/model/qos-txop.h index b2a1a119e..1746a14bb 100644 --- a/src/wifi/model/qos-txop.h +++ b/src/wifi/model/qos-txop.h @@ -146,6 +146,12 @@ public: */ TypeOfStation GetTypeOfStation (void) const; + /** + * Check if the EDCAF has frames to transmit. + * \return true if the EDCAF has frames to transmit. + */ + virtual bool HasFramesToTransmit (void); + /** * \param address recipient address of the peer station * \param tid traffic ID. diff --git a/src/wifi/model/txop.cc b/src/wifi/model/txop.cc index af15597b8..3643d74d1 100644 --- a/src/wifi/model/txop.cc +++ b/src/wifi/model/txop.cc @@ -304,6 +304,55 @@ Txop::GetTxopLimit (void) const return m_txopLimit; } +bool +Txop::HasFramesToTransmit (void) +{ + bool ret = (m_currentPacket != 0 || !m_queue->IsEmpty ()); + NS_LOG_FUNCTION (this << ret); + return ret; +} + +void +Txop::GenerateBackoffUponAccessIfNeeded (void) +{ + NS_LOG_FUNCTION (this); + /* + * From section 10.3.4.2 "Basic access" of IEEE 802.11-2016: + * + * A STA may transmit an MPDU when it is operating under the DCF access + * method, either in the absence of a PC, or in the CP of the PCF access + * method, when the STA determines that the medium is idle when a frame is + * queued for transmission, and remains idle for a period of a DIFS, or an + * EIFS (10.3.2.3.7) from the end of the immediately preceding medium-busy + * event, whichever is the greater, and the backoff timer is zero. Otherwise + * the random backoff procedure described in 10.3.4.3 shall be followed. + * + * From section 10.22.2.2 "EDCA backoff procedure" of IEEE 802.11-2016: + * + * The backoff procedure shall be invoked by an EDCAF when any of the following + * events occurs: + * a) An MA-UNITDATA.request primitive is received that causes a frame with that AC + * to be queued for transmission such that one of the transmit queues associated + * with that AC has now become non-empty and any other transmit queues + * associated with that AC are empty; the medium is busy on the primary channel + */ + if (!HasFramesToTransmit () && !m_low->IsCfPeriod () && m_backoffSlots == 0) + { + if (!m_channelAccessManager->IsBusy ()) + { + // medium idle. If this is a DCF, use immediate access (we can transmit + // in a DIFS if the medium remains idle). + Time delay = (IsQosTxop () ? Seconds (0) : m_low->GetSifs () + GetAifsn () * m_low->GetSlotTime ()); + UpdateBackoffSlotsNow (0, Simulator::Now () + delay); + } + else + { + // medium busy, generate backoff + GenerateBackoff (); + } + } +} + void Txop::Queue (Ptr packet, const WifiMacHeader &hdr) { @@ -313,6 +362,7 @@ Txop::Queue (Ptr packet, const WifiMacHeader &hdr) SocketPriorityTag priorityTag; packetCopy->RemovePacketTag (priorityTag); m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr, packetCopy); + GenerateBackoffUponAccessIfNeeded (); m_queue->Enqueue (Create (packetCopy, hdr)); StartAccessIfNeeded (); } diff --git a/src/wifi/model/txop.h b/src/wifi/model/txop.h index d4cab533b..613f650ed 100644 --- a/src/wifi/model/txop.h +++ b/src/wifi/model/txop.h @@ -375,6 +375,15 @@ protected: */ virtual void NotifyCollision (void); + /** + * Check if the DCF has frames to transmit. + * \return true if the DCF has frames to transmit. + */ + virtual bool HasFramesToTransmit (void); + /** + * Generate a new backoff, if needed, when a packet is queued for transmission. + */ + virtual void GenerateBackoffUponAccessIfNeeded (void); /** * Generate a new backoff now. */ diff --git a/src/wifi/test/channel-access-manager-test.cc b/src/wifi/test/channel-access-manager-test.cc index 78d837955..ff28eeba5 100644 --- a/src/wifi/test/channel-access-manager-test.cc +++ b/src/wifi/test/channel-access-manager-test.cc @@ -75,6 +75,7 @@ private: void NotifyAccessGranted (void); void NotifyInternalCollision (void); void GenerateBackoff (void); + bool HasFramesToTransmit (void); void NotifyChannelSwitching (void); void NotifySleep (void); void NotifyWakeUp (void); @@ -342,6 +343,12 @@ TxopTest::GenerateBackoff (void) m_test->GenerateBackoff (m_i); } +bool +TxopTest::HasFramesToTransmit (void) +{ + return !m_expectedGrants.empty (); +} + void TxopTest::NotifyChannelSwitching (void) { @@ -465,6 +472,8 @@ ChannelAccessManagerTest::StartTest (uint64_t slotTime, uint64_t sifs, uint64_t { m_ChannelAccessManager = CreateObject (); m_low = CreateObject (); + m_low->SetSlotTime (MicroSeconds (slotTime)); + m_low->SetSifs (MicroSeconds (sifs)); m_ChannelAccessManager->SetupLow (m_low); m_ChannelAccessManager->SetSlot (MicroSeconds (slotTime)); m_ChannelAccessManager->SetSifs (MicroSeconds (sifs)); @@ -478,7 +487,8 @@ ChannelAccessManagerTest::AddDcfState (uint32_t aifsn) Ptr txop = CreateObject (this, m_txop.size ()); txop->SetAifsn (aifsn); m_txop.push_back (txop); - m_ChannelAccessManager->Add (txop); + txop->SetChannelAccessManager (m_ChannelAccessManager); + txop->SetMacLow (m_low); } void @@ -601,6 +611,7 @@ ChannelAccessManagerTest::AddAccessRequestWithSuccessfullAck (uint64_t at, uint6 void ChannelAccessManagerTest::DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, Ptr state) { + state->GenerateBackoffUponAccessIfNeeded (); state->QueueTx (txTime, expectedGrantTime); m_ChannelAccessManager->RequestAccess (state); } @@ -632,40 +643,28 @@ ChannelAccessManagerTest::AddRxStartEvt (uint64_t at, uint64_t duration) void ChannelAccessManagerTest::DoRun (void) { - // Bug 2369 addresses this case - // 0 3 4 5 8 9 10 12 - // | sifs | aifsn | tx | sifs | aifsn | | tx | + // DCF immediate access (no backoff) + // 1 4 5 6 8 11 12 + // | sifs | aifsn | tx | idle | sifs | aifsn | tx | // StartTest (1, 3, 10); AddDcfState (1); - AddAccessRequest (1, 1, 4, 0); - // Generate backoff when the request is within SIFS - ExpectBackoff (1, 0, 0); // 0 slots - AddAccessRequest (10, 2, 10, 0); - EndTest (); - // Bug 2369 addresses this case - // 0 3 5 6 9 11 12 13 - // | sifs | aifsn | tx | sifs | aifsn | | tx | - // - StartTest (1, 3, 10); - AddDcfState (2); - AddAccessRequest (4, 1, 5, 0); - // Generate backoff when the request is within AIFSN - ExpectBackoff (4, 0, 0); // 0 slots - AddAccessRequest (12, 2, 12, 0); + AddAccessRequest (1, 1, 5, 0); + AddAccessRequest (8, 2, 12, 0); EndTest (); // Check that receiving inside SIFS shall be cancelled properly: - // 0 3 4 5 8 9 12 13 14 - // | sifs | aifsn | tx | sifs | ack | sifs | aifsn | |tx | + // 1 4 5 6 9 10 14 17 18 + // | sifs | aifsn | tx | sifs | ack | idle | sifs | aifsn | tx | + // | + // 7 start rx // StartTest (1, 3, 10); AddDcfState (1); - AddAccessRequest (1, 1, 4, 0); - ExpectBackoff (1, 0, 0); - AddRxInsideSifsEvt (6, 10); - AddTxEvt (8, 1); - AddAccessRequest (14, 2, 14, 0); + AddAccessRequest (1, 1, 5, 0); + AddRxInsideSifsEvt (7, 10); + AddTxEvt (9, 1); + AddAccessRequest (14, 2, 18, 0); EndTest (); // The test below mainly intends to test the case where the medium // becomes busy in the middle of a backoff slot: the backoff counter @@ -712,31 +711,26 @@ ChannelAccessManagerTest::DoRun (void) ExpectBackoff (30, 0, 0); //backoff: 0 slots EndTest (); - // Bug 2369. Test case of requesting access within SIFS interval + // Requesting access within SIFS interval (DCF immediate access) // - // 20 60 66 70 74 - // | rx | sifs | aifsn | backoff | tx | - // | - // 62 request access. + // 20 60 62 68 72 + // | rx | idle | sifs | aifsn | tx | // StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20, 40); - AddAccessRequest (62, 2, 74, 0); - ExpectBackoff (62, 1, 0); //backoff: 1 slots + AddAccessRequest (62, 2, 72, 0); EndTest (); - // Bug 2369. Test case of requesting access after DIFS (no backoff) + // Requesting access after DIFS (DCF immediate access) // - // 20 60 66 70 - // | rx | sifs | aifsn | tx | - // | - // 70 request access. + // 20 60 70 76 80 + // | rx | idle | sifs | aifsn | tx | // StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20, 40); - AddAccessRequest (70, 2, 70, 0); + AddAccessRequest (70, 2, 80, 0); EndTest (); // Test an EIFS @@ -752,6 +746,19 @@ ChannelAccessManagerTest::DoRun (void) ExpectBackoff (30, 4, 0); //backoff: 4 slots EndTest (); + // Test DCF immediate access after an EIFS (EIFS is greater) + // + // 20 60 66 76 86 + // | <----+-eifs------>| + // | rx | sifs | acktxttime | sifs + aifsn | tx | + // | sifs + aifsn | + // request access 70 80 + StartTest (4, 6, 10); + AddDcfState (1); + AddRxErrorEvt (20, 40); + AddAccessRequest (70, 2, 86, 0); + EndTest (); + // Test that channel stays busy for first frame's duration after Rx error // // 20 60 @@ -801,16 +808,15 @@ ChannelAccessManagerTest::DoRun (void) // Test of AckTimeout handling: First queue requests access and ack procedure fails, // inside the ack timeout second queue with higher priority requests access. // - // 20 40 50 60 66 76 - // DCF0 - low | tx | ack timeout |sifs| | - // DCF1 - high | | |sifs| tx | - // ^ request access + // 20 26 34 54 74 80 + // DCF1 - low | sifs | aifsn | tx | ack timeout | sifs | | + // DCF0 - high | | | sifs | tx | + // ^ request access StartTest (4, 6, 10); - AddDcfState (2); //high priority DCF - AddDcfState (0); //low priority DCF - AddAccessRequestWithAckTimeout (20, 20, 20, 0); - AddAccessRequest (50, 10, 66, 1); - ExpectBackoff (50, 0, 1); + AddDcfState (0); //high priority DCF + AddDcfState (2); //low priority DCF + AddAccessRequestWithAckTimeout (20, 20, 34, 1); + AddAccessRequest (64, 10, 80, 0); EndTest (); // Test of AckTimeout handling: @@ -818,27 +824,27 @@ ChannelAccessManagerTest::DoRun (void) // First queue requests access and ack is 2 us delayed (got ack interval at the picture), // inside this interval second queue with higher priority requests access. // - // 20 40 41 42 48 58 - // DCF0 - low | tx |got ack |sifs| | - // DCF1 - high | | |sifs| tx | - // ^ request access + // 20 26 34 54 56 62 + // DCF1 - low | sifs | aifsn | tx | got ack | sifs | | + // DCF0 - high | | | sifs | tx | + // ^ request access StartTest (4, 6, 10); - AddDcfState (2); //high priority DCF - AddDcfState (0); //low priority DCF - AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0); - AddAccessRequest (41, 10, 48, 1); - ExpectBackoff (41, 0, 1); + AddDcfState (0); //high priority DCF + AddDcfState (2); //low priority DCF + AddAccessRequestWithSuccessfullAck (20, 20, 34, 2, 1); + AddAccessRequest (55, 10, 62, 0); EndTest (); //Repeat the same but with one queue: - // 20 40 41 42 48 58 - // DCF0 - low | tx |got ack |sifs| | - // ^ request access + // 20 26 34 54 60 62 68 76 80 + // DCF0 | sifs | aifsn | tx | sifs | ack | sifs | aifsn | bslot0 | tx | + // ^ request access StartTest (4, 6, 10); AddDcfState (2); - AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0); - AddAccessRequest (41, 10, 56, 0); - ExpectBackoff (41, 0, 0); + AddAccessRequest (20, 20, 34, 0); + AddRxOkEvt (60, 2); // ack + AddAccessRequest (61, 10, 80, 0); + ExpectBackoff (61, 1, 0); // 1 slot EndTest (); // test simple NAV count. This scenario modelizes a simple DATA+ACK handshake @@ -868,10 +874,13 @@ ChannelAccessManagerTest::DoRun (void) EndTest (); + // 20 60 80 86 94 + // | rx | idle | sifs | aifsn | tx | + // ^ request access StartTest (4, 6, 10); AddDcfState (2); AddRxOkEvt (20, 40); - AddAccessRequest (80, 10, 80, 0); + AddAccessRequest (80, 10, 94, 0); EndTest (); @@ -886,15 +895,13 @@ ChannelAccessManagerTest::DoRun (void) // Channel switching tests - // 0 20 23 24 25 - // | switching | sifs | aifsn | tx | - // | - // 21 access request. + // 0 20 21 24 25 26 + // | switching | idle | sifs | aifsn | tx | + // ^ access request. StartTest (1, 3, 10); AddDcfState (1); - AddSwitchingEvt (0,20); - AddAccessRequest (21, 1, 24, 0); - ExpectBackoff (21, 0, 0); + AddSwitchingEvt (0, 20); + AddAccessRequest (21, 1, 25, 0); EndTest (); // 20 40 50 53 54 55 56 57 @@ -910,64 +917,56 @@ ChannelAccessManagerTest::DoRun (void) AddAccessRequest (45, 1, 56, 0); EndTest (); - // 20 30 50 53 54 55 - // | rx | switching | sifs | aifsn | tx | - // | - // 51 access request. + // 20 30 50 51 54 55 56 + // | rx | switching | idle | sifs | aifsn | tx | + // ^ access request. // StartTest (1, 3, 10); AddDcfState (1); - AddRxStartEvt (20,40); - AddSwitchingEvt (30,20); - AddAccessRequest (51, 1, 54, 0); - ExpectBackoff (51, 0, 0); + AddRxStartEvt (20, 40); + AddSwitchingEvt (30, 20); + AddAccessRequest (51, 1, 55, 0); EndTest (); - // 20 30 50 53 54 55 - // | busy | switching | sifs | aifsn | tx | - // | - // 51 access request. + // 20 30 50 51 54 55 56 + // | busy | switching | idle | sifs | aifsn | tx | + // ^ access request. // StartTest (1, 3, 10); AddDcfState (1); - AddCcaBusyEvt (20,40); - AddSwitchingEvt (30,20); - AddAccessRequest (51, 1, 54, 0); - ExpectBackoff (51, 0, 0); + AddCcaBusyEvt (20, 40); + AddSwitchingEvt (30, 20); + AddAccessRequest (51, 1, 55, 0); EndTest (); - // 20 30 50 53 54 55 - // | nav | switching | sifs | aifsn | tx | - // | - // 51 access request. + // 20 30 50 51 54 55 56 + // | nav | switching | idle | sifs | aifsn | tx | + // ^ access request. // StartTest (1, 3, 10); AddDcfState (1); AddNavStart (20,40); AddSwitchingEvt (30,20); - AddAccessRequest (51, 1, 54, 0); - ExpectBackoff (51, 0, 0); + AddAccessRequest (51, 1, 55, 0); EndTest (); - // 20 40 50 55 58 59 60 - // | tx | ack timeout | switching | sifs | aifsn | tx | - // | | - // 45 access request. 56 access request. + // 20 23 24 44 54 59 60 63 64 65 + // | sifs | aifsn | tx | ack timeout | switching | idle | sifs | aifsn | tx | + // | | + // 49 access request. ^ access request. // StartTest (1, 3, 10); AddDcfState (1); - AddAccessRequestWithAckTimeout (20, 20, 20, 0); - AddAccessRequest (45, 1, 50, 0); - ExpectBackoff (45, 0, 0); - AddSwitchingEvt (50,5); - AddAccessRequest (56, 1, 59, 0); - ExpectBackoff (56, 0, 0); + AddAccessRequestWithAckTimeout (20, 20, 24, 0); + AddAccessRequest (49, 1, 54, 0); + AddSwitchingEvt (54, 5); + AddAccessRequest (60, 1, 64, 0); EndTest (); - // 20 60 66 70 74 78 80 100 106 110 112 - // | rx | sifs | aifsn | bslot0 | bslot1 | | switching | sifs | aifsn | tx | - // | | - // 30 access request. 101 access request. + // 20 60 66 70 74 78 80 100 101 107 111 113 + // | rx | sifs | aifsn | bslot0 | bslot1 | | switching | idle | sifs | aifsn | tx | + // | | + // 30 access request. ^ access request. // StartTest (4, 6, 10); AddDcfState (1); @@ -975,8 +974,7 @@ ChannelAccessManagerTest::DoRun (void) AddAccessRequest (30, 2, 80, 0); ExpectBackoff (30, 4, 0); //backoff: 4 slots AddSwitchingEvt (80,20); - AddAccessRequest (101, 2, 110, 0); - ExpectBackoff (101, 0, 0); //backoff: 0 slots + AddAccessRequest (101, 2, 111, 0); EndTest (); } diff --git a/src/wifi/test/inter-bss-test-suite.cc b/src/wifi/test/inter-bss-test-suite.cc index cd808315e..ef01a4ab9 100644 --- a/src/wifi/test/inter-bss-test-suite.cc +++ b/src/wifi/test/inter-bss-test-suite.cc @@ -281,13 +281,13 @@ TestInterBssConstantObssPdAlgo::SetupSimulation () Simulator::Schedule (Seconds (2.4), &TestInterBssConstantObssPdAlgo::SendOnePacket, this, sta_device2, ap_device2, m_payloadSize2 / 10); Simulator::Schedule (Seconds (2.4) + MicroSeconds (5), &TestInterBssConstantObssPdAlgo::SendOnePacket, this, ap_device2, sta_device2, m_payloadSize2 / 10); - Simulator::Schedule (Seconds (2.4) + MicroSeconds (55), &TestInterBssConstantObssPdAlgo::SendOnePacket, this, ap_device1, sta_device1, m_payloadSize1 / 10); + Simulator::Schedule (Seconds (2.4) + MicroSeconds (65), &TestInterBssConstantObssPdAlgo::SendOnePacket, this, ap_device1, sta_device1, m_payloadSize1 / 10); Simulator::Schedule (Seconds (2.4) + MicroSeconds (105), &TestInterBssConstantObssPdAlgo::SendOnePacket, this, ap_device3, sta_device3, m_payloadSize3 / 10); if (expectPhyReset) { // In this case, we check the TX power is restricted (and set the expected value slightly before transmission should occur) double expectedTxPower = std::min (m_txPowerDbm, 21 - (m_obssPdLevelDbm + 82)); - Simulator::Schedule (Seconds (2.4) + MicroSeconds (300), &TestInterBssConstantObssPdAlgo::SetExpectedTxPower, this, expectedTxPower); + Simulator::Schedule (Seconds (2.4) + MicroSeconds (450), &TestInterBssConstantObssPdAlgo::SetExpectedTxPower, this, expectedTxPower); } Simulator::Stop (Seconds (2.5)); diff --git a/src/wifi/test/wifi-test.cc b/src/wifi/test/wifi-test.cc index e0f006128..1ca004537 100644 --- a/src/wifi/test/wifi-test.cc +++ b/src/wifi/test/wifi-test.cc @@ -1247,7 +1247,7 @@ Bug2222TestCase::DoRun (void) //Generate same backoff for AC_VI and AC_VO //The below combination will work RngSeedManager::SetSeed (1); - RngSeedManager::SetRun (2); + RngSeedManager::SetRun (16); int64_t streamNumber = 100; NodeContainer wifiNodes; @@ -1299,8 +1299,8 @@ Bug2222TestCase::DoRun (void) clientLowPriority->SetAttribute ("Priority", UintegerValue (4)); //AC_VI clientLowPriority->SetRemote (socket); wifiNodes.Get (0)->AddApplication (clientLowPriority); - clientLowPriority->SetStartTime (Seconds (1.0)); - clientLowPriority->SetStopTime (Seconds (2.0)); + clientLowPriority->SetStartTime (Seconds (0.0)); + clientLowPriority->SetStopTime (Seconds (1.0)); Ptr clientHighPriority = CreateObject (); clientHighPriority->SetAttribute ("PacketSize", UintegerValue (1460)); @@ -1308,18 +1308,18 @@ Bug2222TestCase::DoRun (void) clientHighPriority->SetAttribute ("Priority", UintegerValue (6)); //AC_VO clientHighPriority->SetRemote (socket); wifiNodes.Get (0)->AddApplication (clientHighPriority); - clientHighPriority->SetStartTime (Seconds (1.0)); - clientHighPriority->SetStopTime (Seconds (2.0)); + clientHighPriority->SetStartTime (Seconds (0.0)); + clientHighPriority->SetStopTime (Seconds (1.0)); Ptr server = CreateObject (); server->SetLocal (socket); wifiNodes.Get (1)->AddApplication (server); - server->SetStartTime (Seconds (1.0)); - server->SetStopTime (Seconds (2.0)); + server->SetStartTime (Seconds (0.0)); + server->SetStopTime (Seconds (1.0)); Config::Connect ("/NodeList/*/DeviceList/*/RemoteStationManager/MacTxDataFailed", MakeCallback (&Bug2222TestCase::TxDataFailedTrace, this)); - Simulator::Stop (Seconds (2.0)); + Simulator::Stop (Seconds (1.0)); Simulator::Run (); Simulator::Destroy (); @@ -2153,7 +2153,7 @@ Bug2470TestCase::DoRun (void) // Block ADDBA request 3 times (== maximum number of MAC frame transmissions in the ADDBA response timeout interval) blackList.push_back (4); blackList.push_back (5); - blackList.push_back (6); + blackList.push_back (8); apPem->SetList (blackList); {