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

(-)a/examples/wireless/power-adaptation-distance.cc (-1 / +1 lines)
 Lines 172-178    Link Here 
172
      WifiMode mode = phy->GetMode (i);
172
      WifiMode mode = phy->GetMode (i);
173
      WifiTxVector txVector;
173
      WifiTxVector txVector;
174
      txVector.SetMode (mode);
174
      txVector.SetMode (mode);
175
      timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency (), NORMAL_MPDU, 0), mode));
175
      timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()), mode));
176
    }
176
    }
177
}
177
}
178
178
(-)a/examples/wireless/power-adaptation-interference.cc (-1 / +1 lines)
 Lines 168-174    Link Here 
168
      WifiMode mode = phy->GetMode (i);
168
      WifiMode mode = phy->GetMode (i);
169
      WifiTxVector txVector;
169
      WifiTxVector txVector;
170
      txVector.SetMode (mode);
170
      txVector.SetMode (mode);
171
      timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency (), NORMAL_MPDU, 0), mode));
171
      timeTable.push_back (std::make_pair (phy->CalculateTxDuration (packetSize, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()), mode));
172
    }
172
    }
173
}
173
}
174
174
(-)a/src/mesh/model/dot11s/airtime-metric.cc (-1 / +1 lines)
 Lines 96-102    Link Here 
96
  //calculate metric
96
  //calculate metric
97
  uint32_t metric = (uint32_t)((double)( /*Overhead + payload*/
97
  uint32_t metric = (uint32_t)((double)( /*Overhead + payload*/
98
                                 mac->GetPifs () + mac->GetSlot () + mac->GetEifsNoDifs () + //DIFS + SIFS + AckTxTime = PIFS + SLOT + EifsNoDifs
98
                                 mac->GetPifs () + mac->GetSlot () + mac->GetEifsNoDifs () + //DIFS + SIFS + AckTxTime = PIFS + SLOT + EifsNoDifs
99
                                 mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), txVector, WIFI_PREAMBLE_LONG, mac->GetWifiPhy ()->GetFrequency(), NORMAL_MPDU, 0)
99
                                 mac->GetWifiPhy ()->CalculateTxDuration (m_testFrame->GetSize (), txVector, WIFI_PREAMBLE_LONG, mac->GetWifiPhy ()->GetFrequency())
100
                                 ).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
100
                                 ).GetMicroSeconds () / (10.24 * (1.0 - failAvg)));
101
  return metric;
101
  return metric;
102
}
102
}
(-)a/src/wifi/examples/test-interference-helper.cc (-2 / +2 lines)
 Lines 106-112    Link Here 
106
  WifiTxVector txVector;
106
  WifiTxVector txVector;
107
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
107
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
108
  txVector.SetMode (WifiMode (m_input.txModeA));
108
  txVector.SetMode (WifiMode (m_input.txModeA));
109
  m_txA->SendPacket (p, txVector, m_input.preamble, NORMAL_MPDU);
109
  m_txA->SendPacket (p, txVector, m_input.preamble);
110
}
110
}
111
111
112
void
112
void
 Lines 116-122    Link Here 
116
  WifiTxVector txVector;
116
  WifiTxVector txVector;
117
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
117
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
118
  txVector.SetMode (WifiMode (m_input.txModeB));
118
  txVector.SetMode (WifiMode (m_input.txModeB));
119
  m_txB->SendPacket (p, txVector, m_input.preamble, NORMAL_MPDU);
119
  m_txB->SendPacket (p, txVector, m_input.preamble);
120
}
120
}
121
121
122
InterferenceExperiment::InterferenceExperiment ()
122
InterferenceExperiment::InterferenceExperiment ()
(-)a/src/wifi/examples/wifi-phy-test.cc (-3 / +3 lines)
 Lines 74-80    Link Here 
74
  WifiTxVector txVector;
74
  WifiTxVector txVector;
75
  txVector.SetTxPowerLevel (m_input.txPowerLevel);
75
  txVector.SetTxPowerLevel (m_input.txPowerLevel);
76
  txVector.SetMode (mode);
76
  txVector.SetMode (mode);
77
  m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, NORMAL_MPDU);
77
  m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG);
78
}
78
}
79
79
80
void
80
void
 Lines 182-188    Link Here 
182
  WifiTxVector txVector;
182
  WifiTxVector txVector;
183
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
183
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
184
  txVector.SetMode (WifiMode (m_input.txModeA));
184
  txVector.SetMode (WifiMode (m_input.txModeA));
185
  m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, NORMAL_MPDU);
185
  m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG);
186
}
186
}
187
187
188
void
188
void
 Lines 193-199    Link Here 
193
  WifiTxVector txVector;
193
  WifiTxVector txVector;
194
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
194
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
195
  txVector.SetMode (WifiMode (m_input.txModeB));
195
  txVector.SetMode (WifiMode (m_input.txModeB));
196
  m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, NORMAL_MPDU);
