wifi: Remove yet another case of scheduling actions when switching EMLSR links

This commit is contained in:
Stefano Avallone
2024-09-07 16:50:14 +02:00
committed by Stefano Avallone
parent f84ccacbd1
commit 287b3d4fe2
5 changed files with 18 additions and 6 deletions

View File

@@ -89,9 +89,10 @@ DefaultEmlsrManager::NotifyEmlsrModeChanged()
void
DefaultEmlsrManager::NotifyMainPhySwitch(std::optional<uint8_t> currLinkId,
uint8_t nextLinkId,
Ptr<WifiPhy> auxPhy,
Time duration)
{
NS_LOG_FUNCTION(this << (currLinkId ? std::to_string(*currLinkId) : "") << nextLinkId
NS_LOG_FUNCTION(this << (currLinkId ? std::to_string(*currLinkId) : "") << nextLinkId << auxPhy
<< duration.As(Time::US));
// if currLinkId has no value (i.e., the main PHY is not operating on any link), it means that
@@ -117,8 +118,6 @@ DefaultEmlsrManager::NotifyMainPhySwitch(std::optional<uint8_t> currLinkId,
// schedule Aux PHY switch so that it operates on the link on which the main PHY was
// operating
auto auxPhy = GetStaMac()->GetWifiPhy(nextLinkId);
NS_LOG_DEBUG("Aux PHY (" << auxPhy << ") operating on link " << +nextLinkId
<< " will switch to link " << +currLinkId.value() << " in "
<< duration.As(Time::US));
@@ -158,7 +157,7 @@ DefaultEmlsrManager::NotifyMainPhySwitch(std::optional<uint8_t> currLinkId,
if (nextLinkId != GetMainPhyId())
{
// the main PHY is moving to an auxiliary link and the aux PHY does not switch link
m_auxPhyToReconnect = GetStaMac()->GetWifiPhy(nextLinkId);
m_auxPhyToReconnect = auxPhy;
}
}

View File

@@ -98,6 +98,7 @@ class DefaultEmlsrManager : public EmlsrManager
void DoNotifyMgtFrameReceived(Ptr<const WifiMpdu> mpdu, uint8_t linkId) override;
void NotifyMainPhySwitch(std::optional<uint8_t> currLinkId,
uint8_t nextLinkId,
Ptr<WifiPhy> auxPhy,
Time duration) override;
void DoNotifyIcfReceived(uint8_t linkId) override;
void DoNotifyUlTxopStart(uint8_t linkId) override;

View File

@@ -714,6 +714,9 @@ EmlsrManager::SwitchMainPhy(uint8_t linkId,
NS_ASSERT_MSG(!mainPhy->GetState()->IsStateTx(),
"We should not ask the main PHY to switch channel while transmitting");
// record the aux PHY operating on the link the main PHY is switching to
auto auxPhy = GetStaMac()->GetWifiPhy(linkId);
// request the main PHY to switch channel
const auto delay = mainPhy->GetChannelSwitchDelay();
const auto pifs = mainPhy->GetSifs() + mainPhy->GetSlot();
@@ -769,7 +772,7 @@ EmlsrManager::SwitchMainPhy(uint8_t linkId,
}
SetCcaEdThresholdOnLinkSwitch(mainPhy, linkId);
NotifyMainPhySwitch(currMainPhyLinkId, linkId, timeToSwitchEnd);
NotifyMainPhySwitch(currMainPhyLinkId, linkId, auxPhy, timeToSwitchEnd);
}
void

View File

@@ -605,10 +605,12 @@ class EmlsrManager : public Object
*
* @param currLinkId the ID of the link on which the main PHY is operating (if any)
* @param nextLinkId the ID of the link on which the main PHY will be operating
* @param auxPhy the aux PHY operating on the link on which the main PHY will be operating
* @param duration the channel switch duration
*/
virtual void NotifyMainPhySwitch(std::optional<uint8_t> currLinkId,
uint8_t nextLinkId,
Ptr<WifiPhy> auxPhy,
Time duration) = 0;
/**

View File

@@ -2055,7 +2055,14 @@ StaWifiMac::NotifySwitchingEmlsrLink(Ptr<WifiPhy> phy, uint8_t linkId, Time dela
// connect the PHY to the new link when the channel switch is completed, so that the PHY
// operating on the new link can possibly continue receiving frames in the meantime.
m_emlsrLinkSwitch.emplace(phy->GetPhyId(), Simulator::Schedule(delay, connectPhy));
if (delay.IsStrictlyPositive())
{
m_emlsrLinkSwitch.emplace(phy->GetPhyId(), Simulator::Schedule(delay, connectPhy));
}
else
{
connectPhy();
}
}
void