From 9fdb1822e0e6151741fec559cf5ea871ca9527f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Mon, 22 May 2023 18:11:30 +0200 Subject: [PATCH] wifi: Add 80+80MHz support for WifiPpdu::DoesOverlapChannel --- src/wifi/model/wifi-ppdu.cc | 75 +++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index 97785142f..34d374fa5 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -196,39 +196,48 @@ WifiPpdu::GetTxCenterFreqs() const bool WifiPpdu::DoesOverlapChannel(uint16_t minFreq, uint16_t maxFreq) const { - NS_LOG_FUNCTION(this << m_txCenterFreqs.front() << minFreq << maxFreq); - uint16_t minTxFreq = m_txCenterFreqs.front() - m_txChannelWidth / 2; - uint16_t maxTxFreq = m_txCenterFreqs.front() + m_txChannelWidth / 2; - /** - * The PPDU does not overlap the channel in two cases. - * - * First non-overlapping case: - * - * ┌─────────┐ - * PPDU │ Nominal │ - * │ Band │ - * └─────────┘ - * minTxFreq maxTxFreq - * - * minFreq maxFreq - * ┌──────────────────────────────┐ - * │ Channel │ - * └──────────────────────────────┘ - * - * Second non-overlapping case: - * - * ┌─────────┐ - * PPDU │ Nominal │ - * │ Band │ - * └─────────┘ - * minTxFreq maxTxFreq - * - * minFreq maxFreq - * ┌──────────────────────────────┐ - * │ Channel │ - * └──────────────────────────────┘ - */ - return minTxFreq < maxFreq && maxTxFreq > minFreq; + NS_LOG_FUNCTION(this << minFreq << maxFreq); + // all segments have the same width + const auto txChannelWidth = (m_txChannelWidth / m_txCenterFreqs.size()); + for (auto txCenterFreq : m_txCenterFreqs) + { + const auto minTxFreq = txCenterFreq - txChannelWidth / 2; + const auto maxTxFreq = txCenterFreq + txChannelWidth / 2; + /** + * The PPDU does not overlap the channel in two cases. + * + * First non-overlapping case: + * + * ┌─────────┐ + * PPDU │ Nominal │ + * │ Band │ + * └─────────┘ + * minTxFreq maxTxFreq + * + * minFreq maxFreq + * ┌──────────────────────────────┐ + * │ Channel │ + * └──────────────────────────────┘ + * + * Second non-overlapping case: + * + * ┌─────────┐ + * PPDU │ Nominal │ + * │ Band │ + * └─────────┘ + * minTxFreq maxTxFreq + * + * minFreq maxFreq + * ┌──────────────────────────────┐ + * │ Channel │ + * └──────────────────────────────┘ + */ + if ((minTxFreq < maxFreq) && (maxTxFreq > minFreq)) + { + return true; + } + } + return false; } uint64_t