196
  m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG);
197
}
197
}
198
198
199
void
199
void
(-)a/src/wifi/model/mac-low.cc (-24 / +25 lines)
 Lines 1252-1258    Link Here 
1252
MacLow::GetAckDuration (WifiTxVector ackTxVector) const
1252
MacLow::GetAckDuration (WifiTxVector ackTxVector) const
1253
{
1253
{
1254
  NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
1254
  NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //ACK should always use non-HT PPDU (HT PPDU cases not supported yet)
1255
  return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1255
  return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency ());
1256
}
1256
}
1257
1257
1258
Time
1258
Time
 Lines 1271-1277    Link Here 
1271
    {
1271
    {
1272
      preamble = WIFI_PREAMBLE_LONG;
1272
      preamble = WIFI_PREAMBLE_LONG;
1273
    }
1273
    }
1274
  return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1274
  return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, preamble, m_phy->GetFrequency ());
1275
}
1275
}
1276
1276
1277
Time
1277
Time
 Lines 1285-1291    Link Here 
1285
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const
1285
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const
1286
{
1286
{
1287
  NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1287
  NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //CTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1288
  return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1288
  return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, WIFI_PREAMBLE_LONG, m_phy->GetFrequency ());
1289
}
1289
}
1290
1290
1291
uint32_t
1291
uint32_t
 Lines 1385-1391    Link Here 
1385
          //Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1385
          //Otherwise, RTS should always use non-HT PPDU (HT PPDU cases not supported yet)
1386
          preamble = WIFI_PREAMBLE_LONG;
1386
          preamble = WIFI_PREAMBLE_LONG;
1387
        }
1387
        }
1388
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1388
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency ());
1389
      txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector);
1389
      txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector);
1390
      txTime += Time (GetSifs () * 2);
1390
      txTime += Time (GetSifs () * 2);
1391
    }
1391
    }
 Lines 1411-1417    Link Here 
1411
      preamble = WIFI_PREAMBLE_LONG;
1411
      preamble = WIFI_PREAMBLE_LONG;
1412
    }
1412
    }
1413
  uint32_t dataSize = GetSize (packet, hdr);
1413
  uint32_t dataSize = GetSize (packet, hdr);
1414
  txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1414
  txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, preamble, m_phy->GetFrequency ());
1415
  if (params.MustWaitAck ())
1415
  if (params.MustWaitAck ())
1416
    {
1416
    {
1417
      txTime += GetSifs ();
1417
      txTime += GetSifs ();
 Lines 1451-1457    Link Here 
1451
          preamble = WIFI_PREAMBLE_LONG;
1451
          preamble = WIFI_PREAMBLE_LONG;
1452
        }
1452
        }
1453
      txTime += GetSifs ();
1453
      txTime += GetSifs ();
1454
      txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1454
      txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency ());
1455
    }
1455
    }
1456
  return txTime;
1456
  return txTime;
1457
}
1457
}
 Lines 1489-1495    Link Here 
1489
          cts.SetType (WIFI_MAC_CTL_CTS);
1489
          cts.SetType (WIFI_MAC_CTL_CTS);
1490
          WifiTxVector txVector = GetRtsTxVector (packet, &hdr);
1490
          WifiTxVector txVector = GetRtsTxVector (packet, &hdr);
1491
          Time navCounterResetCtsMissedDelay =
1491
          Time navCounterResetCtsMissedDelay =
1492
            m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0) +
1492
            m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, preamble, m_phy->GetFrequency ()) +
1493
            Time (2 * GetSifs ()) + Time (2 * GetSlotTime ());
1493
            Time (2 * GetSifs ()) + Time (2 * GetSlotTime ());
1494
          m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay,
1494
          m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay,
1495
                                                            &MacLow::NavCounterResetCtsMissed, this,
1495
                                                            &MacLow::NavCounterResetCtsMissed, this,
 Lines 1585-1591    Link Here 
1585
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1585
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1586
  if (!m_ampdu || hdr->IsRts ())
1586
  if (!m_ampdu || hdr->IsRts ())
1587
    {
1587
    {
1588
      m_phy->SendPacket (packet, txVector, preamble, NORMAL_MPDU);
1588
      m_phy->SendPacket (packet, txVector, preamble);
1589
    }
1589
    }
1590
  else
1590
  else
1591
    {
1591
    {
 Lines 1634-1639    Link Here 
1634
              ampdutag.SetNoOfMpdus (queueSize);
1634
              ampdutag.SetNoOfMpdus (queueSize);
1635
            }
1635
            }
1636
          newPacket->AddPacketTag (ampdutag);
1636
          newPacket->AddPacketTag (ampdutag);
1637
          
1637
          if (delay == Seconds (0))
1638
          if (delay == Seconds (0))
