diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index fbd72c23b..1f115f764 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -104,6 +104,7 @@ ApWifiMac::ApWifiMac () { NS_LOG_FUNCTION (this); m_beaconTxop = CreateObject (); + 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 stationManager) -{ - NS_LOG_FUNCTION (this << stationManager); - m_beaconTxop->SetWifiRemoteStationManager (stationManager); - RegularWifiMac::SetWifiRemoteStationManager (stationManager); -} - void ApWifiMac::SetLinkUpCallback (Callback linkUp) { diff --git a/src/wifi/model/ap-wifi-mac.h b/src/wifi/model/ap-wifi-mac.h index 15e1c3957..528e1e686 100644 --- a/src/wifi/model/ap-wifi-mac.h +++ b/src/wifi/model/ap-wifi-mac.h @@ -57,7 +57,6 @@ public: ApWifiMac (); virtual ~ApWifiMac (); - void SetWifiRemoteStationManager (const Ptr stationManager) override; void SetLinkUpCallback (Callback linkUp) override; void Enqueue (Ptr packet, Mac48Address to) override; void Enqueue (Ptr packet, Mac48Address to, Mac48Address from) override; diff --git a/src/wifi/model/qos-txop.cc b/src/wifi/model/qos-txop.cc index 16e8a2eaf..9b055027d 100644 --- a/src/wifi/model/qos-txop.cc +++ b/src/wifi/model/qos-txop.cc @@ -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 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 htFem = StaticCast (m_qosFem); diff --git a/src/wifi/model/regular-wifi-mac.cc b/src/wifi/model/regular-wifi-mac.cc index 6e4c016c8..9036e9860 100644 --- a/src/wifi/model/regular-wifi-mac.cc +++ b/src/wifi/model/regular-wifi-mac.cc @@ -59,6 +59,7 @@ RegularWifiMac::RegularWifiMac () m_txop = CreateObject (); 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 { 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 @@ -469,6 +465,7 @@ RegularWifiMac::SetupEdcaQueue (AcIndex ac) Ptr edca = CreateObject (); edca->SetChannelAccessManager (m_channelAccessManager); + edca->SetWifiMac (this); edca->SetTxMiddle (m_txMiddle); edca->GetBaManager ()->SetTxOkCallback (MakeCallback (&MpduTracedCallback::operator(), &m_ackedMpduCallback)); diff --git a/src/wifi/model/regular-wifi-mac.h b/src/wifi/model/regular-wifi-mac.h index fe53b5da0..2eb842f85 100644 --- a/src/wifi/model/regular-wifi-mac.h +++ b/src/wifi/model/regular-wifi-mac.h @@ -124,6 +124,43 @@ public: */ Ptr 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 diff --git a/src/wifi/model/txop.cc b/src/wifi/model/txop.cc index 7996f4f34..07c155087 100644 --- a/src/wifi/model/txop.cc +++ b/src/wifi/model/txop.cc @@ -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 txMiddle) } void -Txop::SetWifiRemoteStationManager (const Ptr remoteManager) +Txop::SetWifiMac (const Ptr mac) { - NS_LOG_FUNCTION (this << remoteManager); - m_stationManager = remoteManager; + NS_LOG_FUNCTION (this << mac); + m_mac = mac; } void diff --git a/src/wifi/model/txop.h b/src/wifi/model/txop.h index 4a27900ca..d523c3140 100644 --- a/src/wifi/model/txop.h +++ b/src/wifi/model/txop.h @@ -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 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 remoteManager); + virtual void SetWifiMac (const Ptr mac); /** * Set MacTxMiddle this Txop is associated to. * @@ -328,7 +328,7 @@ protected: DroppedMpdu m_droppedMpduCallback; //!< the dropped MPDU callback Ptr m_queue; //!< the wifi MAC queue Ptr m_txMiddle; //!< the MacTxMiddle - Ptr m_stationManager; //!< the wifi remote station manager + Ptr m_mac; //!< the wifi MAC Ptr m_rng; //!< the random stream uint32_t m_cwMin; //!< the minimum contention window