wifi: Make the methods to update CW public
Also, they automatically trace the updated CW value.
RegularWifiMac::{TxOk, TxFailed} are made public, too.
This commit is contained in:
@@ -729,12 +729,10 @@ QosTxop::NotifyMissedCts (std::list<Ptr<WifiMacQueueItem>> mpduList)
|
||||
//to reset the Txop.
|
||||
m_currentPacket = 0;
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFailedCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
// if a BA agreement is established, store the MPDUs in the block ack manager
|
||||
// retransmission queue. Otherwise, this QosTxop will handle the retransmission
|
||||
// of the (single) frame
|
||||
@@ -1680,7 +1678,6 @@ QosTxop::DoInitialize (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
GenerateBackoff ();
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,21 @@ public:
|
||||
// Should be implemented by child classes
|
||||
virtual void Enqueue (Ptr<Packet> packet, Mac48Address to) = 0;
|
||||
|
||||
/**
|
||||
* The packet we sent was successfully received by the receiver
|
||||
* (i.e. we received an Ack from the receiver).
|
||||
*
|
||||
* \param hdr the header of the packet that we successfully sent
|
||||
*/
|
||||
virtual void TxOk (const WifiMacHeader &hdr);
|
||||
/**
|
||||
* The packet we sent was successfully received by the receiver
|
||||
* (i.e. we did not receive an Ack from the receiver).
|
||||
*
|
||||
* \param hdr the header of the packet that we failed to sent
|
||||
*/
|
||||
virtual void TxFailed (const WifiMacHeader &hdr);
|
||||
|
||||
/**
|
||||
* Enable or disable CTS-to-self feature.
|
||||
*
|
||||
@@ -238,20 +253,6 @@ protected:
|
||||
* \param mpdu the MPDU that has been received.
|
||||
*/
|
||||
virtual void Receive (Ptr<WifiMacQueueItem> mpdu);
|
||||
/**
|
||||
* The packet we sent was successfully received by the receiver
|
||||
* (i.e. we received an Ack from the receiver).
|
||||
*
|
||||
* \param hdr the header of the packet that we successfully sent
|
||||
*/
|
||||
virtual void TxOk (const WifiMacHeader &hdr);
|
||||
/**
|
||||
* The packet we sent was successfully received by the receiver
|
||||
* (i.e. we did not receive an Ack from the receiver).
|
||||
*
|
||||
* \param hdr the header of the packet that we failed to sent
|
||||
*/
|
||||
virtual void TxFailed (const WifiMacHeader &hdr);
|
||||
|
||||
/**
|
||||
* Forward the packet up to the device.
|
||||
|
||||
@@ -191,7 +191,6 @@ Txop::SetMinCw (uint32_t minCw)
|
||||
if (changed == true)
|
||||
{
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +203,6 @@ Txop::SetMaxCw (uint32_t maxCw)
|
||||
if (changed == true)
|
||||
{
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +217,7 @@ Txop::ResetCw (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_cw = m_cwMin;
|
||||
m_cwTrace = m_cw;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -227,6 +226,7 @@ Txop::UpdateFailedCw (void)
|
||||
NS_LOG_FUNCTION (this);
|
||||
//see 802.11-2012, section 9.19.2.5
|
||||
m_cw = std::min ( 2 * (m_cw + 1) - 1, m_cwMax);
|
||||
m_cwTrace = m_cw;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
@@ -373,7 +373,6 @@ Txop::DoInitialize ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
GenerateBackoff ();
|
||||
}
|
||||
|
||||
@@ -622,12 +621,10 @@ Txop::MissedCts (void)
|
||||
//to reset the Txop.
|
||||
m_currentPacket = 0;
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFailedCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
}
|
||||
GenerateBackoff ();
|
||||
RestartAccessIfNeeded ();
|
||||
@@ -651,7 +648,6 @@ Txop::GotAck (void)
|
||||
*/
|
||||
m_currentPacket = 0;
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
GenerateBackoff ();
|
||||
RestartAccessIfNeeded ();
|
||||
}
|
||||
@@ -678,7 +674,6 @@ Txop::MissedAck (void)
|
||||
//to reset the Txop.
|
||||
m_currentPacket = 0;
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -687,7 +682,6 @@ Txop::MissedAck (void)
|
||||
m_currentHdr));
|
||||
m_currentHdr.SetRetry ();
|
||||
UpdateFailedCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
}
|
||||
GenerateBackoff ();
|
||||
RestartAccessIfNeeded ();
|
||||
@@ -769,7 +763,6 @@ Txop::EndTxNoAck (void)
|
||||
NS_LOG_DEBUG ("a transmission that did not require an ACK just finished");
|
||||
m_currentPacket = 0;
|
||||
ResetCw ();
|
||||
m_cwTrace = GetCw ();
|
||||
GenerateBackoff ();
|
||||
if (!m_txOkCallback.IsNull ())
|
||||
{
|
||||
|
||||
@@ -205,6 +205,19 @@ public:
|
||||
* \return the TXOP limit.
|
||||
*/
|
||||
Time GetTxopLimit (void) const;
|
||||
/**
|
||||
* Update the value of the CW variable to take into account
|
||||
* a transmission success or a transmission abort (stop transmission
|
||||
* of a packet after the maximum number of retransmissions has been
|
||||
* reached). By default, this resets the CW variable to minCW.
|
||||
*/
|
||||
void ResetCw (void);
|
||||
/**
|
||||
* Update the value of the CW variable to take into account
|
||||
* a transmission failure. By default, this triggers a doubling
|
||||
* of CW (capped by maxCW).
|
||||
*/
|
||||
void UpdateFailedCw (void);
|
||||
|
||||
/**
|
||||
* When a channel switching occurs, enqueued packets are removed.
|
||||
@@ -394,19 +407,6 @@ protected:
|
||||
* minCW.
|
||||
*/
|
||||
uint32_t GetCw (void) const;
|
||||
/**
|
||||
* Update the value of the CW variable to take into account
|
||||
* a transmission success or a transmission abort (stop transmission
|
||||
* of a packet after the maximum number of retransmissions has been
|
||||
* reached). By default, this resets the CW variable to minCW.
|
||||
*/
|
||||
void ResetCw (void);
|
||||
/**
|
||||
* Update the value of the CW variable to take into account
|
||||
* a transmission failure. By default, this triggers a doubling
|
||||
* of CW (capped by maxCW).
|
||||
*/
|
||||
void UpdateFailedCw (void);
|
||||
/**
|
||||
* Return the current number of backoff slots.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user