wifi: Add StaWifiMac methods to block transmissions on a link

This commit is contained in:
Stefano Avallone
2023-05-10 17:59:12 +02:00
committed by Stefano Avallone
parent e471c20cb4
commit 1f4b4cbfd6
2 changed files with 60 additions and 0 deletions

View File

@@ -1050,6 +1050,50 @@ StaWifiMac::Enqueue(Ptr<Packet> packet, Mac48Address to)
}
}
void
StaWifiMac::BlockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason)
{
NS_LOG_FUNCTION(this << linkId << reason);
auto bssid = GetBssid(linkId);
auto apAddress = GetWifiRemoteStationManager(linkId)->GetMldAddress(bssid).value_or(bssid);
BlockUnicastTxOnLinks(reason, apAddress, {linkId});
// the only type of broadcast frames that a non-AP STA can send are management frames
for (const auto [acIndex, ac] : wifiAcList)
{
GetMacQueueScheduler()->BlockQueues(reason,
acIndex,
{WIFI_MGT_QUEUE},
Mac48Address::GetBroadcast(),
GetFrameExchangeManager(linkId)->GetAddress(),
{},
{linkId});
}
}
void
StaWifiMac::UnblockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason)
{
NS_LOG_FUNCTION(this << linkId << reason);
auto bssid = GetBssid(linkId);
auto apAddress = GetWifiRemoteStationManager(linkId)->GetMldAddress(bssid).value_or(bssid);
UnblockUnicastTxOnLinks(reason, apAddress, {linkId});
// the only type of broadcast frames that a non-AP STA can send are management frames
for (const auto [acIndex, ac] : wifiAcList)
{
GetMacQueueScheduler()->UnblockQueues(reason,
acIndex,
{WIFI_MGT_QUEUE},
Mac48Address::GetBroadcast(),
GetFrameExchangeManager(linkId)->GetAddress(),
{},
{linkId});
}
}
void
StaWifiMac::Receive(Ptr<const WifiMpdu> mpdu, uint8_t linkId)
{

View File

@@ -316,6 +316,22 @@ class StaWifiMac : public WifiMac
*/
void NotifySwitchingEmlsrLink(Ptr<WifiPhy> phy, uint8_t linkId);
/**
* Block transmissions on the given link for the given reason.
*
* \param linkId the ID of the given link
* \param reason the reason for blocking transmissions on the given link
*/
void BlockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason);
/**
* Unblock transmissions on the given link for the given reason.
*
* \param linkId the ID of the given link
* \param reason the reason for unblocking transmissions on the given link
*/
void UnblockTxOnLink(uint8_t linkId, WifiQueueBlockedReason reason);
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that