Skip to content

Commit

Permalink
wifi: (fixes #2764) WifiSpectrumModelId doesn't distinguish 11ax
Browse files Browse the repository at this point in the history
  • Loading branch information
rediet-orange committed Nov 2, 2017
1 parent 90fb309 commit 05f53a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ New user-visible features
Bugs fixed
----------
- Bug 2505 - network: Avoid asserts in Header/Trailer deserialization
- Bug 2764 - wifi: WifiSpectrumModelId doesn't distinguish 11ax from legacy

Known issues
------------
Expand Down
20 changes: 14 additions & 6 deletions src/spectrum/model/wifi-spectrum-value-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,20 @@ struct WifiSpectrumModelId
* Constructor
* \param f the frequency in Mhz
* \param w the channel width in Mhz
* \param b the width of each band (Hz)
*/
WifiSpectrumModelId (uint32_t f, uint8_t w);
WifiSpectrumModelId (uint32_t f, uint8_t w, double b);
uint32_t m_centerFrequency; ///< center frequency
uint8_t m_channelWidth; ///< channel width
double m_bandBandwidth; ///< width of each band (Hz)
};

WifiSpectrumModelId::WifiSpectrumModelId (uint32_t f, uint8_t w)
WifiSpectrumModelId::WifiSpectrumModelId (uint32_t f, uint8_t w, double b)
: m_centerFrequency (f),
m_channelWidth (w)
m_channelWidth (w),
m_bandBandwidth (b)
{
NS_LOG_FUNCTION (this << f << (uint16_t)w);
NS_LOG_FUNCTION (this << f << (uint16_t)w << b);
}

/**
Expand All @@ -60,7 +63,12 @@ WifiSpectrumModelId::WifiSpectrumModelId (uint32_t f, uint8_t w)
bool
operator < (const WifiSpectrumModelId& a, const WifiSpectrumModelId& b)
{
return ( (a.m_centerFrequency < b.m_centerFrequency) || ( (a.m_centerFrequency == b.m_centerFrequency) && (a.m_channelWidth < b.m_channelWidth)));
return ( (a.m_centerFrequency < b.m_centerFrequency)
|| ((a.m_centerFrequency == b.m_centerFrequency) &&
(a.m_channelWidth < b.m_channelWidth))
|| ((a.m_centerFrequency == b.m_centerFrequency) && //to cover coexistence of 11ax with legacy case
(a.m_channelWidth == b.m_channelWidth) &&
(a.m_bandBandwidth < b.m_bandBandwidth)));
}

static std::map<WifiSpectrumModelId, Ptr<SpectrumModel> > g_wifiSpectrumModelMap; ///< static initializer for the class
Expand All @@ -70,7 +78,7 @@ WifiSpectrumValueHelper::GetSpectrumModel (uint32_t centerFrequency, uint8_t cha
{
NS_LOG_FUNCTION (centerFrequency << (uint16_t)channelWidth << bandBandwidth << (uint16_t)guardBandwidth);
Ptr<SpectrumModel> ret;
WifiSpectrumModelId key (centerFrequency, channelWidth);
WifiSpectrumModelId key (centerFrequency, channelWidth, bandBandwidth);
std::map<WifiSpectrumModelId, Ptr<SpectrumModel> >::iterator it = g_wifiSpectrumModelMap.find (key);
if (it != g_wifiSpectrumModelMap.end ())
{
Expand Down

0 comments on commit 05f53a6

Please sign in to comment.