1638
            {
1639
            {
1639
              if (!vhtSingleMpdu)
1640
              if (!vhtSingleMpdu)
 Lines 1645-1659    Link Here 
1645
                {
1646
                {
1646
                  mpdutype = NORMAL_MPDU;
1647
                  mpdutype = NORMAL_MPDU;
1647
                }
1648
                }
1648
              m_phy->SendPacket (newPacket, txVector, preamble, mpdutype);
1649
              m_phy->SendPacket (newPacket, packet->GetSize (), txVector, preamble, mpdutype);
1649
            }
1650
            }
1650
          else
1651
          else
1651
            {
1652
            {
1652
              Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, mpdutype);
1653
              Simulator::Schedule (delay, &MacLow::SendMpdu, this, newPacket, packet->GetSize (), txVector, preamble, mpdutype);
1653
            }
1654
            }
1654
          if (queueSize > 1)
1655
          if (queueSize > 1)
1655
            {
1656
            {
1656
              delay = delay + m_phy->CalculateTxDuration (GetSize (newPacket, &newHdr), txVector, preamble, m_phy->GetFrequency (), mpdutype, 0);
1657
              delay = delay + m_phy->CalculateTxDuration (GetSize (newPacket, &newHdr), packet->GetSize (), txVector, preamble, m_phy->GetFrequency (), mpdutype, 0);
1657
            }
1658
            }
1658
          preamble = WIFI_PREAMBLE_NONE;
1659
          preamble = WIFI_PREAMBLE_NONE;
1659
        }
1660
        }
 Lines 1661-1670    Link Here 
1661
}
1662
}
1662
1663
1663
void
1664
void
1664
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
1665
MacLow::SendMpdu (Ptr<const Packet> packet, uint32_t ampduSize, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
1665
{
1666
{
1666
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1667
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1667
  m_phy->SendPacket (packet, txVector, preamble, mpdutype);
1668
  m_phy->SendPacket (packet, ampduSize, txVector, preamble, mpdutype);
1668
}
1669
}
1669
1670
1670
void
1671
void
 Lines 1794-1800    Link Here 
1794
      duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector);
1795
      duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector);
1795
      duration += GetSifs ();
1796
      duration += GetSifs ();
1796
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr),
1797
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr),
1797
                                              dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1798
                                              dataTxVector, preamble, m_phy->GetFrequency ());
1798
      duration += GetSifs ();
1799
      duration += GetSifs ();
1799
      if (m_txParams.MustWaitBasicBlockAck ())
1800
      if (m_txParams.MustWaitBasicBlockAck ())
1800
        {
1801
        {
 Lines 1813-1819    Link Here 
1813
      if (m_txParams.HasNextPacket ())
1814
      if (m_txParams.HasNextPacket ())
1814
        {
1815
        {
1815
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1816
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1816
                                                  dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1817
                                                  dataTxVector, preamble, m_phy->GetFrequency ());
1817
          if (m_txParams.MustWaitAck ())
1818
          if (m_txParams.MustWaitAck ())
1818
            {
1819
            {
1819
              duration += GetSifs ();
1820
              duration += GetSifs ();
 Lines 1823-1829    Link Here 
1823
    }
1824
    }
1824
  rts.SetDuration (duration);
1825
  rts.SetDuration (duration);
1825
1826
1826
  Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1827
  Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency ());
1827
  Time timerDelay = txDuration + GetCtsTimeout ();
1828
  Time timerDelay = txDuration + GetCtsTimeout ();
1828
1829
1829
  NS_ASSERT (m_ctsTimeoutEvent.IsExpired ());
1830
  NS_ASSERT (m_ctsTimeoutEvent.IsExpired ());
 Lines 1865-1871    Link Here 
1865
      preamble = WIFI_PREAMBLE_LONG;
1866
      preamble = WIFI_PREAMBLE_LONG;
1866
    }
1867
    }
1867
1868
1868
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1869
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, preamble, m_phy->GetFrequency ());
1869
  if (m_txParams.MustWaitNormalAck ())
1870
  if (m_txParams.MustWaitNormalAck ())
