wifi: (Qos)Txop does not need to hold a pointer to WifiRemoteStationManager

This commit is contained in:
Stefano Avallone
2021-05-14 18:37:18 +02:00
parent c9f52ab17f
commit 5729302d28
7 changed files with 54 additions and 69 deletions

View File

@@ -104,6 +104,7 @@ ApWifiMac::ApWifiMac ()
{
NS_LOG_FUNCTION (this);
m_beaconTxop = CreateObject<Txop> ();
m_beaconTxop->SetWifiMac (this);
m_beaconTxop->SetAifsn (1);
m_beaconTxop->SetMinCw (0);
m_beaconTxop->SetMaxCw (0);
@@ -163,14 +164,6 @@ ApWifiMac::GetBeaconInterval (void) const
return m_beaconInterval;
}
void
ApWifiMac::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> stationManager)
{
NS_LOG_FUNCTION (this << stationManager);
m_beaconTxop->SetWifiRemoteStationManager (stationManager);
RegularWifiMac::SetWifiRemoteStationManager (stationManager);
}
void
ApWifiMac::SetLinkUpCallback (Callback<void> linkUp)
{

View File

@@ -57,7 +57,6 @@ public:
ApWifiMac ();
virtual ~ApWifiMac ();
void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> stationManager) override;
void SetLinkUpCallback (Callback<void> linkUp) override;
void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) override;

View File

