diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 3deba3a96..20cdeae50 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -2980,6 +2980,8 @@ WifiPhy::EndReceive (Ptr event) receptionOkAtLeastForOneMpdu = rxInfo.first; } + NotifyRxEnd (psdu); + if (receptionOkAtLeastForOneMpdu) { NotifyMonitorSniffRx (psdu, GetFrequency (), txVector, signalNoise, statusPerMpdu); @@ -3017,13 +3019,11 @@ WifiPhy::GetReceptionStatus (Ptr psdu, Ptr event, Time re !(m_postReceptionErrorModel && m_postReceptionErrorModel->IsCorrupt (psdu->GetPacket ()->Copy ()))) { NS_LOG_DEBUG ("Reception succeeded: " << psdu); - NotifyRxEnd (psdu); return std::make_pair (true, signalNoise); } else { NS_LOG_DEBUG ("Reception failed: " << psdu); - NotifyRxDrop (psdu, ERRONEOUS_FRAME); return std::make_pair (false, signalNoise); } } diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 9069ee7d6..aa90ed539 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -59,7 +59,6 @@ enum WifiPhyRxfailureReason TXING, SLEEPING, BUSY_DECODING_PREAMBLE, - ERRONEOUS_FRAME, PREAMBLE_DETECT_FAILURE, L_SIG_FAILURE, SIG_A_FAILURE, @@ -91,8 +90,6 @@ inline std::ostream& operator<< (std::ostream& os, WifiPhyRxfailureReason reason return (os << "SLEEPING"); case BUSY_DECODING_PREAMBLE: return (os << "BUSY_DECODING_PREAMBLE"); - case ERRONEOUS_FRAME: - return (os << "ERRONEOUS_FRAME"); case PREAMBLE_DETECT_FAILURE: return (os << "PREAMBLE_DETECT_FAILURE"); case L_SIG_FAILURE: diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index 3a7ddb6e1..9654b06e9 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -1942,7 +1942,7 @@ TestAmpduReception::DoRun (void) // All MPDUs of A-MPDU 2 should have been received with errors. Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu2, this, 0b00000000); Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu2, this, 0b00000111); - Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu2, this, 0b00000111); + Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu2, this, 0b00000000); Simulator::Schedule (Seconds (9.2), &TestAmpduReception::ResetBitmaps, this); @@ -1983,7 +1983,7 @@ TestAmpduReception::DoRun (void) // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (11.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); Simulator::Schedule (Seconds (11.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000111); - Simulator::Schedule (Seconds (11.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000111); + Simulator::Schedule (Seconds (11.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000000); // All MPDUs of A-MPDU 2 should have been dropped. Simulator::Schedule (Seconds (11.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu2, this, 0b00000000); @@ -2052,7 +2052,7 @@ TestAmpduReception::DoRun (void) // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (14.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); Simulator::Schedule (Seconds (14.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000111); - Simulator::Schedule (Seconds (14.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000111); + Simulator::Schedule (Seconds (14.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000000); // All MPDUs of A-MPDU 2 should have been dropped. Simulator::Schedule (Seconds (14.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu2, this, 0b00000000); @@ -2190,7 +2190,7 @@ TestAmpduReception::DoRun (void) // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (20.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); Simulator::Schedule (Seconds (20.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000111); - Simulator::Schedule (Seconds (20.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000111); + Simulator::Schedule (Seconds (20.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000000); // All MPDUs of A-MPDU 2 should have been dropped (no reception switch, MPDUs dropped because PHY is already in RX state). Simulator::Schedule (Seconds (20.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu2, this, 0b00000000); @@ -2236,7 +2236,7 @@ TestAmpduReception::DoRun (void) // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (22.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); Simulator::Schedule (Seconds (22.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000111); - Simulator::Schedule (Seconds (22.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000111); + Simulator::Schedule (Seconds (22.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000000); // All MPDUs of A-MPDU 2 should have been dropped. Simulator::Schedule (Seconds (22.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu2, this, 0b00000000); @@ -2260,7 +2260,7 @@ TestAmpduReception::DoRun (void) // The two other MPDUs failed due to interference and are marked as failure (and dropped). Simulator::Schedule (Seconds (23.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000001); Simulator::Schedule (Seconds (23.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000110); - Simulator::Schedule (Seconds (23.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000110); + Simulator::Schedule (Seconds (23.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000000); // The two first MPDUs of A-MPDU 2 are dropped because PHY is already in RX state (receiving A-MPDU 1). // The last MPDU of A-MPDU 2 is interference free (A-MPDU 1 transmission is finished) but is dropped because its PHY preamble and header were not received. diff --git a/src/wifi/test/wifi-test.cc b/src/wifi/test/wifi-test.cc index 97533ddc9..3db4c65b4 100644 --- a/src/wifi/test/wifi-test.cc +++ b/src/wifi/test/wifi-test.cc @@ -1922,10 +1922,10 @@ private: /** * Callback when packet is dropped * \param context node context - * \param p the dropped packet - * \param reason the reason + * \param p the failed packet + * \param snr the SNR of the failed packet in linear scale */ - void RxDropCallback (std::string context, Ptr p, WifiPhyRxfailureReason reason); + void RxErrorCallback (std::string context, Ptr p, double snr); /** * Triggers the arrival of a burst of 1000 Byte-long packets in the source device * \param numPackets number of packets in burst @@ -1942,7 +1942,7 @@ private: uint16_t m_receivedNormalMpduCount; ///< Count received normal MPDU packets on STA uint16_t m_receivedAmpduCount; ///< Count received A-MPDU packets on STA - uint16_t m_droppedActionCount; ///< Count dropped ADDBA request/response + uint16_t m_failedActionCount; ///< Count failed ADDBA request/response uint16_t m_addbaEstablishedCount; ///< Count number of times ADDBA state machine is in established state uint16_t m_addbaPendingCount; ///< Count number of times ADDBA state machine is in pending state uint16_t m_addbaRejectedCount; ///< Count number of times ADDBA state machine is in rejected state @@ -1954,7 +1954,7 @@ Bug2470TestCase::Bug2470TestCase () : TestCase ("Test case for Bug 2470"), m_receivedNormalMpduCount (0), m_receivedAmpduCount (0), - m_droppedActionCount (0), + m_failedActionCount (0), m_addbaEstablishedCount (0), m_addbaPendingCount (0), m_addbaRejectedCount (0), @@ -2010,14 +2010,14 @@ Bug2470TestCase::RxCallback (std::string context, Ptr p, uint16_t } void -Bug2470TestCase::RxDropCallback (std::string context, Ptr p, WifiPhyRxfailureReason reason) +Bug2470TestCase::RxErrorCallback (std::string context, Ptr p, double snr) { Ptr packet = p->Copy (); WifiMacHeader hdr; packet->RemoveHeader (hdr); if (hdr.IsAction ()) { - m_droppedActionCount++; + m_failedActionCount++; } } @@ -2079,7 +2079,7 @@ Bug2470TestCase::RunSubtest (PointerValue apErrorModel, PointerValue staErrorMod mobility.Install (wifiStaNode); Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/MonitorSnifferRx", MakeCallback (&Bug2470TestCase::RxCallback, this)); - Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyRxDrop", MakeCallback (&Bug2470TestCase::RxDropCallback, this)); + Config::Connect ("/NodeList/*/DeviceList/*/Phy/State/RxError", MakeCallback (&Bug2470TestCase::RxErrorCallback, this)); Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/BE_Txop/BlockAckManager/AgreementState", MakeCallback (&Bug2470TestCase::AddbaStateChangedCallback, this)); Simulator::Schedule (Seconds (0.5), &Bug2470TestCase::SendPacketBurst, this, 1, apDevice.Get (0), staDevice.Get (0)->GetAddress ()); @@ -2112,9 +2112,9 @@ Bug2470TestCase::DoRun (void) { RunSubtest (PointerValue (), PointerValue (staPem)); - NS_TEST_ASSERT_MSG_EQ (m_droppedActionCount, 6, "ADDBA request packet is not dropped correctly"); + NS_TEST_ASSERT_MSG_EQ (m_failedActionCount, 6, "ADDBA request packets are not failed"); // There are two sets of 5 packets to be transmitted. The first 5 packets should be sent by normal - // MPDU because of failed ADDBA handshake.For the second set, the first packet should be sent by + // MPDU because of failed ADDBA handshake. For the second set, the first packet should be sent by // normal MPDU, and the rest with A-MPDU. In total we expect to receive 2 normal MPDU packets and // 8 A-MPDU packets. NS_TEST_ASSERT_MSG_EQ (m_receivedNormalMpduCount, 2, "Receiving incorrect number of normal MPDU packet on subtest 1"); @@ -2129,7 +2129,7 @@ Bug2470TestCase::DoRun (void) m_receivedNormalMpduCount = 0; m_receivedAmpduCount = 0; - m_droppedActionCount = 0; + m_failedActionCount = 0; m_addbaEstablishedCount = 0; m_addbaPendingCount = 0; m_addbaRejectedCount = 0; @@ -2146,7 +2146,7 @@ Bug2470TestCase::DoRun (void) { RunSubtest (PointerValue (apPem), PointerValue ()); - NS_TEST_ASSERT_MSG_EQ (m_droppedActionCount, 3, "ADDBA response packet is not dropped correctly"); + NS_TEST_ASSERT_MSG_EQ (m_failedActionCount, 3, "ADDBA response packets are not failed"); // Similar to subtest 1, we also expect to receive 6 normal MPDU packets and 4 A-MPDU packets. NS_TEST_ASSERT_MSG_EQ (m_receivedNormalMpduCount, 6, "Receiving incorrect number of normal MPDU packet on subtest 2"); NS_TEST_ASSERT_MSG_EQ (m_receivedAmpduCount, 4, "Receiving incorrect number of A-MPDU packet on subtest 2");