wifi: (partial fix #1797) Carry SnrTag info back to IdealWifiManager

This commit is contained in:
Tom Henderson
2016-03-09 22:02:00 -08:00
parent 5bcabeba26
commit 4c553b83d1
8 changed files with 48 additions and 33 deletions

View File

@@ -526,9 +526,9 @@ BlockAckManager::AlreadyExists (uint16_t currentSeq, Mac48Address recipient, uin
}
void
BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, WifiMode txMode)
BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
{
NS_LOG_FUNCTION (this << blockAck << recipient);
NS_LOG_FUNCTION (this << blockAck << recipient << rxSnr << txMode.GetUniqueName () << dataSnr);
uint16_t sequenceFirstLost = 0;
if (!blockAck->IsMultiTid ())
{
@@ -619,7 +619,7 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac4
}
}
}
m_stationManager->ReportAmpduTxStatus (recipient, tid, nSuccessfulMpdus, nFailedMpdus);
m_stationManager->ReportAmpduTxStatus (recipient, tid, nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr);
uint16_t newSeq = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
if ((foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, sequenceFirstLost))
|| (!foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, newSeq)))

View File

@@ -164,14 +164,16 @@ public:
/**
* \param blockAck The received block ack frame.
* \param recipient Sender of block ack frame.
* \param rxSnr received SNR of the block ack frame itself
* \param txMode mode of block ack frame.
* \param dataSnr data SNR reported by remote station
*
* Invoked upon receipt of a block ack frame. Typically, this function, is called
* by ns3::EdcaTxopN object. Performs a check on which MPDUs, previously sent
* with ack policy set to Block Ack, were correctly received by the recipient.
* An acknowledged MPDU is removed from the buffer, retransmitted otherwise.
*/
void NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, WifiMode txMode);
void NotifyGotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr);
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.

View File

@@ -115,9 +115,9 @@ public:
{
m_txop->MissedAck ();
}
virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, WifiMode txMode)
virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, double rxSnr, WifiMode txMode, double dataSnr)
{
m_txop->GotBlockAck (blockAck, source,txMode);
m_txop->GotBlockAck (blockAck, source, rxSnr, txMode, dataSnr);
}
virtual void MissedBlockAck (uint32_t nMpdus)
{
@@ -893,7 +893,7 @@ EdcaTxopN::MissedBlockAck (uint32_t nMpdus)
}
if (GetAmpduExist (m_currentHdr.GetAddr1 ()))
{
m_stationManager->ReportAmpduTxStatus (m_currentHdr.GetAddr1 (), tid, 0, nMpdus);
m_stationManager->ReportAmpduTxStatus (m_currentHdr.GetAddr1 (), tid, 0, nMpdus, 0, 0);
}
if (NeedBarRetransmission ())
{
@@ -1241,11 +1241,11 @@ EdcaTxopN::GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient
}
void
EdcaTxopN::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, WifiMode txMode)
EdcaTxopN::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr)
{
NS_LOG_FUNCTION (this << blockAck << recipient);
NS_LOG_FUNCTION (this << blockAck << recipient << rxSnr << txMode.GetUniqueName () << dataSnr);
NS_LOG_DEBUG ("got block ack from=" << recipient);
m_baManager->NotifyGotBlockAck (blockAck, recipient, txMode);
m_baManager->NotifyGotBlockAck (blockAck, recipient, rxSnr, txMode, dataSnr);
if (!m_txOkCallback.IsNull ())
{
m_txOkCallback (m_currentHdr);

View File

@@ -262,9 +262,11 @@ public:
*
* \param blockAck
* \param recipient
* \param rxSnr SNR of the block ack itself
* \param txMode
* \param dataSnr reported data SNR from the peer
*/
void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, WifiMode txMode);
void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient, double rxSnr, WifiMode txMode, double dataSnr);
/**
* Event handler when a Block ACK timeout has occurred.
*/

View File

