View | Details | Raw Unified | Return to bug 2421
Collapse All | Expand All

(-)ns-3-dev-29f44a43de62/src/wifi/model/mac-low.cc (-5 / +12 lines)
 Lines 1634-1640    Link Here 
1634
    }
1634
    }
1635
  else
1635
  else
1636
    {
1636
    {
1637
      Ptr<Packet> newPacket;
1637
      Ptr<Packet> newPacket, first_mpduPkt;
1638
      Ptr <const Packet> dequeuedPacket;
1638
      Ptr <const Packet> dequeuedPacket;
1639
      WifiMacHeader newHdr;
1639
      WifiMacHeader newHdr;
1640
      WifiMacTrailer fcs;
1640
      WifiMacTrailer fcs;
 Lines 1643-1649    Link Here 
1643
      bool vhtSingleMpdu = false;
1643
      bool vhtSingleMpdu = false;
1644
      bool last = false;
1644
      bool last = false;
1645
      enum mpduType mpdutype = NORMAL_MPDU;
1645
      enum mpduType mpdutype = NORMAL_MPDU;
1646
      
1646
      enum mpduType first_mpdutype = NORMAL_MPDU;
1647
      WifiPreamble first_preamble = preamble;
1648
1647
      uint8_t tid = GetTid (packet, *hdr);
1649
      uint8_t tid = GetTid (packet, *hdr);
1648
      AcIndex ac = QosUtilsMapTidToAc (tid);
1650
      AcIndex ac = QosUtilsMapTidToAc (tid);
1649
      std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac);
1651
      std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac);
 Lines 1683-1696    Link Here 
1683
                {
1685
                {
1684
                  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1686
                  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1685
                  mpdutype = MPDU_IN_AGGREGATE;
1687
                  mpdutype = MPDU_IN_AGGREGATE;
1688
                  first_mpdutype = MPDU_IN_AGGREGATE;
1686
                }
1689
                }
1687
              else
1690
              else
1688
                {
1691
                {
1689
                  mpdutype = NORMAL_MPDU;
1692
            	  mpdutype = NORMAL_MPDU;
1693
            	  first_mpdutype = NORMAL_MPDU;
1690
                }
1694
                }
1691
            }
1695
            }
1692
          
1696
          
1693
          Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, preamble, m_phy->GetFrequency (), mpdutype, 0);
1697
          Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, preamble, m_phy->GetFrequency (), mpdutype, 1);
1694
          remainingAmpduDuration -= mpduDuration;
1698
          remainingAmpduDuration -= mpduDuration;
1695
          ampdutag.SetRemainingNbOfMpdus (queueSize - 1);
1699
          ampdutag.SetRemainingNbOfMpdus (queueSize - 1);
1696
          ampdutag.SetRemainingAmpduDuration (remainingAmpduDuration);
1700
          ampdutag.SetRemainingAmpduDuration (remainingAmpduDuration);
 Lines 1698-1704    Link Here 
1698
1702
1699
          if (delay == Seconds (0))
1703
          if (delay == Seconds (0))
1700
            {
1704
            {
1701
              m_phy->SendPacket (newPacket, txVector, preamble, mpdutype);
1705
        	  first_mpduPkt = newPacket->Copy();
1706
        	  first_preamble = preamble;
1702
            }
1707
            }
1703
          else
1708
          else
1704
            {
1709
            {
 Lines 1711-1716    Link Here 
1711
1716
1712
          preamble = WIFI_PREAMBLE_NONE;
1717
          preamble = WIFI_PREAMBLE_NONE;
1713
        }
1718
        }
1719
       NS_ASSERT(remainingAmpduDuration == 0);
1720
      m_phy->SendPacket (first_mpduPkt, txVector, first_preamble, first_mpdutype);
1714
    }
1721
    }
1715
}
1722
}
1716
1723
(-)ns-3-dev-29f44a43de62/src/wifi/model/wifi-phy.cc (-6 / +43 lines)
 Lines 493-499    Link Here 
493
        Time symbolDuration;
493
        Time symbolDuration;
494
        double m_Stbc;
494
        double m_Stbc;
495
        //if short GI data rate is used then symbol duration is 3.6us else symbol duration is 4us
495
        //if short GI data rate is used then symbol duration is 3.6us else symbol duration is 4us
496
        //In the future has to create a stationmanager that only uses these data rates if sender and reciever support GI
496
        //In the future has to create a stationmanager that only uses these data rates if sender and receiver support GI
497
        if (txVector.IsShortGuardInterval ())
497
        if (txVector.IsShortGuardInterval ())
