wifi: Add a StaWifiMac trace source to notify of EMLSR link switch events

This commit is contained in:
Stefano Avallone
2024-06-22 16:24:41 +02:00
parent 146475f758
commit 7947f33b2b
2 changed files with 22 additions and 7 deletions

View File

@@ -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<WifiPhy> 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<WifiPhy> 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

View File

@@ -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<Mac48Address> m_assocLogger; ///< association logger
TracedCallback<uint8_t, Mac48Address> m_setupCompleted; ///< link setup completed logger
TracedCallback<Mac48Address> m_deAssocLogger; ///< disassociation logger
TracedCallback<uint8_t, Mac48Address> m_setupCanceled; ///< link setup canceled logger
TracedCallback<Time> m_beaconArrival; ///< beacon arrival logger
TracedCallback<ApInfo> m_beaconInfo; ///< beacon info logger
TracedCallback<Mac48Address> m_assocLogger; ///< association logger
TracedCallback<uint8_t, Mac48Address> m_setupCompleted; ///< link setup completed logger
TracedCallback<Mac48Address> m_deAssocLogger; ///< disassociation logger
TracedCallback<uint8_t, Mac48Address> m_setupCanceled; ///< link setup canceled logger
TracedCallback<Time> m_beaconArrival; ///< beacon arrival logger
TracedCallback<ApInfo> m_beaconInfo; ///< beacon info logger
TracedCallback<uint8_t, Ptr<WifiPhy>> m_emlsrLinkSwitchLogger; ///< EMLSR link switch logger
/// TracedCallback signature for link setup completed/canceled events
using LinkSetupCallback = void (*)(uint8_t /* link ID */, Mac48Address /* AP address */);
/// TracedCallback signature for EMLSR link switch events
using EmlsrLinkSwitchCallback = void (*)(uint8_t /* link ID */, Ptr<WifiPhy> /* PHY */);
};
/**