From a534b60ce080bb3b584736bfb790bcccfdd6bcc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Mon, 16 Jan 2023 18:57:58 +0100 Subject: [PATCH] wifi: Fix bits not cleared before updating Basic HE-MCS And NSS Set in HE Operation IE --- src/wifi/model/he/he-operation.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/wifi/model/he/he-operation.cc b/src/wifi/model/he/he-operation.cc index 0ada054ac..ff4f2603a 100644 --- a/src/wifi/model/he/he-operation.cc +++ b/src/wifi/model/he/he-operation.cc @@ -88,19 +88,27 @@ void HeOperation::SetMaxHeMcsPerNss(uint8_t nss, uint8_t maxHeMcs) { NS_ASSERT((maxHeMcs >= 7 && maxHeMcs <= 11) && (nss >= 1 && nss <= 8)); - uint8_t val = 3; // 3 means not supported - if (maxHeMcs > 9) // MCS 0 - 11 + + // IEEE 802.11ax-2021 9.4.2.248.4 Supported HE-MCS And NSS Set field + uint8_t val = 0x03; // not supported + if (maxHeMcs > 9) // MCS 0 - 11 { - val = 2; + val = 0x02; } else if (maxHeMcs > 7) // MCS 0 - 9 { - val = 1; + val = 0x01; } else if (maxHeMcs == 7) // MCS 0 - 7 { - val = 0; + val = 0x01; } + + // clear bits for that nss + const uint16_t mask = ~(0x03 << ((nss - 1) * 2)); + m_basicHeMcsAndNssSet &= mask; + + // update bits for that nss m_basicHeMcsAndNssSet |= ((val & 0x03) << ((nss - 1) * 2)); }