498
          {
498
          {
499
            symbolDuration = NanoSeconds (3600);
499
            symbolDuration = NanoSeconds (3600);
 Lines 627-632    Link Here 
627
        double numDataBitsPerSymbol = payloadMode.GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ()) * symbolDuration.GetNanoSeconds () / 1e9;
627
        double numDataBitsPerSymbol = payloadMode.GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ()) * symbolDuration.GetNanoSeconds () / 1e9;
628
        double numSymbols;
628
        double numSymbols;
629
629
630
        if(incFlag == 0)
631
        	NS_ASSERT(m_totalAmpduSize == 0);
632
630
        if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
633
        if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
631
          {
634
          {
632
            //First packet in an A-MPDU
635
            //First packet in an A-MPDU
 Lines 635-640    Link Here 
635
              {
638
              {
636
                m_totalAmpduSize += size;
639
                m_totalAmpduSize += size;
637
                m_totalAmpduNumSymbols += numSymbols;
640
                m_totalAmpduNumSymbols += numSymbols;
641
                if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT && frequency >= 2400 && frequency <= 2500) //at 2.4 GHz
642
				  {
643
                	Time mpdu_time = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()) + MicroSeconds (6);
644
                	m_txDurationTime += mpdu_time;
645
					return mpdu_time;
646
				  }
647
				else //at 5 GHz
648
				  {
649
					Time mpdu_time = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ());
650
					m_txDurationTime += mpdu_time;
651
					return mpdu_time;
652
				  }
638
              }
653
              }
639
          }
654
          }
640
        else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
655
        else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
 Lines 645-664    Link Here 
645
              {
660
              {
646
                m_totalAmpduSize += size;
661
                m_totalAmpduSize += size;
647
                m_totalAmpduNumSymbols += numSymbols;
662
                m_totalAmpduNumSymbols += numSymbols;
663
                if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT && frequency >= 2400 && frequency <= 2500) //at 2.4 GHz
664
				  {
665
                	Time mpdu_time = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()) + MicroSeconds (6);
666
                	m_txDurationTime += mpdu_time;
667
					return mpdu_time;
668
				  }
669
				else //at 5 GHz
670
				  {
671
					Time mpdu_time = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ());
672
					m_txDurationTime += mpdu_time;
673
					return mpdu_time;
674
				  }
648
              }
675
              }
649
          }
676
          }
650
        else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
677
        else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
651
          {
678
          {
652
            //last packet in an A-MPDU
679
            //last packet in an A-MPDU
653
            uint32_t totalAmpduSize = m_totalAmpduSize + size;
680
            uint32_t totalAmpduSize = m_totalAmpduSize + size;
681
            Time totalAmpduTime = Seconds(0);
654
            numSymbols = lrint (m_Stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
682
            numSymbols = lrint (m_Stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
655
            NS_ASSERT (m_totalAmpduNumSymbols <= numSymbols);
683
            if(incFlag == 1){
656
            numSymbols -= m_totalAmpduNumSymbols;
684
                if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT && frequency >= 2400 && frequency <= 2500) //at 2.4 GHz
657
            if (incFlag == 1)
685
				  {
658
              {
686
                	totalAmpduTime = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()) + MicroSeconds (6);
687
				  }
688
				else //at 5 GHz
689
				  {
690
					totalAmpduTime =  NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ());
691
				  }
692
                Time lastMpduTime = totalAmpduTime - m_txDurationTime;
693
                NS_ASSERT (m_totalAmpduNumSymbols <= numSymbols);
659
                m_totalAmpduSize = 0;
694
                m_totalAmpduSize = 0;
660
                m_totalAmpduNumSymbols = 0;
695
                m_totalAmpduNumSymbols = 0;
661
              }
696
                m_txDurationTime = Seconds(0);
697
                return lastMpduTime;
698
            }
662
          }
699
          }
663
        else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE)
700
        else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE)
664
          {
701
          {
(-)ns-3-dev-29f44a43de62/src/wifi/model/wifi-phy.h (+1 lines)
 Lines 1410-1415    Link Here 
1410
1410
1411
  double m_totalAmpduNumSymbols;   //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1411
  double m_totalAmpduNumSymbols;   //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1412
  uint32_t m_totalAmpduSize;       //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1412
  uint32_t m_totalAmpduSize;       //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1413
  Time m_txDurationTime;	        //!< Total tx time of the previously transmitted MPDUs in an A-MPDU (in NanoSeconds), used for the computation of the transmission time needed for the last MPDU in the A-MPDU.
1413
};
1414
};
1414
1415
1415
/**
1416
/**

Return to bug 2421