wifi: BlockAckManager does not need to hold a pointer to WifiRemoteStationManager

This commit is contained in:
Stefano Avallone
2021-05-13 19:39:20 +02:00
parent a826d8a447
commit 847c88d392
6 changed files with 31 additions and 50 deletions

View File

@@ -21,7 +21,7 @@
#include "ns3/log.h"
#include "ns3/simulator.h"
#include "block-ack-manager.h"
#include "wifi-remote-station-manager.h"
#include "wifi-utils.h"
#include "ctrl-headers.h"
#include "mgt-headers.h"
#include "wifi-mac-queue.h"
@@ -82,7 +82,6 @@ BlockAckManager::DoDispose ()
m_retryPackets = nullptr;
m_bars.clear ();
m_queue = nullptr;
m_stationManager = nullptr;
}
bool
@@ -120,9 +119,9 @@ BlockAckManager::ExistsAgreementInState (Mac48Address recipient, uint8_t tid,
}
void
BlockAckManager::CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient)
BlockAckManager::CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient, bool htSupported)
{
NS_LOG_FUNCTION (this << reqHdr << recipient);
NS_LOG_FUNCTION (this << reqHdr << recipient << htSupported);
std::pair<Mac48Address, uint8_t> key (recipient, reqHdr->GetTid ());
OriginatorBlockAckAgreement agreement (recipient, reqHdr->GetTid ());
agreement.SetStartingSequence (reqHdr->GetStartingSequence ());
@@ -131,7 +130,7 @@ BlockAckManager::CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Addr
agreement.SetBufferSize (reqHdr->GetBufferSize());
agreement.SetTimeout (reqHdr->GetTimeout ());
agreement.SetAmsduSupport (reqHdr->IsAmsduSupported ());
agreement.SetHtSupported (m_stationManager->GetHtSupported () && m_stationManager->GetHtSupported (recipient));
agreement.SetHtSupported (htSupported);
if (reqHdr->IsImmediateBlockAck ())
{
agreement.SetImmediateBlockAck ();
@@ -393,13 +392,6 @@ BlockAckManager::SetBlockAckThreshold (uint8_t nPackets)
m_blockAckThreshold = nPackets;
}
void
BlockAckManager::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> manager)
{
NS_LOG_FUNCTION (this << manager);
m_stationManager = manager;
}
void
BlockAckManager::NotifyGotAck (Ptr<const WifiMacQueueItem> mpdu)
{
@@ -462,12 +454,14 @@ BlockAckManager::NotifyMissedAck (Ptr<WifiMacQueueItem> mpdu)
InsertInRetryQueue (mpdu);
}
void
std::pair<uint16_t,uint16_t>
BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader& blockAck, Mac48Address recipient,
const std::set<uint8_t>& tids, double rxSnr, double dataSnr,
const WifiTxVector& dataTxVector, size_t index)
const std::set<uint8_t>& tids, size_t index)
{
NS_LOG_FUNCTION (this << blockAck << recipient << rxSnr << dataSnr << dataTxVector << index);
NS_LOG_FUNCTION (this << blockAck << recipient << index);
uint16_t nSuccessfulMpdus = 0;
uint16_t nFailedMpdus = 0;
if (!blockAck.IsMultiTid ())
{
uint8_t tid = blockAck.GetTidInfo (index);
@@ -481,8 +475,6 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader& blockAck, Mac4
if (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED))
{
bool foundFirstLost = false;
uint16_t nSuccessfulMpdus = 0;
uint16_t nFailedMpdus = 0;
AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
PacketQueueI queueEnd = it->second.second.end ();
@@ -558,7 +550,6 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader& blockAck, Mac4
queueIt = it->second.second.erase (queueIt);
}
}
m_stationManager->ReportAmpduTxStatus (recipient, nSuccessfulMpdus, nFailedMpdus, rxSnr, dataSnr, dataTxVector);
}
}
else
@@ -566,6 +557,7 @@ BlockAckManager::NotifyGotBlockAck (const CtrlBAckResponseHeader& blockAck, Mac4
//NOT SUPPORTED FOR NOW
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
}
return {nSuccessfulMpdus, nFailedMpdus};
}
void

View File

