wifi: Keep the timestamp when passing MPDUs to MacLow

This commit is contained in:
Stefano Avallone
2019-03-04 09:10:28 +01:00
parent c96d4b6152
commit 5c197ca1e2
6 changed files with 44 additions and 44 deletions

View File

@@ -106,22 +106,21 @@ WaveMacLow::GetDataTxVector (Ptr<const WifiMacQueueItem> item) const
}
void
WaveMacLow::StartTransmission (Ptr<const Packet> packet,
const WifiMacHeader* hdr,
WaveMacLow::StartTransmission (Ptr<WifiMacQueueItem> mpdu,
MacLowTransmissionParameters params,
Ptr<Txop> dca)
{
NS_LOG_FUNCTION (this << packet << hdr << params << dca);
NS_LOG_FUNCTION (this << *mpdu << params << dca);
Ptr<WifiPhy> phy = MacLow::GetPhy ();
uint32_t curChannel = phy->GetChannelNumber ();
// if current channel access is not AlternatingAccess, just do as MacLow.
if (!m_scheduler->IsAlternatingAccessAssigned (curChannel))
{
MacLow::StartTransmission (packet, hdr, params, dca);
MacLow::StartTransmission (mpdu, params, dca);
return;
}
Time transmissionTime = MacLow::CalculateTransmissionTime (packet, hdr, params);
Time transmissionTime = MacLow::CalculateTransmissionTime (mpdu->GetPacket (), &mpdu->GetHeader (), params);
Time remainingTime = m_coordinator->NeedTimeToGuardInterval ();
if (transmissionTime > remainingTime)
@@ -134,7 +133,7 @@ WaveMacLow::StartTransmission (Ptr<const Packet> packet,
}
else
{
MacLow::StartTransmission (packet, hdr, params, dca);
MacLow::StartTransmission (mpdu, params, dca);
}
}

View File

@@ -63,16 +63,14 @@ public:
void SetWaveNetDevice (Ptr<WaveNetDevice> device);
/**
* \param packet packet to send
* \param hdr 802.11 header for packet to send
* \param mpdu packet to send
* \param parameters the transmission parameters to use for this packet.
* \param txop pointer to the calling Txop.
*
* Start the transmission of the input packet and notify the listener
* of transmission events.
*/
virtual void StartTransmission (Ptr<const Packet> packet,
const WifiMacHeader* hdr,
virtual void StartTransmission (Ptr<WifiMacQueueItem> mpdu,
MacLowTransmissionParameters parameters,
Ptr<Txop> txop);
private:

View File

@@ -487,12 +487,11 @@ MacLow::RegisterDcf (Ptr<ChannelAccessManager> dcf)
}
void
MacLow::StartTransmission (Ptr<const Packet> packet,
const WifiMacHeader* hdr,
MacLow::StartTransmission (Ptr<WifiMacQueueItem> mpdu,
MacLowTransmissionParameters params,
Ptr<Txop> txop)
{
NS_LOG_FUNCTION (this << packet << hdr << params << txop);
NS_LOG_FUNCTION (this << *mpdu << params << txop);
NS_ASSERT (!m_cfAckInfo.expectCfAck);
if (m_phy->IsStateOff ())
{
@@ -513,17 +512,18 @@ MacLow::StartTransmission (Ptr<const Packet> packet,
* QapScheduler has taken access to the channel from
* one of the Edca of the QAP.
*/
m_currentPacket = Create<WifiPsdu> (packet, *hdr);
m_currentPacket = Create<WifiPsdu> (mpdu, false);
const WifiMacHeader& hdr = mpdu->GetHeader ();
CancelAllEvents ();
m_currentTxop = txop;
m_txParams = params;
if (hdr->IsCtl ())
if (hdr.IsCtl ())
{
m_currentTxVector = GetRtsTxVector (*m_currentPacket->begin ());
m_currentTxVector = GetRtsTxVector (mpdu);
}
else
{
m_currentTxVector = GetDataTxVector (*m_currentPacket->begin ()); // TODO
m_currentTxVector = GetDataTxVector (mpdu);
}
if (NeedRts () && !IsCfPeriod ())
@@ -541,27 +541,27 @@ MacLow::StartTransmission (Ptr<const Packet> packet,
* (c) a QoS data or DELBA Request frame dequeued from a QosTxop
* (d) a BlockAckReq or ADDBA Request frame
*/
if (hdr->IsQosData () && !hdr->GetAddr1 ().IsBroadcast () && m_mpduAggregator != 0)
if (hdr.IsQosData () && !hdr.GetAddr1 ().IsBroadcast () && m_mpduAggregator != 0)
{
/* We get here if the received packet is any of the following:
* (a) a QoS data frame
* (b) a BlockAckRequest
*/
uint8_t tid = GetTid (packet, *hdr);
uint8_t tid = GetTid (mpdu->GetPacket (), hdr);
Ptr<QosTxop> qosTxop = m_edca.find (QosUtilsMapTidToAc (tid))->second;
std::vector<Ptr<WifiMacQueueItem>> mpduList;
//Perform MPDU aggregation if possible
mpduList = m_mpduAggregator->GetNextAmpdu (*m_currentPacket->begin (), m_currentTxVector);
mpduList = m_mpduAggregator->GetNextAmpdu (mpdu, m_currentTxVector);
if (mpduList.size () > 1)
{
m_currentPacket = Create<WifiPsdu> (mpduList);
// assume implicit block ack for now
qosTxop->CompleteAmpduTransfer (hdr->GetAddr1 (), tid);
qosTxop->CompleteAmpduTransfer (hdr.GetAddr1 (), tid);
if (qosTxop->GetBaBufferSize (hdr->GetAddr1 (), tid) > 64)
if (qosTxop->GetBaBufferSize (hdr.GetAddr1 (), tid) > 64)
{
m_txParams.EnableExtendedCompressedBlockAck ();
}
@@ -571,27 +571,26 @@ MacLow::StartTransmission (Ptr<const Packet> packet,
}
NS_LOG_DEBUG ("tx unicast A-MPDU containing " << mpduList.size () << " MPDUs");
qosTxop->SetAmpduExist (hdr->GetAddr1 (), true);
qosTxop->SetAmpduExist (hdr.GetAddr1 (), true);
}
else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT
|| m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HE)
{
// VHT/HE single MPDU
Ptr<WifiMacQueueItem> mpdu = *m_currentPacket->begin ();
mpdu->GetHeader ().SetQosAckPolicy (WifiMacHeader::NORMAL_ACK);
m_currentPacket = Create<WifiPsdu> (mpdu, true);
m_currentPacket->SetAckPolicyForTid (tid, WifiMacHeader::NORMAL_ACK);
if (qosTxop->GetBaAgreementEstablished (hdr->GetAddr1 (), tid))
if (qosTxop->GetBaAgreementEstablished (hdr.GetAddr1 (), tid))
{
qosTxop->CompleteAmpduTransfer (hdr->GetAddr1 (), tid);
qosTxop->CompleteAmpduTransfer (hdr.GetAddr1 (), tid);
}
//VHT/HE single MPDUs are followed by normal ACKs
m_txParams.EnableAck ();
NS_LOG_DEBUG ("tx unicast S-MPDU with sequence number " << hdr->GetSequenceNumber ());
qosTxop->SetAmpduExist (hdr->GetAddr1 (), true);
NS_LOG_DEBUG ("tx unicast S-MPDU with sequence number " << hdr.GetSequenceNumber ());
qosTxop->SetAmpduExist (hdr.GetAddr1 (), true);
}
else if (hdr->IsQosData () && !hdr->IsQosBlockAck () && !hdr->GetAddr1 ().IsGroup ())
else if (hdr.IsQosData () && !hdr.IsQosBlockAck () && !hdr.GetAddr1 ().IsGroup ())
{
m_txParams.EnableAck ();
}

View File

@@ -324,16 +324,14 @@ public:
const MacLowTransmissionParameters& params) const;
/**
* \param packet packet to send
* \param hdr 802.11 header for packet to send
* \param mpdu packet to send
* \param parameters the transmission parameters to use for this packet.
* \param txop pointer to the calling Txop.
*
* Start the transmission of the input packet and notify the listener
* of transmission events.
*/
virtual void StartTransmission (Ptr<const Packet> packet,
const WifiMacHeader* hdr,
virtual void StartTransmission (Ptr<WifiMacQueueItem> mpdu,
MacLowTransmissionParameters parameters,
Ptr<Txop> txop);

View File

@@ -495,13 +495,15 @@ QosTxop::NotifyAccessGranted (void)
VerifyBlockAck ();
}
}
Ptr<WifiMacQueueItem> mpdu = Create <WifiMacQueueItem> (m_currentPacket, m_currentHdr,
m_currentPacketTimestamp);
if (m_currentHdr.GetAddr1 ().IsGroup ())
{
m_currentParams.DisableRts ();
m_currentParams.DisableAck ();
m_currentParams.DisableNextData ();
NS_LOG_DEBUG ("tx broadcast");
m_low->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this);
m_low->StartTransmission (mpdu, m_currentParams, this);
}
else if (m_currentHdr.GetType () == WIFI_MAC_CTL_BACKREQ)
{
@@ -537,13 +539,14 @@ QosTxop::NotifyAccessGranted (void)
NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
m_currentParams.EnableNextData (GetNextFragmentSize ());
}
m_low->StartTransmission (fragment, &hdr, m_currentParams, this);
m_low->StartTransmission (Create<WifiMacQueueItem> (fragment, hdr),
m_currentParams, this);
}
else
{
m_currentIsFragmented = false;
m_currentParams.DisableNextData ();
m_low->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this);
m_low->StartTransmission (mpdu, m_currentParams, this);
if (!GetAmpduExist (m_currentHdr.GetAddr1 ()))
{
CompleteTx ();
@@ -1186,7 +1189,7 @@ QosTxop::StartNextPacket (void)
m_stationManager->UpdateFragmentationThreshold ();
m_fragmentNumber = 0;
VerifyBlockAck ();
GetLow ()->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this);
GetLow ()->StartTransmission (item, m_currentParams, this);
if (!GetAmpduExist (m_currentHdr.GetAddr1 ()))
{
CompleteTx ();
@@ -1715,7 +1718,7 @@ QosTxop::SendBlockAckRequest (const Bar &bar)
//Delayed block ack
m_currentParams.EnableAck ();
}
m_low->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this);
m_low->StartTransmission (Create<WifiMacQueueItem> (m_currentPacket, m_currentHdr), m_currentParams, this);
}
void
@@ -1807,7 +1810,7 @@ QosTxop::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq,
m_currentParams.DisableRts ();
m_currentParams.DisableNextData ();
m_low->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this);
m_low->StartTransmission (Create<WifiMacQueueItem> (m_currentPacket, m_currentHdr), m_currentParams, this);
}
void

