wifi: Have a unique MustWaitBlockAck method in MacLowTransmissionParameters
...and another method to return the Block Ack type
This commit is contained in:
@@ -58,7 +58,7 @@ MacLowTransmissionParameters::EnableCompressedBlockAck (void)
|
||||
void
|
||||
MacLowTransmissionParameters::EnableExtendedCompressedBlockAck (void)
|
||||
{
|
||||
m_waitAck = EXTENDED_BLOCK_ACK_COMPRESSED;
|
||||
m_waitAck = BLOCK_ACK_EXTENDED_COMPRESSED;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -98,27 +98,47 @@ MacLowTransmissionParameters::MustWaitNormalAck (void) const
|
||||
}
|
||||
|
||||
bool
|
||||
MacLowTransmissionParameters::MustWaitBasicBlockAck (void) const
|
||||
MacLowTransmissionParameters::MustWaitBlockAck (void) const
|
||||
{
|
||||
return (m_waitAck == BLOCK_ACK_BASIC) ? true : false;
|
||||
bool ret;
|
||||
switch (m_waitAck)
|
||||
{
|
||||
case BLOCK_ACK_BASIC:
|
||||
case BLOCK_ACK_COMPRESSED:
|
||||
case BLOCK_ACK_EXTENDED_COMPRESSED:
|
||||
case BLOCK_ACK_MULTI_TID:
|
||||
ret = true;
|
||||
break;
|
||||
default:
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
MacLowTransmissionParameters::MustWaitCompressedBlockAck (void) const
|
||||
BlockAckType
|
||||
MacLowTransmissionParameters::GetBlockAckType (void) const
|
||||
{
|
||||
return (m_waitAck == BLOCK_ACK_COMPRESSED) ? true : false;
|
||||
}
|
||||
|
||||
bool
|
||||
MacLowTransmissionParameters::MustWaitExtendedCompressedBlockAck (void) const
|
||||
{
|
||||
return (m_waitAck == EXTENDED_BLOCK_ACK_COMPRESSED) ? true : false;
|
||||
}
|
||||
|
||||
bool
|
||||
MacLowTransmissionParameters::MustWaitMultiTidBlockAck (void) const
|
||||
{
|
||||
return (m_waitAck == BLOCK_ACK_MULTI_TID) ? true : false;
|
||||
BlockAckType type;
|
||||
switch (m_waitAck)
|
||||
{
|
||||
case BLOCK_ACK_BASIC:
|
||||
type = BlockAckType::BASIC_BLOCK_ACK;
|
||||
break;
|
||||
case BLOCK_ACK_COMPRESSED:
|
||||
type = BlockAckType::COMPRESSED_BLOCK_ACK;
|
||||
break;
|
||||
case BLOCK_ACK_EXTENDED_COMPRESSED:
|
||||
type = BlockAckType::EXTENDED_COMPRESSED_BLOCK_ACK;
|
||||
break;
|
||||
case BLOCK_ACK_MULTI_TID:
|
||||
type = BlockAckType::MULTI_TID_BLOCK_ACK;
|
||||
break;
|
||||
default:
|
||||
NS_FATAL_ERROR ("Block ack is not used");
|
||||
break;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -160,7 +180,7 @@ std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters
|
||||
case MacLowTransmissionParameters::BLOCK_ACK_COMPRESSED:
|
||||
os << "compressed-block-ack";
|
||||
break;
|
||||
case MacLowTransmissionParameters::EXTENDED_BLOCK_ACK_COMPRESSED:
|
||||
case MacLowTransmissionParameters::BLOCK_ACK_EXTENDED_COMPRESSED:
|
||||
os << "extended-compressed-block-ack";
|
||||
break;
|
||||
case MacLowTransmissionParameters::BLOCK_ACK_MULTI_TID:
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define MAC_LOW_TRANSMISSION_PARAMETERS_H
|
||||
|
||||
#include "ns3/uinteger.h"
|
||||
#include "block-ack-type.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -104,25 +105,13 @@ public:
|
||||
*
|
||||
* \sa EnableBlockAck
|
||||
*/
|
||||
bool MustWaitBasicBlockAck (void) const;
|
||||
bool MustWaitBlockAck (void) const;
|
||||
/**
|
||||
* \returns true if compressed block ack mechanism is used, false otherwise.
|
||||
* \returns the selected block ack variant.
|
||||
*
|
||||
* \sa EnableCompressedBlockAck
|
||||
* Only call this method if the block ack mechanism is used.
|
||||
*/
|
||||
bool MustWaitCompressedBlockAck (void) const;
|
||||
/**
|
||||
* \returns true if extended compressed block ack mechanism is used, false otherwise.
|
||||
*
|
||||
* \sa EnableExtendedCompressedBlockAck
|
||||
*/
|
||||
bool MustWaitExtendedCompressedBlockAck (void) const;
|
||||
/**
|
||||
* \returns true if multi-tid block ack mechanism is used, false otherwise.
|
||||
*
|
||||
* \sa EnableMultiTidBlockAck
|
||||
*/
|
||||
bool MustWaitMultiTidBlockAck (void) const;
|
||||
BlockAckType GetBlockAckType (void) const;
|
||||
/**
|
||||
* \returns true if RTS should be sent and CTS waited for before
|
||||
* sending data, false otherwise.
|
||||
@@ -147,7 +136,7 @@ private:
|
||||
ACK_NORMAL,
|
||||
BLOCK_ACK_BASIC,
|
||||
BLOCK_ACK_COMPRESSED,
|
||||
EXTENDED_BLOCK_ACK_COMPRESSED,
|
||||
BLOCK_ACK_EXTENDED_COMPRESSED,
|
||||
BLOCK_ACK_MULTI_TID
|
||||
} m_waitAck; //!< wait ack
|
||||
bool m_sendRts; //!< send an RTS?
|
||||
|
||||
@@ -830,7 +830,7 @@ MacLow::ReceiveOk (Ptr<Packet> packet, double rxSnr, WifiTxVector txVector, bool
|
||||
}
|
||||
}
|
||||
else if (hdr.IsBlockAck () && hdr.GetAddr1 () == m_self
|
||||
&& (m_txParams.MustWaitBasicBlockAck () || m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
&& m_txParams.MustWaitBlockAck ()
|
||||
&& m_blockAckTimeoutEvent.IsRunning ())
|
||||
{
|
||||
NS_LOG_DEBUG ("got block ack from " << hdr.GetAddr2 ());
|
||||
@@ -1703,22 +1703,10 @@ MacLow::SendRtsForPacket (void)
|
||||
duration += m_phy->CalculateTxDuration (m_currentPacket->GetSize (),
|
||||
m_currentTxVector, m_phy->GetFrequency ());
|
||||
duration += GetSifs ();
|
||||
if (m_txParams.MustWaitBasicBlockAck ())
|
||||
if (m_txParams.MustWaitBlockAck ())
|
||||
{
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (), m_currentTxVector.GetMode ());
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
|
||||
}
|
||||
else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (), m_currentTxVector.GetMode ());
|
||||
if (m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, m_txParams.GetBlockAckType ());
|
||||
}
|
||||
else if (m_txParams.MustWaitNormalAck ())
|
||||
{
|
||||
@@ -1757,14 +1745,16 @@ MacLow::StartDataTxTimers (WifiTxVector dataTxVector)
|
||||
NotifyAckTimeoutStartNow (timerDelay);
|
||||
m_normalAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::NormalAckTimeout, this);
|
||||
}
|
||||
else if (m_txParams.MustWaitBasicBlockAck ())
|
||||
else if (m_txParams.MustWaitBlockAck () && m_txParams.GetBlockAckType () == BlockAckType::BASIC_BLOCK_ACK)
|
||||
{
|
||||
Time timerDelay = txDuration + GetBasicBlockAckTimeout ();
|
||||
NS_ASSERT (m_blockAckTimeoutEvent.IsExpired ());
|
||||
NotifyAckTimeoutStartNow (timerDelay);
|
||||
m_blockAckTimeoutEvent = Simulator::Schedule (timerDelay, &MacLow::BlockAckTimeout, this);
|
||||
}
|
||||
else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
else if (m_txParams.MustWaitBlockAck () &&
|
||||
(m_txParams.GetBlockAckType () == BlockAckType::COMPRESSED_BLOCK_ACK
|
||||
|| m_txParams.GetBlockAckType () == BlockAckType::EXTENDED_COMPRESSED_BLOCK_ACK))
|
||||
{
|
||||
Time timerDelay = txDuration + GetCompressedBlockAckTimeout ();
|
||||
NS_ASSERT (m_blockAckTimeoutEvent.IsExpired ());
|
||||
@@ -1816,26 +1806,12 @@ MacLow::SendDataPacket (void)
|
||||
if (!IsCfPeriod ())
|
||||
{
|
||||
Time duration = Seconds (0);
|
||||
if (m_txParams.MustWaitBasicBlockAck ())
|
||||
if (m_txParams.MustWaitBlockAck ())
|
||||
{
|
||||
duration += GetSifs ();
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (),
|
||||
m_currentTxVector.GetMode ());
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
|
||||
}
|
||||
else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
duration += GetSifs ();
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (),
|
||||
m_currentTxVector.GetMode ());
|
||||
if (m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, m_txParams.GetBlockAckType ());
|
||||
}
|
||||
else if (m_txParams.MustWaitNormalAck ())
|
||||
{
|
||||
@@ -1942,26 +1918,12 @@ MacLow::SendCtsToSelf (void)
|
||||
duration += GetSifs ();
|
||||
duration += m_phy->CalculateTxDuration (m_currentPacket->GetSize (),
|
||||
m_currentTxVector, m_phy->GetFrequency ());
|
||||
if (m_txParams.MustWaitBasicBlockAck ())
|
||||
if (m_txParams.MustWaitBlockAck ())
|
||||
{
|
||||
duration += GetSifs ();
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (),
|
||||
m_currentTxVector.GetMode ());
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
|
||||
}
|
||||
else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
duration += GetSifs ();
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (),
|
||||
m_currentTxVector.GetMode ());
|
||||
if (m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, m_txParams.GetBlockAckType ());
|
||||
}
|
||||
else if (m_txParams.MustWaitNormalAck ())
|
||||
{
|
||||
@@ -1973,19 +1935,12 @@ MacLow::SendCtsToSelf (void)
|
||||
duration += GetSifs ();
|
||||
duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (),
|
||||
m_currentTxVector, m_phy->GetFrequency ());
|
||||
if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
if (m_txParams.MustWaitBlockAck ())
|
||||
{
|
||||
duration += GetSifs ();
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (),
|
||||
m_currentTxVector.GetMode ());
|
||||
if (m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
duration += GetBlockAckDuration (blockAckReqTxVector, m_txParams.GetBlockAckType ());
|
||||
}
|
||||
else if (m_txParams.MustWaitNormalAck ())
|
||||
{
|
||||
@@ -2048,24 +2003,11 @@ MacLow::SendDataAfterCts (Time duration)
|
||||
|
||||
StartDataTxTimers (m_currentTxVector);
|
||||
Time newDuration = Seconds (0);
|
||||
if (m_txParams.MustWaitBasicBlockAck ())
|
||||
if (m_txParams.MustWaitBlockAck ())
|
||||
{
|
||||
newDuration += GetSifs ();
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (), m_currentTxVector.GetMode ());
|
||||
newDuration += GetBlockAckDuration (blockAckReqTxVector, BASIC_BLOCK_ACK);
|
||||
}
|
||||
else if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
newDuration += GetSifs ();
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (), m_currentTxVector.GetMode ());
|
||||
if (m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
newDuration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
newDuration += GetBlockAckDuration (blockAckReqTxVector, m_txParams.GetBlockAckType ());
|
||||
}
|
||||
else if (m_txParams.MustWaitNormalAck ())
|
||||
{
|
||||
@@ -2083,18 +2025,11 @@ MacLow::SendDataAfterCts (Time duration)
|
||||
newDuration += GetSifs ();
|
||||
}
|
||||
newDuration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, m_phy->GetFrequency ());
|
||||
if (m_txParams.MustWaitCompressedBlockAck () || m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
if (m_txParams.MustWaitBlockAck ())
|
||||
{
|
||||
newDuration += GetSifs ();
|
||||
WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentPacket->GetAddr2 (), m_currentTxVector.GetMode ());
|
||||
if (m_txParams.MustWaitExtendedCompressedBlockAck ())
|
||||
{
|
||||
newDuration += GetBlockAckDuration (blockAckReqTxVector, EXTENDED_COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
newDuration += GetBlockAckDuration (blockAckReqTxVector, COMPRESSED_BLOCK_ACK);
|
||||
}
|
||||
newDuration += GetBlockAckDuration (blockAckReqTxVector, m_txParams.GetBlockAckType ());
|
||||
}
|
||||
else if (m_txParams.MustWaitNormalAck ())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user