|
|
| 533 |
void |
533 |
void |
| 534 |
MacLow::ResetPhy (void) |
534 |
MacLow::ResetPhy (void) |
| 535 |
{ |
535 |
{ |
| 536 |
m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> ()); |
536 |
m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector> ()); |
| 537 |
m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<Packet>, double> ()); |
537 |
m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<Packet>, double> ()); |
| 538 |
RemovePhyMacLowListener (m_phy); |
538 |
RemovePhyMacLowListener (m_phy); |
| 539 |
m_phy = 0; |
539 |
m_phy = 0; |
|
|
| 887 |
} |
887 |
} |
| 888 |
|
888 |
|
| 889 |
void |
889 |
void |
| 890 |
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, WifiPreamble preamble, bool ampduSubframe) |
890 |
MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, bool ampduSubframe) |
| 891 |
{ |
891 |
{ |
| 892 |
NS_LOG_FUNCTION (this << packet << rxSnr << txVector.GetMode () << preamble); |
892 |
NS_LOG_FUNCTION (this << packet << rxSnr << txVector.GetMode () << txVector.GetPreambleType ()); |
| 893 |
/* A packet is received from the PHY. |
893 |
/* A packet is received from the PHY. |
| 894 |
* When we have handled this packet, |
894 |
* When we have handled this packet, |
| 895 |
* we handle any packet present in the |
895 |
* we handle any packet present in the |
|
|
| 901 |
|
901 |
|
| 902 |
bool isPrevNavZero = IsNavZero (); |
902 |
bool isPrevNavZero = IsNavZero (); |
| 903 |
NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ()); |
903 |
NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ()); |
| 904 |
NotifyNav (packet, hdr, preamble); |
904 |
NotifyNav (packet, hdr, txVector.GetPreambleType ()); |
| 905 |
if (hdr.IsRts ()) |
905 |
if (hdr.IsRts ()) |
| 906 |
{ |
906 |
{ |
| 907 |
/* see section 9.2.5.7 802.11-1999 |
907 |
/* see section 9.2.5.7 802.11-1999 |
|
|
| 1242 |
} |
1242 |
} |
| 1243 |
|
1243 |
|
| 1244 |
uint32_t |
1244 |
uint32_t |
| 1245 |
MacLow::GetBlockAckSize (enum BlockAckType type) const |
1245 |
MacLow::GetBlockAckSize (BlockAckType type) const |
| 1246 |
{ |
1246 |
{ |
| 1247 |
WifiMacHeader hdr; |
1247 |
WifiMacHeader hdr; |
| 1248 |
hdr.SetType (WIFI_MAC_CTL_BACKRESP); |
1248 |
hdr.SetType (WIFI_MAC_CTL_BACKRESP); |
|
|
| 1282 |
MacLow::GetAckDuration (WifiTxVector ackTxVector) const |
1282 |
MacLow::GetAckDuration (WifiTxVector ackTxVector) const |
| 1283 |
{ |
1283 |
{ |
| 1284 |
NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //ACK should always use non-HT PPDU (HT PPDU cases not supported yet) |
1284 |
NS_ASSERT (ackTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //ACK should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 1285 |
WifiPreamble preamble; |
1285 |
return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, m_phy->GetFrequency ()); |
| 1286 |
if (m_stationManager->GetShortPreambleEnabled ()) |
|
|
| 1287 |
{ |
| 1288 |
preamble = WIFI_PREAMBLE_SHORT; |
| 1289 |
} |
| 1290 |
else |
| 1291 |
{ |
| 1292 |
preamble = WIFI_PREAMBLE_LONG; |
| 1293 |
} |
| 1294 |
return m_phy->CalculateTxDuration (GetAckSize (), ackTxVector, preamble, m_phy->GetFrequency ()); |
| 1295 |
} |
1286 |
} |
| 1296 |
|
1287 |
|
| 1297 |
Time |
1288 |
Time |
| 1298 |
MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const |
1289 |
MacLow::GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, BlockAckType type) const |
| 1299 |
{ |
1290 |
{ |
| 1300 |
/* |
1291 |
/* |
| 1301 |
* For immediate Basic BlockAck we should transmit the frame with the same WifiMode |
1292 |
* For immediate Basic BlockAck we should transmit the frame with the same WifiMode |
| 1302 |
* as the BlockAckReq. |
1293 |
* as the BlockAckReq. |
| 1303 |
*/ |
1294 |
*/ |
| 1304 |
WifiPreamble preamble; |
1295 |
return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, m_phy->GetFrequency ()); |
| 1305 |
if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && type == BASIC_BLOCK_ACK) |
|
|
| 1306 |
{ |
| 1307 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 1308 |
} |
| 1309 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 1310 |
{ |
| 1311 |
preamble = WIFI_PREAMBLE_SHORT; |
| 1312 |
} |
| 1313 |
else |
| 1314 |
{ |
| 1315 |
preamble = WIFI_PREAMBLE_LONG; |
| 1316 |
} |
| 1317 |
return m_phy->CalculateTxDuration (GetBlockAckSize (type), blockAckReqTxVector, preamble, m_phy->GetFrequency ()); |
| 1318 |
} |
1296 |
} |
| 1319 |
|
1297 |
|
| 1320 |
Time |
1298 |
Time |
|
|
| 1328 |
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const |
1306 |
MacLow::GetCtsDuration (WifiTxVector ctsTxVector) const |
| 1329 |
{ |
1307 |
{ |
| 1330 |
NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //CTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
1308 |
NS_ASSERT (ctsTxVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT); //CTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 1331 |
WifiPreamble preamble; |
1309 |
return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, m_phy->GetFrequency ()); |
| 1332 |
if (m_stationManager->GetShortPreambleEnabled ()) |
|
|
| 1333 |
{ |
| 1334 |
preamble = WIFI_PREAMBLE_SHORT; |
| 1335 |
} |
| 1336 |
else |
| 1337 |
{ |
| 1338 |
preamble = WIFI_PREAMBLE_LONG; |
| 1339 |
} |
| 1340 |
return m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency ()); |
| 1341 |
} |
1310 |
} |
| 1342 |
|
1311 |
|
| 1343 |
uint32_t |
1312 |
uint32_t |
|
|
| 1419 |
const WifiMacHeader* hdr, |
1388 |
const WifiMacHeader* hdr, |
| 1420 |
const MacLowTransmissionParameters& params) const |
1389 |
const MacLowTransmissionParameters& params) const |
| 1421 |
{ |
1390 |
{ |
| 1422 |
WifiPreamble preamble; |
|
|
| 1423 |
Time txTime = Seconds (0); |
1391 |
Time txTime = Seconds (0); |
| 1424 |
if (params.MustSendRts ()) |
1392 |
if (params.MustSendRts ()) |
| 1425 |
{ |
1393 |
{ |
| 1426 |
WifiTxVector rtsTxVector = GetRtsTxVector (packet, hdr); |
1394 |
WifiTxVector rtsTxVector = GetRtsTxVector (packet, hdr); |
| 1427 |
if (m_stationManager->GetShortPreambleEnabled ()) |
1395 |
txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_phy->GetFrequency ()); |
| 1428 |
{ |
|
|
| 1429 |
preamble = WIFI_PREAMBLE_SHORT; |
| 1430 |
} |
| 1431 |
else |
| 1432 |
{ |
| 1433 |
preamble = WIFI_PREAMBLE_LONG; |
| 1434 |
} |
| 1435 |
txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency ()); |
| 1436 |
txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector); |
1396 |
txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector); |
| 1437 |
txTime += Time (GetSifs () * 2); |
1397 |
txTime += Time (GetSifs () * 2); |
| 1438 |
} |
1398 |
} |
| 1439 |
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); |
1399 |
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); |
| 1440 |
if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) |
|
|
| 1441 |
{ |
| 1442 |
preamble = WIFI_PREAMBLE_VHT; |
| 1443 |
} |
| 1444 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1445 |
{ |
| 1446 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 1447 |
} |
| 1448 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1449 |
{ |
| 1450 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 1451 |
} |
| 1452 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 1453 |
{ |
| 1454 |
preamble = WIFI_PREAMBLE_SHORT; |
| 1455 |
} |
| 1456 |
else |
| 1457 |
{ |
| 1458 |
preamble = WIFI_PREAMBLE_LONG; |
| 1459 |
} |
| 1460 |
uint32_t dataSize = GetSize (packet, hdr); |
1400 |
uint32_t dataSize = GetSize (packet, hdr); |
| 1461 |
txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, preamble, m_phy->GetFrequency ()); |
1401 |
txTime += m_phy->CalculateTxDuration (dataSize, dataTxVector, m_phy->GetFrequency ()); |
| 1462 |
if (params.MustWaitAck ()) |
1402 |
if (params.MustWaitAck ()) |
| 1463 |
{ |
1403 |
{ |
| 1464 |
txTime += GetSifs (); |
1404 |
txTime += GetSifs (); |
|
|
| 1476 |
if (params.HasNextPacket ()) |
1416 |
if (params.HasNextPacket ()) |
| 1477 |
{ |
1417 |
{ |
| 1478 |
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); |
1418 |
WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); |
| 1479 |
WifiPreamble preamble; |
|
|
| 1480 |
if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1481 |
{ |
| 1482 |
preamble = WIFI_PREAMBLE_VHT; |
| 1483 |
} |
| 1484 |
if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1485 |
{ |
| 1486 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 1487 |
} |
| 1488 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1489 |
{ |
| 1490 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 1491 |
} |
| 1492 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 1493 |
{ |
| 1494 |
preamble = WIFI_PREAMBLE_SHORT; |
| 1495 |
} |
| 1496 |
else |
| 1497 |
{ |
| 1498 |
preamble = WIFI_PREAMBLE_LONG; |
| 1499 |
} |
| 1500 |
txTime += GetSifs (); |
1419 |
txTime += GetSifs (); |
| 1501 |
txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, preamble, m_phy->GetFrequency ()); |
1420 |
txTime += m_phy->CalculateTxDuration (params.GetNextPacketSize (), dataTxVector, m_phy->GetFrequency ()); |
| 1502 |
} |
1421 |
} |
| 1503 |
return txTime; |
1422 |
return txTime; |
| 1504 |
} |
1423 |
} |
|
|
| 1536 |
cts.SetType (WIFI_MAC_CTL_CTS); |
1455 |
cts.SetType (WIFI_MAC_CTL_CTS); |
| 1537 |
WifiTxVector txVector = GetRtsTxVector (packet, &hdr); |
1456 |
WifiTxVector txVector = GetRtsTxVector (packet, &hdr); |
| 1538 |
Time navCounterResetCtsMissedDelay = |
1457 |
Time navCounterResetCtsMissedDelay = |
| 1539 |
m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, preamble, m_phy->GetFrequency ()) + |
1458 |
m_phy->CalculateTxDuration (cts.GetSerializedSize (), txVector, m_phy->GetFrequency ()) + |
| 1540 |
Time (2 * GetSifs ()) + Time (2 * GetSlotTime ()); |
1459 |
Time (2 * GetSifs ()) + Time (2 * GetSlotTime ()); |
| 1541 |
m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay, |
1460 |
m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay, |
| 1542 |
&MacLow::NavCounterResetCtsMissed, this, |
1461 |
&MacLow::NavCounterResetCtsMissed, this, |
|
|
| 1620 |
} |
1539 |
} |
| 1621 |
|
1540 |
|
| 1622 |
void |
1541 |
void |
| 1623 |
MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr, |
1542 |
MacLow::ForwardDown (Ptr<const Packet> packet, const WifiMacHeader* hdr, WifiTxVector txVector) |
| 1624 |
WifiTxVector txVector, WifiPreamble preamble) |
|
|
| 1625 |
{ |
1543 |
{ |
| 1626 |
NS_LOG_FUNCTION (this << packet << hdr << txVector); |
1544 |
NS_LOG_FUNCTION (this << packet << hdr << txVector); |
| 1627 |
NS_LOG_DEBUG ("send " << hdr->GetTypeString () << |
1545 |
NS_LOG_DEBUG ("send " << hdr->GetTypeString () << |
| 1628 |
", to=" << hdr->GetAddr1 () << |
1546 |
", to=" << hdr->GetAddr1 () << |
| 1629 |
", size=" << packet->GetSize () << |
1547 |
", size=" << packet->GetSize () << |
| 1630 |
", mode=" << txVector.GetMode () << |
1548 |
", mode=" << txVector.GetMode () << |
|
|
1549 |
", preamble=" << txVector.GetPreambleType () << |
| 1631 |
", duration=" << hdr->GetDuration () << |
1550 |
", duration=" << hdr->GetDuration () << |
| 1632 |
", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); |
1551 |
", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec); |
| 1633 |
if (!m_ampdu || hdr->IsRts () || hdr->IsBlockAck ()) |
1552 |
if (!m_ampdu || hdr->IsRts () || hdr->IsBlockAck ()) |
| 1634 |
{ |
1553 |
{ |
| 1635 |
m_phy->SendPacket (packet, txVector, preamble); |
1554 |
m_phy->SendPacket (packet, txVector); |
| 1636 |
} |
1555 |
} |
| 1637 |
else |
1556 |
else |
| 1638 |
{ |
1557 |
{ |
|
|
| 1644 |
uint32_t queueSize = m_aggregateQueue->GetSize (); |
1563 |
uint32_t queueSize = m_aggregateQueue->GetSize (); |
| 1645 |
bool vhtSingleMpdu = false; |
1564 |
bool vhtSingleMpdu = false; |
| 1646 |
bool last = false; |
1565 |
bool last = false; |
| 1647 |
enum mpduType mpdutype = NORMAL_MPDU; |
1566 |
MpduType mpdutype = NORMAL_MPDU; |
| 1648 |
|
1567 |
|
| 1649 |
uint8_t tid = GetTid (packet, *hdr); |
1568 |
uint8_t tid = GetTid (packet, *hdr); |
| 1650 |
AcIndex ac = QosUtilsMapTidToAc (tid); |
1569 |
AcIndex ac = QosUtilsMapTidToAc (tid); |
|
|
| 1659 |
AmpduTag ampdutag; |
1578 |
AmpduTag ampdutag; |
| 1660 |
ampdutag.SetAmpdu (true); |
1579 |
ampdutag.SetAmpdu (true); |
| 1661 |
Time delay = Seconds (0); |
1580 |
Time delay = Seconds (0); |
| 1662 |
Time remainingAmpduDuration = m_phy->CalculateTxDuration (packet->GetSize (), txVector, preamble, m_phy->GetFrequency ()); |
1581 |
Time remainingAmpduDuration = m_phy->CalculateTxDuration (packet->GetSize (), txVector, m_phy->GetFrequency ()); |
| 1663 |
if (queueSize > 1 || vhtSingleMpdu) |
1582 |
if (queueSize > 1 || vhtSingleMpdu) |
| 1664 |
{ |
1583 |
{ |
| 1665 |
txVector.SetAggregation (true); |
1584 |
txVector.SetAggregation (true); |
|
|
| 1692 |
} |
1611 |
} |
| 1693 |
} |
1612 |
} |
| 1694 |
|
1613 |
|
| 1695 |
Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, preamble, m_phy->GetFrequency (), mpdutype, 0); |
1614 |
Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, m_phy->GetFrequency (), mpdutype, 0); |
| 1696 |
remainingAmpduDuration -= mpduDuration; |
1615 |
remainingAmpduDuration -= mpduDuration; |
| 1697 |
|
1616 |
|
| 1698 |
ampdutag.SetRemainingNbOfMpdus (queueSize - 1); |
1617 |
ampdutag.SetRemainingNbOfMpdus (queueSize - 1); |
|
|
| 1708 |
|
1627 |
|
| 1709 |
if (delay == Seconds (0)) |
1628 |
if (delay == Seconds (0)) |
| 1710 |
{ |
1629 |
{ |
| 1711 |
m_phy->SendPacket (newPacket, txVector, preamble, mpdutype); |
1630 |
m_phy->SendPacket (newPacket, txVector, mpdutype); |
| 1712 |
} |
1631 |
} |
| 1713 |
else |
1632 |
else |
| 1714 |
{ |
1633 |
{ |
| 1715 |
Simulator::Schedule (delay, &MacLow::SendMpdu, this, newPacket, txVector, preamble, mpdutype); |
1634 |
Simulator::Schedule (delay, &MacLow::SendMpdu, this, newPacket, txVector, mpdutype); |
| 1716 |
} |
1635 |
} |
| 1717 |
if (queueSize > 1) |
1636 |
if (queueSize > 1) |
| 1718 |
{ |
1637 |
{ |
|
|
| 1720 |
delay = delay + mpduDuration; |
1639 |
delay = delay + mpduDuration; |
| 1721 |
} |
1640 |
} |
| 1722 |
|
1641 |
|
| 1723 |
preamble = WIFI_PREAMBLE_NONE; |
1642 |
txVector.SetPreambleType (WIFI_PREAMBLE_NONE); |
| 1724 |
} |
1643 |
} |
| 1725 |
} |
1644 |
} |
| 1726 |
} |
1645 |
} |
| 1727 |
|
1646 |
|
| 1728 |
void |
1647 |
void |
| 1729 |
MacLow::SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, enum mpduType mpdutype) |
1648 |
MacLow::SendMpdu (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype) |
| 1730 |
{ |
1649 |
{ |
| 1731 |
NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU"); |
1650 |
NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU"); |
| 1732 |
m_phy->SendPacket (packet, txVector, preamble, mpdutype); |
1651 |
m_phy->SendPacket (packet, txVector, mpdutype); |
| 1733 |
} |
1652 |
} |
| 1734 |
|
1653 |
|
| 1735 |
void |
1654 |
void |
|
|
| 1835 |
WifiTxVector rtsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr); |
1754 |
WifiTxVector rtsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr); |
| 1836 |
Time duration = Seconds (0); |
1755 |
Time duration = Seconds (0); |
| 1837 |
|
1756 |
|
| 1838 |
WifiPreamble preamble; |
|
|
| 1839 |
if (m_stationManager->GetShortPreambleEnabled ()) |
| 1840 |
{ |
| 1841 |
preamble = WIFI_PREAMBLE_SHORT; |
| 1842 |
} |
| 1843 |
else |
| 1844 |
{ |
| 1845 |
preamble = WIFI_PREAMBLE_LONG; |
| 1846 |
} |
| 1847 |
|
| 1848 |
if (m_txParams.HasDurationId ()) |
1757 |
if (m_txParams.HasDurationId ()) |
| 1849 |
{ |
1758 |
{ |
| 1850 |
duration += m_txParams.GetDurationId (); |
1759 |
duration += m_txParams.GetDurationId (); |
|
|
| 1855 |
duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector); |
1764 |
duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector); |
| 1856 |
duration += GetSifs (); |
1765 |
duration += GetSifs (); |
| 1857 |
duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), |
1766 |
duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), |
| 1858 |
m_currentTxVector, preamble, m_phy->GetFrequency ()); |
1767 |
m_currentTxVector, m_phy->GetFrequency ()); |
| 1859 |
duration += GetSifs (); |
1768 |
duration += GetSifs (); |
| 1860 |
if (m_txParams.MustWaitBasicBlockAck ()) |
1769 |
if (m_txParams.MustWaitBasicBlockAck ()) |
| 1861 |
{ |
1770 |
{ |
|
|
| 1874 |
if (m_txParams.HasNextPacket ()) |
1783 |
if (m_txParams.HasNextPacket ()) |
| 1875 |
{ |
1784 |
{ |
| 1876 |
duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
1785 |
duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
| 1877 |
m_currentTxVector, preamble, m_phy->GetFrequency ()); |
1786 |
m_currentTxVector, m_phy->GetFrequency ()); |
| 1878 |
if (m_txParams.MustWaitAck ()) |
1787 |
if (m_txParams.MustWaitAck ()) |
| 1879 |
{ |
1788 |
{ |
| 1880 |
duration += GetSifs (); |
1789 |
duration += GetSifs (); |
|
|
| 1884 |
} |
1793 |
} |
| 1885 |
rts.SetDuration (duration); |
1794 |
rts.SetDuration (duration); |
| 1886 |
|
1795 |
|
| 1887 |
Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble, m_phy->GetFrequency ()); |
1796 |
Time txDuration = m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, m_phy->GetFrequency ()); |
| 1888 |
Time timerDelay = txDuration + GetCtsTimeout (); |
1797 |
Time timerDelay = txDuration + GetCtsTimeout (); |
| 1889 |
|
1798 |
|
| 1890 |
NS_ASSERT (m_ctsTimeoutEvent.IsExpired ()); |
1799 |
NS_ASSERT (m_ctsTimeoutEvent.IsExpired ()); |
|
|
| 1896 |
WifiMacTrailer fcs; |
1805 |
WifiMacTrailer fcs; |
| 1897 |
packet->AddTrailer (fcs); |
1806 |
packet->AddTrailer (fcs); |
| 1898 |
|
1807 |
|
| 1899 |
ForwardDown (packet, &rts, rtsTxVector, preamble); |
1808 |
ForwardDown (packet, &rts, rtsTxVector); |
| 1900 |
} |
1809 |
} |
| 1901 |
|
1810 |
|
| 1902 |
void |
1811 |
void |
| 1903 |
MacLow::StartDataTxTimers (WifiTxVector dataTxVector) |
1812 |
MacLow::StartDataTxTimers (WifiTxVector dataTxVector) |
| 1904 |
{ |
1813 |
{ |
| 1905 |
WifiPreamble preamble; |
1814 |
Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, m_phy->GetFrequency ()); |
| 1906 |
|
|
|
| 1907 |
if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) |
| 1908 |
{ |
| 1909 |
preamble = WIFI_PREAMBLE_VHT; |
| 1910 |
} |
| 1911 |
//Since it is data then it can have format = GF |
| 1912 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1913 |
{ |
| 1914 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 1915 |
} |
| 1916 |
else if (dataTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 1917 |
{ |
| 1918 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 1919 |
} |
| 1920 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 1921 |
{ |
| 1922 |
preamble = WIFI_PREAMBLE_SHORT; |
| 1923 |
} |
| 1924 |
else |
| 1925 |
{ |
| 1926 |
preamble = WIFI_PREAMBLE_LONG; |
| 1927 |
} |
| 1928 |
|
| 1929 |
Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), dataTxVector, preamble, m_phy->GetFrequency ()); |
| 1930 |
if (m_txParams.MustWaitNormalAck ()) |
1815 |
if (m_txParams.MustWaitNormalAck ()) |
| 1931 |
{ |
1816 |
{ |
| 1932 |
Time timerDelay = txDuration + GetAckTimeout (); |
1817 |
Time timerDelay = txDuration + GetAckTimeout (); |
|
|
| 1990 |
{ |
1875 |
{ |
| 1991 |
NS_LOG_FUNCTION (this); |
1876 |
NS_LOG_FUNCTION (this); |
| 1992 |
/* send this packet directly. No RTS is needed. */ |
1877 |
/* send this packet directly. No RTS is needed. */ |
| 1993 |
WifiPreamble preamble; |
|
|
| 1994 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) |
| 1995 |
{ |
| 1996 |
preamble = WIFI_PREAMBLE_VHT; |
| 1997 |
} |
| 1998 |
else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 1999 |
{ |
| 2000 |
//In the future has to make sure that receiver has greenfield enabled |
| 2001 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 2002 |
} |
| 2003 |
else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 2004 |
{ |
| 2005 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 2006 |
} |
| 2007 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 2008 |
{ |
| 2009 |
preamble = WIFI_PREAMBLE_SHORT; |
| 2010 |
} |
| 2011 |
else |
| 2012 |
{ |
| 2013 |
preamble = WIFI_PREAMBLE_LONG; |
| 2014 |
} |
| 2015 |
|
| 2016 |
StartDataTxTimers (m_currentTxVector); |
1878 |
StartDataTxTimers (m_currentTxVector); |
| 2017 |
|
1879 |
|
| 2018 |
Time duration = Seconds (0.0); |
1880 |
Time duration = Seconds (0.0); |
|
|
| 2043 |
{ |
1905 |
{ |
| 2044 |
duration += GetSifs (); |
1906 |
duration += GetSifs (); |
| 2045 |
duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
1907 |
duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
| 2046 |
m_currentTxVector, preamble, m_phy->GetFrequency ()); |
1908 |
m_currentTxVector, m_phy->GetFrequency ()); |
| 2047 |
if (m_txParams.MustWaitAck ()) |
1909 |
if (m_txParams.MustWaitAck ()) |
| 2048 |
{ |
1910 |
{ |
| 2049 |
duration += GetSifs (); |
1911 |
duration += GetSifs (); |
|
|
| 2060 |
m_currentPacket->AddTrailer (fcs); |
1922 |
m_currentPacket->AddTrailer (fcs); |
| 2061 |
} |
1923 |
} |
| 2062 |
|
1924 |
|
| 2063 |
ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector, preamble); |
1925 |
ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector); |
| 2064 |
m_currentPacket = 0; |
1926 |
m_currentPacket = 0; |
| 2065 |
} |
1927 |
} |
| 2066 |
|
1928 |
|
|
|
| 2089 |
cts.SetAddr1 (m_self); |
1951 |
cts.SetAddr1 (m_self); |
| 2090 |
|
1952 |
|
| 2091 |
WifiTxVector ctsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr); |
1953 |
WifiTxVector ctsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr); |
| 2092 |
|
|
|
| 2093 |
WifiPreamble preamble; |
| 2094 |
if (ctsTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 2095 |
{ |
| 2096 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 2097 |
} |
| 2098 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 2099 |
{ |
| 2100 |
preamble = WIFI_PREAMBLE_SHORT; |
| 2101 |
} |
| 2102 |
else |
| 2103 |
{ |
| 2104 |
preamble = WIFI_PREAMBLE_LONG; |
| 2105 |
} |
| 2106 |
|
| 2107 |
Time duration = Seconds (0); |
1954 |
Time duration = Seconds (0); |
| 2108 |
|
1955 |
|
| 2109 |
if (m_txParams.HasDurationId ()) |
1956 |
if (m_txParams.HasDurationId ()) |
|
|
| 2114 |
{ |
1961 |
{ |
| 2115 |
duration += GetSifs (); |
1962 |
duration += GetSifs (); |
| 2116 |
duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket,&m_currentHdr), |
1963 |
duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket,&m_currentHdr), |
| 2117 |
m_currentTxVector, preamble, m_phy->GetFrequency ()); |
1964 |
m_currentTxVector, m_phy->GetFrequency ()); |
| 2118 |
if (m_txParams.MustWaitBasicBlockAck ()) |
1965 |
if (m_txParams.MustWaitBasicBlockAck ()) |
| 2119 |
{ |
1966 |
{ |
| 2120 |
|
1967 |
|
|
|
| 2137 |
{ |
1984 |
{ |
| 2138 |
duration += GetSifs (); |
1985 |
duration += GetSifs (); |
| 2139 |
duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
1986 |
duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), |
| 2140 |
m_currentTxVector, preamble, m_phy->GetFrequency ()); |
1987 |
m_currentTxVector, m_phy->GetFrequency ()); |
| 2141 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
1988 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
| 2142 |
{ |
1989 |
{ |
| 2143 |
duration += GetSifs (); |
1990 |
duration += GetSifs (); |
|
|
| 2159 |
WifiMacTrailer fcs; |
2006 |
WifiMacTrailer fcs; |
| 2160 |
packet->AddTrailer (fcs); |
2007 |
packet->AddTrailer (fcs); |
| 2161 |
|
2008 |
|
| 2162 |
ForwardDown (packet, &cts, ctsTxVector,preamble); |
2009 |
ForwardDown (packet, &cts, ctsTxVector); |
| 2163 |
|
2010 |
|
| 2164 |
Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, preamble, m_phy->GetFrequency ()); |
2011 |
Time txDuration = m_phy->CalculateTxDuration (GetCtsSize (), ctsTxVector, m_phy->GetFrequency ()); |
| 2165 |
txDuration += GetSifs (); |
2012 |
txDuration += GetSifs (); |
| 2166 |
NS_ASSERT (m_sendDataEvent.IsExpired ()); |
2013 |
NS_ASSERT (m_sendDataEvent.IsExpired ()); |
| 2167 |
|
2014 |
|
|
|
| 2200 |
SnrTag tag; |
2047 |
SnrTag tag; |
| 2201 |
tag.Set (rtsSnr); |
2048 |
tag.Set (rtsSnr); |
| 2202 |
packet->AddPacketTag (tag); |
2049 |
packet->AddPacketTag (tag); |
| 2203 |
|
|
|
| 2204 |
WifiPreamble preamble; |
| 2205 |
if (m_stationManager->GetShortPreambleEnabled ()) |
| 2206 |
{ |
| 2207 |
preamble = WIFI_PREAMBLE_SHORT; |
| 2208 |
} |
| 2209 |
else |
| 2210 |
{ |
| 2211 |
preamble = WIFI_PREAMBLE_LONG; |
| 2212 |
} |
| 2213 |
|
2050 |
|
| 2214 |
//CTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
2051 |
//CTS should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 2215 |
ForwardDown (packet, &cts, ctsTxVector, preamble); |
2052 |
ForwardDown (packet, &cts, ctsTxVector); |
| 2216 |
} |
2053 |
} |
| 2217 |
|
2054 |
|
| 2218 |
void |
2055 |
void |
|
|
| 2237 |
m_txPackets.clear (); |
2074 |
m_txPackets.clear (); |
| 2238 |
} |
2075 |
} |
| 2239 |
|
2076 |
|
| 2240 |
WifiPreamble preamble; |
|
|
| 2241 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) |
| 2242 |
{ |
| 2243 |
preamble = WIFI_PREAMBLE_VHT; |
| 2244 |
} |
| 2245 |
else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
| 2246 |
{ |
| 2247 |
//In the future has to make sure that receiver has greenfield enabled |
| 2248 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 2249 |
} |
| 2250 |
else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 2251 |
{ |
| 2252 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 2253 |
} |
| 2254 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 2255 |
{ |
| 2256 |
preamble = WIFI_PREAMBLE_SHORT; |
| 2257 |
} |
| 2258 |
else |
| 2259 |
{ |
| 2260 |
preamble = WIFI_PREAMBLE_LONG; |
| 2261 |
} |
| 2262 |
|
| 2263 |
StartDataTxTimers (m_currentTxVector); |
2077 |
StartDataTxTimers (m_currentTxVector); |
| 2264 |
Time newDuration = Seconds (0); |
2078 |
Time newDuration = Seconds (0); |
| 2265 |
if (m_txParams.MustWaitBasicBlockAck ()) |
2079 |
if (m_txParams.MustWaitBasicBlockAck ()) |
|
|
| 2282 |
if (m_txParams.HasNextPacket ()) |
2096 |
if (m_txParams.HasNextPacket ()) |
| 2283 |
{ |
2097 |
{ |
| 2284 |
newDuration += GetSifs (); |
2098 |
newDuration += GetSifs (); |
| 2285 |
newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, preamble, m_phy->GetFrequency ()); |
2099 |
newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, m_phy->GetFrequency ()); |
| 2286 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
2100 |
if (m_txParams.MustWaitCompressedBlockAck ()) |
| 2287 |
{ |
2101 |
{ |
| 2288 |
newDuration += GetSifs (); |
2102 |
newDuration += GetSifs (); |
|
|
| 2296 |
} |
2110 |
} |
| 2297 |
} |
2111 |
} |
| 2298 |
|
2112 |
|
| 2299 |
Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), m_currentTxVector, preamble, m_phy->GetFrequency ()); |
2113 |
Time txDuration = m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr), m_currentTxVector, m_phy->GetFrequency ()); |
| 2300 |
duration -= txDuration; |
2114 |
duration -= txDuration; |
| 2301 |
duration -= GetSifs (); |
2115 |
duration -= GetSifs (); |
| 2302 |
|
2116 |
|
|
|
| 2311 |
m_currentPacket->AddTrailer (fcs); |
2125 |
m_currentPacket->AddTrailer (fcs); |
| 2312 |
} |
2126 |
} |
| 2313 |
|
2127 |
|
| 2314 |
ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector, preamble); |
2128 |
ForwardDown (m_currentPacket, &m_currentHdr, m_currentTxVector); |
| 2315 |
m_currentPacket = 0; |
2129 |
m_currentPacket = 0; |
| 2316 |
} |
2130 |
} |
| 2317 |
|
2131 |
|
|
|
| 2373 |
SnrTag tag; |
2187 |
SnrTag tag; |
| 2374 |
tag.Set (dataSnr); |
2188 |
tag.Set (dataSnr); |
| 2375 |
packet->AddPacketTag (tag); |
2189 |
packet->AddPacketTag (tag); |
| 2376 |
|
|
|
| 2377 |
WifiPreamble preamble; |
| 2378 |
if (m_stationManager->GetShortPreambleEnabled ()) |
| 2379 |
{ |
| 2380 |
preamble = WIFI_PREAMBLE_SHORT; |
| 2381 |
} |
| 2382 |
else |
| 2383 |
{ |
| 2384 |
preamble = WIFI_PREAMBLE_LONG; |
| 2385 |
} |
| 2386 |
|
2190 |
|
| 2387 |
//ACK should always use non-HT PPDU (HT PPDU cases not supported yet) |
2191 |
//ACK should always use non-HT PPDU (HT PPDU cases not supported yet) |
| 2388 |
ForwardDown (packet, &ack, ackTxVector, preamble); |
2192 |
ForwardDown (packet, &ack, ackTxVector); |
| 2389 |
} |
2193 |
} |
| 2390 |
|
2194 |
|
| 2391 |
bool |
2195 |
bool |
|
|
| 2675 |
packet->AddHeader (hdr); |
2479 |
packet->AddHeader (hdr); |
| 2676 |
WifiMacTrailer fcs; |
2480 |
WifiMacTrailer fcs; |
| 2677 |
packet->AddTrailer (fcs); |
2481 |
packet->AddTrailer (fcs); |
| 2678 |
WifiPreamble preamble; |
|
|
| 2679 |
if (blockAckReqTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 2680 |
{ |
| 2681 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 2682 |
} |
| 2683 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 2684 |
{ |
| 2685 |
preamble = WIFI_PREAMBLE_SHORT; |
| 2686 |
} |
| 2687 |
else |
| 2688 |
{ |
| 2689 |
preamble = WIFI_PREAMBLE_LONG; |
| 2690 |
} |
| 2691 |
SnrTag tag; |
2482 |
SnrTag tag; |
| 2692 |
tag.Set (rxSnr); |
2483 |
tag.Set (rxSnr); |
| 2693 |
packet->AddPacketTag (tag); |
2484 |
packet->AddPacketTag (tag); |
| 2694 |
ForwardDown (packet, &hdr, blockAckReqTxVector, preamble); |
2485 |
ForwardDown (packet, &hdr, blockAckReqTxVector); |
| 2695 |
m_currentPacket = 0; |
2486 |
m_currentPacket = 0; |
| 2696 |
} |
2487 |
} |
| 2697 |
|
2488 |
|
|
|
| 2805 |
} |
2596 |
} |
| 2806 |
|
2597 |
|
| 2807 |
void |
2598 |
void |
| 2808 |
MacLow::RegisterBlockAckListenerForAc (enum AcIndex ac, MacLowAggregationCapableTransmissionListener *listener) |
2599 |
MacLow::RegisterBlockAckListenerForAc (AcIndex ac, MacLowAggregationCapableTransmissionListener *listener) |
| 2809 |
{ |
2600 |
{ |
| 2810 |
m_edcaListeners.insert (std::make_pair (ac, listener)); |
2601 |
m_edcaListeners.insert (std::make_pair (ac, listener)); |
| 2811 |
} |
2602 |
} |
| 2812 |
|
2603 |
|
| 2813 |
void |
2604 |
void |
| 2814 |
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector, WifiPreamble preamble) |
2605 |
MacLow::DeaggregateAmpduAndReceive (Ptr<Packet> aggregatedPacket, double rxSnr, WifiTxVector txVector) |
| 2815 |
{ |
2606 |
{ |
| 2816 |
NS_LOG_FUNCTION (this); |
2607 |
NS_LOG_FUNCTION (this); |
| 2817 |
AmpduTag ampdu; |
2608 |
AmpduTag ampdu; |
|
|
| 2826 |
WifiMacHeader firsthdr; |
2617 |
WifiMacHeader firsthdr; |
| 2827 |
(*n).first->PeekHeader (firsthdr); |
2618 |
(*n).first->PeekHeader (firsthdr); |
| 2828 |
NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ()); |
2619 |
NS_LOG_DEBUG ("duration/id=" << firsthdr.GetDuration ()); |
|
|
2620 |
WifiPreamble preamble = txVector.GetPreambleType (); |
| 2829 |
NotifyNav ((*n).first, firsthdr, preamble); |
2621 |
NotifyNav ((*n).first, firsthdr, preamble); |
| 2830 |
|
2622 |
|
| 2831 |
if (firsthdr.GetAddr1 () == m_self) |
2623 |
if (firsthdr.GetAddr1 () == m_self) |
|
|
| 2850 |
|
2642 |
|
| 2851 |
if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) |
2643 |
if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) |
| 2852 |
{ |
2644 |
{ |
| 2853 |
ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe); |
2645 |
ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe); |
| 2854 |
} |
2646 |
} |
| 2855 |
else if (firsthdr.IsData () || firsthdr.IsQosData ()) |
2647 |
else if (firsthdr.IsData () || firsthdr.IsQosData ()) |
| 2856 |
{ |
2648 |
{ |
| 2857 |
NS_LOG_DEBUG ("Deaggregate packet from " << firsthdr.GetAddr2 () << " with sequence=" << firsthdr.GetSequenceNumber ()); |
2649 |
NS_LOG_DEBUG ("Deaggregate packet from " << firsthdr.GetAddr2 () << " with sequence=" << firsthdr.GetSequenceNumber ()); |
| 2858 |
ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe); |
2650 |
ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe); |
| 2859 |
if (firsthdr.IsQosAck ()) |
2651 |
if (firsthdr.IsQosAck ()) |
| 2860 |
{ |
2652 |
{ |
| 2861 |
NS_LOG_DEBUG ("Normal Ack"); |
2653 |
NS_LOG_DEBUG ("Normal Ack"); |
|
|
| 2895 |
} |
2687 |
} |
| 2896 |
else |
2688 |
else |
| 2897 |
{ |
2689 |
{ |
| 2898 |
ReceiveOk (aggregatedPacket, rxSnr, txVector, preamble, ampduSubframe); |
2690 |
ReceiveOk (aggregatedPacket, rxSnr, txVector, ampduSubframe); |
| 2899 |
} |
2691 |
} |
| 2900 |
} |
2692 |
} |
| 2901 |
|
2693 |
|
|
|
| 2908 |
return true; |
2700 |
return true; |
| 2909 |
} |
2701 |
} |
| 2910 |
|
2702 |
|
| 2911 |
WifiPreamble preamble; |
|
|
| 2912 |
Time aPPDUMaxTime = MilliSeconds (10); |
2703 |
Time aPPDUMaxTime = MilliSeconds (10); |
| 2913 |
|
|
|
| 2914 |
uint8_t tid = GetTid (peekedPacket, peekedHdr); |
2704 |
uint8_t tid = GetTid (peekedPacket, peekedHdr); |
| 2915 |
AcIndex ac = QosUtilsMapTidToAc (tid); |
2705 |
AcIndex ac = QosUtilsMapTidToAc (tid); |
| 2916 |
std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac); |
2706 |
std::map<AcIndex, MacLowAggregationCapableTransmissionListener*>::const_iterator listenerIt = m_edcaListeners.find (ac); |
| 2917 |
|
2707 |
|
| 2918 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) |
2708 |
if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT) |
| 2919 |
{ |
2709 |
{ |
| 2920 |
preamble = WIFI_PREAMBLE_VHT; |
|
|
| 2921 |
aPPDUMaxTime = MicroSeconds (5484); |
2710 |
aPPDUMaxTime = MicroSeconds (5484); |
| 2922 |
} |
2711 |
} |
| 2923 |
else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT && m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) |
|
|
| 2924 |
{ |
| 2925 |
preamble = WIFI_PREAMBLE_HT_GF; |
| 2926 |
} |
| 2927 |
else if (m_currentTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 2928 |
{ |
| 2929 |
preamble = WIFI_PREAMBLE_HT_MF; |
| 2930 |
} |
| 2931 |
else if (m_stationManager->GetShortPreambleEnabled ()) |
| 2932 |
{ |
| 2933 |
preamble = WIFI_PREAMBLE_SHORT; |
| 2934 |
} |
| 2935 |
else |
| 2936 |
{ |
| 2937 |
preamble = WIFI_PREAMBLE_LONG; |
| 2938 |
} |
| 2939 |
|
2712 |
|
| 2940 |
//A STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime |
2713 |
//A STA shall not transmit a PPDU that has a duration that is greater than aPPDUMaxTime |
| 2941 |
if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, preamble, m_phy->GetFrequency ()) > aPPDUMaxTime) |
2714 |
if (m_phy->CalculateTxDuration (aggregatedPacket->GetSize () + peekedPacket->GetSize () + peekedHdr.GetSize () + WIFI_MAC_FCS_LENGTH, m_currentTxVector, m_phy->GetFrequency ()) > aPPDUMaxTime) |
| 2942 |
{ |
2715 |
{ |
| 2943 |
NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime"); |
2716 |
NS_LOG_DEBUG ("no more packets can be aggregated to satisfy PPDU <= aPPDUMaxTime"); |
| 2944 |
return true; |
2717 |
return true; |