From a85bcf08f37c11151a93ca23578a3a15b856afc3 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Tue, 29 Jan 2019 19:49:29 +0100 Subject: [PATCH] wifi: Remove unused functions --- src/wifi/model/mac-low.cc | 504 ------------------------------ src/wifi/model/mac-low.h | 64 ---- src/wifi/model/mpdu-aggregator.cc | 68 ---- src/wifi/model/mpdu-aggregator.h | 35 --- src/wifi/model/msdu-aggregator.cc | 30 -- src/wifi/model/msdu-aggregator.h | 17 - src/wifi/model/qos-txop.cc | 15 - src/wifi/model/qos-txop.h | 11 - 8 files changed, 744 deletions(-) diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index 1a9f34940..11dec042e 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -494,22 +494,6 @@ MacLow::RegisterDcf (Ptr dcf) m_channelAccessManagers.push_back (dcf); } -bool -MacLow::IsAmpdu (Ptr packet, const WifiMacHeader hdr) -{ - uint32_t size, actualSize; - WifiMacTrailer fcs; - size = packet->GetSize () + hdr.GetSize () + fcs.GetSerializedSize (); - Ptr p = AggregateToAmpdu (packet, hdr); - actualSize = p->GetSize (); - if (actualSize > size) - { - m_currentPacket = p; - return true; - } - return false; -} - void MacLow::StartTransmission (Ptr packet, const WifiMacHeader* hdr, @@ -2859,351 +2843,6 @@ MacLow::DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, } } -bool -MacLow::StopMpduAggregation (Ptr peekedPacket, WifiMacHeader peekedHdr, Ptr aggregatedPacket, uint8_t blockAckSize) const -{ - if (peekedPacket == 0) - { - NS_LOG_DEBUG ("no more packets in queue"); - return true; - } - - Time aPPDUMaxTime = MicroSeconds (5484); - uint8_t tid = GetTid (peekedPacket, peekedHdr); - AcIndex ac = QosUtilsMapTidToAc (tid); - - if (m_stationManager->GetGreenfieldSupported ()) - { - aPPDUMaxTime = MicroSeconds (10000); - } - - //A STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime - if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, m_phy->GetFrequency ()) > aPPDUMaxTime) - { - NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime"); - return true; - } - - if (!m_mpduAggregator->CanBeAggregated (peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, blockAckSize, GetMaxAmpduSize (ac))) - { - NS_LOG_DEBUG ("no more packets can be aggregated because the maximum A-MPDU size has been reached"); - return true; - } - - return false; -} - -Ptr -MacLow::AggregateToAmpdu (Ptr packet, const WifiMacHeader hdr) -{ - bool isAmpdu = false; - Ptr newPacket, tempPacket; - WifiMacHeader peekedHdr; - newPacket = packet->Copy (); - Ptr currentAggregatedPacket; - CtrlBAckRequestHeader blockAckReq; - - if (hdr.IsBlockAckReq ()) - { - //Workaround to avoid BlockAckReq to be part of an A-MPDU. The standard says that - //BlockAckReq is not present in A-MPDU if any QoS data frames for that TID are present. - //Since an A-MPDU in non-PSMP frame exchanges aggregates MPDUs from one TID, this means - //we should stop aggregation here for single-TID A-MPDUs. Once PSMP and multi-TID A-MPDUs - //are supported, the condition of entering here should be changed. - return newPacket; - } - - //missing hdr.IsAck() since we have no means of knowing the Tid of the Ack yet - if (hdr.IsQosData () || hdr.IsBlockAck ()|| hdr.IsBlockAckReq ()) - { - Time tstamp; - uint8_t tid = GetTid (packet, hdr); - Ptr queue; - Ptr aggPacket; - AcIndex ac = QosUtilsMapTidToAc (tid); - std::map >::const_iterator edcaIt = m_edca.find (ac); - NS_ASSERT (edcaIt != m_edca.end ()); - queue = edcaIt->second->GetWifiMacQueue (); - - if (!hdr.GetAddr1 ().IsBroadcast () && m_mpduAggregator != 0) - { - //Have to make sure that the block ACK agreement is established before sending an AMPDU - if (edcaIt->second->GetBaAgreementEstablished (hdr.GetAddr1 (), tid)) - { - /* here is performed mpdu aggregation */ - /* MSDU aggregation happened in edca if the user asked for it so m_currentPacket may contains a normal packet or a A-MSDU*/ - currentAggregatedPacket = Create (); - peekedHdr = hdr; - uint16_t startingSequenceNumber = 0; - uint16_t currentSequenceNumber = 0; - uint8_t qosPolicy = 0; - uint8_t blockAckSize = 0; - bool aggregated = false; - uint16_t i = 0; - aggPacket = newPacket->Copy (); - - if (!hdr.IsBlockAckReq ()) - { - if (!hdr.IsBlockAck ()) - { - startingSequenceNumber = peekedHdr.GetSequenceNumber (); - peekedHdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); - } - currentSequenceNumber = peekedHdr.GetSequenceNumber (); - newPacket->AddHeader (peekedHdr); - AddWifiMacTrailer (newPacket); - - aggregated = m_mpduAggregator->Aggregate (newPacket, currentAggregatedPacket, GetMaxAmpduSize (ac)); - - if (aggregated) - { - NS_LOG_DEBUG ("Adding packet with sequence number " << currentSequenceNumber << " to A-MPDU, packet size = " << newPacket->GetSize () << ", A-MPDU size = " << currentAggregatedPacket->GetSize ()); - i++; - m_aggregateQueue[tid]->Enqueue (Create (aggPacket, peekedHdr)); - } - } - else if (hdr.IsBlockAckReq ()) - { - blockAckSize = static_cast (packet->GetSize () + hdr.GetSize () + WIFI_MAC_FCS_LENGTH); - qosPolicy = 3; //if the last subframe is block ack req then set ack policy of all frames to blockack - packet->PeekHeader (blockAckReq); - startingSequenceNumber = blockAckReq.GetStartingSequence (); - } - /// \todo We should also handle Ack and BlockAck - bool retry = false; - //looks for other packets to the same destination with the same Tid need to extend that to include MSDUs - Ptr peekedPacket = edcaIt->second->PeekNextRetransmitPacket (peekedHdr, tid, &tstamp); - if (peekedPacket == 0) - { - Ptr item = queue->PeekByTidAndAddress (tid, - hdr.GetAddr1 ()); - if (item) - { - peekedPacket = item->GetPacket (); - peekedHdr = item->GetHeader (); - tstamp = item->GetTimeStamp (); - } - currentSequenceNumber = edcaIt->second->PeekNextSequenceNumberFor (&peekedHdr); - - /* here is performed MSDU aggregation (two-level aggregation) */ - if (peekedPacket != 0 && m_msduAggregator != 0) - { - tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize); - if (tempPacket != 0) //MSDU aggregation - { - peekedPacket = tempPacket->Copy (); - } - } - } - else - { - retry = true; - currentSequenceNumber = peekedHdr.GetSequenceNumber (); - } - - uint16_t maxMpdus = edcaIt->second->GetBaBufferSize (hdr.GetAddr1 (), tid); - while (IsInWindow (currentSequenceNumber, startingSequenceNumber, maxMpdus) && !StopMpduAggregation (peekedPacket, peekedHdr, currentAggregatedPacket, blockAckSize)) - { - //for now always send AMPDU with normal ACK - if (retry == false) - { - currentSequenceNumber = edcaIt->second->GetNextSequenceNumberFor (&peekedHdr); - peekedHdr.SetSequenceNumber (currentSequenceNumber); - peekedHdr.SetFragmentNumber (0); - peekedHdr.SetNoMoreFragments (); - peekedHdr.SetNoRetry (); - } - if (qosPolicy == 0) - { - peekedHdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); - } - else - { - peekedHdr.SetQosAckPolicy (WifiMacHeader::BLOCK_ACK); - } - - newPacket = peekedPacket->Copy (); - aggPacket = newPacket->Copy (); - - newPacket->AddHeader (peekedHdr); - AddWifiMacTrailer (newPacket); - aggregated = m_mpduAggregator->Aggregate (newPacket, currentAggregatedPacket, GetMaxAmpduSize (ac)); - if (aggregated) - { - m_aggregateQueue[tid]->Enqueue (Create (aggPacket, peekedHdr)); - if (i == 1 && hdr.IsQosData ()) - { - if (!m_txParams.MustSendRts ()) - { - edcaIt->second->CompleteMpduTx (Create (packet, hdr, tstamp)); - } - else - { - InsertInTxQueue (Create (packet, hdr, tstamp), tid); - } - } - NS_LOG_DEBUG ("Adding packet with sequence number " << peekedHdr.GetSequenceNumber () << " to A-MPDU, packet size = " << newPacket->GetSize () << ", A-MPDU size = " << currentAggregatedPacket->GetSize ()); - i++; - isAmpdu = true; - if (!m_txParams.MustSendRts ()) - { - edcaIt->second->CompleteMpduTx (Create (peekedPacket, peekedHdr, tstamp)); - } - else - { - InsertInTxQueue (Create (peekedPacket, peekedHdr, tstamp), tid); - } - if (retry) - { - edcaIt->second->RemoveRetransmitPacket (tid, hdr.GetAddr1 (), peekedHdr.GetSequenceNumber ()); - } - else - { - queue->Remove (peekedPacket); - } - newPacket = 0; - } - else - { - break; - } - if (retry == true) - { - peekedPacket = edcaIt->second->PeekNextRetransmitPacket (peekedHdr, tid, &tstamp); - if (peekedPacket == 0) - { - //I reached the first packet that I added to this A-MPDU - retry = false; - Ptr item = queue->PeekByTidAndAddress (tid, - hdr.GetAddr1 ()); - if (item != 0) - { - peekedPacket = item->GetPacket (); - peekedHdr = item->GetHeader (); - tstamp = item->GetTimeStamp (); - currentSequenceNumber = edcaIt->second->PeekNextSequenceNumberFor (&peekedHdr); - - if (m_msduAggregator != 0) - { - tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize); - if (tempPacket != 0) //MSDU aggregation - { - peekedPacket = tempPacket->Copy (); - } - } - } - } - else - { - currentSequenceNumber = peekedHdr.GetSequenceNumber (); - } - } - else - { - Ptr item = queue->PeekByTidAndAddress (tid, - hdr.GetAddr1 ()); - if (item != 0) - { - peekedPacket = item->GetPacket (); - peekedHdr = item->GetHeader (); - tstamp = item->GetTimeStamp (); - currentSequenceNumber = edcaIt->second->PeekNextSequenceNumberFor (&peekedHdr); - - if (m_msduAggregator != 0 && IsInWindow (currentSequenceNumber, startingSequenceNumber, maxMpdus)) - { - tempPacket = PerformMsduAggregation (peekedPacket, &peekedHdr, &tstamp, currentAggregatedPacket, blockAckSize); - if (tempPacket != 0) //MSDU aggregation - { - peekedPacket = tempPacket->Copy (); - } - } - } - else - { - peekedPacket = 0; - } - } - } - - if (isAmpdu) - { - if (hdr.IsBlockAckReq ()) - { - newPacket = packet->Copy (); - peekedHdr = hdr; - aggPacket = newPacket->Copy (); - m_aggregateQueue[tid]->Enqueue (Create (aggPacket, peekedHdr)); - newPacket->AddHeader (peekedHdr); - AddWifiMacTrailer (newPacket); - m_mpduAggregator->Aggregate (newPacket, currentAggregatedPacket, GetMaxAmpduSize (ac)); - currentAggregatedPacket->AddHeader (blockAckReq); - } - - if (qosPolicy == 0) - { - edcaIt->second->CompleteAmpduTransfer (hdr.GetAddr1 (), tid); - } - - //Add packet tag - AmpduTag ampdutag; - ampdutag.SetRemainingNbOfMpdus (i - 1); - newPacket = currentAggregatedPacket; - newPacket->AddPacketTag (ampdutag); - - NS_LOG_DEBUG ("tx unicast A-MPDU containing " << +i << " MPDUs"); - edcaIt->second->SetAmpduExist (hdr.GetAddr1 (), true); - } - else - { - uint32_t queueSize = m_aggregateQueue[tid]->GetNPackets (); - NS_ASSERT (queueSize <= 2); //since it is not an A-MPDU then only 2 packets should have been added to the queue no more - if (queueSize >= 1) - { - //remove any packets that we added to the aggregate queue - FlushAggregateQueue (tid); - } - } - } - if (edcaIt->second->GetBaAgreementEstablished (hdr.GetAddr1 (), tid)) - { - // VHT/HE single MPDU operation - WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); - if (!isAmpdu - && hdr.IsQosData () - && (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT - || dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HE)) - { - peekedHdr = hdr; - peekedHdr.SetQosAckPolicy (WifiMacHeader::NORMAL_ACK); - - currentAggregatedPacket = Create (); - m_mpduAggregator->AggregateSingleMpdu (packet, currentAggregatedPacket); - m_aggregateQueue[tid]->Enqueue (Create (packet, peekedHdr)); - if (m_txParams.MustSendRts ()) - { - InsertInTxQueue (Create (packet, peekedHdr, tstamp), tid); - } - if (edcaIt->second->GetBaAgreementEstablished (hdr.GetAddr1 (), tid)) - { - edcaIt->second->CompleteAmpduTransfer (peekedHdr.GetAddr1 (), tid); - } - - //Add packet tag - AmpduTag ampdutag; - newPacket = currentAggregatedPacket; - newPacket->AddHeader (peekedHdr); - AddWifiMacTrailer (newPacket); - newPacket->AddPacketTag (ampdutag); - - NS_LOG_DEBUG ("tx unicast S-MPDU with sequence number " << hdr.GetSequenceNumber ()); - edcaIt->second->SetAmpduExist (hdr.GetAddr1 (), true); - } - } - } - } - return newPacket; -} - void MacLow::FlushAggregateQueue (uint8_t tid) { @@ -3223,71 +2862,6 @@ MacLow::InsertInTxQueue (Ptr mpdu, uint8_t tid) m_txPackets[tid].push_back (mpdu); } -Ptr -MacLow::PerformMsduAggregation (Ptr packet, WifiMacHeader *hdr, Time *tstamp, Ptr currentAmpduPacket, uint8_t blockAckSize) -{ - bool msduAggregation = false; - bool isAmsdu = false; - Ptr currentAmsduPacket = Create (); - Ptr tempPacket = Create (); - - Ptr queue; - AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr)); - std::map >::const_iterator edcaIt = m_edca.find (ac); - NS_ASSERT (edcaIt != m_edca.end ()); - queue = edcaIt->second->GetWifiMacQueue (); - - Ptr peekedItem = queue->DequeueByTidAndAddress (hdr->GetQosTid (), - hdr->GetAddr1 ()); - if (peekedItem) - { - *hdr = peekedItem->GetHeader (); - } - - m_msduAggregator->Aggregate (packet, currentAmsduPacket, - edcaIt->second->MapSrcAddressForAggregation (*hdr), - edcaIt->second->MapDestAddressForAggregation (*hdr), - GetMaxAmsduSize (ac)); - - peekedItem = queue->PeekByTidAndAddress (hdr->GetQosTid (), hdr->GetAddr1 ()); - while (peekedItem != 0) - { - *hdr = peekedItem->GetHeader (); - *tstamp = peekedItem->GetTimeStamp (); - tempPacket = currentAmsduPacket; - - msduAggregation = m_msduAggregator->Aggregate (peekedItem->GetPacket (), tempPacket, - edcaIt->second->MapSrcAddressForAggregation (*hdr), - edcaIt->second->MapDestAddressForAggregation (*hdr), - GetMaxAmsduSize (ac)); - - if (msduAggregation && !StopMpduAggregation (tempPacket, *hdr, currentAmpduPacket, blockAckSize)) - { - isAmsdu = true; - currentAmsduPacket = tempPacket; - queue->Remove (peekedItem->GetPacket ()); - } - else - { - break; - } - peekedItem = queue->PeekByTidAndAddress (hdr->GetQosTid (), hdr->GetAddr1 ()); - } - - if (isAmsdu) - { - NS_LOG_DEBUG ("A-MSDU with size = " << currentAmsduPacket->GetSize ()); - hdr->SetQosAmsdu (); - hdr->SetAddr3 (GetBssid ()); - return currentAmsduPacket; - } - else - { - queue->PushFront (Create (packet, *hdr)); - return 0; - } -} - Time MacLow::GetRemainingCfpDuration (void) const { @@ -3320,82 +2894,4 @@ MacLow::CanTransmitNextCfFrame (void) const return ((GetRemainingCfpDuration () - nextTransmission).IsPositive ()); } -uint16_t -MacLow::GetMaxAmsduSize (AcIndex ac) const -{ - UintegerValue size; - WifiModulationClass modulation = GetDataTxVector (m_currentPacket, &m_currentHdr).GetMode ().GetModulationClass (); - - switch (ac) - { - case AC_BE: - m_mac->GetAttribute ("BE_MaxAmsduSize", size); - break; - case AC_BK: - m_mac->GetAttribute ("BK_MaxAmsduSize", size); - break; - case AC_VI: - m_mac->GetAttribute ("VI_MaxAmsduSize", size); - break; - case AC_VO: - m_mac->GetAttribute ("VO_MaxAmsduSize", size); - break; - default: - NS_ASSERT (false); - return 0; - } - - if (modulation == WIFI_MOD_CLASS_HT) - { - return std::min (size.Get (), static_cast (7935)); - } - if (modulation == WIFI_MOD_CLASS_VHT || modulation == WIFI_MOD_CLASS_HE) - { - return std::min (size.Get (), static_cast (11398)); - } - - return 0; -} - -uint32_t -MacLow::GetMaxAmpduSize (AcIndex ac) const -{ - UintegerValue size; - WifiModulationClass modulation = GetDataTxVector (m_currentPacket, &m_currentHdr).GetMode ().GetModulationClass (); - - switch (ac) - { - case AC_BE: - m_mac->GetAttribute ("BE_MaxAmpduSize", size); - break; - case AC_BK: - m_mac->GetAttribute ("BK_MaxAmpduSize", size); - break; - case AC_VI: - m_mac->GetAttribute ("VI_MaxAmpduSize", size); - break; - case AC_VO: - m_mac->GetAttribute ("VO_MaxAmpduSize", size); - break; - default: - NS_ASSERT (false); - return 0; - } - - if (modulation == WIFI_MOD_CLASS_HT) - { - return std::min (size.Get (), static_cast (65535)); - } - if (modulation == WIFI_MOD_CLASS_VHT) - { - return std::min (size.Get (), static_cast (1048575)); - } - if (modulation == WIFI_MOD_CLASS_HE) - { - return std::min (size.Get (), static_cast (8388607)); - } - - return 0; -} - } //namespace ns3 diff --git a/src/wifi/model/mac-low.h b/src/wifi/model/mac-low.h index 7da739c24..5b6aa5614 100644 --- a/src/wifi/model/mac-low.h +++ b/src/wifi/model/mac-low.h @@ -397,16 +397,6 @@ public: * associated to this AC. */ void RegisterEdcaForAc (AcIndex ac, Ptr edca); - /** - * \param packet the packet to be aggregated. If the aggregation is successful, it corresponds either to the first data packet that will be aggregated or to the BAR that will be piggybacked at the end of the A-MPDU. - * \param hdr the WifiMacHeader for the packet. - * \return the A-MPDU packet if aggregation is successful, the input packet otherwise - * - * This function adds the packets that will be added to an A-MPDU to an aggregate queue - * - * \todo TO BE REMOVED - */ - Ptr AggregateToAmpdu (Ptr packet, const WifiMacHeader hdr); /** * \param aggregatedPacket which is the current A-MPDU * \param rxSnr snr of packet received @@ -449,24 +439,6 @@ public: * This function decides if a CF frame can be transmitted in the current CFP. */ bool CanTransmitNextCfFrame (void) const; - /** - * Return the maximum A-MSDU size in bytes for a given AC. - * - * \param ac the AC index - * \return the maximum A-MSDU size (in bytes) - * - * \todo TO BE REMOVED - */ - uint16_t GetMaxAmsduSize (AcIndex ac) const; - /** - * Return the maximum A-MPDU size in bytes for a given AC. - * - * \param ac the AC index - * \return the maximum A-MPDU size (in bytes) - * - * \todo TO BE REMOVED - */ - uint32_t GetMaxAmpduSize (AcIndex ac) const; /** * Returns the aggregator used to construct A-MSDU subframes. @@ -522,18 +494,6 @@ private: * \param mpdutype the MPDU type */ void SendMpdu (Ptr packet, WifiTxVector txVector, MpduType mpdutype); - /** - * \param peekedPacket the packet to be aggregated - * \param peekedHdr the WifiMacHeader for the packet. - * \param aggregatedPacket the current A-MPDU - * \param blockAckSize the size of a piggybacked block ack request - * \return false if the given packet can be added to an A-MPDU, true otherwise - * - * This function decides if a given packet can be added to an A-MPDU or not - * - * \todo TO BE REMOVED - */ - bool StopMpduAggregation (Ptr peekedPacket, WifiMacHeader peekedHdr, Ptr aggregatedPacket, uint8_t blockAckSize) const; /** * Return a TXVECTOR for the RTS frame given the destination. * The function consults WifiRemoteStationManager, which controls the rate @@ -891,16 +851,6 @@ private: * \param phy the WifiPhy this MacLow is connected to */ void RemovePhyMacLowListener (Ptr phy); - /** - * Checks if the given packet will be aggregated to an A-MPDU or not - * - * \param packet packet to check whether it can be aggregated in an A-MPDU - * \param hdr 802.11 header for packet to check whether it can be aggregated in an A-MPDU - * \returns true if is A-MPDU - * - * \todo TO BE REMOVED - */ - bool IsAmpdu (Ptr packet, const WifiMacHeader hdr); /** * Insert in a temporary queue. * It is only used with a RTS/CTS exchange for an A-MPDU transmission. @@ -909,20 +859,6 @@ private: * \param tid the Traffic ID of the MPDU to be inserted in the A-MPDU tx queue */ void InsertInTxQueue (Ptr mpdu, uint8_t tid); - /** - * Perform MSDU aggregation for a given MPDU in an A-MPDU - * - * \param packet packet picked for aggregation - * \param hdr 802.11 header for packet picked for aggregation - * \param tstamp timestamp - * \param currentAmpduPacket current A-MPDU packet - * \param blockAckSize size of the piggybacked block ack request - * - * \return the aggregate if MSDU aggregation succeeded, 0 otherwise - * - * \todo TO BE REMOVED - */ - Ptr PerformMsduAggregation (Ptr packet, WifiMacHeader *hdr, Time *tstamp, Ptr currentAmpduPacket, uint8_t blockAckSize); Ptr m_phy; //!< Pointer to WifiPhy (actually send/receives frames) Ptr m_mac; //!< Pointer to WifiMac (to fetch configuration) diff --git a/src/wifi/model/mpdu-aggregator.cc b/src/wifi/model/mpdu-aggregator.cc index a2e06de8a..74c9e0b0a 100644 --- a/src/wifi/model/mpdu-aggregator.cc +++ b/src/wifi/model/mpdu-aggregator.cc @@ -105,55 +105,6 @@ MpduAggregator::Aggregate (Ptr mpdu, Ptr ampdu, ampdu->AddAtEnd (tmp); } -bool -MpduAggregator::Aggregate (Ptr packet, Ptr aggregatedPacket, uint32_t maxAmpduSize) const -{ - NS_LOG_FUNCTION (this); - Ptr currentPacket; - AmpduSubframeHeader currentHdr; - - uint32_t actualSize = aggregatedPacket->GetSize (); - uint8_t padding = CalculatePadding (actualSize); - - if ((4 + packet->GetSize () + actualSize + padding) <= maxAmpduSize) - { - if (padding) - { - Ptr pad = Create (padding); - aggregatedPacket->AddAtEnd (pad); - } - currentHdr.SetLength (static_cast (packet->GetSize ())); - currentPacket = packet->Copy (); - - currentPacket->AddHeader (currentHdr); - aggregatedPacket->AddAtEnd (currentPacket); - return true; - } - return false; -} - -void -MpduAggregator::AggregateSingleMpdu (Ptr packet, Ptr aggregatedPacket) const -{ - NS_LOG_FUNCTION (this); - Ptr currentPacket; - AmpduSubframeHeader currentHdr; - - uint8_t padding = CalculatePadding (aggregatedPacket->GetSize ()); - if (padding) - { - Ptr pad = Create (padding); - aggregatedPacket->AddAtEnd (pad); - } - - currentHdr.SetEof (1); - currentHdr.SetLength (static_cast (packet->GetSize ())); - currentPacket = packet->Copy (); - - currentPacket->AddHeader (currentHdr); - aggregatedPacket->AddAtEnd (currentPacket); -} - void MpduAggregator::AddHeaderAndPad (Ptr mpdu, bool last, bool isSingleMpdu) const { @@ -178,25 +129,6 @@ MpduAggregator::AddHeaderAndPad (Ptr mpdu, bool last, bool isSingleMpdu) } } -bool -MpduAggregator::CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize, uint32_t maxAmpduSize) const -{ - uint32_t actualSize = aggregatedPacket->GetSize (); - uint8_t padding = CalculatePadding (actualSize); - if (blockAckSize > 0) - { - blockAckSize = blockAckSize + 4 + padding; - } - if ((4 + packetSize + actualSize + padding + blockAckSize) <= maxAmpduSize) - { - return true; - } - else - { - return false; - } -} - uint32_t MpduAggregator::GetSizeIfAggregated (uint32_t mpduSize, uint32_t ampduSize) { diff --git a/src/wifi/model/mpdu-aggregator.h b/src/wifi/model/mpdu-aggregator.h index 76d83dc06..89c3d5981 100644 --- a/src/wifi/model/mpdu-aggregator.h +++ b/src/wifi/model/mpdu-aggregator.h @@ -73,28 +73,6 @@ public: */ static void Aggregate (Ptr mpdu, Ptr ampdu, bool isSingle); - /** - * \param packet Packet we have to insert into aggregatedPacket. - * \param aggregatedPacket Packet that will contain packet, if aggregation is possible. - * \param maxAmpduSize the maximum A-MPDU size. - * - * \return true if packet can be aggregated to aggregatedPacket, false otherwise. - * - * Adds packet to aggregatedPacket. In concrete aggregator's implementation is - * specified how and if packet can be added to aggregatedPacket. - * - * \todo TO BE REMOVED - */ - bool Aggregate (Ptr packet, Ptr aggregatedPacket, uint32_t maxAmpduSize) const; - /** - * \param packet the packet we want to insert into aggregatedPacket. - * \param aggregatedPacket packet that will contain the packet of size packetSize, if aggregation is possible. - * - * This method performs a VHT/HE single MPDU aggregation. - * - * \todo TO BE REMOVED - */ - void AggregateSingleMpdu (Ptr packet, Ptr aggregatedPacket) const; /** * \param mpdu the MPDU we want to insert into an A-MPDU subframe. * \param last true if it is the last MPDU. @@ -103,19 +81,6 @@ public: * Adds A-MPDU subframe header and padding to each MPDU that is part of an A-MPDU before it is sent. */ void AddHeaderAndPad (Ptr mpdu, bool last, bool isSingleMpdu) const; - /** - * \param packetSize size of the packet we want to insert into aggregatedPacket. - * \param aggregatedPacket packet that will contain the packet of size packetSize, if aggregation is possible. - * \param blockAckSize size of the piggybacked block ack request - * \param maxAmpduSize the maximum A-MPDU size. - * - * \return true if the packet of size packetSize can be aggregated to aggregatedPacket, false otherwise. - * - * This method is used to determine if a packet could be aggregated to an A-MPDU without exceeding the maximum packet size. - * - * \todo TO BE REMOVED - */ - bool CanBeAggregated (uint32_t packetSize, Ptr aggregatedPacket, uint8_t blockAckSize, uint32_t maxAmpduSize) const; /** * Compute the size of the A-MPDU resulting from the aggregation of an MPDU of diff --git a/src/wifi/model/msdu-aggregator.cc b/src/wifi/model/msdu-aggregator.cc index 49b41bfc5..b9edc904d 100644 --- a/src/wifi/model/msdu-aggregator.cc +++ b/src/wifi/model/msdu-aggregator.cc @@ -65,36 +65,6 @@ MsduAggregator::SetEdcaQueues (EdcaQueues map) m_edca = map; } -bool -MsduAggregator::Aggregate (Ptr packet, Ptr aggregatedPacket, - Mac48Address src, Mac48Address dest, uint16_t maxAmsduSize) const -{ - NS_LOG_FUNCTION (this); - Ptr currentPacket; - AmsduSubframeHeader currentHdr; - - uint32_t actualSize = aggregatedPacket->GetSize (); - uint8_t padding = CalculatePadding (actualSize); - - if ((14 + packet->GetSize () + actualSize + padding) <= maxAmsduSize) - { - if (padding) - { - Ptr pad = Create (padding); - aggregatedPacket->AddAtEnd (pad); - } - currentHdr.SetDestinationAddr (dest); - currentHdr.SetSourceAddr (src); - currentHdr.SetLength (static_cast (packet->GetSize ())); - currentPacket = packet->Copy (); - - currentPacket->AddHeader (currentHdr); - aggregatedPacket->AddAtEnd (currentPacket); - return true; - } - return false; -} - uint16_t MsduAggregator::GetSizeIfAggregated (uint16_t msduSize, uint16_t amsduSize) { diff --git a/src/wifi/model/msdu-aggregator.h b/src/wifi/model/msdu-aggregator.h index 1cdff61a2..5cd4655f5 100644 --- a/src/wifi/model/msdu-aggregator.h +++ b/src/wifi/model/msdu-aggregator.h @@ -57,23 +57,6 @@ public: MsduAggregator (); virtual ~MsduAggregator (); - /** - * Adds packet to aggregatedPacket. In concrete aggregator's implementation is - * specified how and if packet can be added to aggregatedPacket. If packet - * can be added returns true, false otherwise. - * - * \param packet the packet. - * \param aggregatedPacket the aggregated packet. - * \param src the source address. - * \param dest the destination address - * \param maxAmsduSize the maximum A-MSDU size. - * \return true if successful. - * - * \todo TO BE REMOVED - */ - bool Aggregate (Ptr packet, Ptr aggregatedPacket, - Mac48Address src, Mac48Address dest, uint16_t maxAmsduSize) const; - /** * Aggregate an MSDU to an A-MSDU. * diff --git a/src/wifi/model/qos-txop.cc b/src/wifi/model/qos-txop.cc index 8050a2f29..eb6308e73 100644 --- a/src/wifi/model/qos-txop.cc +++ b/src/wifi/model/qos-txop.cc @@ -171,21 +171,6 @@ QosTxop::PeekNextSequenceNumberFor (const WifiMacHeader *hdr) return m_txMiddle->PeekNextSequenceNumberFor (hdr); } -Ptr -QosTxop::PeekNextRetransmitPacket (WifiMacHeader &header, uint8_t tid, Time *timestamp) -{ - Ptr item = m_baManager->PeekNextPacketByTidAndAddress (tid, header.GetAddr1 ()); - - if (!item) - { - return 0; - } - - header = item->GetHeader (); - *timestamp = item->GetTimeStamp (); - return item->GetPacket (); -} - Ptr QosTxop::PeekNextRetransmitPacket (uint8_t tid, Mac48Address recipient) { diff --git a/src/wifi/model/qos-txop.h b/src/wifi/model/qos-txop.h index 987360851..819daf648 100644 --- a/src/wifi/model/qos-txop.h +++ b/src/wifi/model/qos-txop.h @@ -381,17 +381,6 @@ public: * \param seqnumber sequence number of the packet to be removed. */ void RemoveRetransmitPacket (uint8_t tid, Mac48Address recipient, uint16_t seqnumber); - /** - * Peek in retransmit queue and get the next packet without removing it from the queue. - * - * \param header Wi-Fi header. - * \param tid traffic ID. - * \param timestamp the timestamp. - * \returns the packet. - * - * \todo TO BE REMOVED - */ - Ptr PeekNextRetransmitPacket (WifiMacHeader &header, uint8_t tid, Time *timestamp); /** * Peek in retransmit queue and get the next packet without removing it from the queue. *