wifi: (fixes #2327) CWmin value selection based on 802.11g standard rules
This commit is contained in:
@@ -577,15 +577,13 @@ ApWifiMac::SendOneBeacon (void)
|
||||
{
|
||||
if (GetShortSlotTimeEnabled () == true)
|
||||
{
|
||||
//Enable short slot time and set cwMin to 15
|
||||
//Enable short slot time
|
||||
SetSlot (MicroSeconds (9));
|
||||
ConfigureContentionWindow (15, 1023);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Disable short slot time and set CWmin to 31
|
||||
//Disable short slot time
|
||||
SetSlot (MicroSeconds (20));
|
||||
ConfigureContentionWindow (31, 1023);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1091,7 +1091,10 @@ RegularWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
|
||||
case WIFI_PHY_STANDARD_80211ac:
|
||||
SetVhtSupported (true);
|
||||
case WIFI_PHY_STANDARD_80211n_5GHZ:
|
||||
case WIFI_PHY_STANDARD_80211n_2_4GHZ:
|
||||
SetHtSupported (true);
|
||||
case WIFI_PHY_STANDARD_80211g:
|
||||
m_erpSupported = true;
|
||||
case WIFI_PHY_STANDARD_holland:
|
||||
case WIFI_PHY_STANDARD_80211a:
|
||||
case WIFI_PHY_STANDARD_80211_10MHZ:
|
||||
@@ -1099,10 +1102,6 @@ RegularWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
|
||||
cwmin = 15;
|
||||
cwmax = 1023;
|
||||
break;
|
||||
case WIFI_PHY_STANDARD_80211n_2_4GHZ:
|
||||
SetHtSupported (true);
|
||||
case WIFI_PHY_STANDARD_80211g:
|
||||
m_erpSupported = true;
|
||||
case WIFI_PHY_STANDARD_80211b:
|
||||
cwmin = 31;
|
||||
cwmax = 1023;
|
||||
|
||||
@@ -530,15 +530,13 @@ StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
|
||||
}
|
||||
if (capabilities.IsShortSlotTime () == true)
|
||||
{
|
||||
//enable short slot time and set cwMin to 15
|
||||
//enable short slot time
|
||||
SetSlot (MicroSeconds (9));
|
||||
ConfigureContentionWindow (15, 1023);
|
||||
}
|
||||
else
|
||||
{
|
||||
//disable short slot time and set cwMin to 31
|
||||
//disable short slot time
|
||||
SetSlot (MicroSeconds (20));
|
||||
ConfigureContentionWindow (31, 1023);
|
||||
}
|
||||
}
|
||||
m_stationManager->SetShortPreambleEnabled (isShortPreambleEnabled);
|
||||
@@ -589,27 +587,37 @@ StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
|
||||
bool isShortPreambleEnabled = capabilities.IsShortPreamble ();
|
||||
if (m_erpSupported)
|
||||
{
|
||||
ErpInformation erpInformation = probeResp.GetErpInformation ();
|
||||
if (erpInformation.GetUseProtection() == true)
|
||||
{
|
||||
m_stationManager->SetUseNonErpProtection (true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stationManager->SetUseNonErpProtection (false);
|
||||
}
|
||||
if (capabilities.IsShortSlotTime () == true)
|
||||
{
|
||||
//enable short slot time and set cwMin to 15
|
||||
SetSlot (MicroSeconds (9));
|
||||
ConfigureContentionWindow (15, 1023);
|
||||
}
|
||||
else
|
||||
bool isErpAllowed = false;
|
||||
for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
|
||||
{
|
||||
WifiMode mode = m_phy->GetMode (i);
|
||||
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM && rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), false, 1)))
|
||||
{
|
||||
isErpAllowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isErpAllowed)
|
||||
{
|
||||
//disable short slot time and set cwMin to 31
|
||||
SetSlot (MicroSeconds (20));
|
||||
ConfigureContentionWindow (31, 1023);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErpInformation erpInformation = probeResp.GetErpInformation ();
|
||||
isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode ();
|
||||
if (m_stationManager->GetShortSlotTimeEnabled ())
|
||||
{
|
||||
//enable short slot time
|
||||
SetSlot (MicroSeconds (9));
|
||||
}
|
||||
else
|
||||
{
|
||||
//disable short slot time
|
||||
SetSlot (MicroSeconds (20));
|
||||
}
|
||||
}
|
||||
}
|
||||
m_stationManager->SetShortPreambleEnabled (isShortPreambleEnabled);
|
||||
m_stationManager->SetShortSlotTimeEnabled (capabilities.IsShortSlotTime ());
|
||||
@@ -644,20 +652,37 @@ StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
|
||||
bool isShortPreambleEnabled = capabilities.IsShortPreamble ();
|
||||
if (m_erpSupported)
|
||||
{
|
||||
ErpInformation erpInformation = assocResp.GetErpInformation ();
|
||||
isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode ();
|
||||
if (m_stationManager->GetShortSlotTimeEnabled ())
|
||||
{
|
||||
//enable short slot time and set cwMin to 15
|
||||
SetSlot (MicroSeconds (9));
|
||||
ConfigureContentionWindow (15, 1023);
|
||||
}
|
||||
else
|
||||
bool isErpAllowed = false;
|
||||
for (uint32_t i = 0; i < m_phy->GetNModes (); i++)
|
||||
{
|
||||
WifiMode mode = m_phy->GetMode (i);
|
||||
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM && rates.IsSupportedRate (mode.GetDataRate (m_phy->GetChannelWidth (), false, 1)))
|
||||
{
|
||||
isErpAllowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isErpAllowed)
|
||||
{
|
||||
//disable short slot time and set cwMin to 31
|
||||
SetSlot (MicroSeconds (20));
|
||||
ConfigureContentionWindow (31, 1023);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErpInformation erpInformation = assocResp.GetErpInformation ();
|
||||
isShortPreambleEnabled &= !erpInformation.GetBarkerPreambleMode ();
|
||||
if (m_stationManager->GetShortSlotTimeEnabled ())
|
||||
{
|
||||
//enable short slot time
|
||||
SetSlot (MicroSeconds (9));
|
||||
}
|
||||
else
|
||||
{
|
||||
//disable short slot time
|
||||
SetSlot (MicroSeconds (20));
|
||||
}
|
||||
}
|
||||
}
|
||||
m_stationManager->SetShortPreambleEnabled (isShortPreambleEnabled);
|
||||
m_stationManager->SetShortSlotTimeEnabled (capabilities.IsShortSlotTime ());
|
||||
|
||||
Reference in New Issue
Block a user