wifi: Add the EmlsrManager base class

This commit is contained in:
Stefano Avallone
2023-01-30 18:58:53 +01:00
committed by Stefano Avallone
parent 997a676576
commit d653a8871c
4 changed files with 181 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ set(source_files
model/eht/tid-to-link-mapping-element.cc
model/eht/eht-phy.cc
model/eht/eht-ppdu.cc
model/eht/emlsr-manager.cc
model/eht/multi-link-element.cc
model/error-rate-model.cc
model/extended-capabilities.cc
@@ -180,6 +181,7 @@ set(header_files
model/eht/tid-to-link-mapping-element.h
model/eht/eht-phy.h
model/eht/eht-ppdu.h
model/eht/emlsr-manager.h
model/eht/multi-link-element.h
model/error-rate-model.h
model/extended-capabilities.h

View File

@@ -900,6 +900,7 @@ WifiHelper::EnableLogComponents()
LogComponentEnable("DsssErrorRateModel", LOG_LEVEL_ALL);
LogComponentEnable("DsssPhy", LOG_LEVEL_ALL);
LogComponentEnable("DsssPpdu", LOG_LEVEL_ALL);
LogComponentEnable("EmlsrManager", LOG_LEVEL_ALL);
LogComponentEnable("EhtFrameExchangeManager", LOG_LEVEL_ALL);
LogComponentEnable("ErpOfdmPhy", LOG_LEVEL_ALL);
LogComponentEnable("ErpOfdmPpdu", LOG_LEVEL_ALL);

View File

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2023 Universita' degli Studi di Napoli Federico II
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Stefano Avallone <stavallo@unina.it>
*/
#include "emlsr-manager.h"
#include "eht-configuration.h"
#include "eht-frame-exchange-manager.h"
#include "ns3/abort.h"
#include "ns3/log.h"
namespace ns3
{
NS_LOG_COMPONENT_DEFINE("EmlsrManager");
NS_OBJECT_ENSURE_REGISTERED(EmlsrManager);
TypeId
EmlsrManager::GetTypeId()
{
static TypeId tid =
TypeId("ns3::EmlsrManager")
.SetParent<Object>()
.SetGroupName("Wifi")
.AddAttribute("EmlsrPaddingDelay",
"The EMLSR Paddind Delay (not used by AP MLDs). "
"Possible values are 0 us, 32 us, 64 us, 128 us or 256 us.",
TimeValue(MicroSeconds(0)),
MakeTimeAccessor(&EmlsrManager::m_emlsrPaddingDelay),
MakeTimeChecker(MicroSeconds(0), MicroSeconds(256)))
.AddAttribute("EmlsrTransitionDelay",
"The EMLSR Transition Delay (not used by AP MLDs). "
"Possible values are 0 us, 16 us, 32 us, 64 us, 128 us or 256 us.",
TimeValue(MicroSeconds(0)),
MakeTimeAccessor(&EmlsrManager::m_emlsrTransitionDelay),
MakeTimeChecker(MicroSeconds(0), MicroSeconds(256)));
return tid;
}
EmlsrManager::EmlsrManager()
{
NS_LOG_FUNCTION(this);
}
EmlsrManager::~EmlsrManager()
{
NS_LOG_FUNCTION_NOARGS();
}
void
EmlsrManager::DoDispose()
{
NS_LOG_FUNCTION(this);
m_staMac = nullptr;
Object::DoDispose();
}
void
EmlsrManager::SetWifiMac(Ptr<StaWifiMac> mac)
{
NS_LOG_FUNCTION(this << mac);
NS_ASSERT(mac);
m_staMac = mac;
NS_ABORT_MSG_IF(!m_staMac->GetEhtConfiguration(), "EmlsrManager requires EHT support");
NS_ABORT_MSG_IF(m_staMac->GetNLinks() <= 1, "EmlsrManager can only be installed on MLDs");
NS_ABORT_MSG_IF(m_staMac->GetTypeOfStation() != STA,
"EmlsrManager can only be installed on non-AP MLDs");
}
Ptr<StaWifiMac>
EmlsrManager::GetStaMac() const
{
return m_staMac;
}
Ptr<EhtFrameExchangeManager>
EmlsrManager::GetEhtFem(uint8_t linkId) const
{
return StaticCast<EhtFrameExchangeManager>(m_staMac->GetFrameExchangeManager(linkId));
}
} // namespace ns3

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2023 Universita' degli Studi di Napoli Federico II
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Stefano Avallone <stavallo@unina.it>
*/
#ifndef EMLSR_MANAGER_H
#define EMLSR_MANAGER_H
#include "ns3/object.h"
#include "ns3/sta-wifi-mac.h"
namespace ns3
{
class EhtFrameExchangeManager;
/**
* \ingroup wifi
*
* EmlsrManager is an abstract base class defining the API that EHT non-AP MLDs
* with EMLSR activated can use to handle the operations on the EMLSR links
*/
class EmlsrManager : public Object
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId();
EmlsrManager();
~EmlsrManager() override;
/**
* Set the wifi MAC. Note that it must be the MAC of an EHT non-AP MLD.
*
* \param mac the wifi MAC
*/
void SetWifiMac(Ptr<StaWifiMac> mac);
protected:
void DoDispose() override;
/**
* \return the MAC of the non-AP MLD managed by this EMLSR Manager.
*/
Ptr<StaWifiMac> GetStaMac() const;
/**
* \param linkId the ID of the given link
* \return the EHT FrameExchangeManager attached to the non-AP STA operating on the given link
*/
Ptr<EhtFrameExchangeManager> GetEhtFem(uint8_t linkId) const;
Time m_emlsrPaddingDelay; //!< EMLSR Padding delay
Time m_emlsrTransitionDelay; //!< EMLSR Transition delay
private:
Ptr<StaWifiMac> m_staMac; //!< the MAC of the managed non-AP MLD
};
} // namespace ns3
#endif /* EMLSR_MANAGER_H */