wifi: Allow use of CTS-to-self as protection for groupcast frames

This commit is contained in:
Sébastien Deronne
2023-08-15 12:23:05 +02:00
parent 636f421756
commit 5cfd3c1c87
3 changed files with 16 additions and 6 deletions

View File

@@ -212,7 +212,7 @@ WifiDefaultProtectionManager::GetPsduProtection(const WifiMacHeader& hdr,
}
// check if CTS-to-Self is needed
if (GetWifiRemoteStationManager()->NeedCtsToSelf(txParams.m_txVector))
if (GetWifiRemoteStationManager()->NeedCtsToSelf(txParams.m_txVector, hdr))
{
auto protection = std::make_unique<WifiCtsToSelfProtection>();
protection->ctsTxVector = GetWifiRemoteStationManager()->GetCtsToSelfTxVector();

View File

@@ -1225,9 +1225,9 @@ WifiRemoteStationManager::NeedRts(const WifiMacHeader& header, const WifiTxParam
}
bool
WifiRemoteStationManager::NeedCtsToSelf(const WifiTxVector& txVector)
WifiRemoteStationManager::NeedCtsToSelf(const WifiTxVector& txVector, const WifiMacHeader& header)
{
NS_LOG_FUNCTION(this << txVector);
NS_LOG_FUNCTION(this << txVector << header);
if (m_useNonErpProtection && m_erpProtectionMode == CTS_TO_SELF &&
((txVector.GetModulationClass() == WIFI_MOD_CLASS_ERP_OFDM) ||
(txVector.GetModulationClass() == WIFI_MOD_CLASS_HT) ||
@@ -1248,6 +1248,16 @@ WifiRemoteStationManager::NeedCtsToSelf(const WifiTxVector& txVector)
"WifiRemoteStationManager::NeedCtsToSelf returning true to protect non-HT stations");
return true;
}
else if (IsGcr(m_wifiMac, header))
{
EnumValue<GroupcastProtectionMode> enumValue;
auto apMac = DynamicCast<ApWifiMac>(m_wifiMac);
apMac->GetGcrManager()->GetAttribute("GcrProtectionMode", enumValue);
if (enumValue.Get() == GroupcastProtectionMode::CTS_TO_SELF)
{
return true;
}
}
// FIXME: commented out for now
/*else if (!m_useNonErpProtection)
{

View File

@@ -1022,12 +1022,12 @@ class WifiRemoteStationManager : public Object
/**
* Return if we need to do CTS-to-self before sending a DATA.
*
* @param txVector the TXVECTOR of the packet to be sent
*
* @param txVector the TXVECTOR of the DATA
* @param header the MAC header of the DATA
* @return true if CTS-to-self is needed,
* false otherwise
*/
bool NeedCtsToSelf(const WifiTxVector& txVector);
bool NeedCtsToSelf(const WifiTxVector& txVector, const WifiMacHeader& header);
/**
* @param mpdu the MPDU to send