From 4cbde630e2d37fa33c73458cb20f9f8f50fd295b Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Sun, 7 Aug 2022 23:07:46 +0200 Subject: [PATCH] wifi: Fix condition in WifiPpdu::DoesOverlapChannel --- src/wifi/model/wifi-ppdu.cc | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index 2cbc4a5ea..415b95f34 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -115,7 +115,36 @@ WifiPpdu::DoesOverlapChannel (uint16_t minFreq, uint16_t maxFreq) const uint16_t txChannelWidth = GetTxVector ().GetChannelWidth (); uint16_t minTxFreq = m_txCenterFreq - txChannelWidth / 2; uint16_t maxTxFreq = m_txCenterFreq + txChannelWidth / 2; - if (minTxFreq > minFreq || maxTxFreq < maxFreq) + /** + * 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 false; }