1870
    {
1871
    {
1871
      Time timerDelay = txDuration + GetAckTimeout ();
1872
      Time timerDelay = txDuration + GetAckTimeout ();
 Lines 1983-1989    Link Here 
1983
        {
1984
        {
1984
          duration += GetSifs ();
1985
          duration += GetSifs ();
1985
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1986
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
1986
                                                  dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
1987
                                                  dataTxVector, preamble, m_phy->GetFrequency ());
1987
          if (m_txParams.MustWaitAck ())
1988
          if (m_txParams.MustWaitAck ())
1988
            {
1989
            {
1989
              duration += GetSifs ();
1990
              duration += GetSifs ();
 Lines 2051-2057    Link Here 
2051
      WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
2052
      WifiTxVector dataTxVector = GetDataTxVector (m_currentPacket, &m_currentHdr);
2052
      duration += GetSifs ();
2053
      duration += GetSifs ();
2053
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket,&m_currentHdr),
2054
      duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket,&m_currentHdr),
2054
                                              dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
2055
                                              dataTxVector, preamble, m_phy->GetFrequency ());
2055
      if (m_txParams.MustWaitBasicBlockAck ())
2056
      if (m_txParams.MustWaitBasicBlockAck ())
2056
        {
2057
        {
2057
2058
 Lines 2074-2080    Link Here 
2074
        {
2075
        {
2075
          duration += GetSifs ();
2076
          duration += GetSifs ();
2076
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
2077
          duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
2077
                                                  dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
2078
                                                  dataTxVector, preamble, m_phy->GetFrequency ());
2078
          if (m_txParams.MustWaitCompressedBlockAck ())
2079
          if (m_txParams.MustWaitCompressedBlockAck ())
2079
            {
2080
            {
2080
              duration += GetSifs ();
2081
              duration += GetSifs ();
 Lines 2098-2104    Link Here 
2098
2099
2099
  ForwardDown (packet, &cts, ctsTxVector,preamble);
2100
  ForwardDown (packet, &cts, ctsTxVector,preamble);
2100
2101
2101
  Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
2102
  Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency ());
2102
  txDuration += GetSifs ();
2103
  txDuration += GetSifs ();
2103
  NS_ASSERT (m_sendDataEvent.IsExpired ());
2104
  NS_ASSERT (m_sendDataEvent.IsExpired ());
2104
2105
 Lines 2209-2215    Link Here 
2209
  if (m_txParams.HasNextPacket ())
2210
  if (m_txParams.HasNextPacket ())
2210
    {
2211
    {
2211
      newDuration += GetSifs ();
2212
      newDuration += GetSifs ();
2212
      newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
2213
      newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency ());
2213
      if (m_txParams.MustWaitCompressedBlockAck ())
2214
      if (m_txParams.MustWaitCompressedBlockAck ())
2214
        {
2215
        {
2215
          newDuration += GetSifs ();
2216
          newDuration += GetSifs ();
 Lines 2223-2229    Link Here 
2223
        }
2224
        }
2224
    }
2225
    }
2225
2226
2226
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0);
2227
  Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, preamble, m_phy->GetFrequency ());
2227
  duration -= txDuration;
2228
  duration -= txDuration;
2228
  duration -= GetSifs ();
2229
  duration -= GetSifs ();
2229
2230
 Lines 2836-2842    Link Here 
2836
    }
2837
    }
2837
2838
2838
  //An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds)
2839
  //An HT STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime (10 milliseconds)
2839
  if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, dataTxVector, preamble, m_phy->GetFrequency (), NORMAL_MPDU, 0) > MilliSeconds (10))
2840
  if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, dataTxVector, preamble, m_phy->GetFrequency ()) > MilliSeconds (10))
2840
    {
2841
    {
2841
      NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime");
2842
      NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime");
2842
      return true;
2843
      return true;
(-)a/src/wifi/model/mac-low.h (-2 / +3 lines)
 Lines 887-901    Link Here 
887
  void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,
887
  void ForwardDown (Ptr<const Packet> packet, const WifiMacHeader *hdr,
888
                    WifiTxVector txVector, WifiPreamble preamble);
888
                    WifiTxVector txVector, WifiPreamble preamble);
889
  /**
889
  /**
890
   * Forward the packet down to WifiPhy for transmission. This is called for each MPDU when MPDU aggregation is used.
890
   * Forward the MPDU down to WifiPhy for transmission. This is called for each MPDU when MPDU aggregation is used.
891
   *
891
   *
892
   * \param packet
892
   * \param packet
893
   * \param ampduSize
893
   * \param hdr
894
   * \param hdr
894
   * \param txVector
895
   * \param txVector
895
   * \param preamble
896
   * \param preamble
896
   * \param mpdutype
897
   * \param mpdutype
897
   */
898
   */
898
  void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype);
899
  void SendMpdu (Ptr<const Packet> packet, uint32_t ampduSize, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype);
