From f0e9f13480bb70e12f10b0a58ec594ee37baed0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Sun, 21 Feb 2021 15:18:45 +0100 Subject: [PATCH] wifi: Add initial EHT configuration --- src/wifi/CMakeLists.txt | 2 + src/wifi/helper/wifi-helper.cc | 6 +++ src/wifi/model/eht/eht-configuration.cc | 51 ++++++++++++++++++++++++ src/wifi/model/eht/eht-configuration.h | 52 +++++++++++++++++++++++++ src/wifi/model/wifi-net-device.cc | 23 +++++++++++ src/wifi/model/wifi-net-device.h | 10 +++++ 6 files changed, 144 insertions(+) create mode 100644 src/wifi/model/eht/eht-configuration.cc create mode 100644 src/wifi/model/eht/eht-configuration.h diff --git a/src/wifi/CMakeLists.txt b/src/wifi/CMakeLists.txt index 9062a3816..3e731f386 100644 --- a/src/wifi/CMakeLists.txt +++ b/src/wifi/CMakeLists.txt @@ -25,6 +25,7 @@ set(source_files model/channel-access-manager.cc model/ctrl-headers.cc model/edca-parameter-set.cc + model/eht/eht-configuration.cc model/error-rate-model.cc model/extended-capabilities.cc model/frame-capture-model.cc @@ -159,6 +160,7 @@ set(header_files model/channel-access-manager.h model/ctrl-headers.h model/edca-parameter-set.h + model/eht/eht-configuration.h model/error-rate-model.h model/extended-capabilities.h model/frame-capture-model.h diff --git a/src/wifi/helper/wifi-helper.cc b/src/wifi/helper/wifi-helper.cc index 71173c14e..a4388c421 100644 --- a/src/wifi/helper/wifi-helper.cc +++ b/src/wifi/helper/wifi-helper.cc @@ -36,6 +36,7 @@ #include "ns3/ht-configuration.h" #include "ns3/vht-configuration.h" #include "ns3/he-configuration.h" +#include "ns3/eht-configuration.h" #include "ns3/obss-pd-algorithm.h" #include "ns3/wifi-mac-trailer.h" #include "wifi-helper.h" @@ -718,6 +719,11 @@ WifiHelper::Install (const WifiPhyHelper &phyHelper, Ptr heConfiguration = CreateObject (); device->SetHeConfiguration (heConfiguration); } + if (m_standard >= WIFI_STANDARD_80211be) + { + Ptr ehtConfiguration = CreateObject (); + device->SetEhtConfiguration (ehtConfiguration); + } Ptr manager = m_stationManager.Create (); Ptr phy = phyHelper.Create (node, device); phy->ConfigureStandard (m_standard); diff --git a/src/wifi/model/eht/eht-configuration.cc b/src/wifi/model/eht/eht-configuration.cc new file mode 100644 index 000000000..2ff96cacb --- /dev/null +++ b/src/wifi/model/eht/eht-configuration.cc @@ -0,0 +1,51 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2021 DERONNE SOFTWARE ENGINEERING + * + * 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: Sébastien Deronne + */ + +#include "ns3/log.h" +#include "eht-configuration.h" + +namespace ns3 { + +NS_LOG_COMPONENT_DEFINE ("EhtConfiguration"); + +NS_OBJECT_ENSURE_REGISTERED (EhtConfiguration); + +EhtConfiguration::EhtConfiguration () +{ + NS_LOG_FUNCTION (this); +} + +EhtConfiguration::~EhtConfiguration () +{ + NS_LOG_FUNCTION (this); +} + +TypeId +EhtConfiguration::GetTypeId (void) +{ + static ns3::TypeId tid = ns3::TypeId ("ns3::EhtConfiguration") + .SetParent () + .SetGroupName ("Wifi") + .AddConstructor () + ; + return tid; +} + +} //namespace ns3 diff --git a/src/wifi/model/eht/eht-configuration.h b/src/wifi/model/eht/eht-configuration.h new file mode 100644 index 000000000..c19efbf7e --- /dev/null +++ b/src/wifi/model/eht/eht-configuration.h @@ -0,0 +1,52 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2021 DERONNE SOFTWARE ENGINEERING + * + * 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: Sébastien Deronne + */ + +#ifndef EHT_CONFIGURATION_H +#define EHT_CONFIGURATION_H + +#include "ns3/object.h" + +namespace ns3 { + +/** + * \brief EHT configuration + * \ingroup wifi + * + * This object stores EHT configuration information, for use in modifying + * AP or STA behavior and for constructing EHT-related information elements. + * + */ +class EhtConfiguration : public Object +{ +public: + EhtConfiguration (); + virtual ~EhtConfiguration (); + + /** + * \brief Get the type ID. + * \return the object TypeId + */ + static TypeId GetTypeId (void); + +}; + +} //namespace ns3 + +#endif /* EHT_CONFIGURATION_H */ diff --git a/src/wifi/model/wifi-net-device.cc b/src/wifi/model/wifi-net-device.cc index c6b483ba3..4833f295f 100644 --- a/src/wifi/model/wifi-net-device.cc +++ b/src/wifi/model/wifi-net-device.cc @@ -30,6 +30,7 @@ #include "ns3/ht-configuration.h" #include "ns3/vht-configuration.h" #include "ns3/he-configuration.h" +#include "ns3/eht-configuration.h" namespace ns3 { @@ -83,6 +84,11 @@ WifiNetDevice::GetTypeId (void) PointerValue (), MakePointerAccessor (&WifiNetDevice::GetHeConfiguration), MakePointerChecker ()) + .AddAttribute ("EhtConfiguration", + "The EhtConfiguration object.", + PointerValue (), + MakePointerAccessor (&WifiNetDevice::GetEhtConfiguration), + MakePointerChecker ()) ; return tid; } @@ -134,6 +140,11 @@ WifiNetDevice::DoDispose (void) m_heConfiguration->Dispose (); m_heConfiguration = 0; } + if (m_ehtConfiguration) + { + m_ehtConfiguration->Dispose (); + m_ehtConfiguration = 0; + } NetDevice::DoDispose (); } @@ -497,4 +508,16 @@ WifiNetDevice::GetHeConfiguration (void) const return (m_standard >= WIFI_STANDARD_80211ax ? m_heConfiguration : nullptr); } +void +WifiNetDevice::SetEhtConfiguration (Ptr ehtConfiguration) +{ + m_ehtConfiguration = ehtConfiguration; +} + +Ptr +WifiNetDevice::GetEhtConfiguration (void) const +{ + return (m_standard >= WIFI_STANDARD_80211be ? m_ehtConfiguration : nullptr); +} + } //namespace ns3 diff --git a/src/wifi/model/wifi-net-device.h b/src/wifi/model/wifi-net-device.h index 508a20428..7aaa9c418 100644 --- a/src/wifi/model/wifi-net-device.h +++ b/src/wifi/model/wifi-net-device.h @@ -33,6 +33,7 @@ class WifiMac; class HtConfiguration; class VhtConfiguration; class HeConfiguration; +class EhtConfiguration; /// This value conforms to the 802.11 specification static const uint16_t MAX_MSDU_SIZE = 2304; @@ -129,6 +130,14 @@ public: * \return pointer to HeConfiguration if it exists */ Ptr GetHeConfiguration (void) const; + /** + * \param ehtConfiguration pointer to EhtConfiguration + */ + void SetEhtConfiguration (Ptr ehtConfiguration); + /** + * \return pointer to EhtConfiguration if it exists + */ + Ptr GetEhtConfiguration (void) const; void SetIfIndex (const uint32_t index) override; uint32_t GetIfIndex (void) const override; @@ -193,6 +202,7 @@ private: Ptr m_htConfiguration; //!< the HtConfiguration Ptr m_vhtConfiguration; //!< the VhtConfiguration Ptr m_heConfiguration; //!< the HeConfiguration + Ptr m_ehtConfiguration; //!< the EhtConfiguration NetDevice::ReceiveCallback m_forwardUp; //!< forward up callback NetDevice::PromiscReceiveCallback m_promiscRx; //!< promiscuous receive callback