From 7947f33b2b6d5f3e06e0fb2c01fbc14e05cc054a Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Sat, 22 Jun 2024 16:24:41 +0200 Subject: [PATCH] wifi: Add a StaWifiMac trace source to notify of EMLSR link switch events --- src/wifi/model/sta-wifi-mac.cc | 13 ++++++++++++- src/wifi/model/sta-wifi-mac.h | 16 ++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index 0d73ef101..72bad2e83 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -137,7 +137,15 @@ StaWifiMac::GetTypeId() .AddTraceSource("ReceivedBeaconInfo", "Information about every received Beacon frame", MakeTraceSourceAccessor(&StaWifiMac::m_beaconInfo), - "ns3::ApInfo::TracedCallback"); + "ns3::ApInfo::TracedCallback") + .AddTraceSource("EmlsrLinkSwitch", + "Trace start/end of EMLSR link switch events: when a PHY operating on " + "a link starts switching, provides the ID of the link and a null " + "pointer (indicating no PHY is operating on that link); when a PHY " + "completes switching to a link, provides the ID of the link and a " + "pointer to the PHY (that is now operating on that link)", + MakeTraceSourceAccessor(&StaWifiMac::m_emlsrLinkSwitchLogger), + "ns3::StaWifiMac::EmlsrLinkSwitchCallback"); return tid; } @@ -2024,6 +2032,7 @@ StaWifiMac::NotifySwitchingEmlsrLink(Ptr phy, uint8_t linkId, Time dela if (link->phy == phy && id != linkId) { link->phy = nullptr; + m_emlsrLinkSwitchLogger(id, nullptr); } } @@ -2045,6 +2054,8 @@ StaWifiMac::NotifySwitchingEmlsrLink(Ptr phy, uint8_t linkId, Time dela newLink.feManager->SetWifiPhy(phy); // Connect the station manager on the new link to the given PHY newLink.stationManager->SetupPhy(phy); + // log link switch + m_emlsrLinkSwitchLogger(linkId, phy); }; // cancel any pending event for the given PHY to switch link diff --git a/src/wifi/model/sta-wifi-mac.h b/src/wifi/model/sta-wifi-mac.h index 24b674887..e7d617a43 100644 --- a/src/wifi/model/sta-wifi-mac.h +++ b/src/wifi/model/sta-wifi-mac.h @@ -608,15 +608,19 @@ class StaWifiMac : public WifiMac /// store the UL TID-to-Link Mapping included in the Association Request frame WifiTidLinkMapping m_ulTidLinkMappingInAssocReq; - TracedCallback m_assocLogger; ///< association logger - TracedCallback m_setupCompleted; ///< link setup completed logger - TracedCallback m_deAssocLogger; ///< disassociation logger - TracedCallback m_setupCanceled; ///< link setup canceled logger - TracedCallback