899
  /**
900
  /**
900
   * Return a TXVECTOR for the RTS frame given the destination.
901
   * Return a TXVECTOR for the RTS frame given the destination.
901
   * The function consults WifiRemoteStationManager, which controls the rate
902
   * The function consults WifiRemoteStationManager, which controls the rate
(-)a/src/wifi/model/minstrel-wifi-manager.cc (-1 / +1 lines)
 Lines 138-144    Link Here 
138
      WifiMode mode = phy->GetMode (i);
138
      WifiMode mode = phy->GetMode (i);
139
      WifiTxVector txVector;
139
      WifiTxVector txVector;
140
      txVector.SetMode (mode);
140
      txVector.SetMode (mode);
141
      AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency (), NORMAL_MPDU, 0));
141
      AddCalcTxTime (mode, phy->CalculateTxDuration (m_pktLen, txVector, WIFI_PREAMBLE_LONG, phy->GetFrequency ()));
142
    }
142
    }
143
  WifiRemoteStationManager::SetupPhy (phy);
143
  WifiRemoteStationManager::SetupPhy (phy);
144
}
144
}
(-)a/src/wifi/model/wifi-phy.cc (-18 / +60 lines)
 Lines 395-404    Link Here 
395
}
395
}
396
396
397
Time
397
Time
398
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag)
398
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
399
{
400
  return GetPayloadDuration (size, size, txVector, preamble, frequency, NORMAL_MPDU, 0);
401
}
402
403
Time
404
WifiPhy::GetPayloadDuration (uint32_t mpduSize, uint32_t ampduSize, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag)
399
{
405
{
400
  WifiMode payloadMode = txVector.GetMode ();
406
  WifiMode payloadMode = txVector.GetMode ();
401
  NS_LOG_FUNCTION (size << payloadMode);
407
  NS_LOG_FUNCTION (mpduSize << payloadMode);
402
408
403
  switch (payloadMode.GetModulationClass ())
409
  switch (payloadMode.GetModulationClass ())
404
    {
410
    {
 Lines 432-458    Link Here 
432
        if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
438
        if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
433
          {
439
          {
434
            //First packet in an A-MPDU
440
            //First packet in an A-MPDU
435
            numSymbols = ceil ((16 + size * 8.0 + 6) / numDataBitsPerSymbol);
441
            numSymbols = ceil ((16 + mpduSize * 8.0 + 6) / numDataBitsPerSymbol);
436
            if (incFlag == 1)
442
            if (incFlag == 1)
437
              {
443
              {
438
                m_totalAmpduSize += size;
444
                m_totalAmpduSize += mpduSize;
439
                m_totalAmpduNumSymbols += numSymbols;
445
                m_totalAmpduNumSymbols += numSymbols;
446
                NS_ASSERT (m_totalAmpduSize <= ampduSize);
447
                uint32_t expectedTotalSymbols = lrint (ceil ((16 + ampduSize * 8.0 + 6) / numDataBitsPerSymbol));
448
                if (m_totalAmpduNumSymbols == expectedTotalSymbols)
449
                  {
450
                    //Workaround to avoid to have null duration for the last MPDU when it is has a small size (e.g. BAR, ...).
451
                    m_totalAmpduNumSymbols--;
452
                  }
440
              }
453
              }
441
          }
454
          }
442
        else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
455
        else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
443
          {
456
          {
444
            //consecutive packets in an A-MPDU
457
            //consecutive packets in an A-MPDU
445
            numSymbols = ((size * 8.0) / numDataBitsPerSymbol);
458
            numSymbols = ((mpduSize * 8.0) / numDataBitsPerSymbol);
446
            if (incFlag == 1)
459
            if (incFlag == 1)
447
              {
460
              {
448
                m_totalAmpduSize += size;
461
                m_totalAmpduSize += mpduSize;
449
                m_totalAmpduNumSymbols += numSymbols;
462
                m_totalAmpduNumSymbols += numSymbols;
463
                NS_ASSERT (m_totalAmpduSize <= ampduSize);
464
                uint32_t expectedTotalSymbols = lrint (ceil ((16 + ampduSize * 8.0 + 6) / numDataBitsPerSymbol));
465
                if (m_totalAmpduNumSymbols == expectedTotalSymbols)
466
                  {
467
                    //Workaround to avoid to have null duration for the last MPDU when it is has a small size (e.g. BAR, ...).
468
                    m_totalAmpduNumSymbols--;
469
                  }
450
              }
470
              }
451
          }
471
          }
452
        else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
472
        else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
453
          {
473
          {
454
            //last packet in an A-MPDU
474
            //last packet in an A-MPDU
455
            uint32_t totalAmpduSize = m_totalAmpduSize + size;
475
            uint32_t totalAmpduSize = m_totalAmpduSize + mpduSize;
476
            NS_ASSERT (totalAmpduSize == ampduSize);
456
            numSymbols = lrint (ceil ((16 + totalAmpduSize * 8.0 + 6) / numDataBitsPerSymbol));
477
            numSymbols = lrint (ceil ((16 + totalAmpduSize * 8.0 + 6) / numDataBitsPerSymbol));
457
            numSymbols -= m_totalAmpduNumSymbols;
478
            numSymbols -= m_totalAmpduNumSymbols;
458
            if (incFlag == 1)
479
            if (incFlag == 1)
 Lines 464-470    Link Here 
464
        else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE)
485
        else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE)
465
          {
486
          {
466
            //Not an A-MPDU
487
            //Not an A-MPDU
467
            numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
488
            numSymbols = lrint (ceil ((16 + mpduSize * 8.0 + 6.0) / numDataBitsPerSymbol));
468
          }
489
          }
469
        else
490
        else
470
          {
491
          {
 Lines 526-552    Link Here 
526
        if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
547
        if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE)
527
          {
548
          {
528
            //First packet in an A-MPDU
549
            //First packet in an A-MPDU
529
            numSymbols = ceil (m_Stbc * (16 + size * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol));
550
            numSymbols = ceil (m_Stbc * (16 + mpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol));
530
            if (incFlag == 1)
551
            if (incFlag == 1)
531
              {
552
              {
532
                m_totalAmpduSize += size;
553
                m_totalAmpduSize += mpduSize;
533
                m_totalAmpduNumSymbols += numSymbols;
554
                m_totalAmpduNumSymbols += numSymbols;
555
                NS_ASSERT (m_totalAmpduSize <= ampduSize);
556
                uint32_t expectedTotalSymbols = lrint (m_Stbc * ceil ((16 + ampduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
557
                if (m_totalAmpduNumSymbols == expectedTotalSymbols)
558
                  {
559
                    //Workaround to avoid to have null duration for the last MPDU when it is has a small size (e.g. BAR, ...).
560
                    m_totalAmpduNumSymbols--;
561
                  }
534
              }
562
              }
535
          }
563
          }
536
        else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
564
        else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
537
          {
565
          {
538
            //consecutive packets in an A-MPDU
566
            //consecutive packets in an A-MPDU
539
            numSymbols = m_Stbc * ((size * 8.0 ) / (m_Stbc * numDataBitsPerSymbol));
567
            numSymbols = m_Stbc * ((mpduSize * 8.0 ) / (m_Stbc * numDataBitsPerSymbol));
540
            if (incFlag == 1)
568
            if (incFlag == 1)
541
              {
569
              {
542
                m_totalAmpduSize += size;
570
                m_totalAmpduSize += mpduSize;
543
                m_totalAmpduNumSymbols += numSymbols;
571
                m_totalAmpduNumSymbols += numSymbols;
572
                NS_ASSERT (m_totalAmpduSize <= ampduSize);
573
                uint32_t expectedTotalSymbols = lrint (m_Stbc * ceil ((16 + ampduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
574
                if (m_totalAmpduNumSymbols == expectedTotalSymbols)
575
                  {
576
                    //Workaround to avoid to have null duration for the last MPDU when it is has a small size (e.g. BAR, ...).
577
                    m_totalAmpduNumSymbols--;
578
                  }
544
              }
579
              }
545
          }
580
          }
546
        else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
581
        else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE)
547
          {
582
          {
548
            //last packet in an A-MPDU
583
            //last packet in an A-MPDU
549
            uint32_t totalAmpduSize = m_totalAmpduSize + size;
584
            uint32_t totalAmpduSize = m_totalAmpduSize + mpduSize;
585
            NS_ASSERT (totalAmpduSize == ampduSize);
550
            numSymbols = lrint (m_Stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
586
            numSymbols = lrint (m_Stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
551
            NS_ASSERT (m_totalAmpduNumSymbols <= numSymbols);
587
            NS_ASSERT (m_totalAmpduNumSymbols <= numSymbols);
552
            numSymbols -= m_totalAmpduNumSymbols;
588
            numSymbols -= m_totalAmpduNumSymbols;
 Lines 559-565    Link Here 
559
        else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE)
595
        else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE)
560
          {
596
          {
561
            //Not an A-MPDU
597
            //Not an A-MPDU
562
            numSymbols = lrint (m_Stbc * ceil ((16 + size * 8.0 + 6.0 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
598
            numSymbols = lrint (m_Stbc * ceil ((16 + mpduSize * 8.0 + 6.0 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
563
          }
599
          }
564
        else
600
        else
565
          {
601
          {
 Lines 578-587    Link Here 
578
    case WIFI_MOD_CLASS_DSSS:
614
    case WIFI_MOD_CLASS_DSSS:
579
    case WIFI_MOD_CLASS_HR_DSSS:
615
    case WIFI_MOD_CLASS_HR_DSSS:
580
      //(Section 17.2.3.6 "Long PLCP LENGTH field"; IEEE Std 802.11-2012)
616
      //(Section 17.2.3.6 "Long PLCP LENGTH field"; IEEE Std 802.11-2012)
581
      NS_LOG_LOGIC (" size=" << size
617
      NS_LOG_LOGIC (" size=" << mpduSize
582
                             << " mode=" << payloadMode
618
                             << " mode=" << payloadMode
583
                             << " rate=" << payloadMode.GetDataRate (22, 0, 1));
619
                             << " rate=" << payloadMode.GetDataRate (22, 0, 1));
584
      return MicroSeconds (lrint (ceil ((size * 8.0) / (payloadMode.GetDataRate (22, 0, 1) / 1.0e6))));
620
      return MicroSeconds (lrint (ceil ((mpduSize * 8.0) / (payloadMode.GetDataRate (22, 0, 1) / 1.0e6))));
585
    default:
621
    default:
586
      NS_FATAL_ERROR ("unsupported modulation class");
622
      NS_FATAL_ERROR ("unsupported modulation class");
587
      return MicroSeconds (0);
623
      return MicroSeconds (0);
 Lines 602-614    Link Here 
602
}
638
}
603
639
604
Time
640
Time
605
WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag)
641
WifiPhy::CalculateTxDuration (uint32_t mpduSize, uint32_t ampduSize, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag)
606
{
642
{
607
  Time duration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble)
643
  Time duration = CalculatePlcpPreambleAndHeaderDuration (txVector, preamble)
608
    + GetPayloadDuration (size, txVector, preamble, frequency, mpdutype, incFlag);
644
    + GetPayloadDuration (mpduSize, ampduSize, txVector, preamble, frequency, mpdutype, incFlag);
609
  return duration;
645
  return duration;
610
}
646
}
611
647
648
Time
649
WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
650
{
651
  return CalculateTxDuration (size, size, txVector, preamble, frequency, NORMAL_MPDU, 0);
652
}
653
612
void
654
void
613
WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
655
WifiPhy::NotifyTxBegin (Ptr<const Packet> packet)
614
{
656
{
(-)a/src/wifi/model/wifi-phy.h (-5 / +34 lines)
 Lines 235-243    Link Here 
235
   *        this packet, and txPowerLevel, a power level to use to send this packet. The real transmission
235
   *        this packet, and txPowerLevel, a power level to use to send this packet. The real transmission
236
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
236
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
237
   * \param preamble the type of preamble to use to send this packet.
237
   * \param preamble the type of preamble to use to send this packet.
238
   */
