wifi: LENGTH field in DSSS PHY header should be the PSDU duration in microseconds

This commit is contained in:
Sébastien Deronne
2019-05-12 12:34:29 +02:00
parent 0adc099679
commit 81d5ed7ce0
2 changed files with 19 additions and 17 deletions

View File

@@ -387,6 +387,7 @@ OcbWifiMacTestCase::DoRun ()
Simulator::Destroy ();
NS_TEST_ASSERT_MSG_LT (phyrx_time, macassoc_time, "In Sta mode with AP, you cannot associate until receive beacon or AssocResponse frame" );
NS_TEST_ASSERT_MSG_LT (macassoc_time, phytx_time, "In Sta mode with AP, you cannot send data packet until associate" );
//Are these position tests redundant with time check tests?
//NS_TEST_ASSERT_MSG_GT ((phyrx_pos.x - macassoc_pos.x), 0.0, "");
//actually macassoc_pos.x - phytx_pos.x is greater than 0
//however associate switch to send is so fast with less than 100ms

View File

@@ -2611,27 +2611,12 @@ WifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector)
heSig.SetNStreams (txVector.GetNss ());
newPacket->AddHeader (heSig);
}
uint8_t sigExtention = 0;
if (Is2_4Ghz (GetFrequency ()))
{
sigExtention = 6;
}
uint8_t m = 0;
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_SU)
{
m = 2;
}
else if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU)
{
m = 1;
}
//Equation 27-11 of IEEE P802.11/D4.0
uint16_t length = ((ceil ((static_cast<double> (txDuration.GetNanoSeconds () - (20 * 1000) - (sigExtention * 1000)) / 1000) / 4.0) * 3) - 3 - m);
if ((txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_DSSS) || (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HR_DSSS))
{
DsssSigHeader sig;
sig.SetRate (txVector.GetMode ().GetDataRate (22));
sig.SetLength (length);
Time psduDuration = txDuration - CalculatePlcpPreambleAndHeaderDuration (txVector);
sig.SetLength (psduDuration.GetMicroSeconds ());
newPacket->AddHeader (sig);
}
else if ((txVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT) || (txVector.GetPreambleType () != WIFI_PREAMBLE_HT_GF))
@@ -2641,6 +2626,22 @@ WifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector)
{
sig.SetRate (txVector.GetMode ().GetDataRate (GetChannelWidth ()), GetChannelWidth ());
}
uint8_t sigExtention = 0;
if (Is2_4Ghz (GetFrequency ()))
{
sigExtention = 6;
}
uint8_t m = 0;
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_SU)
{
m = 2;
}
else if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU)
{
m = 1;
}
//Equation 27-11 of IEEE P802.11/D4.0
uint16_t length = ((ceil ((static_cast<double> (txDuration.GetNanoSeconds () - (20 * 1000) - (sigExtention * 1000)) / 1000) / 4.0) * 3) - 3 - m);
sig.SetLength (length);
newPacket->AddHeader (sig);
}