@@ -51,7 +51,7 @@ MacLowTransmissionListener::~MacLowTransmissionListener ()
{
}
void
MacLowTransmissionListener::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, WifiMode mode)
MacLowTransmissionListener::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, double rxSnr, WifiMode mode, double dataSnr)
{
}
void
@@ -868,7 +868,8 @@ MacLow::ReceiveError (Ptr<Packet> packet, double rxSnr, bool isEndOfFrame)
m_lastReceivedHdr.GetQosTid (),
m_lastReceivedHdr.GetAddr2 (),
m_lastReceivedHdr.GetDuration (),
m_currentTxVector);
m_currentTxVector,
rxSnr);
m_receivedAtLeastOneMpdu = false;
}
if (m_txParams.MustWaitFastAck ())
@@ -1037,11 +1038,13 @@ MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, Wifi
&& m_blockAckTimeoutEvent.IsRunning ())
{
NS_LOG_DEBUG ("got block ack from " << hdr.GetAddr2 ());
SnrTag tag;
packet->RemovePacketTag (tag);
CtrlBAckResponseHeader blockAck;
packet->RemoveHeader (blockAck);
m_blockAckTimeoutEvent.Cancel ();
NotifyAckTimeoutResetNow ();
m_listener->GotBlockAck (&blockAck, hdr.GetAddr2 (), txVector.GetMode ());
m_listener->GotBlockAck (&blockAck, hdr.GetAddr2 (), rxSnr, txVector.GetMode (), tag.Get ());
m_sentMpdus = 0;
m_ampdu = false;
FlushAggregateQueue ();
@@ -1072,7 +1075,8 @@ MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, Wifi
blockAckReq,
hdr.GetAddr2 (),
hdr.GetDuration (),
txVector.GetMode ());
txVector.GetMode (),
rxSnr);
}
else
{
@@ -2616,7 +2620,7 @@ MacLow::RxCompleteBufferedPacketsUntilFirstLost (Mac48Address originator, uint8_
}
void
MacLow::SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
Time duration, WifiMode blockAckReqTxMode)
Time duration, WifiMode blockAckReqTxMode, double rxSnr)
{
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (*blockAck);
@@ -2684,15 +2688,17 @@ MacLow::SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Addre
{
preamble = WIFI_PREAMBLE_LONG;
}
SnrTag tag;
tag.Set (rxSnr);
packet->AddPacketTag (tag);
ForwardDown (packet, &hdr, blockAckReqTxVector, preamble);
m_currentPacket = 0;
}
void
MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector)
MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time duration, WifiTxVector blockAckReqTxVector, double rxSnr)
{
NS_LOG_FUNCTION (this);
NS_LOG_FUNCTION (this << (uint16_t) tid << originator << duration.As (Time::S) << blockAckReqTxVector << rxSnr);
CtrlBAckResponseHeader blockAck;
uint16_t seqNumber = 0;
BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid));
@@ -2708,12 +2714,12 @@ MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time durat
NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
(*i).second.FillBlockAckBitmap (&blockAck);
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxVector.GetMode ());
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxVector.GetMode (), rxSnr);
}
void
MacLow::SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Mac48Address originator,
Time duration, WifiMode blockAckReqTxMode)
Time duration, WifiMode blockAckReqTxMode, double rxSnr)
{
NS_LOG_FUNCTION (this);
CtrlBAckResponseHeader blockAck;
@@ -2771,7 +2777,7 @@ MacLow::SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Ma
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
}
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxMode);
SendBlockAckResponse (&blockAck, originator, immediate, duration, blockAckReqTxMode, rxSnr);
}
void
@@ -2872,7 +2878,8 @@ MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr,
firsthdr.GetQosTid (),
firsthdr.GetAddr2 (),
firsthdr.GetDuration (),
txVector);
txVector,
rxSnr);
}
else
{

View File

@@ -97,7 +97,9 @@ public:
/**
* \param blockAck Block ack response header
* \param source Address of block ack sender
* \param rxSnr received SNR of block ack response
* \param txMode mode of block ack response
* \param dataSnr SNR conveyed from remote station (received data SNR)
*
* Invoked when ns3::MacLow receives a block ack frame.
* Block ack frame is received after a block ack request
@@ -107,7 +109,7 @@ public:
* queue that intends to be notified by MacLow of reception
* of a block ack must redefine this function.
*/
virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, WifiMode txMode);
virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, double rxSnr, WifiMode txMode, double dataSnr);
/**
* \param nMpdus number of MPDUs that were transmitted in the unsuccesful A-MPDU transmission
*
@@ -1220,15 +1222,16 @@ private:
* \param originator
* \param duration
* \param blockAckReqTxMode
* \param rxSnr
*/
void SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Mac48Address originator,
Time duration, WifiMode blockAckReqTxMode);
Time duration, WifiMode blockAckReqTxMode, double rxSnr);
/**
* Invoked after an A-MPDU has been received. Looks for corresponding
* block ack agreement and creates block ack bitmap on a received packets basis.
*/
void SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator,
Time duration, WifiTxVector blockAckReqTxVector);
Time duration, WifiTxVector blockAckReqTxVector, double rxSnr);
/**
* This method creates block ack frame with header equals to <i>blockAck</i> and start its transmission.
*
@@ -1237,9 +1240,10 @@ private:
* \param immediate
* \param duration
* \param blockAckReqTxMode
* \param rxSnr
*/
void SendBlockAckResponse (const CtrlBAckResponseHeader* blockAck, Mac48Address originator, bool immediate,
Time duration, WifiMode blockAckReqTxMode);
Time duration, WifiMode blockAckReqTxMode, double rxSnr);
/**
* Every time that a block ack request or a packet with ack policy equals to <i>block ack</i>
* are received, if a relative block ack agreement exists and the value of inactivity timeout

View File

@@ -873,12 +873,12 @@ WifiRemoteStationManager::ReportRxOk (Mac48Address address, const WifiMacHeader
void
WifiRemoteStationManager::ReportAmpduTxStatus (Mac48Address address, uint8_t tid,
uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus)
uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus, double rxSnr, double dataSnr)
{
NS_LOG_FUNCTION (this << address << (uint16_t)tid << nSuccessfulMpdus << nFailedMpdus);
NS_LOG_FUNCTION (this << address << (uint16_t)tid << nSuccessfulMpdus << nFailedMpdus << rxSnr << dataSnr);
NS_ASSERT (!address.IsGroup ());
WifiRemoteStation *station = Lookup (address, tid);
DoReportAmpduTxStatus (station, nSuccessfulMpdus, nFailedMpdus);
DoReportAmpduTxStatus (station, nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr);
}
bool
@@ -1716,7 +1716,7 @@ WifiRemoteStationManager::DoNeedFragmentation (WifiRemoteStation *station,
}
void
WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus)
WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus, double rxSnr, double dataSnr)
{
NS_LOG_DEBUG ("DoReportAmpduTxStatus received but the manager does not handle A-MPDUs!");
}

View File

@@ -595,7 +595,7 @@ public:
* A value of 0 means that the Block ACK was missed.
* \param nFailedMpdus number of unsuccessfully transmitted MPDUs.
*/
void ReportAmpduTxStatus (Mac48Address address, uint8_t tid, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus);
void ReportAmpduTxStatus (Mac48Address address, uint8_t tid, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus, double rxSnr, double dataSnr);
/**
* \param address remote address
@@ -1106,7 +1106,7 @@ private:
* A value of 0 means that the Block ACK was missed.
* \param nFailedMpdus number of unsuccessfully transmitted MPDUs.
*/
virtual void DoReportAmpduTxStatus (WifiRemoteStation *station, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus);
virtual void DoReportAmpduTxStatus (WifiRemoteStation *station, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus, double rxSnr, double dataSnr);
/**
* Return the state of the station associated with the given address.