wifi: NeedRts needs just the packet size
This commit is contained in:
@@ -362,9 +362,9 @@ AarfcdWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
|
||||
|
||||
bool
|
||||
AarfcdWifiManager::DoNeedRts (WifiRemoteStation *st,
|
||||
Ptr<const Packet> packet, bool normally)
|
||||
uint32_t size, bool normally)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << packet << normally);
|
||||
NS_LOG_FUNCTION (this << st << size << normally);
|
||||
AarfcdWifiRemoteStation *station = static_cast<AarfcdWifiRemoteStation*> (st);
|
||||
NS_LOG_INFO ("" << station << " rate=" << station->m_rate << " rts=" << (station->m_rtsOn ? "RTS" : "BASIC") <<
|
||||
" rtsCounter=" << station->m_rtsCounter);
|
||||
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
WifiTxVector DoGetDataTxVector (WifiRemoteStation *station);
|
||||
WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
|
||||
bool DoNeedRts (WifiRemoteStation *station,
|
||||
Ptr<const Packet> packet, bool normally);
|
||||
uint32_t size, bool normally);
|
||||
|
||||
/**
|
||||
* Check if the use of RTS for the given station can be turned off.
|
||||
|
||||
@@ -244,9 +244,9 @@ CaraWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
|
||||
|
||||
bool
|
||||
CaraWifiManager::DoNeedRts (WifiRemoteStation *st,
|
||||
Ptr<const Packet> packet, bool normally)
|
||||
uint32_t size, bool normally)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << normally);
|
||||
NS_LOG_FUNCTION (this << st << size << normally);
|
||||
CaraWifiRemoteStation *station = static_cast<CaraWifiRemoteStation*> (st);
|
||||
return normally || station->m_failed >= m_probeThreshold;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
WifiTxVector DoGetDataTxVector (WifiRemoteStation *station);
|
||||
WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
|
||||
bool DoNeedRts (WifiRemoteStation *station,
|
||||
Ptr<const Packet> packet, bool normally);
|
||||
uint32_t size, bool normally);
|
||||
|
||||
uint32_t m_timerTimeout; ///< timer threshold
|
||||
uint32_t m_successThreshold; ///< success threshold
|
||||
|
||||
@@ -441,7 +441,7 @@ QosTxop::GetTransmissionParameters (Ptr<const WifiMacQueueItem> frame) const
|
||||
|
||||
// Enable/disable RTS
|
||||
if (!frame->GetHeader ().IsBlockAckReq ()
|
||||
&& m_stationManager->NeedRts (&frame->GetHeader (), frame->GetPacket ())
|
||||
&& m_stationManager->NeedRts (frame->GetHeader (), frame->GetSize ())
|
||||
&& !m_low->IsCfPeriod ())
|
||||
{
|
||||
params.EnableRts ();
|
||||
@@ -998,25 +998,18 @@ QosTxop::RestartAccessIfNeeded (void)
|
||||
if ((m_currentPacket != 0 || baManagerHasPackets || queueIsNotEmpty)
|
||||
&& !IsAccessRequested ())
|
||||
{
|
||||
Ptr<const Packet> packet;
|
||||
WifiMacHeader hdr;
|
||||
Ptr<const WifiMacQueueItem> item;
|
||||
if (m_currentPacket != 0)
|
||||
{
|
||||
packet = m_currentPacket;
|
||||
hdr = m_currentHdr;
|
||||
item = Create<const WifiMacQueueItem> (m_currentPacket, m_currentHdr);
|
||||
}
|
||||
else
|
||||
{
|
||||
Ptr<const WifiMacQueueItem> item = PeekNextFrame ();
|
||||
if (item)
|
||||
{
|
||||
packet = item->GetPacket ();
|
||||
hdr = item->GetHeader ();
|
||||
}
|
||||
item = PeekNextFrame ();
|
||||
}
|
||||
if (packet != 0)
|
||||
if (item != 0)
|
||||
{
|
||||
m_isAccessRequestedForRts = m_stationManager->NeedRts (&hdr, packet);
|
||||
m_isAccessRequestedForRts = m_stationManager->NeedRts (item->GetHeader (), item->GetSize ());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1042,17 +1035,10 @@ QosTxop::StartAccessIfNeeded (void)
|
||||
&& (baManagerHasPackets || queueIsNotEmpty)
|
||||
&& !IsAccessRequested ())
|
||||
{
|
||||
Ptr<const Packet> packet;
|
||||
WifiMacHeader hdr;
|
||||
Ptr<const WifiMacQueueItem> item = PeekNextFrame ();
|
||||
if (item)
|
||||
if (item != 0)
|
||||
{
|
||||
packet = item->GetPacket ();
|
||||
hdr = item->GetHeader ();
|
||||
}
|
||||
if (packet != 0)
|
||||
{
|
||||
m_isAccessRequestedForRts = m_stationManager->NeedRts (&hdr, packet);
|
||||
m_isAccessRequestedForRts = m_stationManager->NeedRts (item->GetHeader (), item->GetSize ());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -393,9 +393,9 @@ RraaWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
|
||||
|
||||
bool
|
||||
RraaWifiManager::DoNeedRts (WifiRemoteStation *st,
|
||||
Ptr<const Packet> packet, bool normally)
|
||||
uint32_t size, bool normally)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << packet << normally);
|
||||
NS_LOG_FUNCTION (this << st << size << normally);
|
||||
RraaWifiRemoteStation *station = static_cast<RraaWifiRemoteStation*> (st);
|
||||
CheckInit (station);
|
||||
if (m_basic)
|
||||
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
WifiTxVector DoGetDataTxVector (WifiRemoteStation *station);
|
||||
WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
|
||||
bool DoNeedRts (WifiRemoteStation *st,
|
||||
Ptr<const Packet> packet, bool normally);
|
||||
uint32_t size, bool normally);
|
||||
|
||||
/**
|
||||
* Check for initializations.
|
||||
|
||||
@@ -443,9 +443,9 @@ RrpaaWifiManager::DoGetRtsTxVector (WifiRemoteStation *st)
|
||||
|
||||
bool
|
||||
RrpaaWifiManager::DoNeedRts (WifiRemoteStation *st,
|
||||
Ptr<const Packet> packet, bool normally)
|
||||
uint32_t size, bool normally)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << st << packet << normally);
|
||||
NS_LOG_FUNCTION (this << st << size << normally);
|
||||
RrpaaWifiRemoteStation *station = static_cast<RrpaaWifiRemoteStation*> (st);
|
||||
CheckInit (station);
|
||||
if (m_basic)
|
||||
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station);
|
||||
virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
|
||||
virtual bool DoNeedRts (WifiRemoteStation *st,
|
||||
Ptr<const Packet> packet, bool normally);
|
||||
uint32_t size, bool normally);
|
||||
|
||||
/**
|
||||
* Check for initializations.
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "mac-tx-middle.h"
|
||||
#include "mac-low.h"
|
||||
#include "wifi-remote-station-manager.h"
|
||||
#include "wifi-mac-trailer.h"
|
||||
|
||||
#undef NS_LOG_APPEND_CONTEXT
|
||||
#define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
|
||||
@@ -532,7 +533,8 @@ Txop::NotifyAccessGranted (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_stationManager->NeedRts (&m_currentHdr, m_currentPacket) && !m_low->IsCfPeriod ())
|
||||
uint32_t size = m_currentHdr.GetSize () + m_currentPacket->GetSize () + WIFI_MAC_FCS_LENGTH;
|
||||
if (m_stationManager->NeedRts (m_currentHdr, size) && !m_low->IsCfPeriod ())
|
||||
{
|
||||
m_currentParams.EnableRts ();
|
||||
}
|
||||
|
||||
@@ -740,11 +740,11 @@ WifiRemoteStationManager::ReportAmpduTxStatus (Mac48Address address,
|
||||
}
|
||||
|
||||
bool
|
||||
WifiRemoteStationManager::NeedRts (const WifiMacHeader *header, Ptr<const Packet> packet)
|
||||
WifiRemoteStationManager::NeedRts (const WifiMacHeader &header, uint32_t size)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *header << packet);
|
||||
Mac48Address address = header->GetAddr1 ();
|
||||
WifiTxVector txVector = GetDataTxVector (*header);
|
||||
NS_LOG_FUNCTION (this << header << size);
|
||||
Mac48Address address = header.GetAddr1 ();
|
||||
WifiTxVector txVector = GetDataTxVector (header);
|
||||
WifiMode mode = txVector.GetMode ();
|
||||
if (address.IsGroup ())
|
||||
{
|
||||
@@ -769,8 +769,8 @@ WifiRemoteStationManager::NeedRts (const WifiMacHeader *header, Ptr<const Packet
|
||||
NS_LOG_DEBUG ("WifiRemoteStationManager::NeedRTS returning true to protect non-HT stations");
|
||||
return true;
|
||||
}
|
||||
bool normally = (packet->GetSize () + header->GetSize () + WIFI_MAC_FCS_LENGTH) > m_rtsCtsThreshold;
|
||||
return DoNeedRts (Lookup (address), packet, normally);
|
||||
bool normally = (size > m_rtsCtsThreshold);
|
||||
return DoNeedRts (Lookup (address), size, normally);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -1386,7 +1386,7 @@ WifiRemoteStationManager::GetNonUnicastMode (void) const
|
||||
|
||||
bool
|
||||
WifiRemoteStationManager::DoNeedRts (WifiRemoteStation *station,
|
||||
Ptr<const Packet> packet, bool normally)
|
||||
uint32_t size, bool normally)
|
||||
{
|
||||
return normally;
|
||||
}
|
||||
|
||||
@@ -766,12 +766,12 @@ public:
|
||||
|
||||
/**
|
||||
* \param header MAC header
|
||||
* \param packet the packet to send
|
||||
* \param size the size of the frame to send in bytes
|
||||
*
|
||||
* \return true if we want to use an RTS/CTS handshake for this
|
||||
* packet before sending it, false otherwise.
|
||||
* frame before sending it, false otherwise.
|
||||
*/
|
||||
bool NeedRts (const WifiMacHeader *header, Ptr<const Packet> packet);
|
||||
bool NeedRts (const WifiMacHeader &header, uint32_t size);
|
||||
/**
|
||||
* Return if we need to do CTS-to-self before sending a DATA.
|
||||
*
|
||||
@@ -1061,17 +1061,17 @@ protected:
|
||||
private:
|
||||
/**
|
||||
* \param station the station that we need to communicate
|
||||
* \param packet the packet to send
|
||||
* \param size the size of the frame to send in bytes
|
||||
* \param normally indicates whether the normal 802.11 RTS enable mechanism would
|
||||
* request that the RTS is sent or not.
|
||||
*
|
||||
* \return true if we want to use an RTS/CTS handshake for this packet before sending it,
|
||||
* \return true if we want to use an RTS/CTS handshake for this frame before sending it,
|
||||
* false otherwise.
|
||||
*
|
||||
* Note: This method is called before a unicast packet is sent on the medium.
|
||||
*/
|
||||
virtual bool DoNeedRts (WifiRemoteStation *station,
|
||||
Ptr<const Packet> packet, bool normally);
|
||||
uint32_t size, bool normally);
|
||||
/**
|
||||
* \param station the station that we need to communicate
|
||||
* \param packet the packet to send
|
||||
|
||||
Reference in New Issue
Block a user