wifi: Add attributes to EMLSR manager to switch EMLSR links

This commit is contained in:
Stefano Avallone
2023-04-03 17:34:57 +02:00
committed by Stefano Avallone
parent efec608c15
commit 636c2578f4
4 changed files with 90 additions and 5 deletions

View File

@@ -19,6 +19,7 @@
#include "default-emlsr-manager.h"
#include "ns3/boolean.h"
#include "ns3/log.h"
#include "ns3/wifi-mpdu.h"
@@ -32,10 +33,17 @@ NS_OBJECT_ENSURE_REGISTERED(DefaultEmlsrManager);
TypeId
DefaultEmlsrManager::GetTypeId()
{
static TypeId tid = TypeId("ns3::DefaultEmlsrManager")
.SetParent<EmlsrManager>()
.SetGroupName("Wifi")
.AddConstructor<DefaultEmlsrManager>();
static TypeId tid =
TypeId("ns3::DefaultEmlsrManager")
.SetParent<EmlsrManager>()
.SetGroupName("Wifi")
.AddConstructor<DefaultEmlsrManager>()
.AddAttribute("SwitchAuxPhy",
"Whether Aux PHY should switch channel to operate on the link on which "
"the Main PHY was operating before moving to the link of the Aux PHY.",
BooleanValue(true),
MakeBooleanAccessor(&DefaultEmlsrManager::m_switchAuxPhy),
MakeBooleanChecker());
return tid;
}

View File

@@ -54,6 +54,8 @@ class DefaultEmlsrManager : public EmlsrManager
std::optional<uint8_t> m_assocLinkId; /**< ID of the link on which Association Response
was received */
bool m_switchAuxPhy; /**< whether Aux PHY should switch channel to operate on the link on which
the Main PHY was operating before moving to the link of the Aux PHY */
};
} // namespace ns3

View File

@@ -54,13 +54,32 @@ EmlsrManager::GetTypeId()
TimeValue(MicroSeconds(0)),
MakeTimeAccessor(&EmlsrManager::m_emlsrTransitionDelay),
MakeTimeChecker(MicroSeconds(0), MicroSeconds(256)))
.AddAttribute(
"MainPhyId",
"The ID of the main PHY (position in the vector of PHYs held by "
"WifiNetDevice). This attribute cannot be set after initialization.",
UintegerValue(0),
MakeUintegerAccessor(&EmlsrManager::SetMainPhyId, &EmlsrManager::GetMainPhyId),
MakeUintegerChecker<uint8_t>())
.AddAttribute("AuxPhyChannelWidth",
"The maximum channel width (MHz) supported by Aux PHYs",
UintegerValue(20),
MakeUintegerAccessor(&EmlsrManager::m_auxPhyMaxWidth),
MakeUintegerChecker<uint16_t>(20, 160))
.AddAttribute(
"EmlsrLinkSet",
"IDs of the links on which EMLSR mode will be enabled. An empty set "
"indicates to disable EMLSR.",
AttributeContainerValue<UintegerValue>(),
MakeAttributeContainerAccessor<UintegerValue>(&EmlsrManager::SetEmlsrLinks),
MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint8_t>()));
MakeAttributeContainerChecker<UintegerValue>(MakeUintegerChecker<uint8_t>()))
.AddAttribute("ResetCamState",
"Whether to reset the state of the ChannelAccessManager associated with "
"the link on which the main PHY has just switched to.",
BooleanValue(false),
MakeBooleanAccessor(&EmlsrManager::SetCamStateReset,
&EmlsrManager::GetCamStateReset),
MakeBooleanChecker());
return tid;
}
@@ -103,6 +122,32 @@ EmlsrManager::SetWifiMac(Ptr<StaWifiMac> mac)
MakeCallback(&EmlsrManager::TxDropped, this));
}
void
EmlsrManager::SetMainPhyId(uint8_t mainPhyId)
{
NS_LOG_FUNCTION(this << mainPhyId);
NS_ABORT_MSG_IF(IsInitialized(), "Cannot be called once this object has been initialized");
m_mainPhyId = mainPhyId;
}
uint8_t
EmlsrManager::GetMainPhyId() const
{
return m_mainPhyId;
}
void
EmlsrManager::SetCamStateReset(bool enable)
{
m_resetCamState = enable;
}
bool
EmlsrManager::GetCamStateReset() const
{
return m_resetCamState;
}
const std::set<uint8_t>&
EmlsrManager::GetEmlsrLinks() const
{

View File

@@ -70,6 +70,19 @@ class EmlsrManager : public Object
*/
std::optional<Time> GetTransitionTimeout() const;
/**
* Set the ID of main PHY (position in the vector of PHYs held by WifiNetDevice). This
* method cannot be called during or after initialization.
*
* \param mainPhyId the ID of the main PHY
*/
void SetMainPhyId(uint8_t mainPhyId);
/**
* \return the ID of main PHY (position in the vector of PHYs held by WifiNetDevice)
*/
uint8_t GetMainPhyId() const;
/**
* Take actions to enable EMLSR mode on the given set of links, if non-empty, or
* disable EMLSR mode, otherwise.
@@ -84,6 +97,20 @@ class EmlsrManager : public Object
*/
const std::set<uint8_t>& GetEmlsrLinks() const;
/**
* Set the member variable indicating whether the state of the CAM should be reset when
* the main PHY switches channel and operates on the link associated with the CAM.
*
* \param enable whether the CAM state should be reset
*/
void SetCamStateReset(bool enable);
/**
* \return the value of the member variable indicating whether the state of the CAM should be
* reset when the main PHY switches channel and operates on the link associated with the CAM.
*/
bool GetCamStateReset() const;
/**
* Notify the reception of a management frame addressed to us.
*
@@ -122,6 +149,8 @@ class EmlsrManager : public Object
Time m_emlsrPaddingDelay; //!< EMLSR Padding delay
Time m_emlsrTransitionDelay; //!< EMLSR Transition delay
uint8_t m_mainPhyId; //!< ID of main PHY (position in the vector of PHYs held by WifiNetDevice)
uint16_t m_auxPhyMaxWidth; //!< max channel width (MHz) supported by aux PHYs
private:
/**
@@ -174,6 +203,7 @@ class EmlsrManager : public Object
Time m_lastAdvTransitionDelay; //!< last advertised transition delay
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
};
} // namespace ns3