wifi: Generate in-device interference during transmissions on EMLSR links

...if the corresponding attribute is set to true
This commit is contained in:
Stefano Avallone
2023-12-18 17:21:16 +01:00
committed by Stefano Avallone
parent 84202aeec3
commit 0b4ebba006
4 changed files with 108 additions and 3 deletions

View File

@@ -26,9 +26,11 @@
#include "ns3/ap-wifi-mac.h"
#include "ns3/log.h"
#include "ns3/mgt-action-headers.h"
#include "ns3/spectrum-signal-parameters.h"
#include "ns3/sta-wifi-mac.h"
#include "ns3/wifi-mac-queue.h"
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-spectrum-phy-interface.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT WIFI_FEM_NS_LOG_APPEND_CONTEXT
@@ -448,6 +450,21 @@ EhtFrameExchangeManager::ForwardPsduDown(Ptr<const WifiPsdu> psdu, WifiTxVector&
}
}
}
else if (m_staMac && m_staMac->IsEmlsrLink(m_linkId) &&
m_staMac->GetEmlsrManager()->GetInDeviceInterference())
{
for (const auto linkId : m_staMac->GetLinkIds())
{
if (auto phy = m_mac->GetWifiPhy(linkId);
phy && linkId != m_linkId && m_staMac->IsEmlsrLink(linkId))
{
auto txPowerDbm = phy->GetPowerDbm(txVector.GetTxPowerLevel()) + phy->GetTxGain();
// generate in-device interference on the other EMLSR link for the duration of this
// transmission
GenerateInDeviceInterference(linkId, txDuration, DbmToW(txPowerDbm));
}
}
}
}
void
@@ -483,6 +500,49 @@ EhtFrameExchangeManager::ForwardPsduMapDown(WifiConstPsduMap psduMap, WifiTxVect
}
}
}
else if (m_staMac && m_staMac->IsEmlsrLink(m_linkId) &&
m_staMac->GetEmlsrManager()->GetInDeviceInterference())
{
for (const auto linkId : m_staMac->GetLinkIds())
{
if (auto phy = m_mac->GetWifiPhy(linkId);
phy && linkId != m_linkId && m_staMac->IsEmlsrLink(linkId))
{
auto txPowerDbm = phy->GetPowerDbm(txVector.GetTxPowerLevel()) + phy->GetTxGain();
// generate in-device interference on the other EMLSR link for the duration of this
// transmission
GenerateInDeviceInterference(linkId, txDuration, DbmToW(txPowerDbm));
}
}
}
}
void
EhtFrameExchangeManager::GenerateInDeviceInterference(uint8_t linkId, Time duration, double txPower)
{
NS_LOG_FUNCTION(this << linkId << duration.As(Time::US) << txPower);
auto rxPhy = DynamicCast<SpectrumWifiPhy>(m_mac->GetWifiPhy(linkId));
if (!rxPhy)
{
NS_LOG_DEBUG("No spectrum PHY operating on link " << +linkId);
return;
}
auto txPhy = DynamicCast<SpectrumWifiPhy>(m_phy);
NS_ASSERT(txPhy);
auto psd = Create<SpectrumValue>(rxPhy->GetCurrentInterface()->GetRxSpectrumModel());
*psd = txPower;
auto spectrumSignalParams = Create<SpectrumSignalParameters>();
spectrumSignalParams->duration = duration;
spectrumSignalParams->txPhy = txPhy->GetCurrentInterface();
spectrumSignalParams->txAntenna = txPhy->GetAntenna();
spectrumSignalParams->psd = psd;
rxPhy->StartRx(spectrumSignalParams, rxPhy->GetCurrentInterface());
}
void

View File

