diff --git a/src/wifi/model/qos-txop.cc b/src/wifi/model/qos-txop.cc index 8bd719693..4ebd13da1 100644 --- a/src/wifi/model/qos-txop.cc +++ b/src/wifi/model/qos-txop.cc @@ -729,12 +729,10 @@ QosTxop::NotifyMissedCts (std::list> 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 (); } diff --git a/src/wifi/model/regular-wifi-mac.h b/src/wifi/model/regular-wifi-mac.h index d8407153c..b75a50b24 100644 --- a/src/wifi/model/regular-wifi-mac.h +++ b/src/wifi/model/regular-wifi-mac.h @@ -87,6 +87,21 @@ public: // Should be implemented by child classes virtual void Enqueue (Ptr 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 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. diff --git a/src/wifi/model/txop.cc b/src/wifi/model/txop.cc index aad31bf0d..85ded1293 100644 --- a/src/wifi/model/txop.cc +++ b/src/wifi/model/txop.cc @@ -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 ()) { diff --git a/src/wifi/model/txop.h b/src/wifi/model/txop.h index 74c593b82..349b3c2e9 100644 --- a/src/wifi/model/txop.h +++ b/src/wifi/model/txop.h @@ -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. *