diff --git a/src/wifi/model/dca-txop.cc b/src/wifi/model/dca-txop.cc index 431538fcd..afb056eed 100644 --- a/src/wifi/model/dca-txop.cc +++ b/src/wifi/model/dca-txop.cc @@ -380,7 +380,6 @@ DcaTxop::NotifyAccessGranted (void) ", to=" << m_currentHdr.GetAddr1 () << ", seq=" << m_currentHdr.GetSequenceControl ()); } - m_currentParams.DisableOverrideDurationId (); if (m_currentHdr.GetAddr1 ().IsGroup ()) { m_currentParams.DisableRts (); @@ -548,7 +547,6 @@ DcaTxop::StartNextFragment (void) Ptr fragment = GetFragmentPacket (&hdr); m_currentParams.EnableAck (); m_currentParams.DisableRts (); - m_currentParams.DisableOverrideDurationId (); if (IsLastFragment ()) { m_currentParams.DisableNextData (); diff --git a/src/wifi/model/edca-txop-n.cc b/src/wifi/model/edca-txop-n.cc index ed44bc581..730b76112 100644 --- a/src/wifi/model/edca-txop-n.cc +++ b/src/wifi/model/edca-txop-n.cc @@ -215,7 +215,6 @@ EdcaTxopN::NotifyAccessGranted (void) } } } - m_currentParams.DisableOverrideDurationId (); if (m_currentHdr.GetAddr1 ().IsGroup ()) { m_currentParams.DisableRts (); @@ -839,7 +838,6 @@ EdcaTxopN::StartNextPacket (void) } return; } - m_currentParams.DisableOverrideDurationId (); m_currentParams.DisableNextData (); if (m_currentHdr.IsQosData () && m_currentHdr.IsQosBlockAck ()) { @@ -1385,7 +1383,6 @@ EdcaTxopN::SendBlockAckRequest (const Bar &bar) m_currentParams.DisableRts (); m_currentParams.DisableNextData (); - m_currentParams.DisableOverrideDurationId (); if (bar.immediate) { if (m_blockAckType == BASIC_BLOCK_ACK) @@ -1497,7 +1494,6 @@ EdcaTxopN::SendAddBaRequest (Mac48Address dest, uint8_t tid, uint16_t startSeq, m_currentParams.EnableAck (); m_currentParams.DisableRts (); m_currentParams.DisableNextData (); - m_currentParams.DisableOverrideDurationId (); m_low->StartTransmission (m_currentPacket, &m_currentHdr, m_currentParams, this); } diff --git a/src/wifi/model/mac-low-transmission-parameters.cc b/src/wifi/model/mac-low-transmission-parameters.cc index 6e2ddad30..5d34fd725 100644 --- a/src/wifi/model/mac-low-transmission-parameters.cc +++ b/src/wifi/model/mac-low-transmission-parameters.cc @@ -27,8 +27,7 @@ namespace ns3 { MacLowTransmissionParameters::MacLowTransmissionParameters () : m_nextSize (0), m_waitAck (ACK_NONE), - m_sendRts (false), - m_overrideDurationId (Seconds (0)) + m_sendRts (false) { } @@ -44,18 +43,6 @@ MacLowTransmissionParameters::DisableNextData (void) m_nextSize = 0; } -void -MacLowTransmissionParameters::EnableOverrideDurationId (Time durationId) -{ - m_overrideDurationId = durationId; -} - -void -MacLowTransmissionParameters::DisableOverrideDurationId (void) -{ - m_overrideDurationId = Seconds (0); -} - void MacLowTransmissionParameters::EnableSuperFastAck (void) { @@ -158,19 +145,6 @@ MacLowTransmissionParameters::MustSendRts (void) const return m_sendRts; } -bool -MacLowTransmissionParameters::HasDurationId (void) const -{ - return (!m_overrideDurationId.IsZero ()); -} - -Time -MacLowTransmissionParameters::GetDurationId (void) const -{ - NS_ASSERT (!m_overrideDurationId.IsZero ()); - return m_overrideDurationId; -} - bool MacLowTransmissionParameters::HasNextPacket (void) const { @@ -189,7 +163,6 @@ std::ostream &operator << (std::ostream &os, const MacLowTransmissionParameters os << "[" << "send rts=" << params.m_sendRts << ", " << "next size=" << params.m_nextSize << ", " - << "dur=" << params.m_overrideDurationId << ", " << "ack="; switch (params.m_waitAck) { diff --git a/src/wifi/model/mac-low-transmission-parameters.h b/src/wifi/model/mac-low-transmission-parameters.h index 6bca6cf00..251108f24 100644 --- a/src/wifi/model/mac-low-transmission-parameters.h +++ b/src/wifi/model/mac-low-transmission-parameters.h @@ -97,14 +97,6 @@ public: * the current transmission + SIFS. */ void EnableNextData (uint32_t size); - /** - * \param durationId the value to set in the duration/Id field of - * the outgoing packet. - * - * Ignore all other durationId calculation and simply force the - * packet's durationId field to this value. - */ - void EnableOverrideDurationId (Time durationId); /** * Do not wait for Ack after data transmission. Typically * used for Broadcast and multicast frames. @@ -118,12 +110,6 @@ public: * Do not attempt to send data burst after current transmission */ void DisableNextData (void); - /** - * Do not force the duration/id field of the packet: its - * value is automatically calculated by the MacLow before - * calling WifiPhy::Send. - */ - void DisableOverrideDurationId (void); /** * \returns true if must wait for ACK after data transmission, * false otherwise. @@ -176,15 +162,6 @@ public: * sending data, false otherwise. */ bool MustSendRts (void) const; - /** - * \returns true if a duration/id was forced with - * EnableOverrideDurationId, false otherwise. - */ - bool HasDurationId (void) const; - /** - * \returns the duration/id forced by EnableOverrideDurationId - */ - Time GetDurationId (void) const; /** * \returns true if EnableNextData was called, false otherwise. */ @@ -209,7 +186,6 @@ private: BLOCK_ACK_MULTI_TID } m_waitAck; //!< wait ack bool m_sendRts; //!< send an RTS? - Time m_overrideDurationId; //!< override duration ID }; /** diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index df0ff7cd4..f41d2e217 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -1456,42 +1456,35 @@ MacLow::SendRtsForPacket (void) WifiTxVector rtsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr); Time duration = Seconds (0); - if (m_txParams.HasDurationId ()) + duration += GetSifs (); + duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector); + duration += GetSifs (); + duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr, m_ampdu), + m_currentTxVector, m_phy->GetFrequency ()); + duration += GetSifs (); + if (m_txParams.MustWaitBasicBlockAck ()) { - duration += m_txParams.GetDurationId (); + WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); + duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); } - else + else if (m_txParams.MustWaitCompressedBlockAck ()) { - duration += GetSifs (); - duration += GetCtsDuration (m_currentHdr.GetAddr1 (), rtsTxVector); - duration += GetSifs (); - duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr, m_ampdu), + WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); + duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); + } + else if (m_txParams.MustWaitAck ()) + { + duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); + } + if (m_txParams.HasNextPacket ()) + { + duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, m_phy->GetFrequency ()); - duration += GetSifs (); - if (m_txParams.MustWaitBasicBlockAck ()) - { - WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); - duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); - } - else if (m_txParams.MustWaitCompressedBlockAck ()) - { - WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); - duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); - } - else if (m_txParams.MustWaitAck ()) + if (m_txParams.MustWaitAck ()) { + duration += GetSifs (); duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); } - if (m_txParams.HasNextPacket ()) - { - duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), - m_currentTxVector, m_phy->GetFrequency ()); - if (m_txParams.MustWaitAck ()) - { - duration += GetSifs (); - duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); - } - } } rts.SetDuration (duration); @@ -1591,47 +1584,40 @@ MacLow::SendDataPacket (void) StartDataTxTimers (m_currentTxVector); Time duration = Seconds (0.0); - if (m_txParams.HasDurationId ()) + if (m_txParams.MustWaitBasicBlockAck ()) { - duration += m_txParams.GetDurationId (); + duration += GetSifs (); + WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); + duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); } - else + else if (m_txParams.MustWaitCompressedBlockAck ()) { - if (m_txParams.MustWaitBasicBlockAck ()) + duration += GetSifs (); + WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); + duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); + } + else if (m_txParams.MustWaitAck ()) + { + duration += GetSifs (); + duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); + } + if (m_txParams.HasNextPacket ()) + { + if (m_stationManager->GetRifsPermitted ()) + { + duration += GetRifs (); + } + else { duration += GetSifs (); - WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); - duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); } - else if (m_txParams.MustWaitCompressedBlockAck ()) - { - duration += GetSifs (); - WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); - duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); - } - else if (m_txParams.MustWaitAck ()) + duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), + m_currentTxVector, m_phy->GetFrequency ()); + if (m_txParams.MustWaitAck ()) { duration += GetSifs (); duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); } - if (m_txParams.HasNextPacket ()) - { - if (m_stationManager->GetRifsPermitted ()) - { - duration += GetRifs (); - } - else - { - duration += GetSifs (); - } - duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), - m_currentTxVector, m_phy->GetFrequency ()); - if (m_txParams.MustWaitAck ()) - { - duration += GetSifs (); - duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); - } - } } m_currentHdr.SetDuration (duration); Ptr packet = m_currentPacket->Copy (); @@ -1667,22 +1653,32 @@ MacLow::SendCtsToSelf (void) WifiTxVector ctsTxVector = GetRtsTxVector (m_currentPacket, &m_currentHdr); Time duration = Seconds (0); - if (m_txParams.HasDurationId ()) - { - duration += m_txParams.GetDurationId (); - } - else + duration += GetSifs (); + duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr, m_ampdu), + m_currentTxVector, m_phy->GetFrequency ()); + if (m_txParams.MustWaitBasicBlockAck ()) { duration += GetSifs (); - duration += m_phy->CalculateTxDuration (GetSize (m_currentPacket, &m_currentHdr, m_ampdu), + WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); + duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); + } + else if (m_txParams.MustWaitCompressedBlockAck ()) + { + duration += GetSifs (); + WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); + duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); + } + else if (m_txParams.MustWaitAck ()) + { + duration += GetSifs (); + duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); + } + if (m_txParams.HasNextPacket ()) + { + duration += GetSifs (); + duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), m_currentTxVector, m_phy->GetFrequency ()); - if (m_txParams.MustWaitBasicBlockAck ()) - { - duration += GetSifs (); - WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); - duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, BASIC_BLOCK_ACK); - } - else if (m_txParams.MustWaitCompressedBlockAck ()) + if (m_txParams.MustWaitCompressedBlockAck ()) { duration += GetSifs (); WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); @@ -1693,23 +1689,6 @@ MacLow::SendCtsToSelf (void) duration += GetSifs (); duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); } - if (m_txParams.HasNextPacket ()) - { - duration += GetSifs (); - duration += m_phy->CalculateTxDuration (m_txParams.GetNextPacketSize (), - m_currentTxVector, m_phy->GetFrequency ()); - if (m_txParams.MustWaitCompressedBlockAck ()) - { - duration += GetSifs (); - WifiTxVector blockAckReqTxVector = GetBlockAckTxVector (m_currentHdr.GetAddr2 (), m_currentTxVector.GetMode ()); - duration += GetBlockAckDuration (m_currentHdr.GetAddr1 (), blockAckReqTxVector, COMPRESSED_BLOCK_ACK); - } - else if (m_txParams.MustWaitAck ()) - { - duration += GetSifs (); - duration += GetAckDuration (m_currentHdr.GetAddr1 (), m_currentTxVector); - } - } } cts.SetDuration (duration);