239
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble) = 0;
240
  /**
241
   * \param packet the packet to send
242
   * \param totalSize the total number of bytes that is going to be transmitted in the case of an A-MPDU.
243
   * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send
244
   *        this packet, and txPowerLevel, a power level to use to send this packet. The real transmission
245
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
246
   * \param preamble the type of preamble to use to send this packet.
238
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
247
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
239
   */
248
   */
240
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype) = 0;
249
  virtual void SendPacket (Ptr<const Packet> packet, uint32_t totalSize, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype) = 0;
241
250
242
  /**
251
  /**
243
   * \param listener the new listener
252
   * \param listener the new listener
 Lines 315-326    Link Here 
315
   * \param txVector the TXVECTOR used for the transmission of this packet
324
   * \param txVector the TXVECTOR used for the transmission of this packet
316
   * \param preamble the type of preamble to use for this packet.
325
   * \param preamble the type of preamble to use for this packet.
317
   * \param frequency the channel center frequency (MHz)
326
   * \param frequency the channel center frequency (MHz)
327
   *
328
   * \return the total amount of time this PHY will stay busy for the transmission of these bytes.
329
   */
330
  Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency);
331
  /**
332
   * \param size the number of bytes in the packet to send
333
   * \param ampduSize the total number of bytes that is going to be transmitted in the case of an A-MPDU.
334
   * \param txVector the TXVECTOR used for the transmission of this packet
335
   * \param preamble the type of preamble to use for this packet.
336
   * \param frequency the channel center frequency (MHz)
318
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
337
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
319
   * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time.
338
   * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time.
320
   *
339
   *
321
   * \return the total amount of time this PHY will stay busy for the transmission of these bytes.
340
   * \return the total amount of time this PHY will stay busy for the transmission of these bytes.
322
   */