@@ -146,6 +146,16 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager
*/
bool CheckEmlsrClientStartingTxop(const WifiMacHeader& hdr, const WifiTxVector& txVector);
/**
* Generate an in-device interference of the given power on the given link for the given
* duration.
*
* \param linkId the ID of the link on which in-device interference is generated
* \param duration the duration of the in-device interference
* \param txPower the TX power in Watts
*/
void GenerateInDeviceInterference(uint8_t linkId, Time duration, double txPower);
/**
* Update the TXOP end timer when starting a frame transmission.
*

View File

@@ -104,6 +104,14 @@ EmlsrManager::GetTypeId()
MakeBooleanAccessor(&EmlsrManager::SetAuxPhyTxCapable,
&EmlsrManager::GetAuxPhyTxCapable),
MakeBooleanChecker())
.AddAttribute("InDeviceInterference",
"Whether in-device interference is such that a PHY cannot decode "
"anything and cannot decrease the backoff counter when another PHY "
"of the same device is transmitting.",
BooleanValue(false),
MakeBooleanAccessor(&EmlsrManager::SetInDeviceInterference,
&EmlsrManager::GetInDeviceInterference),
MakeBooleanChecker())
.AddAttribute(
"EmlsrLinkSet",
"IDs of the links on which EMLSR mode will be enabled. An empty set "
@@ -209,6 +217,18 @@ EmlsrManager::GetAuxPhyTxCapable() const
return m_auxPhyTxCapable;
}
void
EmlsrManager::SetInDeviceInterference(bool enable)
{
m_inDeviceInterference = enable;
}
bool
EmlsrManager::GetInDeviceInterference() const
{
return m_inDeviceInterference;
}
const std::set<uint8_t>&
EmlsrManager::GetEmlsrLinks() const
{
@@ -366,7 +386,6 @@ EmlsrManager::NotifyIcfReceived(uint8_t linkId)
if (id != linkId && m_staMac->IsEmlsrLink(id))
{
m_staMac->BlockTxOnLink(id, WifiQueueBlockedReason::USING_OTHER_EMLSR_LINK);
m_staMac->GetChannelAccessManager(id)->NotifyStartUsingOtherEmlsrLink();
}
}
@@ -410,7 +429,6 @@ EmlsrManager::NotifyUlTxopStart(uint8_t linkId, std::optional<Time> timeToCtsEnd
if (id != linkId && m_staMac->IsEmlsrLink(id))
{
m_staMac->BlockTxOnLink(id, WifiQueueBlockedReason::USING_OTHER_EMLSR_LINK);
m_staMac->GetChannelAccessManager(id)->NotifyStartUsingOtherEmlsrLink();
}
}
@@ -497,7 +515,6 @@ EmlsrManager::NotifyTxopEnd(uint8_t linkId, bool ulTxopNotStarted, bool ongoingD
{
if ((id != linkId) && m_staMac->IsEmlsrLink(id))
{
m_staMac->GetChannelAccessManager(id)->NotifyStopUsingOtherEmlsrLink();
linkIds.insert(id);
}
}

View File

@@ -169,6 +169,21 @@ class EmlsrManager : public Object
*/
bool GetAuxPhyTxCapable() const;
/**
* Set the member variable indicating whether in-device interference is such that a PHY cannot
* decode anything and cannot decrease the backoff counter when another PHY is transmitting.
*
* \param enable whether in-device interference is such that a PHY cannot decode anything
* and cannot decrease the backoff counter when another PHY is transmitting
*/
void SetInDeviceInterference(bool enable);
/**
* \return whether in-device interference is such that a PHY cannot decode anything and cannot
* decrease the backoff counter when another PHY is transmitting
*/
bool GetInDeviceInterference() const;
/**
* Notify the reception of a management frame addressed to us.
*
@@ -493,6 +508,9 @@ class EmlsrManager : public Object
EventId m_transitionTimeoutEvent; /**< Timer started after the successful transmission of an
EML Operating Mode Notification frame */
bool m_resetCamState; //!< whether to reset the state of CAM when main PHY switches channel
bool m_inDeviceInterference; //!< whether in-device interference is such that a PHY cannot
//!< decode anything and cannot decrease the backoff counter
//!< when another PHY is transmitting
std::map<uint8_t, WifiPhyOperatingChannel>
m_mainPhyChannels; //!< link ID-indexed map of operating channels for the main PHY
std::map<uint8_t, WifiPhyOperatingChannel>