diff -r c9b19f516c5f src/wifi/model/dca-txop.cc --- a/src/wifi/model/dca-txop.cc Wed Oct 31 23:17:27 2012 -0700 +++ b/src/wifi/model/dca-txop.cc Fri Nov 02 10:13:29 2012 -0400 @@ -103,6 +103,10 @@ { m_txop->Cancel (); } + virtual void EndTxNoAck (void) + { + m_txop->EndTxNoAck (); + } private: DcaTxop *m_txop; @@ -407,10 +411,6 @@ &m_currentHdr, params, m_transmissionListener); - m_currentPacket = 0; - m_dcf->ResetCw (); - m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); - StartAccessIfNeeded (); NS_LOG_DEBUG ("tx broadcast"); } else @@ -621,4 +621,15 @@ */ } +void +DcaTxop::EndTxNoAck (void) +{ + NS_LOG_FUNCTION (this); + NS_LOG_DEBUG ("a transmission that did not require an ACK just finished"); + m_currentPacket = 0; + m_dcf->ResetCw (); + m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); + StartAccessIfNeeded (); +} + } // namespace ns3 diff -r c9b19f516c5f src/wifi/model/dca-txop.h --- a/src/wifi/model/dca-txop.h Wed Oct 31 23:17:27 2012 -0700 +++ b/src/wifi/model/dca-txop.h Fri Nov 02 10:13:29 2012 -0400 @@ -147,6 +147,7 @@ void MissedAck (void); void StartNext (void); void Cancel (void); + void EndTxNoAck (void); void RestartAccessIfNeeded (void); void StartAccessIfNeeded (void); diff -r c9b19f516c5f src/wifi/model/edca-txop-n.cc --- a/src/wifi/model/edca-txop-n.cc Wed Oct 31 23:17:27 2012 -0700 +++ b/src/wifi/model/edca-txop-n.cc Fri Nov 02 10:13:29 2012 -0400 @@ -111,6 +111,10 @@ { m_txop->Cancel (); } + virtual void EndTxNoAck (void) + { + m_txop->EndTxNoAck (); + } private: EdcaTxopN *m_txop; @@ -384,10 +388,6 @@ params, m_transmissionListener); - m_currentPacket = 0; - m_dcf->ResetCw (); - m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); - StartAccessIfNeeded (); NS_LOG_DEBUG ("tx broadcast"); } else if (m_currentHdr.GetType () == WIFI_MAC_CTL_BACKREQ) @@ -730,6 +730,17 @@ NS_LOG_DEBUG ("transmission cancelled"); } +void +EdcaTxopN::EndTxNoAck (void) +{ + NS_LOG_FUNCTION (this); + NS_LOG_DEBUG ("a transmission that did not require an ACK just finished"); + m_currentPacket = 0; + m_dcf->ResetCw (); + m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); + StartAccessIfNeeded (); +} + bool EdcaTxopN::NeedFragmentation (void) const { diff -r c9b19f516c5f src/wifi/model/edca-txop-n.h --- a/src/wifi/model/edca-txop-n.h Wed Oct 31 23:17:27 2012 -0700 +++ b/src/wifi/model/edca-txop-n.h Fri Nov 02 10:13:29 2012 -0400 @@ -126,6 +126,7 @@ void MissedAck (void); void StartNext (void); void Cancel (void); + void EndTxNoAck (void); void RestartAccessIfNeeded (void); void StartAccessIfNeeded (void); diff -r c9b19f516c5f src/wifi/model/mac-low.cc --- a/src/wifi/model/mac-low.cc Wed Oct 31 23:17:27 2012 -0700 +++ b/src/wifi/model/mac-low.cc Fri Nov 02 10:13:29 2012 -0400 @@ -360,6 +360,7 @@ m_sendAckEvent (), m_sendDataEvent (), m_waitSifsEvent (), + m_endTxNoAckEvent (), m_currentPacket (0), m_listener (0) { @@ -396,6 +397,7 @@ m_sendAckEvent.Cancel (); m_sendDataEvent.Cancel (); m_waitSifsEvent.Cancel (); + m_endTxNoAckEvent.Cancel (); m_phy = 0; m_stationManager = 0; delete m_phyMacLowListener; @@ -457,6 +459,11 @@ m_waitSifsEvent.Cancel (); oneRunning = true; } + if (m_endTxNoAckEvent.IsRunning ()) + { + m_endTxNoAckEvent.Cancel (); + oneRunning = true; + } if (oneRunning && m_listener != 0) { m_listener->Cancel (); @@ -1352,7 +1359,7 @@ else { // since we do not expect any timer to be triggered. - m_listener = 0; + Simulator::Schedule(txDuration, &MacLow::EndTxNoAck, this); } } @@ -1490,6 +1497,14 @@ m_listener->StartNext (); } +void +MacLow::EndTxNoAck (void) +{ + MacLowTransmissionListener *listener = m_listener; + m_listener = 0; + listener->EndTxNoAck (); +} + void MacLow::FastAckFailedTimeout (void) { diff -r c9b19f516c5f src/wifi/model/mac-low.h --- a/src/wifi/model/mac-low.h Wed Oct 31 23:17:27 2012 -0700 +++ b/src/wifi/model/mac-low.h Fri Nov 02 10:13:29 2012 -0400 @@ -123,7 +123,15 @@ * you can assume that the packet has not been passed * down the stack to the PHY. */ - virtual void Cancel (void) = 0; + virtual void Cancel (void) = 0; + + /** + * Invoked upon the end of the transmission of a frame that does not + * require an ACK (e.g., broadcast and multicast frames). + * + */ + virtual void EndTxNoAck (void) = 0; + }; @@ -541,6 +549,7 @@ void SendAckAfterData (Mac48Address source, Time duration, WifiMode txMode, double rtsSnr); void SendDataAfterCts (Mac48Address source, Time duration, WifiMode txMode); void WaitSifsAfterEndTx (void); + void EndTxNoAck (void); void SendRtsForPacket (void); void SendDataPacket (void); @@ -614,6 +623,7 @@ EventId m_sendAckEvent; EventId m_sendDataEvent; EventId m_waitSifsEvent; + EventId m_endTxNoAckEvent; EventId m_navCounterResetCtsMissed; Ptr m_currentPacket;