|
718 |
{ |
718 |
{ |
719 |
m_dcf->UpdateFailedCw (); |
719 |
m_dcf->UpdateFailedCw (); |
720 |
} |
720 |
} |
721 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
721 |
StartBackoffIfNeeded (); |
722 |
m_dcf->StartBackoffNow (m_backoffTrace); |
|
|
723 |
RestartAccessIfNeeded (); |
722 |
RestartAccessIfNeeded (); |
724 |
} |
723 |
} |
725 |
|
724 |
|
|
727 |
EdcaTxopN::NotifyCollision (void) |
726 |
EdcaTxopN::NotifyCollision (void) |
728 |
{ |
727 |
{ |
729 |
NS_LOG_FUNCTION (this); |
728 |
NS_LOG_FUNCTION (this); |
730 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
729 |
StartBackoffIfNeeded (); |
731 |
m_dcf->StartBackoffNow (m_backoffTrace); |
|
|
732 |
RestartAccessIfNeeded (); |
730 |
RestartAccessIfNeeded (); |
733 |
} |
731 |
} |
734 |
|
732 |
|
|
862 |
m_dcf->UpdateFailedCw (); |
860 |
m_dcf->UpdateFailedCw (); |
863 |
m_cwTrace = m_dcf->GetCw (); |
861 |
m_cwTrace = m_dcf->GetCw (); |
864 |
} |
862 |
} |
865 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
863 |
StartBackoffIfNeeded (); |
866 |
m_dcf->StartBackoffNow (m_backoffTrace); |
|
|
867 |
RestartAccessIfNeeded (); |
864 |
RestartAccessIfNeeded (); |
868 |
} |
865 |
} |
869 |
|
866 |
|
|
899 |
NS_LOG_FUNCTION (this << packet << &hdr); |
896 |
NS_LOG_FUNCTION (this << packet << &hdr); |
900 |
m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr, packet); |
897 |
m_stationManager->PrepareForQueue (hdr.GetAddr1 (), &hdr, packet); |
901 |
m_queue->Enqueue (packet, hdr); |
898 |
m_queue->Enqueue (packet, hdr); |
902 |
StartAccessIfNeeded (); |
899 |
if (m_dcf->GetBackoffSlots () == 0 && m_manager->IsBusy () && !HasTxop ()) |
|
|
900 |
{ |
901 |
NS_LOG_DEBUG ("Starting backoff; slots=" << m_dcf->GetBackoffSlots () << " busy= " << m_manager->IsBusy ()); |
902 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
903 |
NS_LOG_DEBUG ("Drawing new backoff " << m_backoffTrace); |
904 |
m_dcf->StartBackoffNow (m_backoffTrace); |
905 |
RestartAccessIfNeeded (); |
906 |
} |
907 |
else |
908 |
{ |
909 |
StartAccessIfNeeded (); |
910 |
} |
903 |
} |
911 |
} |
904 |
|
912 |
|
905 |
void |
913 |
void |
|
938 |
} |
946 |
} |
939 |
m_currentPacket = 0; |
947 |
m_currentPacket = 0; |
940 |
m_dcf->ResetCw (); |
948 |
m_dcf->ResetCw (); |
941 |
if (!HasTxop ()) |
949 |
m_cwTrace = m_dcf->GetCw (); |
|
|
950 |
if (HasPendingQosMpduWithSameTidAndAddress () && !HasTxop () && m_dcf->GetBackoffSlots () == 0) |
942 |
{ |
951 |
{ |
943 |
m_cwTrace = m_dcf->GetCw (); |
952 |
StartBackoffIfNeeded (); |
944 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
|
|
945 |
m_dcf->StartBackoffNow (m_backoffTrace); |
946 |
RestartAccessIfNeeded (); |
953 |
RestartAccessIfNeeded (); |
947 |
} |
954 |
} |
948 |
} |
955 |
} |
|
1012 |
m_dcf->UpdateFailedCw (); |
1019 |
m_dcf->UpdateFailedCw (); |
1013 |
m_cwTrace = m_dcf->GetCw (); |
1020 |
m_cwTrace = m_dcf->GetCw (); |
1014 |
} |
1021 |
} |
1015 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
1022 |
StartBackoffIfNeeded (); |
1016 |
m_dcf->StartBackoffNow (m_backoffTrace); |
|
|
1017 |
RestartAccessIfNeeded (); |
1023 |
RestartAccessIfNeeded (); |
1018 |
} |
1024 |
} |
1019 |
|
1025 |
|
|
1087 |
m_dcf->ResetCw (); |
1093 |
m_dcf->ResetCw (); |
1088 |
m_cwTrace = m_dcf->GetCw (); |
1094 |
m_cwTrace = m_dcf->GetCw (); |
1089 |
} |
1095 |
} |
1090 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
1096 |
StartBackoffIfNeeded (); |
1091 |
m_dcf->StartBackoffNow (m_backoffTrace); |
|
|
1092 |
RestartAccessIfNeeded (); |
1097 |
RestartAccessIfNeeded (); |
1093 |
} |
1098 |
} |
1094 |
|
1099 |
|
|
1260 |
&tstamp); |
1265 |
&tstamp); |
1261 |
if (peekedPacket == 0) |
1266 |
if (peekedPacket == 0) |
1262 |
{ |
1267 |
{ |
|
|
1268 |
NS_LOG_DEBUG ("No pending packet; returning"); |
1263 |
return; |
1269 |
return; |
1264 |
} |
1270 |
} |
|
|
1271 |
if (!HasTxop () && m_dcf->GetBackoffSlots () == 0) |
1272 |
{ |
1273 |
NS_LOG_DEBUG ("No TXOP left; start backoff again"); |
1274 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
1275 |
NS_LOG_DEBUG ("Drawing new backoff " << m_backoffTrace); |
1276 |
m_dcf->StartBackoffNow (m_backoffTrace); |
1277 |
RestartAccessIfNeeded (); |
1278 |
} |
1265 |
|
1279 |
|
1266 |
MacLowTransmissionParameters params; |
1280 |
MacLowTransmissionParameters params; |
1267 |
params.DisableOverrideDurationId (); |
1281 |
params.DisableOverrideDurationId (); |
|
1295 |
} |
1309 |
} |
1296 |
} |
1310 |
} |
1297 |
|
1311 |
|
|
|
1312 |
void |
1313 |
EdcaTxopN::StartBackoffIfNeeded (void) |
1314 |
{ |
1315 |
NS_LOG_FUNCTION (this); |
1316 |
if (m_dcf->GetBackoffSlots () == 0) |
1317 |
{ |
1318 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
1319 |
NS_LOG_DEBUG ("Drawing new backoff " << m_backoffTrace); |
1320 |
m_dcf->StartBackoffNow (m_backoffTrace); |
1321 |
} |
1322 |
} |
1323 |
|
1298 |
Time |
1324 |
Time |
1299 |
EdcaTxopN::GetTxopRemaining (void) |
1325 |
EdcaTxopN::GetTxopRemaining (void) |
1300 |
{ |
1326 |
{ |
|
1353 |
return (GetTxopRemaining () >= Low ()->CalculateOverallTxTime (peekedPacket, &hdr, params)); |
1379 |
return (GetTxopRemaining () >= Low ()->CalculateOverallTxTime (peekedPacket, &hdr, params)); |
1354 |
} |
1380 |
} |
1355 |
|
1381 |
|
|
|
1382 |
bool |
1383 |
EdcaTxopN::HasPendingQosMpduWithSameTidAndAddress (void) const |
1384 |
{ |
1385 |
NS_LOG_FUNCTION (this); |
1386 |
WifiMacHeader hdr; |
1387 |
Time tstamp; |
1388 |
if (!m_currentHdr.IsQosData ()) |
1389 |
{ |
1390 |
NS_LOG_DEBUG ("Current header is not QoS data; returning false"); |
1391 |
return false; |
1392 |
} |
1393 |
|
1394 |
Ptr<const Packet> peekedPacket = m_queue->PeekByTidAndAddress (&hdr, |
1395 |
m_currentHdr.GetQosTid (), |
1396 |
WifiMacHeader::ADDR1, |
1397 |
m_currentHdr.GetAddr1 (), |
1398 |
&tstamp); |
1399 |
if (peekedPacket == 0) |
1400 |
{ |
1401 |
NS_LOG_DEBUG ("No pending MPDU matching current header TID and address; returning false"); |
1402 |
return false; |
1403 |
} |
1404 |
else |
1405 |
{ |
1406 |
NS_LOG_DEBUG ("Pending MPDU found; returning true"); |
1407 |
return true; |
1408 |
} |
1409 |
} |
1410 |
|
1356 |
void |
1411 |
void |
1357 |
EdcaTxopN::Cancel (void) |
1412 |
EdcaTxopN::Cancel (void) |
1358 |
{ |
1413 |
{ |
|
1368 |
m_currentPacket = 0; |
1423 |
m_currentPacket = 0; |
1369 |
m_dcf->ResetCw (); |
1424 |
m_dcf->ResetCw (); |
1370 |
m_cwTrace = m_dcf->GetCw (); |
1425 |
m_cwTrace = m_dcf->GetCw (); |
1371 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
1426 |
StartBackoffIfNeeded (); |
1372 |
m_dcf->StartBackoffNow (m_backoffTrace); |
|
|
1373 |
StartAccessIfNeeded (); |
1427 |
StartAccessIfNeeded (); |
1374 |
} |
1428 |
} |
1375 |
|
1429 |
|
|
1552 |
m_currentPacket = 0; |
1606 |
m_currentPacket = 0; |
1553 |
m_dcf->ResetCw (); |
1607 |
m_dcf->ResetCw (); |
1554 |
m_cwTrace = m_dcf->GetCw (); |
1608 |
m_cwTrace = m_dcf->GetCw (); |
1555 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
1609 |
StartBackoffIfNeeded (); |
1556 |
m_dcf->StartBackoffNow (m_backoffTrace); |
|
|
1557 |
RestartAccessIfNeeded (); |
1610 |
RestartAccessIfNeeded (); |
1558 |
} |
1611 |
} |
1559 |
|
1612 |
|
|
1830 |
NS_LOG_FUNCTION (this); |
1883 |
NS_LOG_FUNCTION (this); |
1831 |
m_dcf->ResetCw (); |
1884 |
m_dcf->ResetCw (); |
1832 |
m_cwTrace = m_dcf->GetCw (); |
1885 |
m_cwTrace = m_dcf->GetCw (); |
1833 |
m_backoffTrace = m_rng->GetNext (0, m_dcf->GetCw ()); |
1886 |
StartBackoffIfNeeded (); |
1834 |
m_dcf->StartBackoffNow (m_backoffTrace); |
|
|
1835 |
ns3::Dcf::DoInitialize (); |
1887 |
ns3::Dcf::DoInitialize (); |
1836 |
} |
1888 |
} |
1837 |
|
1889 |
|