wifi: Remove unused functions
This commit is contained in:
@@ -494,22 +494,6 @@ MacLow::RegisterDcf (Ptr<ChannelAccessManager> dcf)
|
||||
m_channelAccessManagers.push_back (dcf);
|
||||
}
|
||||
|
||||
bool
|
||||
MacLow::IsAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr)
|
||||
{
|
||||
uint32_t size, actualSize;
|
||||
WifiMacTrailer fcs;
|
||||
size = packet->GetSize () + hdr.GetSize () + fcs.GetSerializedSize ();
|
||||
Ptr<Packet> p = AggregateToAmpdu (packet, hdr);
|
||||
actualSize = p->GetSize ();
|
||||
if (actualSize > size)
|
||||
{
|
||||
m_currentPacket = p;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
MacLow::StartTransmission (Ptr<const Packet> packet,
|
||||
const WifiMacHeader* hdr,
|
||||
@@ -2859,351 +2843,6 @@ MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr,
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MacLow::StopMpduAggregation (Ptr<const Packet> peekedPacket, WifiMacHeader peekedHdr, Ptr<Packet> 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<Packet>
|
||||
MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr)
|
||||
{
|
||||
bool isAmpdu = false;
|
||||
Ptr<Packet> newPacket, tempPacket;
|
||||
WifiMacHeader peekedHdr;
|
||||
newPacket = packet->Copy ();
|
||||
Ptr<Packet> 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<WifiMacQueue> queue;
|
||||
Ptr<Packet> aggPacket;
|
||||
AcIndex ac = QosUtilsMapTidToAc (tid);
|
||||
std::map<AcIndex, Ptr<QosTxop> >::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<Packet> ();
|
||||
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<WifiMacQueueItem> (aggPacket, peekedHdr));
|
||||
}
|
||||
}
|
||||
else if (hdr.IsBlockAckReq ())
|
||||
{
|
||||
blockAckSize = static_cast<uint8_t> (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<const Packet> peekedPacket = edcaIt->second->PeekNextRetransmitPacket (peekedHdr, tid, &tstamp);
|
||||
if (peekedPacket == 0)
|
||||
{
|
||||
Ptr<const WifiMacQueueItem> 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<WifiMacQueueItem> (aggPacket, peekedHdr));
|
||||
if (i == 1 && hdr.IsQosData ())
|
||||
{
|
||||
if (!m_txParams.MustSendRts ())
|
||||
{
|
||||
edcaIt->second->CompleteMpduTx (Create<const WifiMacQueueItem> (packet, hdr, tstamp));
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertInTxQueue (Create<const WifiMacQueueItem> (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<const WifiMacQueueItem> (peekedPacket, peekedHdr, tstamp));
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertInTxQueue (Create<const WifiMacQueueItem> (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<const WifiMacQueueItem> 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<const WifiMacQueueItem> 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<WifiMacQueueItem> (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<Packet> ();
|
||||
m_mpduAggregator->AggregateSingleMpdu (packet, currentAggregatedPacket);
|
||||
m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> (packet, peekedHdr));
|
||||
if (m_txParams.MustSendRts ())
|
||||
{
|
||||
InsertInTxQueue (Create<const WifiMacQueueItem> (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<const WifiMacQueueItem> mpdu, uint8_t tid)
|
||||
m_txPackets[tid].push_back (mpdu);
|
||||
}
|
||||
|
||||
Ptr<Packet>
|
||||
MacLow::PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint8_t blockAckSize)
|
||||
{
|
||||
bool msduAggregation = false;
|
||||
bool isAmsdu = false;
|
||||
Ptr<Packet> currentAmsduPacket = Create<Packet> ();
|
||||
Ptr<Packet> tempPacket = Create<Packet> ();
|
||||
|
||||
Ptr<WifiMacQueue> queue;
|
||||
AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr));
|
||||
std::map<AcIndex, Ptr<QosTxop> >::const_iterator edcaIt = m_edca.find (ac);
|
||||
NS_ASSERT (edcaIt != m_edca.end ());
|
||||
queue = edcaIt->second->GetWifiMacQueue ();
|
||||
|
||||
Ptr<const WifiMacQueueItem> 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<WifiMacQueueItem> (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<uint64_t> (7935));
|
||||
}
|
||||
if (modulation == WIFI_MOD_CLASS_VHT || modulation == WIFI_MOD_CLASS_HE)
|
||||
{
|
||||
return std::min (size.Get (), static_cast<uint64_t> (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<uint64_t> (65535));
|
||||
}
|
||||
if (modulation == WIFI_MOD_CLASS_VHT)
|
||||
{
|
||||
return std::min (size.Get (), static_cast<uint64_t> (1048575));
|
||||
}
|
||||
if (modulation == WIFI_MOD_CLASS_HE)
|
||||
{
|
||||
return std::min (size.Get (), static_cast<uint64_t> (8388607));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -397,16 +397,6 @@ public:
|
||||
* associated to this AC.
|
||||
*/
|
||||
void RegisterEdcaForAc (AcIndex ac, Ptr<QosTxop> 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<Packet> AggregateToAmpdu (Ptr<const Packet> 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<const Packet> 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<const Packet> peekedPacket, WifiMacHeader peekedHdr, Ptr<Packet> 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<WifiPhy> 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<const Packet> 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<const WifiMacQueueItem> 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<Packet> PerformMsduAggregation (Ptr<const Packet> packet, WifiMacHeader *hdr, Time *tstamp, Ptr<Packet> currentAmpduPacket, uint8_t blockAckSize);
|
||||
|
||||
Ptr<WifiPhy> m_phy; //!< Pointer to WifiPhy (actually send/receives frames)
|
||||
Ptr<WifiMac> m_mac; //!< Pointer to WifiMac (to fetch configuration)
|
||||
|
||||
@@ -105,55 +105,6 @@ MpduAggregator::Aggregate (Ptr<const WifiMacQueueItem> mpdu, Ptr<Packet> ampdu,
|
||||
ampdu->AddAtEnd (tmp);
|
||||
}
|
||||
|
||||
bool
|
||||
MpduAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket, uint32_t maxAmpduSize) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<Packet> currentPacket;
|
||||
AmpduSubframeHeader currentHdr;
|
||||
|
||||
uint32_t actualSize = aggregatedPacket->GetSize ();
|
||||
uint8_t padding = CalculatePadding (actualSize);
|
||||
|
||||
if ((4 + packet->GetSize () + actualSize + padding) <= maxAmpduSize)
|
||||
{
|
||||
if (padding)
|
||||
{
|
||||
Ptr<Packet> pad = Create<Packet> (padding);
|
||||
aggregatedPacket->AddAtEnd (pad);
|
||||
}
|
||||
currentHdr.SetLength (static_cast<uint16_t> (packet->GetSize ()));
|
||||
currentPacket = packet->Copy ();
|
||||
|
||||
currentPacket->AddHeader (currentHdr);
|
||||
aggregatedPacket->AddAtEnd (currentPacket);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
MpduAggregator::AggregateSingleMpdu (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<Packet> currentPacket;
|
||||
AmpduSubframeHeader currentHdr;
|
||||
|
||||
uint8_t padding = CalculatePadding (aggregatedPacket->GetSize ());
|
||||
if (padding)
|
||||
{
|
||||
Ptr<Packet> pad = Create<Packet> (padding);
|
||||
aggregatedPacket->AddAtEnd (pad);
|
||||
}
|
||||
|
||||
currentHdr.SetEof (1);
|
||||
currentHdr.SetLength (static_cast<uint16_t> (packet->GetSize ()));
|
||||
currentPacket = packet->Copy ();
|
||||
|
||||
currentPacket->AddHeader (currentHdr);
|
||||
aggregatedPacket->AddAtEnd (currentPacket);
|
||||
}
|
||||
|
||||
void
|
||||
MpduAggregator::AddHeaderAndPad (Ptr<Packet> mpdu, bool last, bool isSingleMpdu) const
|
||||
{
|
||||
@@ -178,25 +129,6 @@ MpduAggregator::AddHeaderAndPad (Ptr<Packet> mpdu, bool last, bool isSingleMpdu)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MpduAggregator::CanBeAggregated (uint32_t packetSize, Ptr<Packet> 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)
|
||||
{
|
||||
|
||||
@@ -73,28 +73,6 @@ public:
|
||||
*/
|
||||
static void Aggregate (Ptr<const WifiMacQueueItem> mpdu, Ptr<Packet> ampdu, bool isSingle);
|
||||
|
||||
/**
|
||||
* \param packet Packet we have to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket Packet that will contain <i>packet</i>, if aggregation is possible.
|
||||
* \param maxAmpduSize the maximum A-MPDU size.
|
||||
*
|
||||
* \return true if <i>packet</i> can be aggregated to <i>aggregatedPacket</i>, false otherwise.
|
||||
*
|
||||
* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
|
||||
* specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>.
|
||||
*
|
||||
* \todo TO BE REMOVED
|
||||
*/
|
||||
bool Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket, uint32_t maxAmpduSize) const;
|
||||
/**
|
||||
* \param packet the packet we want to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, if aggregation is possible.
|
||||
*
|
||||
* This method performs a VHT/HE single MPDU aggregation.
|
||||
*
|
||||
* \todo TO BE REMOVED
|
||||
*/
|
||||
void AggregateSingleMpdu (Ptr<const Packet> packet, Ptr<Packet> 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<Packet> mpdu, bool last, bool isSingleMpdu) const;
|
||||
/**
|
||||
* \param packetSize size of the packet we want to insert into <i>aggregatedPacket</i>.
|
||||
* \param aggregatedPacket packet that will contain the packet of size <i>packetSize</i>, 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 <i>packetSize</i> can be aggregated to <i>aggregatedPacket</i>, 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<Packet> aggregatedPacket, uint8_t blockAckSize, uint32_t maxAmpduSize) const;
|
||||
|
||||
/**
|
||||
* Compute the size of the A-MPDU resulting from the aggregation of an MPDU of
|
||||
|
||||
@@ -65,36 +65,6 @@ MsduAggregator::SetEdcaQueues (EdcaQueues map)
|
||||
m_edca = map;
|
||||
}
|
||||
|
||||
bool
|
||||
MsduAggregator::Aggregate (Ptr<const Packet> packet, Ptr<Packet> aggregatedPacket,
|
||||
Mac48Address src, Mac48Address dest, uint16_t maxAmsduSize) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<Packet> currentPacket;
|
||||
AmsduSubframeHeader currentHdr;
|
||||
|
||||
uint32_t actualSize = aggregatedPacket->GetSize ();
|
||||
uint8_t padding = CalculatePadding (actualSize);
|
||||
|
||||
if ((14 + packet->GetSize () + actualSize + padding) <= maxAmsduSize)
|
||||
{
|
||||
if (padding)
|
||||
{
|
||||
Ptr<Packet> pad = Create<Packet> (padding);
|
||||
aggregatedPacket->AddAtEnd (pad);
|
||||
}
|
||||
currentHdr.SetDestinationAddr (dest);
|
||||
currentHdr.SetSourceAddr (src);
|
||||
currentHdr.SetLength (static_cast<uint16_t> (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)
|
||||
{
|
||||
|
||||
@@ -57,23 +57,6 @@ public:
|
||||
MsduAggregator ();
|
||||
virtual ~MsduAggregator ();
|
||||
|
||||
/**
|
||||
* Adds <i>packet</i> to <i>aggregatedPacket</i>. In concrete aggregator's implementation is
|
||||
* specified how and if <i>packet</i> can be added to <i>aggregatedPacket</i>. If <i>packet</i>
|
||||
* 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<const Packet> packet, Ptr<Packet> aggregatedPacket,
|
||||
Mac48Address src, Mac48Address dest, uint16_t maxAmsduSize) const;
|
||||
|
||||
/**
|
||||
* Aggregate an MSDU to an A-MSDU.
|
||||
*
|
||||
|
||||
@@ -171,21 +171,6 @@ QosTxop::PeekNextSequenceNumberFor (const WifiMacHeader *hdr)
|
||||
return m_txMiddle->PeekNextSequenceNumberFor (hdr);
|
||||
}
|
||||
|
||||
Ptr<const Packet>
|
||||
QosTxop::PeekNextRetransmitPacket (WifiMacHeader &header, uint8_t tid, Time *timestamp)
|
||||
{
|
||||
Ptr<const WifiMacQueueItem> item = m_baManager->PeekNextPacketByTidAndAddress (tid, header.GetAddr1 ());
|
||||
|
||||
if (!item)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
header = item->GetHeader ();
|
||||
*timestamp = item->GetTimeStamp ();
|
||||
return item->GetPacket ();
|
||||
}
|
||||
|
||||
Ptr<const WifiMacQueueItem>
|
||||
QosTxop::PeekNextRetransmitPacket (uint8_t tid, Mac48Address recipient)
|
||||
{
|
||||
|
||||
@@ -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<const Packet> PeekNextRetransmitPacket (WifiMacHeader &header, uint8_t tid, Time *timestamp);
|
||||
/**
|
||||
* Peek in retransmit queue and get the next packet without removing it from the queue.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user