View File

@@ -498,7 +498,8 @@ Txop::NotifyAccessGranted (void)
m_currentParams.DisableAck ();
m_currentParams.DisableNextData ();
NS_LOG_DEBUG ("tx broadcast");
GetLow ()->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this);
GetLow ()->StartTransmission (Create<WifiMacQueueItem> (m_currentPacket, m_currentHdr),
m_currentParams, this);
}
else
{
@@ -517,12 +518,14 @@ Txop::NotifyAccessGranted (void)
NS_LOG_DEBUG ("fragmenting size=" << fragment->GetSize ());
m_currentParams.EnableNextData (GetNextFragmentSize ());
}
GetLow ()->StartTransmission (fragment, &hdr, m_currentParams, this);
GetLow ()->StartTransmission (Create<WifiMacQueueItem> (fragment, hdr),
m_currentParams, this);
}
else
{
m_currentParams.DisableNextData ();
GetLow ()->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this);
GetLow ()->StartTransmission (Create<WifiMacQueueItem> (m_currentPacket, m_currentHdr),
m_currentParams, this);
}
}
}
@@ -737,7 +740,7 @@ Txop::StartNextFragment (void)
{
m_currentParams.EnableNextData (GetNextFragmentSize ());
}
GetLow ()->StartTransmission (fragment, &hdr, m_currentParams, this);
GetLow ()->StartTransmission (Create<WifiMacQueueItem> (fragment, hdr), m_currentParams, this);
}
void