|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
|
|
| 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 |
} |
|
|
| 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 (); |
|
|
| 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 |
} |
|
|
| 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, |
|
|
| 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 |
{ |
|
|
| 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) |
|
|
| 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 |
} |
|
|
| 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 |
|
|
| 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 |
{ |
|
|
| 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 (); |
|
|
| 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 ()); |
|
|
| 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 (); |
|
|
| 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 (); |
|
|
| 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 |
|
|
|
| 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 (); |
|
|
| 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 |
|
|
|
| 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 (); |
|
|
| 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 |
|
|
|
| 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; |