wifi: Simplify WifiRemoteStationManager::NeedRts function

This commit is contained in:
Sébastien Deronne
2019-10-06 17:58:12 +02:00
committed by Sebastien Deronne
parent a2b47f171f
commit 282b4cda2f
4 changed files with 9 additions and 19 deletions

View File

@@ -439,8 +439,7 @@ QosTxop::GetTransmissionParameters (Ptr<const WifiMacQueueItem> frame) const
// Enable/disable RTS
if (!frame->GetHeader ().IsBlockAckReq ()
&& m_stationManager->NeedRts (recipient, &frame->GetHeader (),
frame->GetPacket (), m_low->GetDataTxVector (frame))
&& m_stationManager->NeedRts (&frame->GetHeader (), frame->GetPacket ())
&& !m_low->IsCfPeriod ())
{
params.EnableRts ();
@@ -1010,8 +1009,7 @@ QosTxop::RestartAccessIfNeeded (void)
}
if (packet != 0)
{
m_isAccessRequestedForRts = m_stationManager->NeedRts (hdr.GetAddr1 (), &hdr, packet,
m_low->GetDataTxVector (Create<const WifiMacQueueItem> (packet, hdr)));
m_isAccessRequestedForRts = m_stationManager->NeedRts (&hdr, packet);
}
else
{
@@ -1042,8 +1040,7 @@ QosTxop::StartAccessIfNeeded (void)
}
if (packet != 0)
{
m_isAccessRequestedForRts = m_stationManager->NeedRts (hdr.GetAddr1 (), &hdr, packet,
m_low->GetDataTxVector (Create<const WifiMacQueueItem> (packet, hdr)));
m_isAccessRequestedForRts = m_stationManager->NeedRts (&hdr, packet);
}
else
{

View File

@@ -533,12 +533,7 @@ Txop::NotifyAccessGranted (void)
}
else
{
WifiTxVector dataTxVector = m_stationManager->GetDataTxVector (m_currentHdr.GetAddr1 (),
&m_currentHdr, m_currentPacket);
if (m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr,
m_currentPacket, dataTxVector)
&& !m_low->IsCfPeriod ())
if (m_stationManager->NeedRts (&m_currentHdr, m_currentPacket) && !m_low->IsCfPeriod ())
{
m_currentParams.EnableRts ();
}

View File

@@ -807,11 +807,12 @@ WifiRemoteStationManager::ReportAmpduTxStatus (Mac48Address address, uint8_t tid
}
bool
WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *header,
Ptr<const Packet> packet, WifiTxVector txVector)
WifiRemoteStationManager::NeedRts (const WifiMacHeader *header, Ptr<const Packet> packet)
{
NS_LOG_FUNCTION (this << *header << packet);
Mac48Address address = header->GetAddr1 ();
WifiTxVector txVector = GetDataTxVector (address, header, packet);
WifiMode mode = txVector.GetMode ();
NS_LOG_FUNCTION (this << address << *header << packet << mode);
if (address.IsGroup ())
{
return false;

View File

@@ -793,16 +793,13 @@ public:
double rxSnr, WifiMode txMode);
/**
* \param address remote address
* \param header MAC header
* \param packet the packet to send
* \param txVector the TXVECTOR of the packet to send
*
* \return true if we want to use an RTS/CTS handshake for this
* packet before sending it, false otherwise.
*/
bool NeedRts (Mac48Address address, const WifiMacHeader *header,
Ptr<const Packet> packet, WifiTxVector txVector);
bool NeedRts (const WifiMacHeader *header, Ptr<const Packet> packet);
/**
* Return if we need to do CTS-to-self before sending a DATA.
*