@@ -32,7 +32,6 @@
#include "wifi-mac-trailer.h"
#include "wifi-mac-queue.h"
#include "qos-blocked-destinations.h"
#include "wifi-remote-station-manager.h"
#include "msdu-aggregator.h"
#include "mpdu-aggregator.h"
#include "ctrl-headers.h"
@@ -42,7 +41,7 @@
#include "wifi-tx-parameters.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT if (m_stationManager != 0 && m_stationManager->GetMac () != 0) { std::clog << "[mac=" << m_stationManager->GetMac ()->GetAddress () << "] "; }
#define NS_LOG_APPEND_CONTEXT if (m_mac != 0) { std::clog << "[mac=" << m_mac->GetAddress () << "] "; }
namespace ns3 {
@@ -183,7 +182,7 @@ QosTxop::PrepareBlockAckRequest (Mac48Address recipient, uint8_t tid) const
WifiMacHeader hdr;
hdr.SetType (WIFI_MAC_CTL_BACKREQ);
hdr.SetAddr1 (recipient);
hdr.SetAddr2 (m_stationManager->GetMac ()->GetAddress ());
hdr.SetAddr2 (m_mac->GetAddress ());
hdr.SetDsNotTo ();
hdr.SetDsNotFrom ();
hdr.SetNoRetry ();
@@ -415,7 +414,7 @@ QosTxop::GetNextMpdu (Ptr<const WifiMacQueueItem> peekedItem, WifiTxParameters&
GetBaBufferSize (recipient, tid)));
// try A-MSDU aggregation
if (m_stationManager->GetHtSupported () && !recipient.IsBroadcast ()
if (m_mac->GetHtSupported () && !recipient.IsBroadcast ()
&& !peekedItem->GetHeader ().IsRetry () && !peekedItem->IsFragment ())
{
Ptr<HtFrameExchangeManager> htFem = StaticCast<HtFrameExchangeManager> (m_qosFem);

View File

@@ -59,6 +59,7 @@ RegularWifiMac::RegularWifiMac ()
m_txop = CreateObject<Txop> ();
m_txop->SetChannelAccessManager (m_channelAccessManager);
m_txop->SetWifiMac (this);
m_txop->SetTxMiddle (m_txMiddle);
m_txop->SetDroppedMpduCallback (MakeCallback (&DroppedMpduTracedCallback::operator(),
&m_droppedMpduCallback));
@@ -182,11 +183,6 @@ RegularWifiMac::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager>
{
NS_LOG_FUNCTION (this << stationManager);
m_stationManager = stationManager;
m_txop->SetWifiRemoteStationManager (stationManager);
for (EdcaQueues::const_iterator i = m_edca.begin (); i != m_edca.end (); ++i)
{
i->second->SetWifiRemoteStationManager (stationManager);
}
}
Ptr<WifiRemoteStationManager>
@@ -469,6 +465,7 @@ RegularWifiMac::SetupEdcaQueue (AcIndex ac)
Ptr<QosTxop> edca = CreateObject<QosTxop> ();
edca->SetChannelAccessManager (m_channelAccessManager);
edca->SetWifiMac (this);
edca->SetTxMiddle (m_txMiddle);
edca->GetBaManager ()->SetTxOkCallback (MakeCallback (&MpduTracedCallback::operator(),
&m_ackedMpduCallback));

View File

@@ -124,6 +124,43 @@ public:
*/
Ptr<QosTxop> GetQosTxop (uint8_t tid) const;
/**
* Return whether the device supports QoS.
*
* \return true if QoS is supported, false otherwise
*/
bool GetQosSupported () const;
/**
* Return whether the device supports ERP.
*
* \return true if ERP is supported, false otherwise
*/
bool GetErpSupported () const;
/**
* Return whether the device supports DSSS.
*
* \return true if DSSS is supported, false otherwise
*/
bool GetDsssSupported () const;
/**
* Return whether the device supports HT.
*
* \return true if HT is supported, false otherwise
*/
bool GetHtSupported () const;
/**
* Return whether the device supports VHT.
*
* \return true if VHT is supported, false otherwise
*/
bool GetVhtSupported () const;
/**
* Return whether the device supports HE.
*
* \return true if HE is supported, false otherwise
*/
bool GetHeSupported () const;
/**
* Return the extended capabilities of the device.
*
@@ -267,12 +304,6 @@ protected:
* \param enable whether QoS is supported
*/
virtual void SetQosSupported (bool enable);
/**
* Return whether the device supports QoS.
*
* \return true if QoS is supported, false otherwise
*/
bool GetQosSupported () const;
/**
* Create a Frame Exchange Manager depending on the supported version
@@ -280,32 +311,12 @@ protected:
*/
void SetupFrameExchangeManager (void);
/**
* Return whether the device supports HT.
*
* \return true if HT is supported, false otherwise
*/
bool GetHtSupported () const;
/**
* Return whether the device supports VHT.
*
* \return true if VHT is supported, false otherwise
*/
bool GetVhtSupported () const;
/**
* Enable or disable ERP support for the device.
*
* \param enable whether ERP is supported
*/
void SetErpSupported (bool enable);
/**
* Return whether the device supports ERP.
*
* \return true if ERP is supported, false otherwise
*/
bool GetErpSupported () const;
/**
* Enable or disable DSSS support for the device.
@@ -313,19 +324,6 @@ protected:
* \param enable whether DSSS is supported
*/
void SetDsssSupported (bool enable);
/**
* Return whether the device supports DSSS.
*
* \return true if DSSS is supported, false otherwise
*/
bool GetDsssSupported () const;
/**
* Return whether the device supports HE.
*
* \return true if HE is supported, false otherwise
*/
bool GetHeSupported () const;
private:
/// type conversion operator

View File

@@ -25,14 +25,13 @@
#include "ns3/socket.h"
#include "txop.h"
#include "channel-access-manager.h"
#include "wifi-mac.h"
#include "regular-wifi-mac.h"
#include "wifi-mac-queue.h"
#include "mac-tx-middle.h"
#include "wifi-remote-station-manager.h"
#include "wifi-mac-trailer.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT if (m_stationManager != 0 && m_stationManager->GetMac () != 0) { std::clog << "[mac=" << m_stationManager->GetMac ()->GetAddress () << "] "; }
#define NS_LOG_APPEND_CONTEXT if (m_mac != 0) { std::clog << "[mac=" << m_mac->GetAddress () << "] "; }
namespace ns3 {
@@ -108,7 +107,7 @@ Txop::DoDispose (void)
{
NS_LOG_FUNCTION (this);
m_queue = 0;
m_stationManager = 0;
m_mac = 0;
m_rng = 0;
m_txMiddle = 0;
m_channelAccessManager = 0;
@@ -129,10 +128,10 @@ void Txop::SetTxMiddle (const Ptr<MacTxMiddle> txMiddle)
}
void
Txop::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager)
Txop::SetWifiMac (const Ptr<RegularWifiMac> mac)
{
NS_LOG_FUNCTION (this << remoteManager);
m_stationManager = remoteManager;
NS_LOG_FUNCTION (this << mac);
m_mac = mac;
}
void

View File

@@ -34,7 +34,7 @@ class WifiMacQueue;
class WifiMacQueueItem;
class UniformRandomVariable;
class CtrlBAckResponseHeader;
class WifiRemoteStationManager;
class RegularWifiMac;
enum WifiMacDropReason : uint8_t; // opaque enum declaration
enum AcIndex : uint8_t;
@@ -112,11 +112,11 @@ public:
*/
void SetChannelAccessManager (const Ptr<ChannelAccessManager> manager);
/**
* Set WifiRemoteStationsManager this Txop is associated to.
* Set the wifi MAC this Txop is associated to.
*
* \param remoteManager WifiRemoteStationManager to associate.
* \param mac associated wifi MAC
*/
virtual void SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> remoteManager);
virtual void SetWifiMac (const Ptr<RegularWifiMac> mac);
/**
* Set MacTxMiddle this Txop is associated to.
*
@@ -328,7 +328,7 @@ protected:
DroppedMpdu m_droppedMpduCallback; //!< the dropped MPDU callback
Ptr<WifiMacQueue> m_queue; //!< the wifi MAC queue
Ptr<MacTxMiddle> m_txMiddle; //!< the MacTxMiddle
Ptr<WifiRemoteStationManager> m_stationManager; //!< the wifi remote station manager
Ptr<RegularWifiMac> m_mac; //!< the wifi MAC
Ptr<UniformRandomVariable> m_rng; //!< the random stream
uint32_t m_cwMin; //!< the minimum contention window