diff --git a/src/wifi/model/dca-txop.cc b/src/wifi/model/dca-txop.cc index dfce07830..eee2d2c44 100644 --- a/src/wifi/model/dca-txop.cc +++ b/src/wifi/model/dca-txop.cc @@ -323,14 +323,6 @@ DcaTxop::Low (void) return m_low; } -bool -DcaTxop::NeedRts (Ptr packet, const WifiMacHeader *header) -{ - NS_LOG_FUNCTION (this << packet << header); - return m_stationManager->NeedRts (header->GetAddr1 (), header, - packet); -} - void DcaTxop::DoInitialize () { @@ -475,14 +467,6 @@ DcaTxop::NotifyAccessGranted (void) { WifiMacHeader hdr; Ptr fragment = GetFragmentPacket (&hdr); - if (NeedRts (fragment, &hdr)) - { - params.EnableRts (); - } - else - { - params.DisableRts (); - } if (IsLastFragment ()) { NS_LOG_DEBUG ("fragmenting last fragment size=" << fragment->GetSize ()); @@ -498,16 +482,6 @@ DcaTxop::NotifyAccessGranted (void) } else { - if (NeedRts (m_currentPacket, &m_currentHdr)) - { - params.EnableRts (); - NS_LOG_DEBUG ("tx unicast rts"); - } - else - { - params.DisableRts (); - NS_LOG_DEBUG ("tx unicast"); - } params.DisableNextData (); Low ()->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener); diff --git a/src/wifi/model/dca-txop.h b/src/wifi/model/dca-txop.h index db3529fd8..9d204d02d 100644 --- a/src/wifi/model/dca-txop.h +++ b/src/wifi/model/dca-txop.h @@ -255,16 +255,6 @@ private: */ void StartAccessIfNeeded (void); - /** - * Check if the current packet should be sent with a RTS protection. - * - * \param packet - * \param header - * - * \return true if RTS protection should be used, - * false otherwise - */ - bool NeedRts (Ptr packet, const WifiMacHeader *header); /** * Check if RTS should be re-transmitted if CTS was missed. * diff --git a/src/wifi/model/edca-txop-n.cc b/src/wifi/model/edca-txop-n.cc index e4f7ab519..08aad37d9 100644 --- a/src/wifi/model/edca-txop-n.cc +++ b/src/wifi/model/edca-txop-n.cc @@ -548,13 +548,10 @@ EdcaTxopN::NotifyAccessGranted (void) { params.EnableAck (); } - if (NeedFragmentation () && ((m_currentHdr.IsQosData () - && !m_currentHdr.IsQosAmsdu ()) - || - (m_currentHdr.IsData () - && !m_currentHdr.IsQosData () && m_currentHdr.IsQosAmsdu ())) - && (m_blockAckThreshold == 0 - || m_blockAckType == BASIC_BLOCK_ACK)) + if (((m_currentHdr.IsQosData () && !m_currentHdr.IsQosAmsdu ()) + ||(m_currentHdr.IsData () && !m_currentHdr.IsQosData () && m_currentHdr.IsQosAmsdu ())) + && (m_blockAckThreshold == 0 || m_blockAckType == BASIC_BLOCK_ACK) + && NeedFragmentation ()) { //With COMPRESSED_BLOCK_ACK fragmentation must be avoided. params.DisableRts (); @@ -619,16 +616,6 @@ EdcaTxopN::NotifyAccessGranted (void) NS_LOG_DEBUG ("tx unicast A-MSDU"); } } - if (NeedRts ()) - { - params.EnableRts (); - NS_LOG_DEBUG ("tx unicast rts"); - } - else - { - params.DisableRts (); - NS_LOG_DEBUG ("tx unicast"); - } params.DisableNextData (); m_low->StartTransmission (m_currentPacket, &m_currentHdr, params, m_transmissionListener); @@ -984,14 +971,6 @@ EdcaTxopN::StartAccessIfNeeded (void) } } -bool -EdcaTxopN::NeedRts (void) -{ - NS_LOG_FUNCTION (this); - return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), &m_currentHdr, - m_currentPacket); -} - bool EdcaTxopN::NeedRtsRetransmission (void) { diff --git a/src/wifi/model/edca-txop-n.h b/src/wifi/model/edca-txop-n.h index 110608b04..f6072c1ff 100644 --- a/src/wifi/model/edca-txop-n.h +++ b/src/wifi/model/edca-txop-n.h @@ -287,13 +287,6 @@ public: * Request access from DCF manager if needed. */ void StartAccessIfNeeded (void); - /** - * Check if the current packet should be sent with a RTS protection. - * - * \return true if RTS protection should be used, - * false otherwise - */ - bool NeedRts (void); /** * Check if RTS should be re-transmitted if CTS was missed. * diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index 84a0072fc..450ee9cc3 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -786,6 +786,15 @@ MacLow::StartTransmission (Ptr packet, } } } + + if (NeedRts ()) + { + m_txParams.EnableRts (); + } + else + { + m_txParams.DisableRts (); + } NS_LOG_DEBUG ("startTx size=" << GetSize (m_currentPacket, &m_currentHdr) << ", to=" << m_currentHdr.GetAddr1 () << ", listener=" << m_listener); @@ -796,7 +805,7 @@ MacLow::StartTransmission (Ptr packet, } else { - if (NeedCtsToSelf () && m_ctsToSelfSupported) + if (m_ctsToSelfSupported && NeedCtsToSelf ()) { SendCtsToSelf (); } @@ -810,6 +819,14 @@ MacLow::StartTransmission (Ptr packet, NS_ASSERT (m_phy->IsStateTx ()); } +bool +MacLow::NeedRts (void) +{ + return m_stationManager->NeedRts (m_currentHdr.GetAddr1 (), + &m_currentHdr, + m_currentPacket); +} + bool MacLow::NeedCtsToSelf (void) { diff --git a/src/wifi/model/mac-low.h b/src/wifi/model/mac-low.h index ef9d085f1..84ec1300d 100644 --- a/src/wifi/model/mac-low.h +++ b/src/wifi/model/mac-low.h @@ -1013,6 +1013,13 @@ private: * \return the time required to transmit the Block ACK (including preamble and FCS) */ Time GetBlockAckDuration (Mac48Address to, WifiTxVector blockAckReqTxVector, enum BlockAckType type) const; + /** + * Check if the current packet should be sent with a RTS protection. + * + * \return true if RTS protection should be used, + * false otherwise + */ + bool NeedRts (void); /** * Check if CTS-to-self mechanism should be used for the current packet. * diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index b99f99bb5..f8fd85a4b 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -282,46 +282,50 @@ WifiRemoteStationManager::GetTypeId (void) static TypeId tid = TypeId ("ns3::WifiRemoteStationManager") .SetParent () .SetGroupName ("Wifi") - .AddAttribute ("IsLowLatency", "If true, we attempt to modelize a so-called low-latency device: a device" - " where decisions about tx parameters can be made on a per-packet basis and feedback about the" - " transmission of each packet is obtained before sending the next. Otherwise, we modelize a " - " high-latency device, that is a device where we cannot update our decision about tx parameters" - " after every packet transmission.", + .AddAttribute ("IsLowLatency", + "If true, we attempt to modelize a so-called low-latency device: " + "a device where decisions about tx parameters can be made on a per-packet basis and " + "feedback about the transmission of each packet is obtained before sending the next. " + "Otherwise, we modelize a high-latency device, that is a device where we cannot update " + "our decision about tx parameters after every packet transmission.", TypeId::ATTR_GET, BooleanValue (true), //this value is ignored because there is no setter MakeBooleanAccessor (&WifiRemoteStationManager::IsLowLatency), MakeBooleanChecker ()) - .AddAttribute ("MaxSsrc", "The maximum number of retransmission attempts for an RTS. This value" - " will not have any effect on some rate control algorithms.", + .AddAttribute ("MaxSsrc", + "The maximum number of retransmission attempts for an RTS. " + " This value will not have any effect on some rate control algorithms.", UintegerValue (7), MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSsrc), MakeUintegerChecker ()) - .AddAttribute ("MaxSlrc", "The maximum number of retransmission attempts for a DATA packet. This value" - " will not have any effect on some rate control algorithms.", + .AddAttribute ("MaxSlrc", + "The maximum number of retransmission attempts for a DATA packet. " + "This value will not have any effect on some rate control algorithms.", UintegerValue (7), MakeUintegerAccessor (&WifiRemoteStationManager::m_maxSlrc), MakeUintegerChecker ()) - .AddAttribute ("RtsCtsThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than " - "this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2012, Section 9.3.5. " + .AddAttribute ("RtsCtsThreshold", + "If the size of the PSDU is bigger than this value, we use an RTS/CTS handshake before sending the data frame." "This value will not have any effect on some rate control algorithms.", - UintegerValue (2346), + UintegerValue (65535), MakeUintegerAccessor (&WifiRemoteStationManager::m_rtsCtsThreshold), MakeUintegerChecker ()) - .AddAttribute ("FragmentationThreshold", "If the size of the data packet + LLC header + MAC header + FCS trailer is bigger" - "than this value, we fragment it such that the size of the fragments are equal or smaller " - "than this value, as per IEEE Std. 802.11-2012, Section 9.5. " + .AddAttribute ("FragmentationThreshold", + "If the size of the PSDU is bigger than this value, we fragment it such that the size of the fragments are equal or smaller. " + "This value does not apply when it is carried in an A-MPDU. " "This value will not have any effect on some rate control algorithms.", UintegerValue (2346), MakeUintegerAccessor (&WifiRemoteStationManager::DoSetFragmentationThreshold, &WifiRemoteStationManager::DoGetFragmentationThreshold), MakeUintegerChecker ()) - .AddAttribute ("NonUnicastMode", "Wifi mode used for non-unicast transmissions.", + .AddAttribute ("NonUnicastMode", + "Wifi mode used for non-unicast transmissions.", WifiModeValue (), MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode), MakeWifiModeChecker ()) - .AddAttribute ("DefaultTxPowerLevel", "Default power level to be used for transmissions. " - "This is the power level that is used by all those WifiManagers that do not" - "implement TX power control.", + .AddAttribute ("DefaultTxPowerLevel", + "Default power level to be used for transmissions. " + "This is the power level that is used by all those WifiManagers that do not implement TX power control.", UintegerValue (0), MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxPowerLevel), MakeUintegerChecker ())