wifi: (fixes #2327) CWmin value selection based on 802.11g standard rules

This commit is contained in:
Sébastien Deronne
2016-03-09 20:32:05 +01:00
parent f2cdfb1144
commit 58c4f13f59
5 changed files with 67 additions and 44 deletions

View File

@@ -123,6 +123,7 @@ Bugs fixed
- Bug 2318 - MPDU Aggregation fails with TCP
- Bug 2319 - BlockAckTimeout value is too low for 802.11n operating at 2.4 GHz
- Bug 2321 - Wifi rate managers should not be triggered for each MPDU when A-MPDU is used
- Bug 2327 - CWmin value selection for 802.11g is not compliant with the standard rules
Known issues
------------

View File

@@ -235,7 +235,7 @@ int main (int argc, char *argv[])
std::cout << "Protection mode" << "\t\t" << "Slot time supported" << "\t\t" << "PLCP preamble supported" << "\t\t" << "Scenario" << "\t" << "Throughput" << std::endl;
throughput = experiment.Run (false, false, false, false, isUdp, payloadSize, simulationTime);
if (throughput < 17 || throughput > 18)
if (throughput < 23 || throughput > 24)
{
NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
exit (1);
@@ -251,7 +251,7 @@ int main (int argc, char *argv[])
std::cout << "Disabled" << "\t\t" << "Short" << "\t\t\t\t" << "Long" << "\t\t\t\t" << "G-only" << "\t\t" << throughput <<" Mbit/s" << std::endl;
throughput = experiment.Run (false, false, false, true, isUdp, payloadSize, simulationTime);
if (throughput < 17 || throughput > 18)
if (throughput < 23 || throughput > 24)
{
NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
exit (1);
@@ -259,7 +259,7 @@ int main (int argc, char *argv[])
std::cout << "Disabled" << "\t\t" << "Long" << "\t\t\t\t" << "Long" << "\t\t\t\t" << "Mixed" << "\t\t" << throughput <<" Mbit/s" << std::endl;
throughput = experiment.Run (false, false, true, true, isUdp, payloadSize, simulationTime);
if (throughput < 17 || throughput > 18)
if (throughput < 23 || throughput > 24)
{
NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
exit (1);
@@ -269,7 +269,7 @@ int main (int argc, char *argv[])
Config::SetDefault ("ns3::WifiRemoteStationManager::ProtectionMode", StringValue ("Rts-Cts"));
throughput = experiment.Run (true, false, false, true, isUdp, payloadSize, simulationTime);
if (throughput < 9 || throughput > 10)
if (throughput < 11 || throughput > 12)
{
NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
exit (1);
@@ -277,7 +277,7 @@ int main (int argc, char *argv[])
std::cout << "RTS/CTS" << "\t\t\t" << "Long" << "\t\t\t\t" << "Long" << "\t\t\t\t" << "Mixed" << "\t\t" << throughput <<" Mbit/s" << std::endl;
throughput = experiment.Run (true, false, true, true, isUdp, payloadSize, simulationTime);
if (throughput < 11 || throughput > 12)
if (throughput < 13 || throughput > 14)
{
NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
exit (1);
@@ -287,7 +287,7 @@ int main (int argc, char *argv[])
Config::SetDefault ("ns3::WifiRemoteStationManager::ProtectionMode", StringValue ("Cts-To-Self"));
throughput = experiment.Run (true, false, false, true, isUdp, payloadSize, simulationTime);
if (throughput < 12 || throughput > 13)
if (throughput < 15 || throughput > 16)
{
NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
exit (1);
@@ -295,7 +295,7 @@ int main (int argc, char *argv[])
std::cout << "CTS-TO-SELF" << "\t\t" << "Long" << "\t\t\t\t" << "Long" << "\t\t\t\t" << "Mixed" << "\t\t" << throughput <<" Mbit/s" << std::endl;
throughput = experiment.Run (true, false, true, true, isUdp, payloadSize, simulationTime);
if (throughput < 14 || throughput > 15)
if (throughput < 17 || throughput > 18)
{
NS_LOG_ERROR ("Obtained throughput is not in the expected boundaries!");
exit (1);

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -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 ());