@@ -32,7 +32,6 @@
namespace ns3 {
class WifiRemoteStationManager;
class MgtAddBaResponseHeader;
class MgtAddBaRequestHeader;
class CtrlBAckResponseHeader;
@@ -90,12 +89,6 @@ public:
BlockAckManager ();
~BlockAckManager ();
/**
* Set up WifiRemoteStationManager associated with this BlockAckManager.
*
* \param manager WifiRemoteStationManager associated with this BlockAckManager
*/
void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> manager);
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid Traffic ID.
@@ -121,11 +114,12 @@ public:
/**
* \param reqHdr Relative Add block ack request (action frame).
* \param recipient Address of peer station involved in block ack mechanism.
* \param htSupported Whether both originator and recipient support HT
*
* Creates a new block ack agreement in pending state. When a ADDBA response
* with a successful status code is received, the relative agreement becomes established.
*/
void CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient);
void CreateAgreement (const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient, bool htSupported = true);
/**
* \param recipient Address of peer station involved in block ack mechanism.
* \param tid traffic ID of transmitted packet.
@@ -194,11 +188,10 @@ public:
* \param blockAck The received BlockAck frame.
* \param recipient Sender of BlockAck frame.
* \param tids the set of TIDs the acknowledged MPDUs belong to
* \param rxSnr received SNR of the BlockAck frame itself
* \param dataSnr data SNR reported by remote station
* \param dataTxVector the TXVECTOR used to send the Data
* \param index the index of the Per AID TID Info subfield, in case of Multi-STA
* Block Ack, or 0, otherwise
* \return a pair of values indicating the number of successfully received MPDUs
* and the number of failed MPDUs
*
* Invoked upon receipt of a BlockAck frame. Typically, this function, is called
* by ns3::QosTxop object. Performs a check on which MPDUs, previously sent
@@ -207,9 +200,9 @@ public:
* Note that <i>tids</i> is only used if <i>blockAck</i> is a Multi-STA Block Ack
* using All-ack context.
*/
void NotifyGotBlockAck (const CtrlBAckResponseHeader& blockAck, Mac48Address recipient,
const std::set<uint8_t>& tids, double rxSnr, double dataSnr,
const WifiTxVector& dataTxVector, size_t index = 0);
std::pair<uint16_t,uint16_t> NotifyGotBlockAck (const CtrlBAckResponseHeader& blockAck,
Mac48Address recipient, const std::set<uint8_t>& tids,
size_t index = 0);
/**
* \param recipient Sender of the expected BlockAck frame.
* \param tid Traffic ID.
@@ -534,7 +527,6 @@ private:
Callback<void, Mac48Address, uint8_t> m_unblockPackets; ///< unblock packets callback
TxOk m_txOkCallback; ///< transmit OK callback
TxFailed m_txFailedCallback; ///< transmit failed callback
Ptr<WifiRemoteStationManager> m_stationManager; ///< the station manager
/**
* The trace source fired when a state transition occurred.

View File

@@ -1428,8 +1428,10 @@ HeFrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rx
CtrlBAckResponseHeader blockAck;
mpdu->GetPacket ()->PeekHeader (blockAck);
uint8_t tid = blockAck.GetTidInfo ();
GetBaManager (tid)->NotifyGotBlockAck (blockAck, hdr.GetAddr2 (), {tid}, rxSignalInfo.snr,
tag.Get (), m_txParams.m_txVector);
std::pair<uint16_t,uint16_t> ret = GetBaManager (tid)->NotifyGotBlockAck (blockAck, hdr.GetAddr2 (),
{tid});
m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (hdr.GetAddr2 (), ret.first, ret.second,
rxSignalInfo.snr, tag.Get (), m_txParams.m_txVector);
// remove the sender from the set of stations that are expected to send a BlockAck
if (m_staExpectTbPpduFrom.erase (sender) == 0)
@@ -1497,9 +1499,12 @@ HeFrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rx
tid = *tids.begin ();
}
GetBaManager (tid)->NotifyGotBlockAck (blockAck, hdr.GetAddr2 (), {tid},
rxSignalInfo.snr, tag.Get (staId),
m_txParams.m_txVector, index);
std::pair<uint16_t,uint16_t> ret = GetBaManager (tid)->NotifyGotBlockAck (blockAck,
hdr.GetAddr2 (),
{tid}, index);
m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (hdr.GetAddr2 (), ret.first,
ret.second, rxSignalInfo.snr,
tag.Get (staId), m_txParams.m_txVector);
}
}

View File

@@ -1343,8 +1343,9 @@ HtFrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rx
CtrlBAckResponseHeader blockAck;
mpdu->GetPacket ()->PeekHeader (blockAck);
uint8_t tid = blockAck.GetTidInfo ();
GetBaManager (tid)->NotifyGotBlockAck (blockAck, hdr.GetAddr2 (), {tid}, rxSnr,
tag.Get (), m_txParams.m_txVector);
std::pair<uint16_t,uint16_t> ret = GetBaManager (tid)->NotifyGotBlockAck (blockAck, hdr.GetAddr2 (), {tid});
m_mac->GetWifiRemoteStationManager ()->ReportAmpduTxStatus (hdr.GetAddr2 (), ret.first, ret.second,
rxSnr, tag.Get (), m_txParams.m_txVector);
// cancel the timer
m_txTimer.Cancel ();

View File

@@ -203,14 +203,6 @@ QosTxop::ScheduleBar (Ptr<const WifiMacQueueItem> bar, bool skipIfNoDataQueued)
m_baManager->ScheduleBar (bar, skipIfNoDataQueued);
}
void
QosTxop::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager)
{
Txop::SetWifiRemoteStationManager (remoteManager);
NS_LOG_FUNCTION (this << remoteManager);
m_baManager->SetWifiRemoteStationManager (m_stationManager);
}
bool
QosTxop::UseExplicitBarAfterMissedBlockAck (void) const
{

View File

@@ -85,7 +85,6 @@ public:
bool IsQosTxop (void) const override;
AcIndex GetAccessCategory (void) const override;
void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager) override;
bool HasFramesToTransmit (void) override;
void NotifyInternalCollision (void) override;
void NotifyChannelAccessed (Time txopDuration) override;