wifi: Create a remote station manager for each link of an 11be MLD
This commit is contained in:
@@ -354,7 +354,6 @@ WifiMac::DoDispose ()
|
||||
it->second = 0;
|
||||
}
|
||||
|
||||
m_stationManager = 0;
|
||||
m_device = 0;
|
||||
}
|
||||
|
||||
@@ -518,7 +517,7 @@ WifiMac::NotifyChannelSwitching (void)
|
||||
// SetupPhy not only resets the remote station manager, but also sets the
|
||||
// default TX mode and MCS, which is required when switching to a channel
|
||||
// in a different band
|
||||
m_stationManager->SetupPhy (GetLink (SINGLE_LINK_OP_ID).phy);
|
||||
GetLink (SINGLE_LINK_OP_ID).stationManager->SetupPhy (GetLink (SINGLE_LINK_OP_ID).phy);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -794,13 +793,36 @@ void
|
||||
WifiMac::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> stationManager)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << stationManager);
|
||||
m_stationManager = stationManager;
|
||||
SetWifiRemoteStationManagers ({stationManager});
|
||||
}
|
||||
|
||||
void
|
||||
WifiMac::SetWifiRemoteStationManagers (const std::vector<Ptr<WifiRemoteStationManager>>& stationManagers)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
NS_ABORT_MSG_UNLESS (m_links.size () == 0 || m_links.size () == stationManagers.size (),
|
||||
"If links have been already created, the number of provided "
|
||||
"Remote Manager objects (" << stationManagers.size () << ") must "
|
||||
"match the number of links (" << m_links.size () << ")");
|
||||
|
||||
for (std::size_t i = 0; i < stationManagers.size (); i++)
|
||||
{
|
||||
// the link may already exist in case PHY objects were configured first
|
||||
if (i == m_links.size ())
|
||||
{
|
||||
m_links.push_back (CreateLinkEntity ());
|
||||
m_links.back ()->id = i;
|
||||
}
|
||||
NS_ABORT_IF (i != m_links[i]->id);
|
||||
m_links[i]->stationManager = stationManagers[i];
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<WifiRemoteStationManager>
|
||||
WifiMac::GetWifiRemoteStationManager () const
|
||||
WifiMac::GetWifiRemoteStationManager (uint8_t linkId) const
|
||||
{
|
||||
return m_stationManager;
|
||||
return GetLink (linkId).stationManager;
|
||||
}
|
||||
|
||||
std::unique_ptr<WifiMac::LinkEntity>
|
||||
@@ -838,6 +860,7 @@ WifiMac::SetWifiPhys (const std::vector<Ptr<WifiPhy>>& phys)
|
||||
{
|
||||
// the link may already exist in case we are setting new PHY objects
|
||||
// (ResetWifiPhys just nullified the PHY(s) but left the links)
|
||||
// or the remote station managers were configured first
|
||||
if (i == m_links.size ())
|
||||
{
|
||||
m_links.push_back (CreateLinkEntity ());
|
||||
|
||||
@@ -280,9 +280,14 @@ public:
|
||||
*/
|
||||
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
|
||||
/**
|
||||
* \return the station manager attached to this MAC.
|
||||
* \param stationManagers the station managers attached to this MAC.
|
||||
*/
|
||||
Ptr<WifiRemoteStationManager> GetWifiRemoteStationManager (void) const;
|
||||
void SetWifiRemoteStationManagers (const std::vector<Ptr<WifiRemoteStationManager>>& stationManagers);
|
||||
/**
|
||||
* \param linkId the ID (starting at 0) of the link of the RemoteStationManager object to retrieve
|
||||
* \return the remote station manager operating on the given link
|
||||
*/
|
||||
Ptr<WifiRemoteStationManager> GetWifiRemoteStationManager (uint8_t linkId = 0) const;
|
||||
|
||||
/**
|
||||
* This type defines the callback of a higher layer that a
|
||||
@@ -576,6 +581,8 @@ protected:
|
||||
Ptr<WifiPhy> phy; //!< Wifi PHY object
|
||||
Ptr<ChannelAccessManager> channelAccessManager; //!< channel access manager object
|
||||
Ptr<FrameExchangeManager> feManager; //!< Frame Exchange Manager object
|
||||
Ptr<WifiRemoteStationManager> stationManager; /**< Remote station manager (rate control, RTS/CTS/
|
||||
fragmentation thresholds etc.) */
|
||||
bool erpSupported {false}; /**< set to \c true iff this WifiMac is
|
||||
to model 802.11g */
|
||||
bool dsssSupported {false}; /**< set to \c true iff this WifiMac is
|
||||
@@ -726,7 +733,6 @@ private:
|
||||
TypeOfStation m_typeOfStation; //!< the type of station
|
||||
|
||||
Ptr<WifiNetDevice> m_device; //!< Pointer to the device
|
||||
Ptr<WifiRemoteStationManager> m_stationManager; //!< Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
|
||||
std::vector<std::unique_ptr<LinkEntity>> m_links; //!< vector of Link objects
|
||||
|
||||
Mac48Address m_address; //!< MAC address of this station
|
||||
|
||||
@@ -75,8 +75,14 @@ WifiNetDevice::GetTypeId (void)
|
||||
.AddAttribute ("RemoteStationManager", "The station manager attached to this device.",
|
||||
PointerValue (),
|
||||
MakePointerAccessor (&WifiNetDevice::SetRemoteStationManager,
|
||||
&WifiNetDevice::GetRemoteStationManager),
|
||||
(Ptr<WifiRemoteStationManager> (WifiNetDevice::*) (void) const) &WifiNetDevice::GetRemoteStationManager),
|
||||
MakePointerChecker<WifiRemoteStationManager> ())
|
||||
.AddAttribute ("RemoteStationManagers",
|
||||
"The remote station managers attached to this device (11be multi-link devices only).",
|
||||
ObjectVectorValue (),
|
||||
MakeObjectVectorAccessor (&WifiNetDevice::GetRemoteStationManager,
|
||||
&WifiNetDevice::GetNRemoteStationManagers),
|
||||
MakeObjectVectorChecker<WifiPhy> ())
|
||||
.AddAttribute ("HtConfiguration",
|
||||
"The HtConfiguration object.",
|
||||
PointerValue (),
|
||||
@@ -132,11 +138,15 @@ WifiNetDevice::DoDispose (void)
|
||||
}
|
||||
}
|
||||
m_phys.clear ();
|
||||
if (m_stationManager)
|
||||
for (auto& stationManager : m_stationManagers)
|
||||
{
|
||||
m_stationManager->Dispose ();
|
||||
m_stationManager = 0;
|
||||
if (stationManager != nullptr)
|
||||
{
|
||||
stationManager->Dispose ();
|
||||
stationManager = nullptr;
|
||||
}
|
||||
}
|
||||
m_stationManagers.clear ();
|
||||
if (m_htConfiguration)
|
||||
{
|
||||
m_htConfiguration->Dispose ();
|
||||
@@ -176,9 +186,12 @@ WifiNetDevice::DoInitialize (void)
|
||||
{
|
||||
m_mac->Initialize ();
|
||||
}
|
||||
if (m_stationManager)
|
||||
for (const auto& stationManager : m_stationManagers)
|
||||
{
|
||||
m_stationManager->Initialize ();
|
||||
if (stationManager)
|
||||
{
|
||||
stationManager->Initialize ();
|
||||
}
|
||||
}
|
||||
NetDevice::DoInitialize ();
|
||||
}
|
||||
@@ -188,19 +201,23 @@ WifiNetDevice::CompleteConfig (void)
|
||||
{
|
||||
if (m_mac == 0
|
||||
|| m_phys.empty ()
|
||||
|| m_stationManager == 0
|
||||
|| m_stationManagers.empty ()
|
||||
|| m_node == 0
|
||||
|| m_configComplete)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_mac->SetWifiRemoteStationManager (m_stationManager);
|
||||
NS_ABORT_IF (m_phys.size () != m_stationManagers.size ());
|
||||
m_mac->SetWifiPhys (m_phys);
|
||||
m_mac->SetWifiRemoteStationManagers (m_stationManagers);
|
||||
m_mac->SetForwardUpCallback (MakeCallback (&WifiNetDevice::ForwardUp, this));
|
||||
m_mac->SetLinkUpCallback (MakeCallback (&WifiNetDevice::LinkUp, this));
|
||||
m_mac->SetLinkDownCallback (MakeCallback (&WifiNetDevice::LinkDown, this));
|
||||
m_stationManager->SetupPhy (m_phys[SINGLE_LINK_OP_ID]);
|
||||
m_stationManager->SetupMac (m_mac);
|
||||
for (uint8_t linkId = 0; linkId < m_stationManagers.size (); linkId++)
|
||||
{
|
||||
m_stationManagers.at (linkId)->SetupPhy (m_phys.at (linkId));
|
||||
m_stationManagers.at (linkId)->SetupMac (m_mac);
|
||||
}
|
||||
m_configComplete = true;
|
||||
}
|
||||
|
||||
@@ -246,7 +263,17 @@ WifiNetDevice::SetPhys (const std::vector<Ptr<WifiPhy>>& phys)
|
||||
void
|
||||
WifiNetDevice::SetRemoteStationManager (const Ptr<WifiRemoteStationManager> manager)
|
||||
{
|
||||
m_stationManager = manager;
|
||||
m_stationManagers.clear ();
|
||||
m_stationManagers.push_back (manager);
|
||||
CompleteConfig ();
|
||||
}
|
||||
|
||||
void
|
||||
WifiNetDevice::SetRemoteStationManagers (const std::vector<Ptr<WifiRemoteStationManager>>& managers)
|
||||
{
|
||||
NS_ABORT_MSG_IF (managers.size () > 1 && m_ehtConfiguration == nullptr,
|
||||
"Multiple remote station managers only allowed for 11be multi-link devices");
|
||||
m_stationManagers = managers;
|
||||
CompleteConfig ();
|
||||
}
|
||||
|
||||
@@ -284,7 +311,26 @@ WifiNetDevice::GetNPhys (void) const
|
||||
Ptr<WifiRemoteStationManager>
|
||||
WifiNetDevice::GetRemoteStationManager (void) const
|
||||
{
|
||||
return m_stationManager;
|
||||
return GetRemoteStationManager (0);
|
||||
}
|
||||
|
||||
Ptr<WifiRemoteStationManager>
|
||||
WifiNetDevice::GetRemoteStationManager (uint8_t linkId) const
|
||||
{
|
||||
NS_ASSERT (linkId < GetRemoteStationManagers ().size ());
|
||||
return GetRemoteStationManagers ().at (linkId);
|
||||
}
|
||||
|
||||
const std::vector<Ptr<WifiRemoteStationManager>>&
|
||||
WifiNetDevice::GetRemoteStationManagers (void) const
|
||||
{
|
||||
return m_stationManagers;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
WifiNetDevice::GetNRemoteStationManagers (void) const
|
||||
{
|
||||
return GetRemoteStationManagers ().size ();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -98,6 +98,10 @@ public:
|
||||
* \param manager the manager to use.
|
||||
*/
|
||||
void SetRemoteStationManager (const Ptr<WifiRemoteStationManager> manager);
|
||||
/**
|
||||
* \param managers the managers to use (for 11be multi-link devices only)
|
||||
*/
|
||||
void SetRemoteStationManagers (const std::vector<Ptr<WifiRemoteStationManager>>& managers);
|
||||
/**
|
||||
* \returns the MAC we are currently using.
|
||||
*/
|
||||
@@ -123,8 +127,25 @@ public:
|
||||
uint8_t GetNPhys (void) const;
|
||||
/**
|
||||
* \returns the remote station manager we are currently using.
|
||||
*
|
||||
* This GetRemoteStationManager variant is needed to keep using "RemoteStationManager"
|
||||
* in the path names.
|
||||
*/
|
||||
Ptr<WifiRemoteStationManager> GetRemoteStationManager (void) const;
|
||||
/**
|
||||
* \param linkId the ID (starting at 0) of the link of the RemoteStationManager
|
||||
* object to retrieve
|
||||
* \returns the requested remote station manager
|
||||
*/
|
||||
Ptr<WifiRemoteStationManager> GetRemoteStationManager (uint8_t linkId) const;
|
||||
/**
|
||||
* \returns a const reference to the vector of remote station managers
|
||||
*/
|
||||
virtual const std::vector<Ptr<WifiRemoteStationManager>>& GetRemoteStationManagers (void) const;
|
||||
/**
|
||||
* \returns the number of remote station managers
|
||||
*/
|
||||
uint8_t GetNRemoteStationManagers (void) const;
|
||||
|
||||
/**
|
||||
* \param htConfiguration pointer to HtConfiguration
|
||||
@@ -218,7 +239,7 @@ private:
|
||||
Ptr<Node> m_node; //!< the node
|
||||
std::vector<Ptr<WifiPhy>> m_phys; //!< the phy objects
|
||||
Ptr<WifiMac> m_mac; //!< the MAC
|
||||
Ptr<WifiRemoteStationManager> m_stationManager; //!< the station manager
|
||||
std::vector<Ptr<WifiRemoteStationManager>> m_stationManagers; //!< the station managers
|
||||
Ptr<HtConfiguration> m_htConfiguration; //!< the HtConfiguration
|
||||
Ptr<VhtConfiguration> m_vhtConfiguration; //!< the VhtConfiguration
|
||||
Ptr<HeConfiguration> m_heConfiguration; //!< the HeConfiguration
|
||||
|
||||
Reference in New Issue
Block a user