Skip to content

Commit

Permalink
wifi: Make HtConfiguration member variables public
Browse files Browse the repository at this point in the history
..unless they require non-trivial setter/getter.
  • Loading branch information
Stefano Avallone committed Nov 5, 2024
1 parent 387414b commit 769ffe3
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This file is a best-effort approach to solving this issue; we will do our best b
* (applications) Deprecated attributes `RemoteAddress` and `RemotePort` in UdpClient, UdpTraceClient and UdpEchoClient. They have been combined into a single `Remote` attribute.
* (applications) Deprecated attributes `ThreeGppHttpClient::RemoteServerAddress` and `ThreeGppHttpClient::RemoteServerPort`. They have been combined into a single `ThreeGppHttpClient::Remote` attribute.
* (wifi) Added a new **ProtectedIfResponded** attribute to `FrameExchangeManager` to disable RTS/CTS protection for stations that have already responded to a frame requiring acknowledgment in the same TXOP, even if such frame had not been protected by RTS/CTS. The default value is true, even though it represents a change with respect to the previous behavior, because it is likely a more realistic choice.
* (wifi) Deprecated setters/getters of the {Ht,Vht,He}Configuration classes that trivially set/get member variables, which have been made public and hence accessible to users.

### Changes to build system

Expand Down
4 changes: 2 additions & 2 deletions src/wifi/examples/wifi-manager-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,9 @@ main(int argc, char* argv[])
serverSelectedStandard.m_name == "802.11ac")
{
Ptr<HtConfiguration> clientHtConfiguration = wndClient->GetHtConfiguration();
clientHtConfiguration->SetShortGuardIntervalSupported(clientShortGuardInterval == 400);
clientHtConfiguration->m_sgiSupported = (clientShortGuardInterval == 400);
Ptr<HtConfiguration> serverHtConfiguration = wndServer->GetHtConfiguration();
serverHtConfiguration->SetShortGuardIntervalSupported(serverShortGuardInterval == 400);
serverHtConfiguration->m_sgiSupported = (serverShortGuardInterval == 400);
}
else if (serverSelectedStandard.m_name == "802.11ax-6GHz" ||
serverSelectedStandard.m_name == "802.11ax-5GHz" ||
Expand Down
8 changes: 4 additions & 4 deletions src/wifi/model/ap-wifi-mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -819,10 +819,10 @@ ApWifiMac::GetHtOperation(uint8_t linkId) const
{
uint8_t nss = (mcs.GetMcsValue() / 8) + 1;
NS_ASSERT(nss > 0 && nss < 5);
uint64_t dataRate = mcs.GetDataRate(
phy->GetChannelWidth(),
NanoSeconds(GetHtConfiguration()->GetShortGuardIntervalSupported() ? 400 : 800),
nss);
uint64_t dataRate =
mcs.GetDataRate(phy->GetChannelWidth(),
NanoSeconds(GetHtConfiguration()->m_sgiSupported ? 400 : 800),
nss);
if (dataRate > maxSupportedRate)
{
maxSupportedRate = dataRate;
Expand Down
9 changes: 3 additions & 6 deletions src/wifi/model/ht/ht-configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,17 @@ HtConfiguration::GetTypeId()
.AddAttribute("ShortGuardIntervalSupported",
"Whether or not short guard interval is supported.",
BooleanValue(false),
MakeBooleanAccessor(&HtConfiguration::GetShortGuardIntervalSupported,
&HtConfiguration::SetShortGuardIntervalSupported),
MakeBooleanAccessor(&HtConfiguration::m_sgiSupported),
MakeBooleanChecker())
.AddAttribute("LdpcSupported",
"Whether or not LDPC coding is supported.",
BooleanValue(false),
MakeBooleanAccessor(&HtConfiguration::GetLdpcSupported,
&HtConfiguration::SetLdpcSupported),
MakeBooleanAccessor(&HtConfiguration::m_ldpcSupported),
MakeBooleanChecker())
.AddAttribute("Support40MHzOperation",
"Whether or not 40 MHz operation is to be supported.",
BooleanValue(true),
MakeBooleanAccessor(&HtConfiguration::Get40MHzOperationSupported,
&HtConfiguration::Set40MHzOperationSupported),
MakeBooleanAccessor(&HtConfiguration::m_40MHzSupported),
MakeBooleanChecker());
return tid;
}
Expand Down
13 changes: 12 additions & 1 deletion src/wifi/model/ht/ht-configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef HT_CONFIGURATION_H
#define HT_CONFIGURATION_H

#include "ns3/deprecated.h"
#include "ns3/object.h"

namespace ns3
Expand Down Expand Up @@ -40,42 +41,52 @@ class HtConfiguration : public Object
* \param enable true if SGI is to be supported,
* false otherwise
*/
NS_DEPRECATED_3_44("Set the m_sgiSupported member variable instead")
void SetShortGuardIntervalSupported(bool enable);

/**
* \return whether the device supports SGI.
*
* \return true if SGI is supported,
* false otherwise.
*/
NS_DEPRECATED_3_44("Get the m_sgiSupported member variable instead")
bool GetShortGuardIntervalSupported() const;

/**
* Enable or disable LDPC support.
*
* \param enable true if LDPC is to be supported,
* false otherwise
*/
NS_DEPRECATED_3_44("Set the m_ldpcSupported member variable instead")
void SetLdpcSupported(bool enable);

/**
* \return whether the device supports LDPC.
*
* \return true if LDPC is supported,
* false otherwise.
*/
NS_DEPRECATED_3_44("Get the m_ldpcSupported member variable instead")
bool GetLdpcSupported() const;

/**
* Enable or disable 40 MHz operation support.
*
* \param enable true if both 20 MHz and 40 MHz operation is to be supported,
* false if only 20 MHz operation is to be supported
*/
NS_DEPRECATED_3_44("Set the m_40MHzSupported member variable instead")
void Set40MHzOperationSupported(bool enable);

/**
* \return true if both 20 MHz and 40 MHz operation is supported, false if
* only 20 MHz operation is supported
*/
NS_DEPRECATED_3_44("Get the m_40MHzSupported member variable instead")
bool Get40MHzOperationSupported() const;

private:
bool m_sgiSupported; ///< flag whether short guard interval is supported
bool m_ldpcSupported; ///< flag whether LDPC coding is supported
bool m_40MHzSupported; ///< whether 40 MHz operation is supported
Expand Down
21 changes: 10 additions & 11 deletions src/wifi/model/wifi-mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2130,9 +2130,9 @@ WifiMac::GetHtCapabilities(uint8_t linkId) const

auto phy = GetWifiPhy(linkId);
Ptr<HtConfiguration> htConfiguration = GetHtConfiguration();
bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported();
capabilities.SetLdpc(htConfiguration->GetLdpcSupported());
capabilities.SetSupportedChannelWidth(htConfiguration->Get40MHzOperationSupported() ? 1 : 0);
bool sgiSupported = htConfiguration->m_sgiSupported;
capabilities.SetLdpc(htConfiguration->m_ldpcSupported);
capabilities.SetSupportedChannelWidth(htConfiguration->m_40MHzSupported ? 1 : 0);
capabilities.SetShortGuardInterval20(sgiSupported);
capabilities.SetShortGuardInterval40(sgiSupported);
// Set Maximum A-MSDU Length subfield
Expand Down Expand Up @@ -2160,7 +2160,7 @@ WifiMac::GetHtCapabilities(uint8_t linkId) const
capabilities.SetRxMcsBitmask(mcs.GetMcsValue());
uint8_t nss = (mcs.GetMcsValue() / 8) + 1;
NS_ASSERT(nss > 0 && nss < 5);
uint64_t dataRate = mcs.GetDataRate(htConfiguration->Get40MHzOperationSupported() ? 40 : 20,
uint64_t dataRate = mcs.GetDataRate(htConfiguration->m_40MHzSupported ? 40 : 20,
NanoSeconds(sgiSupported ? 400 : 800),
nss);
if (dataRate > maxSupportedRate)
Expand Down Expand Up @@ -2189,10 +2189,10 @@ WifiMac::GetVhtCapabilities(uint8_t linkId) const

auto phy = GetWifiPhy(linkId);
Ptr<HtConfiguration> htConfiguration = GetHtConfiguration();
NS_ABORT_MSG_IF(!htConfiguration->Get40MHzOperationSupported(),
NS_ABORT_MSG_IF(!htConfiguration->m_40MHzSupported,
"VHT stations have to support 40 MHz operation");
Ptr<VhtConfiguration> vhtConfiguration = GetVhtConfiguration();
bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported();
bool sgiSupported = htConfiguration->m_sgiSupported;
capabilities.SetSupportedChannelWidthSet(vhtConfiguration->m_160MHzSupported ? 1 : 0);
// Set Maximum MPDU Length subfield
uint16_t maxAmsduSize =
Expand All @@ -2216,7 +2216,7 @@ WifiMac::GetVhtCapabilities(uint8_t linkId) const
// The maximum A-MPDU length in VHT capabilities elements ranges from 2^13-1 to 2^20-1
capabilities.SetMaxAmpduLength(std::min(std::max(maxAmpduLength, 8191U), 1048575U));

capabilities.SetRxLdpc(htConfiguration->GetLdpcSupported());
capabilities.SetRxLdpc(htConfiguration->m_ldpcSupported);
capabilities.SetShortGuardIntervalFor80Mhz(sgiSupported);
capabilities.SetShortGuardIntervalFor160Mhz(sgiSupported);
uint8_t maxMcs = 0;
Expand Down Expand Up @@ -2273,8 +2273,7 @@ WifiMac::GetHeCapabilities(uint8_t linkId) const
Ptr<VhtConfiguration> vhtConfiguration = GetVhtConfiguration();
Ptr<HeConfiguration> heConfiguration = GetHeConfiguration();
uint8_t channelWidthSet = 0;
if ((htConfiguration->Get40MHzOperationSupported()) &&
(phy->GetPhyBand() == WIFI_PHY_BAND_2_4GHZ))
if ((htConfiguration->m_40MHzSupported) && (phy->GetPhyBand() == WIFI_PHY_BAND_2_4GHZ))
{
channelWidthSet |= 0x01;
}
Expand All @@ -2289,7 +2288,7 @@ WifiMac::GetHeCapabilities(uint8_t linkId) const
channelWidthSet |= 0x04;
}
capabilities.SetChannelWidthSet(channelWidthSet);
capabilities.SetLdpcCodingInPayload(htConfiguration->GetLdpcSupported());
capabilities.SetLdpcCodingInPayload(htConfiguration->m_ldpcSupported);
if (heConfiguration->GetGuardInterval().GetNanoSeconds() == 800)
{
// todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well
Expand Down Expand Up @@ -2400,7 +2399,7 @@ WifiMac::GetEhtCapabilities(uint8_t linkId) const

const uint8_t maxTxNss = phy->GetMaxSupportedTxSpatialStreams();
const uint8_t maxRxNss = phy->GetMaxSupportedRxSpatialStreams();
if (auto htConfig = GetHtConfiguration(); !htConfig->Get40MHzOperationSupported())
if (auto htConfig = GetHtConfiguration(); !htConfig->m_40MHzSupported)
{
for (auto maxMcs : {7, 9, 11, 13})
{
Expand Down
2 changes: 1 addition & 1 deletion src/wifi/model/wifi-phy-common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GetGuardIntervalForMode(WifiMode mode, const Ptr<WifiNetDevice> device)
Ptr<HtConfiguration> htConfiguration = device->GetHtConfiguration();
NS_ASSERT(htConfiguration); // If HT/VHT modulation is used, we should have a HT
// configuration attached
gi = NanoSeconds(htConfiguration->GetShortGuardIntervalSupported() ? 400 : 800);
gi = NanoSeconds(htConfiguration->m_sgiSupported ? 400 : 800);
}
return gi;
}
Expand Down
2 changes: 1 addition & 1 deletion src/wifi/model/wifi-phy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ WifiPhy::DoChannelSwitch()
if (m_device)
{
if (auto htConfig = m_device->GetHtConfiguration();
htConfig && !htConfig->Get40MHzOperationSupported() && chWidth > 20)
htConfig && !htConfig->m_40MHzSupported && chWidth > 20)
{
NS_ABORT_MSG("Attempting to set a " << chWidth
<< " MHz channel on"
Expand Down
4 changes: 2 additions & 2 deletions src/wifi/model/wifi-remote-station-manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ WifiRemoteStationManager::GetLdpcSupported() const
{
if (auto htConfiguration = m_wifiPhy->GetDevice()->GetHtConfiguration())
{
return htConfiguration->GetLdpcSupported();
return htConfiguration->m_ldpcSupported;
}
return false;
}
Expand All @@ -281,7 +281,7 @@ WifiRemoteStationManager::GetShortGuardIntervalSupported() const
{
if (auto htConfiguration = m_wifiPhy->GetDevice()->GetHtConfiguration())
{
return htConfiguration->GetShortGuardIntervalSupported();
return htConfiguration->m_sgiSupported;
}
return false;
}
Expand Down

0 comments on commit 769ffe3

Please sign in to comment.