Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
4 * Copyright (c) 2009 MIRKO BANCHI | 4 * Copyright (c) 2009 MIRKO BANCHI |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License version 2 as | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 { | 489 { |
490 //This is mainly encountered when a higher priority control or management frame is | 490 //This is mainly encountered when a higher priority control or management frame is |
491 //sent between A-MPDU transmissions. It avoids to unexpectedly flush the a ggregate | 491 //sent between A-MPDU transmissions. It avoids to unexpectedly flush the a ggregate |
492 //queue when previous RTS request has failed. | 492 //queue when previous RTS request has failed. |
493 m_ampdu = false; | 493 m_ampdu = false; |
494 } | 494 } |
495 else if (m_currentHdr.IsQosData () && !m_aggregateQueue[GetTid (packet, *hdr)] ->IsEmpty ()) | 495 else if (m_currentHdr.IsQosData () && !m_aggregateQueue[GetTid (packet, *hdr)] ->IsEmpty ()) |
496 { | 496 { |
497 //m_aggregateQueue > 0 occurs when a RTS/CTS exchange failed before an A-M PDU transmission. | 497 //m_aggregateQueue > 0 occurs when a RTS/CTS exchange failed before an A-M PDU transmission. |
498 //In that case, we transmit the same A-MPDU as previously. | 498 //In that case, we transmit the same A-MPDU as previously. |
499 uint8_t sentMpdus = m_aggregateQueue[GetTid (packet, *hdr)]->GetNPackets ( ); | 499 uint8_t sentMpdus = static_cast<uint8_t> (m_aggregateQueue[GetTid (packet, *hdr)]->GetNPackets ()); |
S. Deronne
2018/03/30 06:56:54
another type for sentMpdus?
ammo6818-vandals.uidaho.edu
2018/04/05 17:51:01
changed to unit32_t
| |
500 m_ampdu = true; | 500 m_ampdu = true; |
501 if (sentMpdus > 1) | 501 if (sentMpdus > 1) |
502 { | 502 { |
503 m_txParams.EnableCompressedBlockAck (); | 503 m_txParams.EnableCompressedBlockAck (); |
504 } | 504 } |
505 else if (m_currentHdr.IsQosData ()) | 505 else if (m_currentHdr.IsQosData ()) |
506 { | 506 { |
507 //VHT/HE single MPDUs are followed by normal ACKs | 507 //VHT/HE single MPDUs are followed by normal ACKs |
508 m_txParams.EnableAck (); | 508 m_txParams.EnableAck (); |
509 } | 509 } |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1229 ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); | 1229 ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); |
1230 if (!m_ampdu || hdr->IsAck () || hdr->IsRts () || hdr->IsCts () || hdr->IsBloc kAck () || hdr->IsMgt ()) | 1230 if (!m_ampdu || hdr->IsAck () || hdr->IsRts () || hdr->IsCts () || hdr->IsBloc kAck () || hdr->IsMgt ()) |
1231 { | 1231 { |
1232 m_phy->SendPacket (packet, txVector); | 1232 m_phy->SendPacket (packet, txVector); |
1233 } | 1233 } |
1234 else | 1234 else |
1235 { | 1235 { |
1236 Ptr<Packet> newPacket; | 1236 Ptr<Packet> newPacket; |
1237 Ptr <WifiMacQueueItem> dequeuedItem; | 1237 Ptr <WifiMacQueueItem> dequeuedItem; |
1238 WifiMacHeader newHdr; | 1238 WifiMacHeader newHdr; |
1239 uint8_t queueSize = m_aggregateQueue[GetTid (packet, *hdr)]->GetNPackets ( ); | 1239 uint8_t queueSize = static_cast<uint8_t> (m_aggregateQueue[GetTid (packet, *hdr)]->GetNPackets ()); |
S. Deronne
2018/03/30 06:56:53
another type for queueSize?
ammo6818-vandals.uidaho.edu
2018/04/05 17:51:01
no its passed in to other functions which compare
| |
1240 bool singleMpdu = false; | 1240 bool singleMpdu = false; |
1241 bool last = false; | 1241 bool last = false; |
1242 MpduType mpdutype = NORMAL_MPDU; | 1242 MpduType mpdutype = NORMAL_MPDU; |
1243 | 1243 |
1244 uint8_t tid = GetTid (packet, *hdr); | 1244 uint8_t tid = GetTid (packet, *hdr); |
1245 AcIndex ac = QosUtilsMapTidToAc (tid); | 1245 AcIndex ac = QosUtilsMapTidToAc (tid); |
1246 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (a c); | 1246 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (a c); |
1247 | 1247 |
1248 if (queueSize == 1) | 1248 if (queueSize == 1) |
1249 { | 1249 { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1364 | 1364 |
1365 void | 1365 void |
1366 MacLow::BlockAckTimeout (void) | 1366 MacLow::BlockAckTimeout (void) |
1367 { | 1367 { |
1368 NS_LOG_FUNCTION (this); | 1368 NS_LOG_FUNCTION (this); |
1369 NS_LOG_DEBUG ("block ack timeout"); | 1369 NS_LOG_DEBUG ("block ack timeout"); |
1370 Ptr<DcaTxop> dca = m_currentDca; | 1370 Ptr<DcaTxop> dca = m_currentDca; |
1371 m_currentDca = 0; | 1371 m_currentDca = 0; |
1372 m_ampdu = false; | 1372 m_ampdu = false; |
1373 uint8_t tid = GetTid (m_currentPacket, m_currentHdr); | 1373 uint8_t tid = GetTid (m_currentPacket, m_currentHdr); |
1374 uint8_t nTxMpdus = m_aggregateQueue[tid]->GetNPackets (); | 1374 uint8_t nTxMpdus = static_cast<uint8_t> (m_aggregateQueue[tid]->GetNPackets () ); |
S. Deronne
2018/03/30 06:56:54
another type for nTxMpdus?
ammo6818-vandals.uidaho.edu
2018/04/05 17:51:01
no its passed in to other functions which compare
| |
1375 FlushAggregateQueue (tid); | 1375 FlushAggregateQueue (tid); |
1376 dca->MissedBlockAck (nTxMpdus); | 1376 dca->MissedBlockAck (nTxMpdus); |
1377 } | 1377 } |
1378 | 1378 |
1379 void | 1379 void |
1380 MacLow::SendRtsForPacket (void) | 1380 MacLow::SendRtsForPacket (void) |
1381 { | 1381 { |
1382 NS_LOG_FUNCTION (this); | 1382 NS_LOG_FUNCTION (this); |
1383 /* send an RTS for this packet. */ | 1383 /* send an RTS for this packet. */ |
1384 WifiMacHeader rts; | 1384 WifiMacHeader rts; |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1850 MacLow::StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr) | 1850 MacLow::StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr) |
1851 { | 1851 { |
1852 AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), hdr.G etQosTid ())); | 1852 AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), hdr.G etQosTid ())); |
1853 if (it != m_bAckAgreements.end ()) | 1853 if (it != m_bAckAgreements.end ()) |
1854 { | 1854 { |
1855 WifiMacTrailer fcs; | 1855 WifiMacTrailer fcs; |
1856 packet->RemoveTrailer (fcs); | 1856 packet->RemoveTrailer (fcs); |
1857 BufferedPacket bufferedPacket (packet, hdr); | 1857 BufferedPacket bufferedPacket (packet, hdr); |
1858 | 1858 |
1859 uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096; | 1859 uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096; |
1860 uint16_t mappedSeqControl = QosUtilsMapSeqControlToUniqueInteger (hdr.GetS equenceControl (), endSequence); | 1860 uint16_t mappedSeqControl = static_cast<uint16_t> (QosUtilsMapSeqControlTo UniqueInteger (hdr.GetSequenceControl (), endSequence)); |
S. Deronne
2018/03/30 06:56:54
another type for mappedSeqControl?
ammo6818-vandals.uidaho.edu
2018/04/05 17:51:01
changed to uint32_t
| |
1861 | 1861 |
1862 BufferedPacketI i = (*it).second.second.begin (); | 1862 BufferedPacketI i = (*it).second.second.begin (); |
1863 for (; i != (*it).second.second.end () | 1863 for (; i != (*it).second.second.end () |
1864 && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceContr ol (), endSequence) < mappedSeqControl; i++) | 1864 && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceContr ol (), endSequence) < mappedSeqControl; i++) |
1865 { | 1865 { |
1866 } | 1866 } |
1867 (*it).second.second.insert (i, bufferedPacket); | 1867 (*it).second.second.insert (i, bufferedPacket); |
1868 | 1868 |
1869 //Update block ack cache | 1869 //Update block ack cache |
1870 BlockAckCachesI j = m_bAckCaches.find (std::make_pair (hdr.GetAddr2 (), hd r.GetQosTid ())); | 1870 BlockAckCachesI j = m_bAckCaches.find (std::make_pair (hdr.GetAddr2 (), hd r.GetQosTid ())); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1933 } | 1933 } |
1934 } | 1934 } |
1935 | 1935 |
1936 void | 1936 void |
1937 MacLow::RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address originator, uint8_t tid) | 1937 MacLow::RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address originator, uint8_t tid) |
1938 { | 1938 { |
1939 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); | 1939 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); |
1940 if (it != m_bAckAgreements.end ()) | 1940 if (it != m_bAckAgreements.end ()) |
1941 { | 1941 { |
1942 uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096; | 1942 uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096; |
1943 uint16_t mappedStart = QosUtilsMapSeqControlToUniqueInteger (seq, endSeque nce); | 1943 uint16_t mappedStart = static_cast<uint16_t> (QosUtilsMapSeqControlToUniqu eInteger (seq, endSequence)); |
S. Deronne
2018/03/30 06:56:54
another type for mappedStart?
ammo6818-vandals.uidaho.edu
2018/04/05 17:51:01
changed to uint32_t
| |
1944 BufferedPacketI last = (*it).second.second.begin (); | 1944 BufferedPacketI last = (*it).second.second.begin (); |
1945 uint16_t guard = 0; | 1945 uint16_t guard = 0; |
1946 if (last != (*it).second.second.end ()) | 1946 if (last != (*it).second.second.end ()) |
1947 { | 1947 { |
1948 guard = (*it).second.second.begin ()->second.GetSequenceControl (); | 1948 guard = (*it).second.second.begin ()->second.GetSequenceControl (); |
1949 } | 1949 } |
1950 BufferedPacketI i = (*it).second.second.begin (); | 1950 BufferedPacketI i = (*it).second.second.begin (); |
1951 for (; i != (*it).second.second.end () | 1951 for (; i != (*it).second.second.end () |
1952 && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceContr ol (), endSequence) < mappedStart; ) | 1952 && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceContr ol (), endSequence) < mappedStart; ) |
1953 { | 1953 { |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2310 aPPDUMaxTime = MicroSeconds (10000); | 2310 aPPDUMaxTime = MicroSeconds (10000); |
2311 } | 2311 } |
2312 | 2312 |
2313 //A STA shall not transmit a PPDU that has a duration that is greater than aPP DUMaxTime | 2313 //A STA shall not transmit a PPDU that has a duration that is greater than aPP DUMaxTime |
2314 if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->G etSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, m_phy ->GetFrequency ()) > aPPDUMaxTime) | 2314 if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->G etSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, m_phy ->GetFrequency ()) > aPPDUMaxTime) |
2315 { | 2315 { |
2316 NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUM axTime"); | 2316 NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUM axTime"); |
2317 return true; | 2317 return true; |
2318 } | 2318 } |
2319 | 2319 |
2320 if (!edcaIt->second->GetMpduAggregator ()->CanBeAggregated (peekedPacket->GetS ize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, size)) | 2320 if (!edcaIt->second->GetMpduAggregator ()->CanBeAggregated (peekedPacket->GetS ize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, static_ca st<uint8_t> (size))) |
2321 { | 2321 { |
2322 NS_LOG_DEBUG ("no more packets can be aggregated because the maximum A-MPD U size has been reached"); | 2322 NS_LOG_DEBUG ("no more packets can be aggregated because the maximum A-MPD U size has been reached"); |
2323 return true; | 2323 return true; |
2324 } | 2324 } |
2325 | 2325 |
2326 return false; | 2326 return false; |
2327 } | 2327 } |
2328 | 2328 |
2329 Ptr<Packet> | 2329 Ptr<Packet> |
2330 MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) | 2330 MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2390 | 2390 |
2391 if (aggregated) | 2391 if (aggregated) |
2392 { | 2392 { |
2393 NS_LOG_DEBUG ("Adding packet with sequence number " << cur rentSequenceNumber << " to A-MPDU, packet size = " << newPacket->GetSize () << " , A-MPDU size = " << currentAggregatedPacket->GetSize ()); | 2393 NS_LOG_DEBUG ("Adding packet with sequence number " << cur rentSequenceNumber << " to A-MPDU, packet size = " << newPacket->GetSize () << " , A-MPDU size = " << currentAggregatedPacket->GetSize ()); |
2394 i++; | 2394 i++; |
2395 m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> ( aggPacket, peekedHdr)); | 2395 m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> ( aggPacket, peekedHdr)); |
2396 } | 2396 } |
2397 } | 2397 } |
2398 else if (hdr.IsBlockAckReq ()) | 2398 else if (hdr.IsBlockAckReq ()) |
2399 { | 2399 { |
2400 blockAckSize = packet->GetSize () + hdr.GetSize () + WIFI_MAC_ FCS_LENGTH; | 2400 blockAckSize = static_cast<uint16_t> (packet->GetSize () + hdr .GetSize () + WIFI_MAC_FCS_LENGTH); |
2401 qosPolicy = 3; //if the last subrame is block ack req then set ack policy of all frames to blockack | 2401 qosPolicy = 3; //if the last subrame is block ack req then set ack policy of all frames to blockack |
2402 packet->PeekHeader (blockAckReq); | 2402 packet->PeekHeader (blockAckReq); |
2403 startingSequenceNumber = blockAckReq.GetStartingSequence (); | 2403 startingSequenceNumber = blockAckReq.GetStartingSequence (); |
2404 } | 2404 } |
2405 /// \todo We should also handle Ack and BlockAck | 2405 /// \todo We should also handle Ack and BlockAck |
2406 bool retry = false; | 2406 bool retry = false; |
2407 //looks for other packets to the same destination with the same Ti d need to extend that to include MSDUs | 2407 //looks for other packets to the same destination with the same Ti d need to extend that to include MSDUs |
2408 Ptr<const Packet> peekedPacket = edcaIt->second->PeekNextRetransmi tPacket (peekedHdr, peekedHdr.GetAddr1 (), tid, &tstamp); | 2408 Ptr<const Packet> peekedPacket = edcaIt->second->PeekNextRetransmi tPacket (peekedHdr, peekedHdr.GetAddr1 (), tid, &tstamp); |
2409 if (peekedPacket == 0) | 2409 if (peekedPacket == 0) |
2410 { | 2410 { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2575 currentAggregatedPacket->AddHeader (blockAckReq); | 2575 currentAggregatedPacket->AddHeader (blockAckReq); |
2576 } | 2576 } |
2577 | 2577 |
2578 if (qosPolicy == 0) | 2578 if (qosPolicy == 0) |
2579 { | 2579 { |
2580 edcaIt->second->CompleteAmpduTransfer (hdr.GetAddr1 (), ti d); | 2580 edcaIt->second->CompleteAmpduTransfer (hdr.GetAddr1 (), ti d); |
2581 } | 2581 } |
2582 | 2582 |
2583 //Add packet tag | 2583 //Add packet tag |
2584 AmpduTag ampdutag; | 2584 AmpduTag ampdutag; |
2585 ampdutag.SetRemainingNbOfMpdus (i - 1); | 2585 ampdutag.SetRemainingNbOfMpdus (static_cast<uint8_t> (i - 1)); |
2586 newPacket = currentAggregatedPacket; | 2586 newPacket = currentAggregatedPacket; |
2587 newPacket->AddPacketTag (ampdutag); | 2587 newPacket->AddPacketTag (ampdutag); |
2588 | 2588 |
2589 NS_LOG_DEBUG ("tx unicast A-MPDU"); | 2589 NS_LOG_DEBUG ("tx unicast A-MPDU"); |
2590 edcaIt->second->SetAmpduExist (hdr.GetAddr1 (), true); | 2590 edcaIt->second->SetAmpduExist (hdr.GetAddr1 (), true); |
2591 } | 2591 } |
2592 else | 2592 else |
2593 { | 2593 { |
2594 uint8_t queueSize = m_aggregateQueue[tid]->GetNPackets (); | 2594 uint8_t queueSize = static_cast<uint8_t> (m_aggregateQueue[tid ]->GetNPackets ()); |
2595 NS_ASSERT (queueSize <= 2); //since it is not an A-MPDU then o nly 2 packets should have been added to the queue no more | 2595 NS_ASSERT (queueSize <= 2); //since it is not an A-MPDU then o nly 2 packets should have been added to the queue no more |
2596 if (queueSize >= 1) | 2596 if (queueSize >= 1) |
2597 { | 2597 { |
2598 //remove any packets that we added to the aggregate queue | 2598 //remove any packets that we added to the aggregate queue |
2599 FlushAggregateQueue (tid); | 2599 FlushAggregateQueue (tid); |
2600 } | 2600 } |
2601 } | 2601 } |
2602 } | 2602 } |
2603 // VHT/HE single MPDU operation | 2603 // VHT/HE single MPDU operation |
2604 WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_curre ntHdr); | 2604 WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_curre ntHdr); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2717 return currentAmsduPacket; | 2717 return currentAmsduPacket; |
2718 } | 2718 } |
2719 else | 2719 else |
2720 { | 2720 { |
2721 queue->PushFront (Create<WifiMacQueueItem> (packet, *hdr)); | 2721 queue->PushFront (Create<WifiMacQueueItem> (packet, *hdr)); |
2722 return 0; | 2722 return 0; |
2723 } | 2723 } |
2724 } | 2724 } |
2725 | 2725 |
2726 } //namespace ns3 | 2726 } //namespace ns3 |
OLD | NEW |