341
   */
323
  Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag);
342
  Time CalculateTxDuration (uint32_t mpduSize, uint32_t ampduSize, WifiTxVector txVector, enum WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag);
324
343
325
  /**
344
  /**
326
   * \param txVector the transmission parameters used for this packet
345
   * \param txVector the transmission parameters used for this packet
 Lines 397-412    Link Here 
397
   */
416
   */
398
  static Time GetPlcpPreambleDuration (WifiTxVector txVector, WifiPreamble preamble);
417
  static Time GetPlcpPreambleDuration (WifiTxVector txVector, WifiPreamble preamble);
399
  /**
418
  /**
400
   * \param size the number of bytes in the packet to send
419
   * \param size the number of bytes in the MPDU to send
420
   * \param txVector the TXVECTOR used for the transmission of this packet
421
   * \param preamble the type of preamble to use for this packet
422
   * \param frequency the channel center frequency (MHz)
423
   *
424
   * \return the duration of the payload
425
   */
426
  Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency);
427
  /**
428
   * \param size the number of bytes in the MPDU to send
429
   * \param ampduSize the total number of bytes in the A-MPDU.
401
   * \param txVector the TXVECTOR used for the transmission of this packet
430
   * \param txVector the TXVECTOR used for the transmission of this packet
402
   * \param preamble the type of preamble to use for this packet
431
   * \param preamble the type of preamble to use for this packet
403
   * \param frequency the channel center frequency (MHz)
432
   * \param frequency the channel center frequency (MHz)
404
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
433
   * \param mpdutype the type of the MPDU as defined in WifiPhy::mpduType.
405
   * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time
434
   * \param incFlag this flag is used to indicate that the static variables need to be update or not. This function is called a couple of times for the same packet so static variables should not be increased each time
406
   *
435
   *
407
   * \return the duration of the payload
436
   * \return the duration of the MPDU in an A-MPDU
408
   */
