wifi: Add public methods to RegularWifiMac to get (Qos)Txops

(Qos)Txops can be obtained via attributes anyway, so make it easier
to get them.
This commit is contained in:
Stefano Avallone
2020-04-24 09:46:33 +02:00
parent 18e3958347
commit c43ac51919
3 changed files with 44 additions and 39 deletions

View File

@@ -899,51 +899,29 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper,
{
Ptr<NetDeviceQueueInterface> ndqi;
BooleanValue qosSupported;
PointerValue ptr;
Ptr<WifiMacQueue> wmq;
Ptr<WifiAckPolicySelector> ackSelector;
rmac->GetAttributeFailSafe ("QosSupported", qosSupported);
if (qosSupported.Get ())
{
ndqi = CreateObjectWithAttributes<NetDeviceQueueInterface> ("NTxQueues",
UintegerValue (4));
rmac->GetAttributeFailSafe ("BE_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_BE].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
rmac->GetAttributeFailSafe ("BK_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_BK].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
ndqi->GetTxQueue (1)->ConnectQueueTraces (wmq);
rmac->GetAttributeFailSafe ("VI_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_VI].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
ndqi->GetTxQueue (2)->ConnectQueueTraces (wmq);
rmac->GetAttributeFailSafe ("VO_Txop", ptr);
ackSelector = m_ackPolicySelector[AC_VO].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
wmq = ptr.Get<QosTxop> ()->GetWifiMacQueue ();
ndqi->GetTxQueue (3)->ConnectQueueTraces (wmq);
for (auto& ac : {AC_BE, AC_BK, AC_VI, AC_VO})
{
Ptr<QosTxop> qosTxop = rmac->GetQosTxop (ac);
auto ackSelector = m_ackPolicySelector[ac].Create<WifiAckPolicySelector> ();
ackSelector->SetQosTxop (qosTxop);
qosTxop->SetAckPolicySelector (ackSelector);
wmq = qosTxop->GetWifiMacQueue ();
ndqi->GetTxQueue (static_cast<std::size_t> (ac))->ConnectQueueTraces (wmq);
}
ndqi->SetSelectQueueCallback (m_selectQueueCallback);
}
else
{
ndqi = CreateObject<NetDeviceQueueInterface> ();
rmac->GetAttributeFailSafe ("Txop", ptr);
wmq = ptr.Get<Txop> ()->GetWifiMacQueue ();
wmq = rmac->GetTxop ()->GetWifiMacQueue ();
ndqi->GetTxQueue (0)->ConnectQueueTraces (wmq);
}
device->AggregateObject (ndqi);

View File

@@ -456,6 +456,18 @@ RegularWifiMac::GetTxop () const
return m_txop;
}
Ptr<QosTxop>
RegularWifiMac::GetQosTxop (AcIndex ac) const
{
return m_edca.find (ac)->second;
}
Ptr<QosTxop>
RegularWifiMac::GetQosTxop (uint8_t tid) const
{
return GetQosTxop (QosUtilsMapTidToAc (tid));
}
Ptr<QosTxop>
RegularWifiMac::GetVOQueue () const
{

View File

@@ -103,6 +103,28 @@ public:
* \return the station manager attached to this MAC.
*/
Ptr<WifiRemoteStationManager> GetWifiRemoteStationManager (void) const;
/**
* Accessor for the DCF object
*
* \return a smart pointer to Txop
*/
Ptr<Txop> GetTxop (void) const;
/**
* Accessor for a specified EDCA object
*
* \param ac the Access Category
* \return a smart pointer to a QosTxop
*/
Ptr<QosTxop> GetQosTxop (AcIndex ac) const;
/**
* Accessor for a specified EDCA object
*
* \param tid the Traffic ID
* \return a smart pointer to a QosTxop
*/
Ptr<QosTxop> GetQosTxop (uint8_t tid) const;
/**
* Return the extended capabilities of the device.
*
@@ -158,13 +180,6 @@ protected:
channel access function */
EdcaQueues m_edca;
/**
* Accessor for the DCF object
*
* \return a smart pointer to Txop
*/
Ptr<Txop> GetTxop (void) const;
/**
* Accessor for the AC_VO channel access function
*