wifi: Allow more reuse/customization of RrMultiUserScheduler code
This commit is contained in:
@@ -167,9 +167,8 @@ RrMultiUserScheduler::SelectTxFormat()
|
||||
return TrySendingDlMuPpdu();
|
||||
}
|
||||
|
||||
template <class Func>
|
||||
WifiTxVector
|
||||
RrMultiUserScheduler::GetTxVectorForUlMu(Func canBeSolicited)
|
||||
RrMultiUserScheduler::GetTxVectorForUlMu(std::function<bool(const MasterInfo&)> canBeSolicited)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
|
||||
@@ -277,6 +276,13 @@ RrMultiUserScheduler::GetTxVectorForUlMu(Func canBeSolicited)
|
||||
return txVector;
|
||||
}
|
||||
|
||||
bool
|
||||
RrMultiUserScheduler::CanSolicitStaInBsrpTf(const MasterInfo& info) const
|
||||
{
|
||||
// only consider stations that have setup the current link
|
||||
return m_apMac->GetStaList(m_linkId).contains(info.aid);
|
||||
}
|
||||
|
||||
MultiUserScheduler::TxFormat
|
||||
RrMultiUserScheduler::TrySendingBsrpTf()
|
||||
{
|
||||
@@ -288,11 +294,8 @@ RrMultiUserScheduler::TrySendingBsrpTf()
|
||||
return TxFormat::SU_TX;
|
||||
}
|
||||
|
||||
// only consider stations that have setup the current link
|
||||
WifiTxVector txVector = GetTxVectorForUlMu([this](const MasterInfo& info) {
|
||||
const auto& staList = m_apMac->GetStaList(m_linkId);
|
||||
return staList.contains(info.aid);
|
||||
});
|
||||
auto txVector = GetTxVectorForUlMu(
|
||||
std::bind(&RrMultiUserScheduler::CanSolicitStaInBsrpTf, this, std::placeholders::_1));
|
||||
|
||||
if (txVector.GetHeMuUserInfoMap().empty())
|
||||
{
|
||||
@@ -361,6 +364,14 @@ RrMultiUserScheduler::TrySendingBsrpTf()
|
||||
return UL_MU_TX;
|
||||
}
|
||||
|
||||
bool
|
||||
RrMultiUserScheduler::CanSolicitStaInBasicTf(const MasterInfo& info) const
|
||||
{
|
||||
// only consider stations that setup the current link and do not have reported a null queue size
|
||||
return m_apMac->GetStaList(m_linkId).contains(info.aid) &&
|
||||
m_apMac->GetMaxBufferStatus(info.address) > 0;
|
||||
}
|
||||
|
||||
MultiUserScheduler::TxFormat
|
||||
RrMultiUserScheduler::TrySendingBasicTf()
|
||||
{
|
||||
@@ -375,12 +386,8 @@ RrMultiUserScheduler::TrySendingBasicTf()
|
||||
// check if an UL OFDMA transmission is possible after a DL OFDMA transmission
|
||||
NS_ABORT_MSG_IF(m_ulPsduSize == 0, "The UlPsduSize attribute must be set to a non-null value");
|
||||
|
||||
// only consider stations that have setup the current link and do not have
|
||||
// reported a null queue size
|
||||
WifiTxVector txVector = GetTxVectorForUlMu([this](const MasterInfo& info) {
|
||||
const auto& staList = m_apMac->GetStaList(m_linkId);
|
||||
return staList.contains(info.aid) && m_apMac->GetMaxBufferStatus(info.address) > 0;
|
||||
});
|
||||
auto txVector = GetTxVectorForUlMu(
|
||||
std::bind(&RrMultiUserScheduler::CanSolicitStaInBasicTf, this, std::placeholders::_1));
|
||||
|
||||
if (txVector.GetHeMuUserInfoMap().empty())
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "multi-user-scheduler.h"
|
||||
|
||||
#include <functional>
|
||||
#include <list>
|
||||
|
||||
namespace ns3
|
||||
@@ -45,6 +46,32 @@ class RrMultiUserScheduler : public MultiUserScheduler
|
||||
void DoDispose() override;
|
||||
void DoInitialize() override;
|
||||
|
||||
/**
|
||||
* Information used to sort stations
|
||||
*/
|
||||
struct MasterInfo
|
||||
{
|
||||
uint16_t aid; //!< station's AID
|
||||
Mac48Address address; //!< station's MAC Address
|
||||
double credits; //!< credits accumulated by the station
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine whether the given STA can be solicited via a Basic Trigger Frame.
|
||||
*
|
||||
* \param info the information about the given STA
|
||||
* \return whether the given STA can be solicited via a Basic Trigger Frame
|
||||
*/
|
||||
virtual bool CanSolicitStaInBasicTf(const MasterInfo& info) const;
|
||||
|
||||
/**
|
||||
* Determine whether the given STA can be solicited via a BSRP Trigger Frame.
|
||||
*
|
||||
* \param info the information about the given STA
|
||||
* \return whether the given STA can be solicited via a BSRP Trigger Frame
|
||||
*/
|
||||
virtual bool CanSolicitStaInBsrpTf(const MasterInfo& info) const;
|
||||
|
||||
private:
|
||||
TxFormat SelectTxFormat() override;
|
||||
DlMuInfo ComputeDlMuInfo() override;
|
||||
@@ -82,13 +109,11 @@ class RrMultiUserScheduler : public MultiUserScheduler
|
||||
* transmissions from suitable stations, i.e., stations that have established a
|
||||
* BlockAck agreement with the AP and for which the given predicate returns true.
|
||||
*
|
||||
* \tparam Func \deduced the type of the given predicate
|
||||
* \param canBeSolicited a predicate returning false for stations that shall not be solicited
|
||||
* \return a TXVECTOR that can be used to construct a Trigger Frame to solicit
|
||||
* transmissions from suitable stations
|
||||
*/
|
||||
template <class Func>
|
||||
WifiTxVector GetTxVectorForUlMu(Func canBeSolicited);
|
||||
virtual WifiTxVector GetTxVectorForUlMu(std::function<bool(const MasterInfo&)> canBeSolicited);
|
||||
|
||||
/**
|
||||
* Notify the scheduler that a station associated with the AP
|
||||
@@ -105,16 +130,6 @@ class RrMultiUserScheduler : public MultiUserScheduler
|
||||
*/
|
||||
void NotifyStationDeassociated(uint16_t aid, Mac48Address address);
|
||||
|
||||
/**
|
||||
* Information used to sort stations
|
||||
*/
|
||||
struct MasterInfo
|
||||
{
|
||||
uint16_t aid; //!< station's AID
|
||||
Mac48Address address; //!< station's MAC Address
|
||||
double credits; //!< credits accumulated by the station
|
||||
};
|
||||
|
||||
/**
|
||||
* Finalize the given TXVECTOR by only including the largest subset of the
|
||||
* current set of candidate stations that can be allocated equal-sized RUs
|
||||
|
||||
Reference in New Issue
Block a user