wifi: Track if main PHY is disconnected rather than switching
This commit is contained in:
@@ -302,7 +302,7 @@ AdvancedEmlsrManager::ReceivedMacHdr(Ptr<WifiPhy> phy,
|
||||
// expires (plus a channel switch delay), try to switch the main PHY back to the preferred link
|
||||
const auto mainPhyInvolved =
|
||||
(phy->GetPhyId() == GetMainPhyId()) ||
|
||||
(m_mainPhySwitchInfo.end >= Simulator::Now() && m_mainPhySwitchInfo.to == *linkId);
|
||||
(m_mainPhySwitchInfo.disconnected && m_mainPhySwitchInfo.to == *linkId);
|
||||
const auto delay =
|
||||
Simulator::GetDelayLeft(m_switchMainPhyBackEvent) + phy->GetChannelSwitchDelay();
|
||||
|
||||
@@ -363,7 +363,7 @@ AdvancedEmlsrManager::DoNotifyTxopEnd(uint8_t linkId)
|
||||
if (m_switchAuxPhy || !mainPhy->IsStateSwitching() || m_interruptSwitching)
|
||||
{
|
||||
NS_ASSERT_MSG(
|
||||
!m_switchAuxPhy || m_mainPhySwitchInfo.end >= Simulator::Now(),
|
||||
!m_switchAuxPhy || m_mainPhySwitchInfo.disconnected,
|
||||
"Aux PHY next link ID should have a value when interrupting a main PHY switch");
|
||||
uint8_t nextLinkId = m_switchAuxPhy ? m_mainPhySwitchInfo.from : GetMainPhyId();
|
||||
SwitchMainPhy(nextLinkId, false, REQUEST_ACCESS, std::move(*traceInfo));
|
||||
|
||||
@@ -141,10 +141,9 @@ EmlsrManager::GetTypeId()
|
||||
}
|
||||
|
||||
EmlsrManager::EmlsrManager()
|
||||
: m_mainPhySwitchInfo{},
|
||||
// The STA initializes dot11MSDTimerDuration to aPPDUMaxTime defined in Table 36-70
|
||||
// (Sec. 35.3.16.8.1 of 802.11be D3.1)
|
||||
m_mediumSyncDuration(MicroSeconds(DEFAULT_MSD_DURATION_USEC)),
|
||||
// The STA initializes dot11MSDTimerDuration to aPPDUMaxTime defined in Table 36-70
|
||||
// (Sec. 35.3.16.8.1 of 802.11be D3.1)
|
||||
: m_mediumSyncDuration(MicroSeconds(DEFAULT_MSD_DURATION_USEC)),
|
||||
// The default value of dot11MSDOFDMEDthreshold is –72 dBm and the default value of
|
||||
// dot11MSDTXOPMax is 1, respectively (Sec. 35.3.16.8.1 of 802.11be D3.1)
|
||||
m_msdOfdmEdThreshold(DEFAULT_MSD_OFDM_ED_THRESH),
|
||||
@@ -243,6 +242,12 @@ EmlsrManager::EmlsrLinkSwitchCallback(uint8_t linkId, Ptr<WifiPhy> phy, bool con
|
||||
|
||||
SetCcaEdThresholdOnLinkSwitch(phy, linkId);
|
||||
|
||||
if (phy->GetPhyId() == m_mainPhyId)
|
||||
{
|
||||
// main PHY has been connected to a link
|
||||
m_mainPhySwitchInfo.disconnected = false;
|
||||
}
|
||||
|
||||
Simulator::ScheduleNow([=, this]() {
|
||||
// phy switched to operate on the link with ID equal to linkId
|
||||
auto it = m_noPhySince.find(linkId);
|
||||
@@ -888,6 +893,11 @@ EmlsrManager::SwitchMainPhy(uint8_t linkId,
|
||||
traceInfo.toLinkId = linkId;
|
||||
m_mainPhySwitchTrace(traceInfo);
|
||||
|
||||
m_mainPhySwitchInfo.from = currMainPhyLinkId.value_or(m_mainPhySwitchInfo.from);
|
||||
m_mainPhySwitchInfo.to = linkId;
|
||||
m_mainPhySwitchInfo.start = Simulator::Now();
|
||||
m_mainPhySwitchInfo.disconnected = true;
|
||||
|
||||
const auto newMainPhyChannel = GetChannelForMainPhy(linkId);
|
||||
|
||||
NS_LOG_DEBUG("Main PHY (" << mainPhy << ") is about to switch to " << newMainPhyChannel
|
||||
@@ -958,11 +968,6 @@ EmlsrManager::SwitchMainPhy(uint8_t linkId,
|
||||
});
|
||||
}
|
||||
|
||||
m_mainPhySwitchInfo.from = currMainPhyLinkId.value_or(m_mainPhySwitchInfo.from);
|
||||
m_mainPhySwitchInfo.to = linkId;
|
||||
m_mainPhySwitchInfo.start = Simulator::Now();
|
||||
m_mainPhySwitchInfo.end = Simulator::Now() + timeToSwitchEnd;
|
||||
|
||||
NotifyMainPhySwitch(currMainPhyLinkId, linkId, auxPhy, timeToSwitchEnd);
|
||||
}
|
||||
|
||||
|
||||
@@ -507,10 +507,11 @@ class EmlsrManager : public Object
|
||||
/// Store information about a main PHY switch.
|
||||
struct MainPhySwitchInfo
|
||||
{
|
||||
Time start; //!< start of channel switching
|
||||
Time end; //!< end of channel switching
|
||||
uint8_t from{}; //!< ID of the link which the main PHY is/has been leaving
|
||||
uint8_t to{}; //!< ID of the link which the main PHY is moving to
|
||||
Time start; //!< start of channel switching
|
||||
bool disconnected{false}; //!< true if the main PHY is not connected to any link, i.e., it
|
||||
//!< is switching or waiting to be connected to a link
|
||||
uint8_t from{}; //!< ID of the link which the main PHY is/has been leaving
|
||||
uint8_t to{}; //!< ID of the link which the main PHY is moving to
|
||||
};
|
||||
|
||||
Time m_emlsrPaddingDelay; //!< EMLSR Padding delay
|
||||
|
||||
Reference in New Issue
Block a user