diff --git a/src/wifi/model/channel-access-manager.cc b/src/wifi/model/channel-access-manager.cc index d89eb536e..ca5b8ca1f 100644 --- a/src/wifi/model/channel-access-manager.cc +++ b/src/wifi/model/channel-access-manager.cc @@ -26,6 +26,9 @@ #include "wifi-phy.h" #include "frame-exchange-manager.h" +#undef NS_LOG_APPEND_CONTEXT +#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "] " + namespace ns3 { NS_LOG_COMPONENT_DEFINE ("ChannelAccessManager"); @@ -109,7 +112,8 @@ ChannelAccessManager::ChannelAccessManager () m_lastSwitchingEnd (MicroSeconds (0)), m_sleeping (false), m_off (false), - m_phyListener (0) + m_phyListener (0), + m_linkId (0) { NS_LOG_FUNCTION (this); InitLastBusyStructs (); @@ -159,6 +163,13 @@ ChannelAccessManager::RemovePhyListener (Ptr phy) } } +void +ChannelAccessManager::SetLinkId (uint8_t linkId) +{ + NS_LOG_FUNCTION (this << +linkId); + m_linkId = linkId; +} + void ChannelAccessManager::SetupFrameExchangeManager (Ptr feManager) { diff --git a/src/wifi/model/channel-access-manager.h b/src/wifi/model/channel-access-manager.h index 8cfb1e5aa..5463dcdcd 100644 --- a/src/wifi/model/channel-access-manager.h +++ b/src/wifi/model/channel-access-manager.h @@ -68,6 +68,12 @@ public: * \param phy the WifiPhy to listen to */ void RemovePhyListener (Ptr phy); + /** + * Set the ID of the link this Channel Access Manager is associated with. + * + * \param linkId the ID of the link this Channel Access Manager is associated with + */ + void SetLinkId (uint8_t linkId); /** * Set up the Frame Exchange Manager. * @@ -352,6 +358,7 @@ private: PhyListener* m_phyListener; //!< the PHY listener Ptr m_phy; //!< pointer to the PHY Ptr m_feManager; //!< pointer to the Frame Exchange Manager + uint8_t m_linkId; //!< the ID of the link this object is associated with }; } //namespace ns3 diff --git a/src/wifi/model/frame-exchange-manager.cc b/src/wifi/model/frame-exchange-manager.cc index c54cc3524..1d0478021 100644 --- a/src/wifi/model/frame-exchange-manager.cc +++ b/src/wifi/model/frame-exchange-manager.cc @@ -27,7 +27,7 @@ #include "wifi-mac-trailer.h" #undef NS_LOG_APPEND_CONTEXT -#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] " +#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] " // Time (in nanoseconds) to be added to the PSDU duration to yield the duration // of the timer that is started when the PHY indicates the start of the reception @@ -53,6 +53,7 @@ FrameExchangeManager::GetTypeId (void) FrameExchangeManager::FrameExchangeManager () : m_navEnd (Seconds (0)), + m_linkId (0), m_promisc (false), m_moreFragments (false) { @@ -126,6 +127,13 @@ FrameExchangeManager::GetAckManager (void) const return m_ackManager; } +void +FrameExchangeManager::SetLinkId (uint8_t linkId) +{ + NS_LOG_FUNCTION (this << +linkId); + m_linkId = linkId; +} + void FrameExchangeManager::SetWifiMac (Ptr mac) { diff --git a/src/wifi/model/frame-exchange-manager.h b/src/wifi/model/frame-exchange-manager.h index f2eef20b4..1abe3f7cb 100644 --- a/src/wifi/model/frame-exchange-manager.h +++ b/src/wifi/model/frame-exchange-manager.h @@ -91,6 +91,12 @@ public: void Receive (Ptr psdu, RxSignalInfo rxSignalInfo, WifiTxVector txVector, std::vector perMpduStatus); + /** + * Set the ID of the link this Frame Exchange Manager is associated with. + * + * \param linkId the ID of the link this Frame Exchange Manager is associated with + */ + void SetLinkId (uint8_t linkId); /** * Set the MAC layer to use. * @@ -398,6 +404,7 @@ protected: Mac48Address m_self; //!< the MAC address of this device Mac48Address m_bssid; //!< BSSID address (Mac48Address) Time m_navEnd; //!< NAV expiration time + uint8_t m_linkId; //!< the ID of the link this object is associated with bool m_promisc; //!< Flag if the device is operating in promiscuous mode DroppedMpdu m_droppedMpduCallback; //!< the dropped MPDU callback AckedMpdu m_ackedMpduCallback; //!< the acknowledged MPDU callback diff --git a/src/wifi/model/he/he-frame-exchange-manager.cc b/src/wifi/model/he/he-frame-exchange-manager.cc index e039f8957..3a4b4ae9b 100644 --- a/src/wifi/model/he/he-frame-exchange-manager.cc +++ b/src/wifi/model/he/he-frame-exchange-manager.cc @@ -32,7 +32,7 @@ #include #undef NS_LOG_APPEND_CONTEXT -#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] " +#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] " namespace ns3 { diff --git a/src/wifi/model/ht/ht-frame-exchange-manager.cc b/src/wifi/model/ht/ht-frame-exchange-manager.cc index 9c961200b..65a96a80a 100644 --- a/src/wifi/model/ht/ht-frame-exchange-manager.cc +++ b/src/wifi/model/ht/ht-frame-exchange-manager.cc @@ -31,7 +31,7 @@ #include #undef NS_LOG_APPEND_CONTEXT -#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] " +#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] " namespace ns3 { diff --git a/src/wifi/model/qos-frame-exchange-manager.cc b/src/wifi/model/qos-frame-exchange-manager.cc index f231f20ef..6e8e0ebd4 100644 --- a/src/wifi/model/qos-frame-exchange-manager.cc +++ b/src/wifi/model/qos-frame-exchange-manager.cc @@ -26,7 +26,7 @@ #include "ap-wifi-mac.h" #undef NS_LOG_APPEND_CONTEXT -#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] " +#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] " namespace ns3 { diff --git a/src/wifi/model/vht/vht-frame-exchange-manager.cc b/src/wifi/model/vht/vht-frame-exchange-manager.cc index f5ed6f4b0..6bf143ccd 100644 --- a/src/wifi/model/vht/vht-frame-exchange-manager.cc +++ b/src/wifi/model/vht/vht-frame-exchange-manager.cc @@ -23,7 +23,7 @@ #include "vht-frame-exchange-manager.h" #undef NS_LOG_APPEND_CONTEXT -#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] " +#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] " namespace ns3 { diff --git a/src/wifi/model/wifi-mac.cc b/src/wifi/model/wifi-mac.cc index 7bd33ff45..faa4aa98f 100644 --- a/src/wifi/model/wifi-mac.cc +++ b/src/wifi/model/wifi-mac.cc @@ -678,6 +678,8 @@ WifiMac::ConfigureStandard (WifiStandard standard) } link->feManager->SetWifiPhy (link->phy); link->feManager->SetWifiMac (this); + link->feManager->SetLinkId (link->id); + link->channelAccessManager->SetLinkId (link->id); link->channelAccessManager->SetupFrameExchangeManager (link->feManager); if (m_txop != nullptr)