Skip to content

Commit 0c87bbf

Browse files
DvdMgrstavallo-create
authored andcommitted
wifi: Send CTS-to-self over the bandwidth of the frame it protects
Assisted-by: Claude Code (claude-fable-5)
1 parent 2e348c2 commit 0c87bbf

6 files changed

Lines changed: 39 additions & 12 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This file is a best-effort approach to solving this issue; we will do our best b
2525
* Pcap helpers now use ``LinkType`` enum contained in the ``iana`` namespace (``iana-link-type-numbers.h``).
2626
* (network) After the introduction of the `iana::` enumerations for L2 protocol numbers, the old ones (e.g., `Ipv4L3Protocol::PROT_NUMBER`) have been deprecated.
2727
* Centralized IANA numbers list in ``network/utils`` is now used instead of the constexpr ``PROT_NUMBER`` found in the definition of multiple protocols.
28+
* (wifi) `WifiRemoteStationManager::GetCtsToSelfTxVector()` now takes the channel width of the data frame being protected, so that the returned TXVECTOR covers that bandwidth (using the non-HT duplicate format if wider than 20 MHz).
2829

2930
### Changes to build system
3031

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ been tested on Linux. As of this release, the latest known version to work with
4545
- (sixlowpan) #1342 Fixed a deserialization error in the MESH header.
4646
- (dsr) !2762 Fixes header format to comply with RFC4728. Also other minor bug fixes and modernization.
4747
- (zigbee) In the NWK, broadcast initiator devices are now registered in the BTT to avoid receiving retransmissions.
48+
- (wifi) !2945 CTS-to-self frames are now transmitted over the bandwidth of the frame they protect, so that transmissions in the rest of the TXOP are no longer limited to 20 MHz.
4849

4950
## Release 3.48
5051

src/wifi/model/wifi-default-protection-manager.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ WifiDefaultProtectionManager::GetPsduProtection(const WifiMacHeader& hdr,
222222
if (GetWifiRemoteStationManager()->NeedCtsToSelf(txParams.m_txVector, hdr))
223223
{
224224
auto protection = std::make_unique<WifiCtsToSelfProtection>();
225-
protection->ctsTxVector = GetWifiRemoteStationManager()->GetCtsToSelfTxVector();
225+
protection->ctsTxVector = GetWifiRemoteStationManager()->GetCtsToSelfTxVector(
226+
txParams.m_txVector.GetChannelWidth());
226227
return protection;
227228
}
228229

src/wifi/model/wifi-remote-station-manager.cc

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ WifiRemoteStationManager::GetDataTxVector(const WifiMacHeader& header, MHz_u all
669669
}
670670

671671
WifiTxVector
672-
WifiRemoteStationManager::GetCtsToSelfTxVector()
672+
WifiRemoteStationManager::GetCtsToSelfTxVector(MHz_u allowedWidth)
673673
{
674674
WifiMode defaultMode = GetDefaultMode();
675675
WifiPreamble defaultPreamble;
@@ -694,15 +694,23 @@ WifiRemoteStationManager::GetCtsToSelfTxVector()
694694
defaultPreamble = WIFI_PREAMBLE_LONG;
695695
}
696696

697-
return WifiTxVector(defaultMode,
698-
GetDefaultTxPowerLevel(),
699-
defaultPreamble,
700-
GetGuardIntervalForMode(defaultMode, m_wifiPhy->GetDevice()),
701-
GetNumberOfAntennas(),
702-
1,
703-
0,
704-
m_wifiPhy->GetTxBandwidth(defaultMode),
705-
false);
697+
WifiTxVector v(defaultMode,
698+
GetDefaultTxPowerLevel(),
699+
defaultPreamble,
700+
GetGuardIntervalForMode(defaultMode, m_wifiPhy->GetDevice()),
701+
GetNumberOfAntennas(),
702+
1,
703+
0,
704+
m_wifiPhy->GetTxBandwidth(defaultMode),
705+
false);
706+
707+
// The CTS-to-self must cover the bandwidth of the data transmission it protects,
708+
// because the TXOP holder shall not transmit any PPDU in the TXOP with a bandwidth
709+
// exceeding that of the CTS-to-self frame (Sec. 10.23.2.8 of 802.11-2024); use the
710+
// non-HT duplicate format for bandwidths wider than 20 MHz
711+
AdjustTxVectorForCtlResponse(v, allowedWidth);
712+
713+
return v;
706714
}
707715

708716
void

src/wifi/model/wifi-remote-station-manager.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,10 +949,13 @@ class WifiRemoteStationManager : public Object
949949
* Since CTS-to-self parameters are not dependent on the station,
950950
* it is implemented in wifi remote station manager
951951
*
952+
* @param allowedWidth the width of the data frame being protected, which the
953+
* CTS-to-self must cover (using the non-HT duplicate format if wider
954+
* than 20 MHz)
952955
* @return the transmission mode to use to send the CTS-to-self prior to the
953956
* transmission of the data packet itself.
954957
*/
955-
WifiTxVector GetCtsToSelfTxVector();
958+
WifiTxVector GetCtsToSelfTxVector(MHz_u allowedWidth);
956959
/**
957960
* Adjust the TXVECTOR for a control response frame to ensure that, if appropriate, the non-HT
958961
* duplicate format is used and the TX width matches that of the data frame transmitted (in case

src/wifi/test/wifi-gcr-test.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,19 @@ GcrTestBase::Transmit(std::string context,
446446
NS_TEST_EXPECT_MSG_EQ(mpdu->GetHeader().GetAddr1(),
447447
m_apWifiMac->GetAddress(),
448448
"Incorrect Address1 set for CTS-to-self frame");
449+
// the CTS-to-self must cover the bandwidth of the protected groupcast frame,
450+
// since no PPDU in the TXOP may be wider than the CTS-to-self frame
451+
// (Sec. 10.23.2.8 of 802.11-2024)
452+
const auto expectedCtsWidth =
453+
std::min_element(m_params.stas.cbegin(),
454+
m_params.stas.cend(),
455+
[](const auto& sta1, const auto& sta2) {
456+
return sta1.maxChannelWidth < sta2.maxChannelWidth;
457+
})
458+
->maxChannelWidth;
459+
NS_TEST_EXPECT_MSG_EQ(txVector.GetChannelWidth(),
460+
expectedCtsWidth,
461+
"Incorrect channel width for CTS-to-self frame");
449462
m_nTxApCts++;
450463
}
451464
else

0 commit comments

Comments
 (0)