437
   */
409
  Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag);
438
  Time GetPayloadDuration (uint32_t size, uint32_t totalSize, WifiTxVector txVector, WifiPreamble preamble, double frequency, enum mpduType mpdutype, uint8_t incFlag);
410
439
411
  /**
440
  /**
412
   * The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used
441
   * The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used
(-)a/src/wifi/model/yans-wifi-phy.cc (-2 / +8 lines)
 Lines 767-773    Link Here 
767
}
767
}
768
768
769
void
769
void
770
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
770
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble)
771
{
772
  SendPacket (packet, packet->GetSize (), txVector, preamble, NORMAL_MPDU);
773
}
774
775
void
776
YansWifiPhy::SendPacket (Ptr<const Packet> packet, uint32_t ampduSize, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype)
771
{
777
{
772
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)mpdutype);
778
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)mpdutype);
773
  /* Transmission can happen if:
779
  /* Transmission can happen if:
 Lines 785-791    Link Here 
785
      return;
791
      return;
786
    }
792
    }
787
793
788
  Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble, GetFrequency (), mpdutype, 1);
794
  Time txDuration = CalculateTxDuration (packet->GetSize (), ampduSize, txVector, preamble, GetFrequency (), mpdutype, 1);
789
  NS_ASSERT (txDuration > NanoSeconds (0));
795
  NS_ASSERT (txDuration > NanoSeconds (0));
790
796
791
  if (m_state->IsStateRx ())
797
  if (m_state->IsStateRx ())
(-)a/src/wifi/model/yans-wifi-phy.h (-1 / +2 lines)
 Lines 279-285    Link Here 
279
279
280
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
280
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
281
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
281
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
282
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype);
282
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble);
283
  virtual void SendPacket (Ptr<const Packet> packet, uint32_t mpduSize, WifiTxVector txVector, enum WifiPreamble preamble, enum mpduType mpdutype);
283
  virtual void RegisterListener (WifiPhyListener *listener);
284
  virtual void RegisterListener (WifiPhyListener *listener);
284
  virtual void UnregisterListener (WifiPhyListener *listener);
285
  virtual void UnregisterListener (WifiPhyListener *listener);
285
  virtual void SetSleepMode (void);
286
  virtual void SetSleepMode (void);
(-)a/src/wifi/test/tx-duration-test.cc (-4 / +4 lines)
 Lines 100-106    Link Here 
100
    {
100
    {
101
      testedFrequency = CHANNEL_36_MHZ;
101
      testedFrequency = CHANNEL_36_MHZ;
102
    }
102
    }
103
  double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency, NORMAL_MPDU, 0).GetMicroSeconds  ();
103
  double calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency).GetMicroSeconds  ();
104
  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
104
  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
105
    {
105
    {
106
      std::cerr << " size=" << size
106
      std::cerr << " size=" << size
 Lines 115-121    Link Here 
115
    {
115
    {
116
      //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
116
      //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
117
      testedFrequency = CHANNEL_1_MHZ;
117
      testedFrequency = CHANNEL_1_MHZ;
118
      calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency, NORMAL_MPDU, 0).GetMicroSeconds ();
118
      calculatedDurationMicroSeconds = (double)phy->GetPayloadDuration (size, txVector, preamble, testedFrequency).GetMicroSeconds ();
119
      if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
119
      if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
120
        {
120
        {
121
          std::cerr << " size=" << size
121
          std::cerr << " size=" << size
 Lines 148-154    Link Here 
148
    {
148
    {
149
      testedFrequency = CHANNEL_36_MHZ;
149
      testedFrequency = CHANNEL_36_MHZ;
150
    }
150
    }
151
  double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency, NORMAL_MPDU, 0).GetNanoSeconds ()) / 1000;
151
  double calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency).GetNanoSeconds ()) / 1000;
152
  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
152
  if (calculatedDurationMicroSeconds != knownDurationMicroSeconds)
153
    {
153
    {
154
      std::cerr << " size=" << size
154
      std::cerr << " size=" << size
 Lines 164-170    Link Here 
164
    {
164
    {
165
      //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
165
      //Durations vary depending on frequency; test also 2.4 GHz (bug 1971)
166
      testedFrequency = CHANNEL_1_MHZ;
166
      testedFrequency = CHANNEL_1_MHZ;
167
      calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency, NORMAL_MPDU, 0).GetNanoSeconds ()) / 1000;
167
      calculatedDurationMicroSeconds = ((double)phy->CalculateTxDuration (size, txVector, preamble, testedFrequency).GetNanoSeconds ()) / 1000;
168
      if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
168
      if (calculatedDurationMicroSeconds != knownDurationMicroSeconds + 6)
169
        {
169
        {
170
          std::cerr << " size=" << size
170
          std::cerr << " size=" << size

Return to bug 2193