wifi: (fixes #2271) Compare RtsCtsThreshold against the total A-MPDU size

This commit is contained in:
Sébastien Deronne
2016-02-05 20:10:07 +01:00
parent 3892ea96b6
commit a091991735
7 changed files with 52 additions and 88 deletions

View File

@@ -323,14 +323,6 @@ DcaTxop::Low (void)
return m_low;
}
bool
DcaTxop::NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header)
{
NS_LOG_FUNCTION (this << packet << header);
return m_stationManager->NeedRts (header->GetAddr1 (), header,
packet);
}
void
DcaTxop::DoInitialize ()
{
@@ -475,14 +467,6 @@ DcaTxop::NotifyAccessGranted (void)
{
WifiMacHeader hdr;
Ptr<Packet> fragment = GetFragmentPacket (&hdr);
if (NeedRts (fragment, &hdr))
{
params.EnableRts ();
}
else
{
params.DisableRts ();
}
if (IsLastFragment ())
{
NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ());
@@ -498,16 +482,6 @@ DcaTxop::NotifyAccessGranted (void)
}
else
{
if (NeedRts (m_currentPacket, &m_currentHdr))
{
params.EnableRts ();
NS_LOG_DEBUG ("tx unicast rts");
}
else
{
params.DisableRts ();
NS_LOG_DEBUG ("tx unicast");
}
params.DisableNextData ();
Low ()->StartTransmission (m_currentPacket, &m_currentHdr,
params, m_transmissionListener);

View File

@@ -255,16 +255,6 @@ private:
*/
void StartAccessIfNeeded (void);
/**
* Check if the current packet should be sent with a RTS protection.
*
* \param packet
* \param header
*
* \return true if RTS protection should be used,
* false otherwise
*/
bool NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header);
/**
* Check if RTS should be re-transmitted if CTS was missed.
*

View File

@@ -548,13 +548,10 @@ EdcaTxopN::NotifyAccessGranted (void)
{
params.EnableAck ();
}
if (NeedFragmentation () && ((m_currentHdr.IsQosData ()
&& !m_currentHdr.IsQosAmsdu ())
||
(m_currentHdr.IsData ()
&& !m_currentHdr.IsQosData () && m_currentHdr.IsQosAmsdu ()))
&& (m_blockAckThreshold == 0
|| m_blockAckType == BASIC_BLOCK_ACK))
if (((m_currentHdr.IsQosData () && !m_currentHdr.IsQosAmsdu ())
||(m_currentHdr.IsData () && !m_currentHdr.IsQosData () && m_currentHdr.IsQosAmsdu ()))
&& (m_blockAckThreshold == 0 || m_blockAckType == BASIC_BLOCK_ACK)
&& NeedFragmentation ())
{
//With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
params.DisableRts ();
@@ -619,16 +616,6 @@ EdcaTxopN::NotifyAccessGranted (void)
NS_LOG_DEBUG ("tx unicast A-MSDU");
}
}
if (NeedRts ())
{
params.EnableRts ();
NS_LOG_DEBUG ("tx unicast rts");
}
else
{
params.DisableRts ();
NS_LOG_DEBUG ("tx unicast");
}
params.DisableNextData ();
m_low->StartTransmission (m_currentPacket, &m_currentHdr,
params, m_transmissionListener);
@@ -984,14 +971,6 @@ EdcaTxopN::StartAccessIfNeeded (void)
}
}
bool
EdcaTxopN::NeedRts (void)
{
NS_LOG_FUNCTION (this);
return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket);
}
bool
EdcaTxopN::NeedRtsRetransmission (void)
{

View File

@@ -287,13 +287,6 @@ public:
* Request access from DCF manager if needed.
*/
void StartAccessIfNeeded (void);
/**
* Check if the current packet should be sent with a RTS protection.
*
* \return true if RTS protection should be used,
* false otherwise
*/
bool NeedRts (void);
/**
* Check if RTS should be re-transmitted if CTS was missed.
*

View File

@@ -786,6 +786,15 @@ MacLow::StartTransmission (Ptr<const Packet> packet,
}
}
}
if (NeedRts ())
{
m_txParams.EnableRts ();
}
else
{
m_txParams.DisableRts ();
}
NS_LOG_DEBUG ("startTx size=" << GetSize (m_currentPacket, &m_currentHdr) <<
", to=" << m_currentHdr.GetAddr1 () << ", listener=" << m_listener);
@@ -796,7 +805,7 @@ MacLow::StartTransmission (Ptr<const Packet> packet,
}
else
{
if (NeedCtsToSelf () && m_ctsToSelfSupported)
if (m_ctsToSelfSupported && NeedCtsToSelf ())
{
SendCtsToSelf ();
}
@@ -810,6 +819,14 @@ MacLow::StartTransmission (Ptr<const Packet> packet,
NS_ASSERT (m_phy->IsStateTx ());
}
bool
MacLow::NeedRts (void)
{
return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (),
&m_currentHdr,
m_currentPacket);
}
bool
MacLow::NeedCtsToSelf (void)
{

View File

@@ -1013,6 +1013,13 @@ private:
* \return the time required to transmit the Block ACK (including preamble and FCS)
*/
Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const;
/**
* Check if the current packet should be sent with a RTS protection.
*
* \return true if RTS protection should be used,
* false otherwise
*/
bool NeedRts (void);
/**
* Check if CTS-to-self mechanism should be used for the current packet.
*

View File

@@ -282,46 +282,50 @@ WifiRemoteStationManager::GetTypeId (void)
static TypeId tid = TypeId ("ns3::WifiRemoteStationManager")
.SetParent<Object> ()
.SetGroupName ("Wifi")
.AddAttribute ("IsLowLatency", "If true, we attempt to modelize a so-called low-latency device: a device"
" where decisions about tx parameters can be made on a per-packet basis and feedback about the"
" transmission of each packet is obtained before sending the next. Otherwise, we modelize a "
" high-latency device, that is a device where we cannot update our decision about tx parameters"
" after every packet transmission.",
.AddAttribute ("IsLowLatency",
"If true, we attempt to modelize a so-called low-latency device: "
"a device where decisions about tx parameters can be made on a per-packet basis and "
"feedback about the transmission of each packet is obtained before sending the next. "
"Otherwise, we modelize a high-latency device, that is a device where we cannot update "
"our decision about tx parameters after every packet transmission.",
TypeId::ATTR_GET,
BooleanValue (true), //this value is ignored because there is no setter
MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency),
MakeBooleanChecker ())
.AddAttribute ("MaxSsrc", "The maximum number of retransmission attempts for an RTS. This value"
" will not have any effect on some rate control algorithms.",
.AddAttribute ("MaxSsrc",
"The maximum number of retransmission attempts for an RTS. "
" This value will not have any effect on some rate control algorithms.",
UintegerValue (7),
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("MaxSlrc", "The maximum number of retransmission attempts for a DATA packet. This value"
" will not have any effect on some rate control algorithms.",
.AddAttribute ("MaxSlrc",
"The maximum number of retransmission attempts for a DATA packet. "
"This value will not have any effect on some rate control algorithms.",
UintegerValue (7),
MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("RtsCtsThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than "
"this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2012, Section 9.3.5. "
.AddAttribute ("RtsCtsThreshold",
"If the size of the PSDU is bigger than this value, we use an RTS/CTS handshake before sending the data frame."
"This value will not have any effect on some rate control algorithms.",
UintegerValue (2346),
UintegerValue (65535),
MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("FragmentationThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger"
"than this value, we fragment it such that the size of the fragments are equal or smaller "
"than this value, as per IEEE Std. 802.11-2012, Section 9.5. "
.AddAttribute ("FragmentationThreshold",
"If the size of the PSDU is bigger than this value, we fragment it such that the size of the fragments are equal or smaller. "
"This value does not apply when it is carried in an A-MPDU. "
"This value will not have any effect on some rate control algorithms.",
UintegerValue (2346),
MakeUintegerAccessor (&WifiRemoteStationManager::DoSetFragmentationThreshold,
&WifiRemoteStationManager::DoGetFragmentationThreshold),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.",
.AddAttribute ("NonUnicastMode",
"Wifi mode used for non-unicast transmissions.",
WifiModeValue (),
MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
MakeWifiModeChecker ())
.AddAttribute ("DefaultTxPowerLevel", "Default power level to be used for transmissions. "
"This is the power level that is used by all those WifiManagers that do not"
"implement TX power control.",
.AddAttribute ("DefaultTxPowerLevel",
"Default power level to be used for transmissions. "
"This is the power level that is used by all those WifiManagers that do not implement TX power control.",
UintegerValue (0),
MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxPowerLevel),
MakeUintegerChecker<uint8_t> ())