Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 11 matching lines...) Expand all Loading... | |
22 | 22 |
23 #include "ns3/simulator.h" | 23 #include "ns3/simulator.h" |
24 #include "ns3/log.h" | 24 #include "ns3/log.h" |
25 #include "ns3/socket.h" | 25 #include "ns3/socket.h" |
26 #include "mac-low.h" | 26 #include "mac-low.h" |
27 #include "edca-txop-n.h" | 27 #include "edca-txop-n.h" |
28 #include "snr-tag.h" | 28 #include "snr-tag.h" |
29 #include "ampdu-tag.h" | 29 #include "ampdu-tag.h" |
30 #include "wifi-mac-queue.h" | 30 #include "wifi-mac-queue.h" |
31 #include "wifi-utils.h" | 31 #include "wifi-utils.h" |
32 #include "ctrl-headers.h" | |
33 #include "mgt-headers.h" | |
34 #include "wifi-remote-station-manager.h" | |
35 #include "mpdu-aggregator.h" | |
36 #include "msdu-aggregator.h" | |
37 #include "ampdu-subframe-header.h" | |
38 #include "wifi-phy-listener.h" | |
39 #include "wifi-mac-trailer.h" | |
40 #include "wifi-phy.h" | |
32 | 41 |
33 #undef NS_LOG_APPEND_CONTEXT | 42 #undef NS_LOG_APPEND_CONTEXT |
34 #define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] " | 43 #define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] " |
35 | 44 |
36 namespace ns3 { | 45 namespace ns3 { |
37 | 46 |
38 NS_LOG_COMPONENT_DEFINE ("MacLow"); | 47 NS_LOG_COMPONENT_DEFINE ("MacLow"); |
39 | 48 |
40 /** | 49 /** |
41 * Listener for PHY events. Forwards to MacLow | 50 * Listener for PHY events. Forwards to MacLow |
(...skipping 17 matching lines...) Expand all Loading... | |
59 { | 68 { |
60 } | 69 } |
61 void NotifyRxEndOk (void) | 70 void NotifyRxEndOk (void) |
62 { | 71 { |
63 } | 72 } |
64 void NotifyRxEndError (void) | 73 void NotifyRxEndError (void) |
65 { | 74 { |
66 } | 75 } |
67 void NotifyTxStart (Time duration, double txPowerDbm) | 76 void NotifyTxStart (Time duration, double txPowerDbm) |
68 { | 77 { |
69 NS_UNUSED(duration); | |
70 NS_UNUSED(txPowerDbm); | |
71 } | 78 } |
72 void NotifyMaybeCcaBusyStart (Time duration) | 79 void NotifyMaybeCcaBusyStart (Time duration) |
73 { | 80 { |
74 } | 81 } |
75 void NotifySwitchingStart (Time duration) | 82 void NotifySwitchingStart (Time duration) |
76 { | 83 { |
77 m_macLow->NotifySwitchingStartNow (duration); | 84 m_macLow->NotifySwitchingStartNow (duration); |
78 } | 85 } |
79 void NotifySleep (void) | 86 void NotifySleep (void) |
80 { | 87 { |
81 m_macLow->NotifySleepNow (); | 88 m_macLow->NotifySleepNow (); |
82 } | 89 } |
83 void NotifyOff (void) | 90 void NotifyOff (void) |
84 { | 91 { |
85 m_macLow->NotifyOffNow (); | 92 m_macLow->NotifyOffNow (); |
86 } | 93 } |
87 void NotifyWakeup (void) | 94 void NotifyWakeup (void) |
88 { | 95 { |
89 } | 96 } |
97 void NotifyOn (void) | |
98 { | |
99 } | |
90 | 100 |
91 private: | 101 private: |
92 ns3::MacLow *m_macLow; ///< the MAC | 102 ns3::MacLow *m_macLow; ///< the MAC |
93 }; | 103 }; |
94 | 104 |
95 | 105 |
96 MacLow::MacLow () | 106 MacLow::MacLow () |
97 : m_normalAckTimeoutEvent (), | 107 : m_normalAckTimeoutEvent (), |
98 m_fastAckTimeoutEvent (), | |
99 m_superFastAckTimeoutEvent (), | |
100 m_fastAckFailedTimeoutEvent (), | |
101 m_blockAckTimeoutEvent (), | 108 m_blockAckTimeoutEvent (), |
102 m_ctsTimeoutEvent (), | 109 m_ctsTimeoutEvent (), |
103 m_sendCtsEvent (), | 110 m_sendCtsEvent (), |
104 m_sendAckEvent (), | 111 m_sendAckEvent (), |
105 m_sendDataEvent (), | 112 m_sendDataEvent (), |
106 m_waitIfsEvent (), | 113 m_waitIfsEvent (), |
107 m_endTxNoAckEvent (), | 114 m_endTxNoAckEvent (), |
108 m_currentPacket (0), | 115 m_currentPacket (0), |
109 m_currentDca (0), | 116 m_currentDca (0), |
110 m_lastNavStart (Seconds (0)), | 117 m_lastNavStart (Seconds (0)), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 delete m_phyMacLowListener; | 161 delete m_phyMacLowListener; |
155 m_phyMacLowListener = 0; | 162 m_phyMacLowListener = 0; |
156 } | 163 } |
157 } | 164 } |
158 | 165 |
159 void | 166 void |
160 MacLow::DoDispose (void) | 167 MacLow::DoDispose (void) |
161 { | 168 { |
162 NS_LOG_FUNCTION (this); | 169 NS_LOG_FUNCTION (this); |
163 m_normalAckTimeoutEvent.Cancel (); | 170 m_normalAckTimeoutEvent.Cancel (); |
164 m_fastAckTimeoutEvent.Cancel (); | |
165 m_superFastAckTimeoutEvent.Cancel (); | |
166 m_fastAckFailedTimeoutEvent.Cancel (); | |
167 m_blockAckTimeoutEvent.Cancel (); | 171 m_blockAckTimeoutEvent.Cancel (); |
168 m_ctsTimeoutEvent.Cancel (); | 172 m_ctsTimeoutEvent.Cancel (); |
169 m_sendCtsEvent.Cancel (); | 173 m_sendCtsEvent.Cancel (); |
170 m_sendAckEvent.Cancel (); | 174 m_sendAckEvent.Cancel (); |
171 m_sendDataEvent.Cancel (); | 175 m_sendDataEvent.Cancel (); |
172 m_waitIfsEvent.Cancel (); | 176 m_waitIfsEvent.Cancel (); |
173 m_endTxNoAckEvent.Cancel (); | 177 m_endTxNoAckEvent.Cancel (); |
174 m_phy = 0; | 178 m_phy = 0; |
175 m_stationManager = 0; | 179 m_stationManager = 0; |
176 if (m_phyMacLowListener != 0) | 180 if (m_phyMacLowListener != 0) |
(...skipping 11 matching lines...) Expand all Loading... | |
188 void | 192 void |
189 MacLow::CancelAllEvents (void) | 193 MacLow::CancelAllEvents (void) |
190 { | 194 { |
191 NS_LOG_FUNCTION (this); | 195 NS_LOG_FUNCTION (this); |
192 bool oneRunning = false; | 196 bool oneRunning = false; |
193 if (m_normalAckTimeoutEvent.IsRunning ()) | 197 if (m_normalAckTimeoutEvent.IsRunning ()) |
194 { | 198 { |
195 m_normalAckTimeoutEvent.Cancel (); | 199 m_normalAckTimeoutEvent.Cancel (); |
196 oneRunning = true; | 200 oneRunning = true; |
197 } | 201 } |
198 if (m_fastAckTimeoutEvent.IsRunning ()) | |
199 { | |
200 m_fastAckTimeoutEvent.Cancel (); | |
201 oneRunning = true; | |
202 } | |
203 if (m_superFastAckTimeoutEvent.IsRunning ()) | |
204 { | |
205 m_superFastAckTimeoutEvent.Cancel (); | |
206 oneRunning = true; | |
207 } | |
208 if (m_fastAckFailedTimeoutEvent.IsRunning ()) | |
209 { | |
210 m_fastAckFailedTimeoutEvent.Cancel (); | |
211 oneRunning = true; | |
212 } | |
213 if (m_blockAckTimeoutEvent.IsRunning ()) | 202 if (m_blockAckTimeoutEvent.IsRunning ()) |
214 { | 203 { |
215 m_blockAckTimeoutEvent.Cancel (); | 204 m_blockAckTimeoutEvent.Cancel (); |
216 oneRunning = true; | 205 oneRunning = true; |
217 } | 206 } |
218 if (m_ctsTimeoutEvent.IsRunning ()) | 207 if (m_ctsTimeoutEvent.IsRunning ()) |
219 { | 208 { |
220 m_ctsTimeoutEvent.Cancel (); | 209 m_ctsTimeoutEvent.Cancel (); |
221 oneRunning = true; | 210 oneRunning = true; |
222 } | 211 } |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
455 } | 444 } |
456 return false; | 445 return false; |
457 } | 446 } |
458 | 447 |
459 void | 448 void |
460 MacLow::StartTransmission (Ptr<const Packet> packet, | 449 MacLow::StartTransmission (Ptr<const Packet> packet, |
461 const WifiMacHeader* hdr, | 450 const WifiMacHeader* hdr, |
462 MacLowTransmissionParameters params, | 451 MacLowTransmissionParameters params, |
463 Ptr<DcaTxop> dca) | 452 Ptr<DcaTxop> dca) |
464 { | 453 { |
454 if (m_phy->IsStateOff ()) | |
455 { | |
456 NS_LOG_DEBUG ("Cannot start TX because device is OFF"); | |
457 return; | |
458 } | |
459 | |
465 NS_LOG_FUNCTION (this << packet << hdr << params << dca); | 460 NS_LOG_FUNCTION (this << packet << hdr << params << dca); |
466 /* m_currentPacket is not NULL because someone started | 461 /* m_currentPacket is not NULL because someone started |
467 * a transmission and was interrupted before one of: | 462 * a transmission and was interrupted before one of: |
468 * - ctsTimeout | 463 * - ctsTimeout |
469 * - sendDataAfterCTS | 464 * - sendDataAfterCTS |
470 * expired. This means that one of these timers is still | 465 * expired. This means that one of these timers is still |
471 * running. They are all cancelled below anyway by the | 466 * running. They are all cancelled below anyway by the |
472 * call to CancelAllEvents (because of at least one | 467 * call to CancelAllEvents (because of at least one |
473 * of these two timers) which will trigger a call to the | 468 * of these two timers) which will trigger a call to the |
474 * previous listener's cancel method. | 469 * previous listener's cancel method. |
(...skipping 28 matching lines...) Expand all Loading... | |
503 { | 498 { |
504 //This is mainly encountered when a higher priority control or management frame is | 499 //This is mainly encountered when a higher priority control or management frame is |
505 //sent between A-MPDU transmissions. It avoids to unexpectedly flush the a ggregate | 500 //sent between A-MPDU transmissions. It avoids to unexpectedly flush the a ggregate |
506 //queue when previous RTS request has failed. | 501 //queue when previous RTS request has failed. |
507 m_ampdu = false; | 502 m_ampdu = false; |
508 } | 503 } |
509 else if (m_currentHdr.IsQosData () && !m_aggregateQueue[GetTid (packet, *hdr)] ->IsEmpty ()) | 504 else if (m_currentHdr.IsQosData () && !m_aggregateQueue[GetTid (packet, *hdr)] ->IsEmpty ()) |
510 { | 505 { |
511 //m_aggregateQueue > 0 occurs when a RTS/CTS exchange failed before an A-M PDU transmission. | 506 //m_aggregateQueue > 0 occurs when a RTS/CTS exchange failed before an A-M PDU transmission. |
512 //In that case, we transmit the same A-MPDU as previously. | 507 //In that case, we transmit the same A-MPDU as previously. |
513 uint8_t sentMpdus = static_cast<uint8_t>(m_aggregateQueue[GetTid (packet, *hdr)]->GetNPackets ()); | 508 uint32_t sentMpdus = m_aggregateQueue[GetTid (packet, *hdr)]->GetNPackets (); |
514 m_ampdu = true; | 509 m_ampdu = true; |
515 if (sentMpdus > 1) | 510 if (sentMpdus > 1) |
516 { | 511 { |
517 m_txParams.EnableCompressedBlockAck (); | 512 m_txParams.EnableCompressedBlockAck (); |
518 } | 513 } |
519 else if (m_currentHdr.IsQosData ()) | 514 else if (m_currentHdr.IsQosData ()) |
520 { | 515 { |
521 //VHT/HE single MPDUs are followed by normal ACKs | 516 //VHT/HE single MPDUs are followed by normal ACKs |
522 m_txParams.EnableAck (); | 517 m_txParams.EnableAck (); |
523 } | 518 } |
524 AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr)); | 519 AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr)); |
525 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (a c); | 520 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (a c); |
526 Ptr<Packet> aggregatedPacket = Create<Packet> (); | 521 Ptr<Packet> aggregatedPacket = Create<Packet> (); |
527 for (uint8_t i = 0; i < sentMpdus; i++) | 522 for (uint32_t i = 0; i < sentMpdus; i++) |
S. Deronne
2018/05/11 14:46:05
why?
| |
528 { | 523 { |
529 Ptr<Packet> newPacket = (m_txPackets[GetTid (packet, *hdr)].at (i).pac ket)->Copy (); | 524 Ptr<Packet> newPacket = (m_txPackets[GetTid (packet, *hdr)].at (i).pac ket)->Copy (); |
530 newPacket->AddHeader (m_txPackets[GetTid (packet, *hdr)].at (i).hdr); | 525 newPacket->AddHeader (m_txPackets[GetTid (packet, *hdr)].at (i).hdr); |
531 AddWifiMacTrailer (newPacket); | 526 AddWifiMacTrailer (newPacket); |
532 edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, aggregated Packet); | 527 edcaIt->second->GetMpduAggregator ()->Aggregate (newPacket, aggregated Packet); |
533 } | 528 } |
534 m_currentPacket = aggregatedPacket; | 529 m_currentPacket = aggregatedPacket; |
535 m_currentHdr = (m_txPackets[GetTid (packet, *hdr)].at (0).hdr); | 530 m_currentHdr = (m_txPackets[GetTid (packet, *hdr)].at (0).hdr); |
536 m_currentTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); | 531 m_currentTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); |
537 } | 532 } |
(...skipping 29 matching lines...) Expand all Loading... | |
567 if ((m_ctsToSelfSupported || m_stationManager->GetUseNonErpProtection ()) && NeedCtsToSelf ()) | 562 if ((m_ctsToSelfSupported || m_stationManager->GetUseNonErpProtection ()) && NeedCtsToSelf ()) |
568 { | 563 { |
569 SendCtsToSelf (); | 564 SendCtsToSelf (); |
570 } | 565 } |
571 else | 566 else |
572 { | 567 { |
573 SendDataPacket (); | 568 SendDataPacket (); |
574 } | 569 } |
575 } | 570 } |
576 | 571 |
577 /* When this method completes, we have taken ownership of the medium. */ | 572 /* When this method completes, either we have taken ownership of the medium or the device switched off in the meantime. */ |
578 NS_ASSERT (m_phy->IsStateTx ()); | 573 NS_ASSERT (m_phy->IsStateTx () || m_phy->IsStateOff ()); |
579 } | 574 } |
580 | 575 |
581 bool | 576 bool |
582 MacLow::NeedRts (void) const | 577 MacLow::NeedRts (void) const |
583 { | 578 { |
584 WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); | 579 WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); |
585 return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr, | 580 return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr, |
586 m_currentPacket, dataTxVector); | 581 m_currentPacket, dataTxVector); |
587 } | 582 } |
588 | 583 |
589 bool | 584 bool |
590 MacLow::NeedCtsToSelf (void) const | 585 MacLow::NeedCtsToSelf (void) const |
591 { | 586 { |
592 WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); | 587 WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr); |
593 return m_stationManager->NeedCtsToSelf (dataTxVector); | 588 return m_stationManager->NeedCtsToSelf (dataTxVector); |
594 } | 589 } |
595 | 590 |
596 void | 591 void |
597 MacLow::ReceiveError (Ptr<Packet> packet, double rxSnr) | 592 MacLow::ReceiveError (Ptr<Packet> packet, double rxSnr) |
598 { | 593 { |
599 NS_LOG_FUNCTION (this << packet << rxSnr); | 594 NS_LOG_FUNCTION (this << packet << rxSnr); |
600 NS_LOG_DEBUG ("rx failed"); | 595 NS_LOG_DEBUG ("rx failed"); |
601 if (m_txParams.MustWaitFastAck ()) | |
602 { | |
603 NS_ASSERT (m_fastAckFailedTimeoutEvent.IsExpired ()); | |
604 m_fastAckFailedTimeoutEvent = Simulator::Schedule (GetSifs (), | |
605 &MacLow::FastAckFailedT imeout, this); | |
606 } | |
607 return; | 596 return; |
608 } | 597 } |
609 | 598 |
610 void | 599 void |
611 MacLow::NotifySwitchingStartNow (Time duration) | 600 MacLow::NotifySwitchingStartNow (Time duration) |
612 { | 601 { |
613 NS_LOG_DEBUG ("switching channel. Cancelling MAC pending events"); | 602 NS_LOG_DEBUG ("switching channel. Cancelling MAC pending events"); |
614 m_stationManager->Reset (); | 603 m_stationManager->Reset (); |
615 CancelAllEvents (); | 604 CancelAllEvents (); |
616 if (m_navCounterResetCtsMissed.IsRunning ()) | 605 if (m_navCounterResetCtsMissed.IsRunning ()) |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
724 | 713 |
725 m_ctsTimeoutEvent.Cancel (); | 714 m_ctsTimeoutEvent.Cancel (); |
726 NotifyCtsTimeoutResetNow (); | 715 NotifyCtsTimeoutResetNow (); |
727 NS_ASSERT (m_sendDataEvent.IsExpired ()); | 716 NS_ASSERT (m_sendDataEvent.IsExpired ()); |
728 m_sendDataEvent = Simulator::Schedule (GetSifs (), | 717 m_sendDataEvent = Simulator::Schedule (GetSifs (), |
729 &MacLow::SendDataAfterCts, this, | 718 &MacLow::SendDataAfterCts, this, |
730 hdr.GetDuration ()); | 719 hdr.GetDuration ()); |
731 } | 720 } |
732 else if (hdr.IsAck () | 721 else if (hdr.IsAck () |
733 && hdr.GetAddr1 () == m_self | 722 && hdr.GetAddr1 () == m_self |
734 && (m_normalAckTimeoutEvent.IsRunning () | 723 && m_normalAckTimeoutEvent.IsRunning () |
735 || m_fastAckTimeoutEvent.IsRunning () | 724 && m_txParams.MustWaitNormalAck ()) |
736 || m_superFastAckTimeoutEvent.IsRunning ()) | |
737 && m_txParams.MustWaitAck ()) | |
738 { | 725 { |
739 NS_LOG_DEBUG ("receive ack from=" << m_currentHdr.GetAddr1 ()); | 726 NS_LOG_DEBUG ("receive ack from=" << m_currentHdr.GetAddr1 ()); |
740 SnrTag tag; | 727 SnrTag tag; |
741 packet->RemovePacketTag (tag); | 728 packet->RemovePacketTag (tag); |
742 //When fragmentation is used, only update manager when the last fragment i s acknowledged | 729 //When fragmentation is used, only update manager when the last fragment i s acknowledged |
743 if (!m_txParams.HasNextPacket ()) | 730 if (!m_txParams.HasNextPacket ()) |
744 { | 731 { |
745 m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr, | 732 m_stationManager->ReportRxOk (m_currentHdr.GetAddr1 (), &m_currentHdr, |
746 rxSnr, txVector.GetMode ()); | 733 rxSnr, txVector.GetMode ()); |
747 m_stationManager->ReportDataOk (m_currentHdr.GetAddr1 (), &m_currentHd r, | 734 m_stationManager->ReportDataOk (m_currentHdr.GetAddr1 (), &m_currentHd r, |
748 rxSnr, txVector.GetMode (), tag.Get () ); | 735 rxSnr, txVector.GetMode (), tag.Get () ); |
749 } | 736 } |
750 bool gotAck = false; | 737 bool gotAck = false; |
751 if (m_txParams.MustWaitNormalAck () | 738 if (m_txParams.MustWaitNormalAck () |
752 && m_normalAckTimeoutEvent.IsRunning ()) | 739 && m_normalAckTimeoutEvent.IsRunning ()) |
753 { | 740 { |
754 m_normalAckTimeoutEvent.Cancel (); | 741 m_normalAckTimeoutEvent.Cancel (); |
755 NotifyAckTimeoutResetNow (); | |
756 gotAck = true; | |
757 } | |
758 if (m_txParams.MustWaitFastAck () | |
759 && m_fastAckTimeoutEvent.IsRunning ()) | |
760 { | |
761 m_fastAckTimeoutEvent.Cancel (); | |
762 NotifyAckTimeoutResetNow (); | 742 NotifyAckTimeoutResetNow (); |
763 gotAck = true; | 743 gotAck = true; |
764 } | 744 } |
765 if (gotAck) | 745 if (gotAck) |
766 { | 746 { |
767 m_currentDca->GotAck (); | 747 m_currentDca->GotAck (); |
768 } | 748 } |
769 if (m_txParams.HasNextPacket () && (!m_currentHdr.IsQosData () || m_curren tDca->GetTxopLimit ().IsZero () || m_currentDca->HasTxop ())) | 749 if (m_txParams.HasNextPacket () && (!m_currentHdr.IsQosData () || m_curren tDca->GetTxopLimit ().IsZero () || m_currentDca->HasTxop ())) |
770 { | 750 { |
771 if (m_stationManager->GetRifsPermitted ()) | 751 if (m_stationManager->GetRifsPermitted ()) |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1100 { | 1080 { |
1101 Ptr<const Packet> fragment = Create<Packet> (fragmentSize); | 1081 Ptr<const Packet> fragment = Create<Packet> (fragmentSize); |
1102 dataSize = GetSize (fragment, hdr, m_ampdu); | 1082 dataSize = GetSize (fragment, hdr, m_ampdu); |
1103 } | 1083 } |
1104 else | 1084 else |
1105 { | 1085 { |
1106 dataSize = GetSize (packet, hdr, m_ampdu); | 1086 dataSize = GetSize (packet, hdr, m_ampdu); |
1107 } | 1087 } |
1108 txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, m_phy->GetFreque ncy ()); | 1088 txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, m_phy->GetFreque ncy ()); |
1109 txTime += GetSifs (); | 1089 txTime += GetSifs (); |
1110 if (params.MustWaitAck ()) | 1090 if (params.MustWaitNormalAck ()) |
1111 { | 1091 { |
1112 txTime += GetAckDuration (hdr->GetAddr1 (), dataTxVector); | 1092 txTime += GetAckDuration (hdr->GetAddr1 (), dataTxVector); |
1113 } | 1093 } |
1114 return txTime; | 1094 return txTime; |
1115 } | 1095 } |
1116 | 1096 |
1117 Time | 1097 Time |
1118 MacLow::CalculateTransmissionTime (Ptr<const Packet> packet, | 1098 MacLow::CalculateTransmissionTime (Ptr<const Packet> packet, |
1119 const WifiMacHeader* hdr, | 1099 const WifiMacHeader* hdr, |
1120 const MacLowTransmissionParameters& params) c onst | 1100 const MacLowTransmissionParameters& params) c onst |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1258 ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); | 1238 ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); |
1259 if (!m_ampdu || hdr->IsAck () || hdr->IsRts () || hdr->IsCts () || hdr->IsBloc kAck () || hdr->IsMgt ()) | 1239 if (!m_ampdu || hdr->IsAck () || hdr->IsRts () || hdr->IsCts () || hdr->IsBloc kAck () || hdr->IsMgt ()) |
1260 { | 1240 { |
1261 m_phy->SendPacket (packet, txVector); | 1241 m_phy->SendPacket (packet, txVector); |
1262 } | 1242 } |
1263 else | 1243 else |
1264 { | 1244 { |
1265 Ptr<Packet> newPacket; | 1245 Ptr<Packet> newPacket; |
1266 Ptr <WifiMacQueueItem> dequeuedItem; | 1246 Ptr <WifiMacQueueItem> dequeuedItem; |
1267 WifiMacHeader newHdr; | 1247 WifiMacHeader newHdr; |
1268 uint8_t queueSize = static_cast<uint8_t>(m_aggregateQueue[GetTid (packet, *hdr)]->GetNPackets ()); | 1248 uint8_t queueSize = static_cast<uint8_t> (m_aggregateQueue[GetTid (packet, *hdr)]->GetNPackets ()); |
S. Deronne
2018/05/11 14:46:05
I suggest to change type of queueSize
| |
1269 bool singleMpdu = false; | 1249 bool singleMpdu = false; |
1270 bool last = false; | 1250 bool last = false; |
1271 MpduType mpdutype = NORMAL_MPDU; | 1251 MpduType mpdutype = NORMAL_MPDU; |
1272 | 1252 |
1273 uint8_t tid = GetTid (packet, *hdr); | 1253 uint8_t tid = GetTid (packet, *hdr); |
1274 AcIndex ac = QosUtilsMapTidToAc (tid); | 1254 AcIndex ac = QosUtilsMapTidToAc (tid); |
1275 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (a c); | 1255 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (a c); |
1276 | 1256 |
1277 if (queueSize == 1) | 1257 if (queueSize == 1) |
1278 { | 1258 { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1385 m_currentDca = 0; | 1365 m_currentDca = 0; |
1386 m_ampdu = false; | 1366 m_ampdu = false; |
1387 if (m_currentHdr.IsQosData ()) | 1367 if (m_currentHdr.IsQosData ()) |
1388 { | 1368 { |
1389 FlushAggregateQueue (GetTid (m_currentPacket, m_currentHdr)); | 1369 FlushAggregateQueue (GetTid (m_currentPacket, m_currentHdr)); |
1390 } | 1370 } |
1391 dca->MissedAck (); | 1371 dca->MissedAck (); |
1392 } | 1372 } |
1393 | 1373 |
1394 void | 1374 void |
1395 MacLow::FastAckTimeout (void) | |
1396 { | |
1397 NS_LOG_FUNCTION (this); | |
1398 m_stationManager->ReportDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr); | |
1399 Ptr<DcaTxop> dca = m_currentDca; | |
1400 m_currentDca = 0; | |
1401 if (m_phy->IsStateIdle ()) | |
1402 { | |
1403 NS_LOG_DEBUG ("fast Ack idle missed"); | |
1404 dca->MissedAck (); | |
1405 } | |
1406 else | |
1407 { | |
1408 NS_LOG_DEBUG ("fast Ack ok"); | |
1409 } | |
1410 } | |
1411 | |
1412 void | |
1413 MacLow::BlockAckTimeout (void) | 1375 MacLow::BlockAckTimeout (void) |
1414 { | 1376 { |
1415 NS_LOG_FUNCTION (this); | 1377 NS_LOG_FUNCTION (this); |
1416 NS_LOG_DEBUG ("block ack timeout"); | 1378 NS_LOG_DEBUG ("block ack timeout"); |
1417 Ptr<DcaTxop> dca = m_currentDca; | 1379 Ptr<DcaTxop> dca = m_currentDca; |
1418 m_currentDca = 0; | 1380 m_currentDca = 0; |
1419 m_ampdu = false; | 1381 m_ampdu = false; |
1420 uint8_t tid = GetTid (m_currentPacket, m_currentHdr); | 1382 uint8_t tid = GetTid (m_currentPacket, m_currentHdr); |
1421 uint8_t nTxMpdus = static_cast<uint8_t>(m_aggregateQueue[tid]->GetNPackets ()) ; | 1383 uint8_t nTxMpdus = static_cast<uint8_t> (m_aggregateQueue[tid]->GetNPackets () ); |
S. Deronne
2018/05/11 14:46:05
I am facing a dilemma: or we change type of nTxMpd
| |
1422 FlushAggregateQueue (tid); | 1384 FlushAggregateQueue (tid); |
1423 dca->MissedBlockAck (nTxMpdus); | 1385 dca->MissedBlockAck (nTxMpdus); |
1424 } | |
1425 | |
1426 void | |
1427 MacLow::SuperFastAckTimeout () | |
1428 { | |
1429 NS_LOG_FUNCTION (this); | |
1430 m_stationManager->ReportDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr); | |
1431 Ptr<DcaTxop> dca = m_currentDca; | |
1432 m_currentDca = 0; | |
1433 if (m_phy->IsStateIdle ()) | |
1434 { | |
1435 NS_LOG_DEBUG ("super fast Ack failed"); | |
1436 dca->MissedAck (); | |
1437 } | |
1438 else | |
1439 { | |
1440 NS_LOG_DEBUG ("super fast Ack ok"); | |
1441 dca->GotAck (); | |
1442 } | |
1443 } | 1386 } |
1444 | 1387 |
1445 void | 1388 void |
1446 MacLow::SendRtsForPacket (void) | 1389 MacLow::SendRtsForPacket (void) |
1447 { | 1390 { |
1448 NS_LOG_FUNCTION (this); | 1391 NS_LOG_FUNCTION (this); |
1449 /* send an RTS for this packet. */ | 1392 /* send an RTS for this packet. */ |
1450 WifiMacHeader rts; | 1393 WifiMacHeader rts; |
1451 rts.SetType (WIFI_MAC_CTL_RTS); | 1394 rts.SetType (WIFI_MAC_CTL_RTS); |
1452 rts.SetDsNotFrom (); | 1395 rts.SetDsNotFrom (); |
(...skipping 14 matching lines...) Expand all Loading... | |
1467 if (m_txParams.MustWaitBasicBlockAck ()) | 1410 if (m_txParams.MustWaitBasicBlockAck ()) |
1468 { | 1411 { |
1469 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); | 1412 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); |
1470 duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK); | 1413 duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK); |
1471 } | 1414 } |
1472 else if (m_txParams.MustWaitCompressedBlockAck ()) | 1415 else if (m_txParams.MustWaitCompressedBlockAck ()) |
1473 { | 1416 { |
1474 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); | 1417 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); |
1475 duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK ); | 1418 duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK ); |
1476 } | 1419 } |
1477 else if (m_txParams.MustWaitAck ()) | 1420 else if (m_txParams.MustWaitNormalAck ()) |
1478 { | 1421 { |
1479 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); | 1422 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); |
1480 } | 1423 } |
1481 if (m_txParams.HasNextPacket ()) | 1424 if (m_txParams.HasNextPacket ()) |
1482 { | 1425 { |
1483 duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), | 1426 duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
1484 m_currentTxVector, m_phy->GetFrequ ency ()); | 1427 m_currentTxVector, m_phy->GetFrequ ency ()); |
1485 if (m_txParams.MustWaitAck ()) | 1428 if (m_txParams.MustWaitNormalAck ()) |
1486 { | 1429 { |
1487 duration += GetSifs (); | 1430 duration += GetSifs (); |
1488 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVecto r); | 1431 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVecto r); |
1489 } | 1432 } |
1490 } | 1433 } |
1491 rts.SetDuration (duration); | 1434 rts.SetDuration (duration); |
1492 | 1435 |
1493 Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_ph y->GetFrequency ()); | 1436 Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_ph y->GetFrequency ()); |
1494 Time timerDelay = txDuration + GetCtsTimeout (); | 1437 Time timerDelay = txDuration + GetCtsTimeout (); |
1495 | 1438 |
(...skipping 12 matching lines...) Expand all Loading... | |
1508 MacLow::StartDataTxTimers (WifiTxVector dataTxVector) | 1451 MacLow::StartDataTxTimers (WifiTxVector dataTxVector) |
1509 { | 1452 { |
1510 Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_cur rentHdr, m_ampdu), dataTxVector, m_phy->GetFrequency ()); | 1453 Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_cur rentHdr, m_ampdu), dataTxVector, m_phy->GetFrequency ()); |
1511 if (m_txParams.MustWaitNormalAck ()) | 1454 if (m_txParams.MustWaitNormalAck ()) |
1512 { | 1455 { |
1513 Time timerDelay = txDuration + GetAckTimeout (); | 1456 Time timerDelay = txDuration + GetAckTimeout (); |
1514 NS_ASSERT (m_normalAckTimeoutEvent.IsExpired ()); | 1457 NS_ASSERT (m_normalAckTimeoutEvent.IsExpired ()); |
1515 NotifyAckTimeoutStartNow (timerDelay); | 1458 NotifyAckTimeoutStartNow (timerDelay); |
1516 m_normalAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::Normal AckTimeout, this); | 1459 m_normalAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::Normal AckTimeout, this); |
1517 } | 1460 } |
1518 else if (m_txParams.MustWaitFastAck ()) | |
1519 { | |
1520 Time timerDelay = txDuration + GetPifs (); | |
1521 NS_ASSERT (m_fastAckTimeoutEvent.IsExpired ()); | |
1522 NotifyAckTimeoutStartNow (timerDelay); | |
1523 m_fastAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::FastAckT imeout, this); | |
1524 } | |
1525 else if (m_txParams.MustWaitSuperFastAck ()) | |
1526 { | |
1527 Time timerDelay = txDuration + GetPifs (); | |
1528 NS_ASSERT (m_superFastAckTimeoutEvent.IsExpired ()); | |
1529 NotifyAckTimeoutStartNow (timerDelay); | |
1530 m_superFastAckTimeoutEvent = Simulator::Schedule (timerDelay, | |
1531 &MacLow::SuperFastAckTim eout, this); | |
1532 } | |
1533 else if (m_txParams.MustWaitBasicBlockAck ()) | 1461 else if (m_txParams.MustWaitBasicBlockAck ()) |
1534 { | 1462 { |
1535 Time timerDelay = txDuration + GetBasicBlockAckTimeout (); | 1463 Time timerDelay = txDuration + GetBasicBlockAckTimeout (); |
1536 NS_ASSERT (m_blockAckTimeoutEvent.IsExpired ()); | 1464 NS_ASSERT (m_blockAckTimeoutEvent.IsExpired ()); |
1537 NotifyAckTimeoutStartNow (timerDelay); | 1465 NotifyAckTimeoutStartNow (timerDelay); |
1538 m_blockAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::BlockAc kTimeout, this); | 1466 m_blockAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::BlockAc kTimeout, this); |
1539 } | 1467 } |
1540 else if (m_txParams.MustWaitCompressedBlockAck ()) | 1468 else if (m_txParams.MustWaitCompressedBlockAck ()) |
1541 { | 1469 { |
1542 Time timerDelay = txDuration + GetCompressedBlockAckTimeout (); | 1470 Time timerDelay = txDuration + GetCompressedBlockAckTimeout (); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1591 duration += GetSifs (); | 1519 duration += GetSifs (); |
1592 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); | 1520 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); |
1593 duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK); | 1521 duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK); |
1594 } | 1522 } |
1595 else if (m_txParams.MustWaitCompressedBlockAck ()) | 1523 else if (m_txParams.MustWaitCompressedBlockAck ()) |
1596 { | 1524 { |
1597 duration += GetSifs (); | 1525 duration += GetSifs (); |
1598 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); | 1526 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); |
1599 duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK ); | 1527 duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK ); |
1600 } | 1528 } |
1601 else if (m_txParams.MustWaitAck ()) | 1529 else if (m_txParams.MustWaitNormalAck ()) |
1602 { | 1530 { |
1603 duration += GetSifs (); | 1531 duration += GetSifs (); |
1604 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); | 1532 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); |
1605 } | 1533 } |
1606 if (m_txParams.HasNextPacket ()) | 1534 if (m_txParams.HasNextPacket ()) |
1607 { | 1535 { |
1608 if (m_stationManager->GetRifsPermitted ()) | 1536 if (m_stationManager->GetRifsPermitted ()) |
1609 { | 1537 { |
1610 duration += GetRifs (); | 1538 duration += GetRifs (); |
1611 } | 1539 } |
1612 else | 1540 else |
1613 { | 1541 { |
1614 duration += GetSifs (); | 1542 duration += GetSifs (); |
1615 } | 1543 } |
1616 duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), | 1544 duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
1617 m_currentTxVector, m_phy->GetFrequ ency ()); | 1545 m_currentTxVector, m_phy->GetFrequ ency ()); |
1618 if (m_txParams.MustWaitAck ()) | 1546 if (m_txParams.MustWaitNormalAck ()) |
1619 { | 1547 { |
1620 duration += GetSifs (); | 1548 duration += GetSifs (); |
1621 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVecto r); | 1549 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVecto r); |
1622 } | 1550 } |
1623 } | 1551 } |
1624 m_currentHdr.SetDuration (duration); | 1552 m_currentHdr.SetDuration (duration); |
1625 Ptr <Packet> packet = m_currentPacket->Copy (); | 1553 Ptr <Packet> packet = m_currentPacket->Copy (); |
1626 if (m_ampdu) | 1554 if (m_ampdu) |
1627 { | 1555 { |
1628 NS_ASSERT (m_currentHdr.IsQosData ()); | 1556 NS_ASSERT (m_currentHdr.IsQosData ()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1663 duration += GetSifs (); | 1591 duration += GetSifs (); |
1664 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); | 1592 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); |
1665 duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK); | 1593 duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK); |
1666 } | 1594 } |
1667 else if (m_txParams.MustWaitCompressedBlockAck ()) | 1595 else if (m_txParams.MustWaitCompressedBlockAck ()) |
1668 { | 1596 { |
1669 duration += GetSifs (); | 1597 duration += GetSifs (); |
1670 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); | 1598 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); |
1671 duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK ); | 1599 duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK ); |
1672 } | 1600 } |
1673 else if (m_txParams.MustWaitAck ()) | 1601 else if (m_txParams.MustWaitNormalAck ()) |
1674 { | 1602 { |
1675 duration += GetSifs (); | 1603 duration += GetSifs (); |
1676 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); | 1604 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); |
1677 } | 1605 } |
1678 if (m_txParams.HasNextPacket ()) | 1606 if (m_txParams.HasNextPacket ()) |
1679 { | 1607 { |
1680 duration += GetSifs (); | 1608 duration += GetSifs (); |
1681 duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), | 1609 duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
1682 m_currentTxVector, m_phy->GetFrequ ency ()); | 1610 m_currentTxVector, m_phy->GetFrequ ency ()); |
1683 if (m_txParams.MustWaitCompressedBlockAck ()) | 1611 if (m_txParams.MustWaitCompressedBlockAck ()) |
1684 { | 1612 { |
1685 duration += GetSifs (); | 1613 duration += GetSifs (); |
1686 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.G etAddr2 (), m_currentTxVector.GetMode ()); | 1614 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.G etAddr2 (), m_currentTxVector.GetMode ()); |
1687 duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK _ACK); | 1615 duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK _ACK); |
1688 } | 1616 } |
1689 else if (m_txParams.MustWaitAck ()) | 1617 else if (m_txParams.MustWaitNormalAck ()) |
1690 { | 1618 { |
1691 duration += GetSifs (); | 1619 duration += GetSifs (); |
1692 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVecto r); | 1620 duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVecto r); |
1693 } | 1621 } |
1694 } | 1622 } |
1695 | 1623 |
1696 cts.SetDuration (duration); | 1624 cts.SetDuration (duration); |
1697 | 1625 |
1698 Ptr<Packet> packet = Create<Packet> (); | 1626 Ptr<Packet> packet = Create<Packet> (); |
1699 packet->AddHeader (cts); | 1627 packet->AddHeader (cts); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1772 newDuration += GetSifs (); | 1700 newDuration += GetSifs (); |
1773 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); | 1701 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); |
1774 newDuration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK); | 1702 newDuration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK); |
1775 } | 1703 } |
1776 else if (m_txParams.MustWaitCompressedBlockAck ()) | 1704 else if (m_txParams.MustWaitCompressedBlockAck ()) |
1777 { | 1705 { |
1778 newDuration += GetSifs (); | 1706 newDuration += GetSifs (); |
1779 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); | 1707 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAd dr2 (), m_currentTxVector.GetMode ()); |
1780 newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ ACK); | 1708 newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ ACK); |
1781 } | 1709 } |
1782 else if (m_txParams.MustWaitAck ()) | 1710 else if (m_txParams.MustWaitNormalAck ()) |
1783 { | 1711 { |
1784 newDuration += GetSifs (); | 1712 newDuration += GetSifs (); |
1785 newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector ); | 1713 newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector ); |
1786 } | 1714 } |
1787 if (m_txParams.HasNextPacket ()) | 1715 if (m_txParams.HasNextPacket ()) |
1788 { | 1716 { |
1789 if (m_stationManager->GetRifsPermitted ()) | 1717 if (m_stationManager->GetRifsPermitted ()) |
1790 { | 1718 { |
1791 newDuration += GetRifs (); | 1719 newDuration += GetRifs (); |
1792 } | 1720 } |
1793 else | 1721 else |
1794 { | 1722 { |
1795 newDuration += GetSifs (); | 1723 newDuration += GetSifs (); |
1796 } | 1724 } |
1797 newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize () , m_currentTxVector, m_phy->GetFrequency ()); | 1725 newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize () , m_currentTxVector, m_phy->GetFrequency ()); |
1798 if (m_txParams.MustWaitCompressedBlockAck ()) | 1726 if (m_txParams.MustWaitCompressedBlockAck ()) |
1799 { | 1727 { |
1800 newDuration += GetSifs (); | 1728 newDuration += GetSifs (); |
1801 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.G etAddr2 (), m_currentTxVector.GetMode ()); | 1729 WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.G etAddr2 (), m_currentTxVector.GetMode ()); |
1802 newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BL OCK_ACK); | 1730 newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BL OCK_ACK); |
1803 } | 1731 } |
1804 else if (m_txParams.MustWaitAck ()) | 1732 else if (m_txParams.MustWaitNormalAck ()) |
1805 { | 1733 { |
1806 newDuration += GetSifs (); | 1734 newDuration += GetSifs (); |
1807 newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVe ctor); | 1735 newDuration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVe ctor); |
1808 } | 1736 } |
1809 } | 1737 } |
1810 | 1738 |
1811 Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_cur rentHdr, m_ampdu), m_currentTxVector, m_phy->GetFrequency ()); | 1739 Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_cur rentHdr, m_ampdu), m_currentTxVector, m_phy->GetFrequency ()); |
1812 duration -= txDuration; | 1740 duration -= txDuration; |
1813 duration -= GetSifs (); | 1741 duration -= GetSifs (); |
1814 | 1742 |
(...skipping 27 matching lines...) Expand all Loading... | |
1842 m_currentDca->StartNextPacket (); | 1770 m_currentDca->StartNextPacket (); |
1843 } | 1771 } |
1844 | 1772 |
1845 void | 1773 void |
1846 MacLow::EndTxNoAck (void) | 1774 MacLow::EndTxNoAck (void) |
1847 { | 1775 { |
1848 NS_LOG_FUNCTION (this); | 1776 NS_LOG_FUNCTION (this); |
1849 Ptr<DcaTxop> dca = m_currentDca; | 1777 Ptr<DcaTxop> dca = m_currentDca; |
1850 m_currentDca = 0; | 1778 m_currentDca = 0; |
1851 dca->EndTxNoAck (); | 1779 dca->EndTxNoAck (); |
1852 } | |
1853 | |
1854 void | |
1855 MacLow::FastAckFailedTimeout (void) | |
1856 { | |
1857 NS_LOG_FUNCTION (this); | |
1858 Ptr<DcaTxop> dca = m_currentDca; | |
1859 m_currentDca = 0; | |
1860 dca->MissedAck (); | |
1861 NS_LOG_DEBUG ("fast Ack busy but missed"); | |
1862 } | 1780 } |
1863 | 1781 |
1864 void | 1782 void |
1865 MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMod e, double dataSnr) | 1783 MacLow::SendAckAfterData (Mac48Address source, Time duration, WifiMode dataTxMod e, double dataSnr) |
1866 { | 1784 { |
1867 NS_LOG_FUNCTION (this); | 1785 NS_LOG_FUNCTION (this); |
1868 // send an ACK, after SIFS, when you receive a packet | 1786 // send an ACK, after SIFS, when you receive a packet |
1869 WifiTxVector ackTxVector = GetAckTxVector (source, dataTxMode); | 1787 WifiTxVector ackTxVector = GetAckTxVector (source, dataTxMode); |
1870 WifiMacHeader ack; | 1788 WifiMacHeader ack; |
1871 ack.SetType (WIFI_MAC_CTL_ACK); | 1789 ack.SetType (WIFI_MAC_CTL_ACK); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1941 MacLow::StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr) | 1859 MacLow::StoreMpduIfNeeded (Ptr<Packet> packet, WifiMacHeader hdr) |
1942 { | 1860 { |
1943 AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), hdr.G etQosTid ())); | 1861 AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), hdr.G etQosTid ())); |
1944 if (it != m_bAckAgreements.end ()) | 1862 if (it != m_bAckAgreements.end ()) |
1945 { | 1863 { |
1946 WifiMacTrailer fcs; | 1864 WifiMacTrailer fcs; |
1947 packet->RemoveTrailer (fcs); | 1865 packet->RemoveTrailer (fcs); |
1948 BufferedPacket bufferedPacket (packet, hdr); | 1866 BufferedPacket bufferedPacket (packet, hdr); |
1949 | 1867 |
1950 uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096; | 1868 uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096; |
1951 uint16_t mappedSeqControl = static_cast<uint16_t>(QosUtilsMapSeqControlToU niqueInteger (hdr.GetSequenceControl (), endSequence)); | 1869 uint32_t mappedSeqControl = QosUtilsMapSeqControlToUniqueInteger(hdr.GetSe quenceControl(), endSequence); |
1952 | 1870 |
1953 BufferedPacketI i = (*it).second.second.begin (); | 1871 BufferedPacketI i = (*it).second.second.begin (); |
1954 for (; i != (*it).second.second.end () | 1872 for (; i != (*it).second.second.end () |
1955 && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceContr ol (), endSequence) < mappedSeqControl; i++) | 1873 && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceContr ol (), endSequence) < mappedSeqControl; i++) |
1956 { | 1874 { |
1957 } | 1875 } |
1958 (*it).second.second.insert (i, bufferedPacket); | 1876 (*it).second.second.insert (i, bufferedPacket); |
1959 | 1877 |
1960 //Update block ack cache | 1878 //Update block ack cache |
1961 BlockAckCachesI j = m_bAckCaches.find (std::make_pair (hdr.GetAddr2 (), hd r.GetQosTid ())); | 1879 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... | |
2024 } | 1942 } |
2025 } | 1943 } |
2026 | 1944 |
2027 void | 1945 void |
2028 MacLow::RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address originator, uint8_t tid) | 1946 MacLow::RxCompleteBufferedPacketsWithSmallerSequence (uint16_t seq, Mac48Address originator, uint8_t tid) |
2029 { | 1947 { |
2030 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); | 1948 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); |
2031 if (it != m_bAckAgreements.end ()) | 1949 if (it != m_bAckAgreements.end ()) |
2032 { | 1950 { |
2033 uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096; | 1951 uint16_t endSequence = ((*it).second.first.GetStartingSequence () + 2047) % 4096; |
2034 uint16_t mappedStart = static_cast<uint16_t>(QosUtilsMapSeqControlToUnique Integer (seq, endSequence)); | 1952 uint32_t mappedStart = QosUtilsMapSeqControlToUniqueInteger (seq, endSeque nce); |
2035 BufferedPacketI last = (*it).second.second.begin (); | 1953 BufferedPacketI last = (*it).second.second.begin (); |
2036 uint16_t guard = 0; | 1954 uint16_t guard = 0; |
2037 if (last != (*it).second.second.end ()) | 1955 if (last != (*it).second.second.end ()) |
2038 { | 1956 { |
2039 guard = (*it).second.second.begin ()->second.GetSequenceControl (); | 1957 guard = (*it).second.second.begin ()->second.GetSequenceControl (); |
2040 } | 1958 } |
2041 BufferedPacketI i = (*it).second.second.begin (); | 1959 BufferedPacketI i = (*it).second.second.begin (); |
2042 for (; i != (*it).second.second.end () | 1960 for (; i != (*it).second.second.end () |
2043 && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceContr ol (), endSequence) < mappedStart; ) | 1961 && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceContr ol (), endSequence) < mappedStart; ) |
2044 { | 1962 { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2176 packet->AddPacketTag (tag); | 2094 packet->AddPacketTag (tag); |
2177 ForwardDown (packet, &hdr, blockAckReqTxVector); | 2095 ForwardDown (packet, &hdr, blockAckReqTxVector); |
2178 } | 2096 } |
2179 | 2097 |
2180 void | 2098 void |
2181 MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time durat ion, WifiTxVector blockAckReqTxVector, double rxSnr) | 2099 MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time durat ion, WifiTxVector blockAckReqTxVector, double rxSnr) |
2182 { | 2100 { |
2183 NS_LOG_FUNCTION (this); | 2101 NS_LOG_FUNCTION (this); |
2184 if (!m_phy->IsStateTx () && !m_phy->IsStateRx ()) | 2102 if (!m_phy->IsStateTx () && !m_phy->IsStateRx ()) |
2185 { | 2103 { |
2186 NS_LOG_FUNCTION (this << static_cast<uint16_t> (tid) << originator << dura tion.As (Time::S) << blockAckReqTxVector << rxSnr); | 2104 NS_LOG_FUNCTION (this << +tid << originator << duration.As (Time::S) << bl ockAckReqTxVector << rxSnr); |
2187 CtrlBAckResponseHeader blockAck; | 2105 CtrlBAckResponseHeader blockAck; |
2188 uint16_t seqNumber = 0; | 2106 uint16_t seqNumber = 0; |
2189 BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid)); | 2107 BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid)); |
2190 NS_ASSERT (i != m_bAckCaches.end ()); | 2108 NS_ASSERT (i != m_bAckCaches.end ()); |
2191 seqNumber = (*i).second.GetWinStart (); | 2109 seqNumber = (*i).second.GetWinStart (); |
2192 | 2110 |
2193 bool immediate = true; | 2111 bool immediate = true; |
2194 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); | 2112 AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid)); |
2195 blockAck.SetStartingSequence (seqNumber); | 2113 blockAck.SetStartingSequence (seqNumber); |
2196 blockAck.SetTidInfo (tid); | 2114 blockAck.SetTidInfo (tid); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2401 aPPDUMaxTime = MicroSeconds (10000); | 2319 aPPDUMaxTime = MicroSeconds (10000); |
2402 } | 2320 } |
2403 | 2321 |
2404 //A STA shall not transmit a PPDU that has a duration that is greater than aPP DUMaxTime | 2322 //A STA shall not transmit a PPDU that has a duration that is greater than aPP DUMaxTime |
2405 if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->G etSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, m_phy ->GetFrequency ()) > aPPDUMaxTime) | 2323 if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->G etSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, m_phy ->GetFrequency ()) > aPPDUMaxTime) |
2406 { | 2324 { |
2407 NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUM axTime"); | 2325 NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUM axTime"); |
2408 return true; | 2326 return true; |
2409 } | 2327 } |
2410 | 2328 |
2411 if (!edcaIt->second->GetMpduAggregator ()->CanBeAggregated (peekedPacket->GetS ize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, static_ca st<uint8_t>(size))) | 2329 if (!edcaIt->second->GetMpduAggregator ()->CanBeAggregated (peekedPacket->GetS ize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, aggregatedPacket, static_ca st<uint8_t> (size))) |
S. Deronne
2018/05/11 14:46:05
size could become uint8_t, I'll give a try.
| |
2412 { | 2330 { |
2413 NS_LOG_DEBUG ("no more packets can be aggregated because the maximum A-MPD U size has been reached"); | 2331 NS_LOG_DEBUG ("no more packets can be aggregated because the maximum A-MPD U size has been reached"); |
2414 return true; | 2332 return true; |
2415 } | 2333 } |
2416 | 2334 |
2417 return false; | 2335 return false; |
2418 } | 2336 } |
2419 | 2337 |
2420 Ptr<Packet> | 2338 Ptr<Packet> |
2421 MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) | 2339 MacLow::AggregateToAmpdu (Ptr<const Packet> packet, const WifiMacHeader hdr) |
(...skipping 14 matching lines...) Expand all Loading... | |
2436 //are supported, the condition of entering here should be changed. | 2354 //are supported, the condition of entering here should be changed. |
2437 return newPacket; | 2355 return newPacket; |
2438 } | 2356 } |
2439 | 2357 |
2440 //missing hdr.IsAck() since we have no means of knowing the Tid of the Ack yet | 2358 //missing hdr.IsAck() since we have no means of knowing the Tid of the Ack yet |
2441 if (hdr.IsQosData () || hdr.IsBlockAck ()|| hdr.IsBlockAckReq ()) | 2359 if (hdr.IsQosData () || hdr.IsBlockAck ()|| hdr.IsBlockAckReq ()) |
2442 { | 2360 { |
2443 Time tstamp; | 2361 Time tstamp; |
2444 uint8_t tid = GetTid (packet, hdr); | 2362 uint8_t tid = GetTid (packet, hdr); |
2445 Ptr<WifiMacQueue> queue; | 2363 Ptr<WifiMacQueue> queue; |
2364 Ptr<Packet> aggPacket; | |
2446 AcIndex ac = QosUtilsMapTidToAc (tid); | 2365 AcIndex ac = QosUtilsMapTidToAc (tid); |
2447 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (a c); | 2366 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (a c); |
2448 NS_ASSERT (edcaIt != m_edca.end ()); | 2367 NS_ASSERT (edcaIt != m_edca.end ()); |
2449 queue = edcaIt->second->GetQueue (); | 2368 queue = edcaIt->second->GetWifiMacQueue (); |
2450 | 2369 |
2451 Ptr<Packet> aggPacket; | |
2452 if (!hdr.GetAddr1 ().IsBroadcast () && edcaIt->second->GetMpduAggregator ( ) != 0) | 2370 if (!hdr.GetAddr1 ().IsBroadcast () && edcaIt->second->GetMpduAggregator ( ) != 0) |
2453 { | 2371 { |
2454 //Have to make sure that their exist a block Ack agreement before send ing an AMPDU (BlockAck Manager) | 2372 //Have to make sure that their exist a block Ack agreement before send ing an AMPDU (BlockAck Manager) |
2455 if (edcaIt->second->GetBaAgreementExists (hdr.GetAddr1 (), tid)) | 2373 if (edcaIt->second->GetBaAgreementExists (hdr.GetAddr1 (), tid)) |
2456 { | 2374 { |
2457 /* here is performed mpdu aggregation */ | 2375 /* here is performed mpdu aggregation */ |
2458 /* MSDU aggregation happened in edca if the user asked for it so m _currentPacket may contains a normal packet or a A-MSDU*/ | 2376 /* MSDU aggregation happened in edca if the user asked for it so m _currentPacket may contains a normal packet or a A-MSDU*/ |
2459 currentAggregatedPacket = Create<Packet> (); | 2377 currentAggregatedPacket = Create<Packet> (); |
2460 peekedHdr = hdr; | 2378 peekedHdr = hdr; |
2461 uint16_t startingSequenceNumber = 0; | 2379 uint16_t startingSequenceNumber = 0; |
(...skipping 19 matching lines...) Expand all Loading... | |
2481 | 2399 |
2482 if (aggregated) | 2400 if (aggregated) |
2483 { | 2401 { |
2484 NS_LOG_DEBUG ("Adding packet with sequence number " << cur rentSequenceNumber << " to A-MPDU, packet size = " << newPacket->GetSize () << " , A-MPDU size = " << currentAggregatedPacket->GetSize ()); | 2402 NS_LOG_DEBUG ("Adding packet with sequence number " << cur rentSequenceNumber << " to A-MPDU, packet size = " << newPacket->GetSize () << " , A-MPDU size = " << currentAggregatedPacket->GetSize ()); |
2485 i++; | 2403 i++; |
2486 m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> ( aggPacket, peekedHdr)); | 2404 m_aggregateQueue[tid]->Enqueue (Create<WifiMacQueueItem> ( aggPacket, peekedHdr)); |
2487 } | 2405 } |
2488 } | 2406 } |
2489 else if (hdr.IsBlockAckReq ()) | 2407 else if (hdr.IsBlockAckReq ()) |
2490 { | 2408 { |
2491 blockAckSize = static_cast<uint16_t>(packet->GetSize () + hdr. GetSize () + WIFI_MAC_FCS_LENGTH); | 2409 blockAckSize = static_cast<uint16_t> (packet->GetSize () + hdr .GetSize () + WIFI_MAC_FCS_LENGTH); |
S. Deronne
2018/05/11 14:46:05
unavoidable?
| |
2492 qosPolicy = 3; //if the last subrame is block ack req then set ack policy of all frames to blockack | 2410 qosPolicy = 3; //if the last subrame is block ack req then set ack policy of all frames to blockack |
2493 packet->PeekHeader (blockAckReq); | 2411 packet->PeekHeader (blockAckReq); |
2494 startingSequenceNumber = blockAckReq.GetStartingSequence (); | 2412 startingSequenceNumber = blockAckReq.GetStartingSequence (); |
2495 } | 2413 } |
2496 /// \todo We should also handle Ack and BlockAck | 2414 /// \todo We should also handle Ack and BlockAck |
2497 bool retry = false; | 2415 bool retry = false; |
2498 //looks for other packets to the same destination with the same Ti d need to extend that to include MSDUs | 2416 //looks for other packets to the same destination with the same Ti d need to extend that to include MSDUs |
2499 Ptr<const Packet> peekedPacket = edcaIt->second->PeekNextRetransmi tPacket (peekedHdr, peekedHdr.GetAddr1 (), tid, &tstamp); | 2417 Ptr<const Packet> peekedPacket = edcaIt->second->PeekNextRetransmi tPacket (peekedHdr, peekedHdr.GetAddr1 (), tid, &tstamp); |
2500 if (peekedPacket == 0) | 2418 if (peekedPacket == 0) |
2501 { | 2419 { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2666 currentAggregatedPacket->AddHeader (blockAckReq); | 2584 currentAggregatedPacket->AddHeader (blockAckReq); |
2667 } | 2585 } |
2668 | 2586 |
2669 if (qosPolicy == 0) | 2587 if (qosPolicy == 0) |
2670 { | 2588 { |
2671 edcaIt->second->CompleteAmpduTransfer (hdr.GetAddr1 (), ti d); | 2589 edcaIt->second->CompleteAmpduTransfer (hdr.GetAddr1 (), ti d); |
2672 } | 2590 } |
2673 | 2591 |
2674 //Add packet tag | 2592 //Add packet tag |
2675 AmpduTag ampdutag; | 2593 AmpduTag ampdutag; |
2676 ampdutag.SetRemainingNbOfMpdus (static_cast<uint8_t>(i - 1)); | 2594 ampdutag.SetRemainingNbOfMpdus (static_cast<uint8_t> (i - 1)); |
S. Deronne
2018/05/11 14:46:05
I guess we could change i to uint8_t
| |
2677 newPacket = currentAggregatedPacket; | 2595 newPacket = currentAggregatedPacket; |
2678 newPacket->AddPacketTag (ampdutag); | 2596 newPacket->AddPacketTag (ampdutag); |
2679 | 2597 |
2680 NS_LOG_DEBUG ("tx unicast A-MPDU"); | 2598 NS_LOG_DEBUG ("tx unicast A-MPDU"); |
2681 edcaIt->second->SetAmpduExist (hdr.GetAddr1 (), true); | 2599 edcaIt->second->SetAmpduExist (hdr.GetAddr1 (), true); |
2682 } | 2600 } |
2683 else | 2601 else |
2684 { | 2602 { |
2685 uint8_t queueSize = static_cast<uint8_t>(m_aggregateQueue[tid] ->GetNPackets ()); | 2603 uint8_t queueSize = static_cast<uint8_t> (m_aggregateQueue[tid ]->GetNPackets ()); |
2686 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 | 2604 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 |
2687 if (queueSize >= 1) | 2605 if (queueSize >= 1) |
2688 { | 2606 { |
2689 //remove any packets that we added to the aggregate queue | 2607 //remove any packets that we added to the aggregate queue |
2690 FlushAggregateQueue (tid); | 2608 FlushAggregateQueue (tid); |
2691 } | 2609 } |
2692 } | 2610 } |
2693 } | 2611 } |
2694 // VHT/HE single MPDU operation | 2612 // VHT/HE single MPDU operation |
2695 WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_curre ntHdr); | 2613 WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_curre ntHdr); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2755 { | 2673 { |
2756 bool msduAggregation = false; | 2674 bool msduAggregation = false; |
2757 bool isAmsdu = false; | 2675 bool isAmsdu = false; |
2758 Ptr<Packet> currentAmsduPacket = Create<Packet> (); | 2676 Ptr<Packet> currentAmsduPacket = Create<Packet> (); |
2759 Ptr<Packet> tempPacket = Create<Packet> (); | 2677 Ptr<Packet> tempPacket = Create<Packet> (); |
2760 | 2678 |
2761 Ptr<WifiMacQueue> queue; | 2679 Ptr<WifiMacQueue> queue; |
2762 AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr)); | 2680 AcIndex ac = QosUtilsMapTidToAc (GetTid (packet, *hdr)); |
2763 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (ac); | 2681 std::map<AcIndex, Ptr<EdcaTxopN> >::const_iterator edcaIt = m_edca.find (ac); |
2764 NS_ASSERT (edcaIt != m_edca.end ()); | 2682 NS_ASSERT (edcaIt != m_edca.end ()); |
2765 queue = edcaIt->second->GetQueue (); | 2683 queue = edcaIt->second->GetWifiMacQueue (); |
2766 | 2684 |
2767 Ptr<const WifiMacQueueItem> peekedItem = queue->DequeueByTidAndAddress (hdr->G etQosTid (), | 2685 Ptr<const WifiMacQueueItem> peekedItem = queue->DequeueByTidAndAddress (hdr->G etQosTid (), |
2768 WifiMa cHeader::ADDR1, | 2686 WifiMa cHeader::ADDR1, |
2769 hdr->G etAddr1 ()); | 2687 hdr->G etAddr1 ()); |
2770 if (peekedItem) | 2688 if (peekedItem) |
2771 { | 2689 { |
2772 *hdr = peekedItem->GetHeader (); | 2690 *hdr = peekedItem->GetHeader (); |
2773 } | 2691 } |
2774 | 2692 |
2775 edcaIt->second->GetMsduAggregator ()->Aggregate (packet, currentAmsduPacket, | 2693 edcaIt->second->GetMsduAggregator ()->Aggregate (packet, currentAmsduPacket, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2808 return currentAmsduPacket; | 2726 return currentAmsduPacket; |
2809 } | 2727 } |
2810 else | 2728 else |
2811 { | 2729 { |
2812 queue->PushFront (Create<WifiMacQueueItem> (packet, *hdr)); | 2730 queue->PushFront (Create<WifiMacQueueItem> (packet, *hdr)); |
2813 return 0; | 2731 return 0; |
2814 } | 2732 } |
2815 } | 2733 } |
2816 | 2734 |
2817 } //namespace ns3 | 2735 } //namespace ns3 |
LEFT | RIGHT |