diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 5a8719fb1..6a701e367 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -484,47 +484,46 @@ EdcaParameterSet ApWifiMac::GetEdcaParameterSet (uint8_t linkId) const { NS_LOG_FUNCTION (this << +linkId); + NS_ASSERT (GetQosSupported ()); EdcaParameterSet edcaParameters; - if (GetQosSupported ()) - { - edcaParameters.SetQosSupported (1); - Ptr edca; - Time txopLimit; - edca = GetQosTxop (AC_BE); - txopLimit = edca->GetTxopLimit (linkId); - edcaParameters.SetBeAci (0); - edcaParameters.SetBeCWmin (edca->GetMinCw (linkId)); - edcaParameters.SetBeCWmax (edca->GetMaxCw (linkId)); - edcaParameters.SetBeAifsn (edca->GetAifsn (linkId)); - edcaParameters.SetBeTxopLimit (static_cast (txopLimit.GetMicroSeconds () / 32)); + Ptr edca; + Time txopLimit; - edca = GetQosTxop (AC_BK); - txopLimit = edca->GetTxopLimit (linkId); - edcaParameters.SetBkAci (1); - edcaParameters.SetBkCWmin (edca->GetMinCw (linkId)); - edcaParameters.SetBkCWmax (edca->GetMaxCw (linkId)); - edcaParameters.SetBkAifsn (edca->GetAifsn (linkId)); - edcaParameters.SetBkTxopLimit (static_cast (txopLimit.GetMicroSeconds () / 32)); + edca = GetQosTxop (AC_BE); + txopLimit = edca->GetTxopLimit (linkId); + edcaParameters.SetBeAci (0); + edcaParameters.SetBeCWmin (edca->GetMinCw (linkId)); + edcaParameters.SetBeCWmax (edca->GetMaxCw (linkId)); + edcaParameters.SetBeAifsn (edca->GetAifsn (linkId)); + edcaParameters.SetBeTxopLimit (static_cast (txopLimit.GetMicroSeconds () / 32)); - edca = GetQosTxop (AC_VI); - txopLimit = edca->GetTxopLimit (linkId); - edcaParameters.SetViAci (2); - edcaParameters.SetViCWmin (edca->GetMinCw (linkId)); - edcaParameters.SetViCWmax (edca->GetMaxCw (linkId)); - edcaParameters.SetViAifsn (edca->GetAifsn (linkId)); - edcaParameters.SetViTxopLimit (static_cast (txopLimit.GetMicroSeconds () / 32)); + edca = GetQosTxop (AC_BK); + txopLimit = edca->GetTxopLimit (linkId); + edcaParameters.SetBkAci (1); + edcaParameters.SetBkCWmin (edca->GetMinCw (linkId)); + edcaParameters.SetBkCWmax (edca->GetMaxCw (linkId)); + edcaParameters.SetBkAifsn (edca->GetAifsn (linkId)); + edcaParameters.SetBkTxopLimit (static_cast (txopLimit.GetMicroSeconds () / 32)); - edca = GetQosTxop (AC_VO); - txopLimit = edca->GetTxopLimit (linkId); - edcaParameters.SetVoAci (3); - edcaParameters.SetVoCWmin (edca->GetMinCw (linkId)); - edcaParameters.SetVoCWmax (edca->GetMaxCw (linkId)); - edcaParameters.SetVoAifsn (edca->GetAifsn (linkId)); - edcaParameters.SetVoTxopLimit (static_cast (txopLimit.GetMicroSeconds () / 32)); + edca = GetQosTxop (AC_VI); + txopLimit = edca->GetTxopLimit (linkId); + edcaParameters.SetViAci (2); + edcaParameters.SetViCWmin (edca->GetMinCw (linkId)); + edcaParameters.SetViCWmax (edca->GetMaxCw (linkId)); + edcaParameters.SetViAifsn (edca->GetAifsn (linkId)); + edcaParameters.SetViTxopLimit (static_cast (txopLimit.GetMicroSeconds () / 32)); + + edca = GetQosTxop (AC_VO); + txopLimit = edca->GetTxopLimit (linkId); + edcaParameters.SetVoAci (3); + edcaParameters.SetVoCWmin (edca->GetMinCw (linkId)); + edcaParameters.SetVoCWmax (edca->GetMaxCw (linkId)); + edcaParameters.SetVoAifsn (edca->GetAifsn (linkId)); + edcaParameters.SetVoTxopLimit (static_cast (txopLimit.GetMicroSeconds () / 32)); + + edcaParameters.SetQosInfo (0); - edcaParameters.SetQosInfo (0); - } return edcaParameters; } diff --git a/src/wifi/model/edca-parameter-set.cc b/src/wifi/model/edca-parameter-set.cc index f4718ff17..af027e8cb 100644 --- a/src/wifi/model/edca-parameter-set.cc +++ b/src/wifi/model/edca-parameter-set.cc @@ -29,8 +29,7 @@ EdcaParameterSet::EdcaParameterSet () m_acBE (0), m_acBK (0), m_acVI (0), - m_acVO (0), - m_qosSupported (0) + m_acVO (0) { } @@ -40,18 +39,6 @@ EdcaParameterSet::ElementId () const return IE_EDCA_PARAMETER_SET; } -void -EdcaParameterSet::SetQosSupported (uint8_t qosSupported) -{ - m_qosSupported = qosSupported; -} - -uint8_t -EdcaParameterSet::IsQosSupported (void) const -{ - return ((m_acBE != 0) || (m_acBK != 0) || (m_acVI != 0) || (m_acVO != 0)); -} - void EdcaParameterSet::SetQosInfo (uint8_t qosInfo) { @@ -299,42 +286,18 @@ EdcaParameterSet::GetVoTxopLimit (void) const uint8_t EdcaParameterSet::GetInformationFieldSize () const { - NS_ASSERT (m_qosSupported); return 18; } -Buffer::Iterator -EdcaParameterSet::Serialize (Buffer::Iterator i) const -{ - if (!m_qosSupported) - { - return i; - } - return WifiInformationElement::Serialize (i); -} - -uint16_t -EdcaParameterSet::GetSerializedSize () const -{ - if (!m_qosSupported) - { - return 0; - } - return WifiInformationElement::GetSerializedSize (); -} - void EdcaParameterSet::SerializeInformationField (Buffer::Iterator start) const { - if (m_qosSupported) - { - start.WriteU8 (GetQosInfo ()); - start.WriteU8 (m_reserved); - start.WriteU32 (m_acBE); - start.WriteU32 (m_acBK); - start.WriteU32 (m_acVI); - start.WriteU32 (m_acVO); - } + start.WriteU8 (GetQosInfo ()); + start.WriteU8 (m_reserved); + start.WriteU32 (m_acBE); + start.WriteU32 (m_acBK); + start.WriteU32 (m_acVI); + start.WriteU32 (m_acVO); } uint8_t diff --git a/src/wifi/model/edca-parameter-set.h b/src/wifi/model/edca-parameter-set.h index 833a6bd69..da90b5a68 100644 --- a/src/wifi/model/edca-parameter-set.h +++ b/src/wifi/model/edca-parameter-set.h @@ -41,23 +41,6 @@ public: uint8_t GetInformationFieldSize () const override; void SerializeInformationField (Buffer::Iterator start) const override; uint8_t DeserializeInformationField (Buffer::Iterator start, uint8_t length) override; - /* This information element is a bit special in that it is only - included if the STA is a QoS STA. To support this we - override the Serialize and GetSerializedSize methods of - WifiInformationElement. */ - Buffer::Iterator Serialize (Buffer::Iterator start) const override; - uint16_t GetSerializedSize () const override; - - /** - * Set QOS supported function - * \param qosSupported the QOS supported indicator - */ - void SetQosSupported (uint8_t qosSupported); - /** - * Is QOS supported function - * \returns the is QOS supported indicator - */ - uint8_t IsQosSupported (void) const; /** * Set the QoS Info field in the EdcaParameterSet information element. @@ -297,9 +280,6 @@ private: uint32_t m_acBK; ///< AC_BK uint32_t m_acVI; ///< AC_VI uint32_t m_acVO; ///< AC_VO - - /// This is used to decide whether this element should be added to the frame or not - bool m_qosSupported; }; } //namespace ns3 diff --git a/src/wifi/model/mgt-headers.cc b/src/wifi/model/mgt-headers.cc index 755b4494d..b110572e8 100644 --- a/src/wifi/model/mgt-headers.cc +++ b/src/wifi/model/mgt-headers.cc @@ -538,7 +538,7 @@ MgtProbeResponseHeader::SetMultiLinkElement (Ptr multiLinkElem m_multiLinkElement = multiLinkElement; } -const EdcaParameterSet& +const std::optional& MgtProbeResponseHeader::GetEdcaParameterSet (void) const { return m_edcaParameterSet; @@ -591,7 +591,7 @@ MgtProbeResponseHeader::GetSerializedSize (void) const size += m_dsssParameterSet.GetSerializedSize (); if (m_erpInformation.has_value ()) size += m_erpInformation->GetSerializedSize (); size += m_rates.extended.GetSerializedSize (); - size += m_edcaParameterSet.GetSerializedSize (); + if (m_edcaParameterSet.has_value ()) size += m_edcaParameterSet->GetSerializedSize (); size += m_extendedCapability.GetSerializedSize (); if (m_htCapability.has_value ()) size += m_htCapability->GetSerializedSize (); if (m_htOperation.has_value ()) size += m_htOperation->GetSerializedSize (); @@ -634,7 +634,7 @@ MgtProbeResponseHeader::Serialize (Buffer::Iterator start) const i = m_dsssParameterSet.Serialize (i); if (m_erpInformation.has_value ()) i = m_erpInformation->Serialize (i); i = m_rates.extended.Serialize (i); - i = m_edcaParameterSet.Serialize (i); + if (m_edcaParameterSet.has_value ()) i = m_edcaParameterSet->Serialize (i); i = m_extendedCapability.Serialize (i); if (m_htCapability.has_value ()) i = m_htCapability->Serialize (i); if (m_htOperation.has_value ()) i = m_htOperation->Serialize (i); @@ -661,7 +661,7 @@ MgtProbeResponseHeader::Deserialize (Buffer::Iterator start) i = m_dsssParameterSet.DeserializeIfPresent (i); i = WifiInformationElement::DeserializeIfPresent (m_erpInformation, i); i = m_rates.extended.DeserializeIfPresent (i); - i = m_edcaParameterSet.DeserializeIfPresent (i); + i = WifiInformationElement::DeserializeIfPresent (m_edcaParameterSet, i); i = m_extendedCapability.DeserializeIfPresent (i); i = WifiInformationElement::DeserializeIfPresent (m_htCapability, i); i = WifiInformationElement::DeserializeIfPresent (m_htOperation, i); @@ -1518,7 +1518,7 @@ MgtAssocResponseHeader::SetMuEdcaParameterSet (MuEdcaParameterSet&& muEdcaParame m_muEdcaParameterSet = std::move (muEdcaParameters); } -const EdcaParameterSet& +const std::optional& MgtAssocResponseHeader::GetEdcaParameterSet (void) const { return m_edcaParameterSet; @@ -1557,7 +1557,7 @@ MgtAssocResponseHeader::GetSerializedSize (void) const size += m_rates.GetSerializedSize (); if (m_erpInformation.has_value ()) size += m_erpInformation->GetSerializedSize (); size += m_rates.extended.GetSerializedSize (); - size += m_edcaParameterSet.GetSerializedSize (); + if (m_edcaParameterSet.has_value ()) size += m_edcaParameterSet->GetSerializedSize (); size += m_extendedCapability.GetSerializedSize (); if (m_htCapability.has_value ()) size += m_htCapability->GetSerializedSize (); if (m_htOperation.has_value ()) size += m_htOperation->GetSerializedSize (); @@ -1598,7 +1598,7 @@ MgtAssocResponseHeader::Serialize (Buffer::Iterator start) const i = m_rates.Serialize (i); if (m_erpInformation.has_value ()) i = m_erpInformation->Serialize (i); i = m_rates.extended.Serialize (i); - i = m_edcaParameterSet.Serialize (i); + if (m_edcaParameterSet.has_value ()) i = m_edcaParameterSet->Serialize (i); i = m_extendedCapability.Serialize (i); if (m_htCapability.has_value ()) i = m_htCapability->Serialize (i); if (m_htOperation.has_value ()) i = m_htOperation->Serialize (i); @@ -1621,7 +1621,7 @@ MgtAssocResponseHeader::Deserialize (Buffer::Iterator start) i = m_rates.Deserialize (i); i = WifiInformationElement::DeserializeIfPresent (m_erpInformation, i); i = m_rates.extended.DeserializeIfPresent (i); - i = m_edcaParameterSet.DeserializeIfPresent (i); + i = WifiInformationElement::DeserializeIfPresent (m_edcaParameterSet, i); i = m_extendedCapability.DeserializeIfPresent (i); i = WifiInformationElement::DeserializeIfPresent (m_htCapability, i); i = WifiInformationElement::DeserializeIfPresent (m_htOperation, i); diff --git a/src/wifi/model/mgt-headers.h b/src/wifi/model/mgt-headers.h index 9a4300b52..b8dae215c 100644 --- a/src/wifi/model/mgt-headers.h +++ b/src/wifi/model/mgt-headers.h @@ -534,11 +534,11 @@ public: */ const std::optional& GetErpInformation (void) const; /** - * Return the EDCA Parameter Set. + * Return the EDCA Parameter Set, if present. * - * \return the EDCA Parameter Set + * \return the EDCA Parameter Set, if present */ - const EdcaParameterSet& GetEdcaParameterSet (void) const; + const std::optional& GetEdcaParameterSet (void) const; /** * Return the MU EDCA Parameter Set. * @@ -719,7 +719,7 @@ private: std::optional m_vhtCapability; //!< VHT capabilities std::optional m_vhtOperation; //!< VHT operation std::optional m_erpInformation; //!< ERP information - EdcaParameterSet m_edcaParameterSet; //!< EDCA Parameter Set + std::optional m_edcaParameterSet; //!< EDCA Parameter Set std::optional m_heCapability; //!< HE capabilities std::optional m_heOperation; //!< HE operation MuEdcaParameterSet m_muEdcaParameterSet; //!< MU EDCA Parameter Set @@ -974,11 +974,11 @@ public: */ const std::optional& GetErpInformation (void) const; /** - * Return the EDCA Parameter Set. + * Return the EDCA Parameter Set, if present. * - * \return the EDCA Parameter Set + * \return the EDCA Parameter Set, if present */ - const EdcaParameterSet& GetEdcaParameterSet (void) const; + const std::optional& GetEdcaParameterSet (void) const; /** * Return the MU EDCA Parameter Set. * @@ -1203,7 +1203,7 @@ private: std::optional m_heCapability; //!< HE capabilities std::optional m_heOperation; //!< HE operation std::optional m_erpInformation; //!< ERP information - EdcaParameterSet m_edcaParameterSet; //!< EDCA Parameter Set + std::optional m_edcaParameterSet; //!< EDCA Parameter Set MuEdcaParameterSet m_muEdcaParameterSet; //!< MU EDCA Parameter Set std::optional m_ehtCapability; //!< EHT capabilities Ptr m_reducedNeighborReport; //!< Reduced Neighbor Report information diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index 98e51bc6c..df8829be7 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -1099,15 +1099,15 @@ StaWifiMac::UpdateApInfo (const MgtFrameType& frame, const Mac48Address& apAddr, if (!GetQosSupported ()) return; /* QoS station */ bool qosSupported = false; - const EdcaParameterSet& edcaParameters = frame.GetEdcaParameterSet (); - if (edcaParameters.IsQosSupported ()) + const auto& edcaParameters = frame.GetEdcaParameterSet (); + if (edcaParameters.has_value ()) { qosSupported = true; //The value of the TXOP Limit field is specified as an unsigned integer, with the least significant octet transmitted first, in units of 32 μs. - SetEdcaParameters (AC_BE, edcaParameters.GetBeCWmin (), edcaParameters.GetBeCWmax (), edcaParameters.GetBeAifsn (), 32 * MicroSeconds (edcaParameters.GetBeTxopLimit ())); - SetEdcaParameters (AC_BK, edcaParameters.GetBkCWmin (), edcaParameters.GetBkCWmax (), edcaParameters.GetBkAifsn (), 32 * MicroSeconds (edcaParameters.GetBkTxopLimit ())); - SetEdcaParameters (AC_VI, edcaParameters.GetViCWmin (), edcaParameters.GetViCWmax (), edcaParameters.GetViAifsn (), 32 * MicroSeconds (edcaParameters.GetViTxopLimit ())); - SetEdcaParameters (AC_VO, edcaParameters.GetVoCWmin (), edcaParameters.GetVoCWmax (), edcaParameters.GetVoAifsn (), 32 * MicroSeconds (edcaParameters.GetVoTxopLimit ())); + SetEdcaParameters (AC_BE, edcaParameters->GetBeCWmin (), edcaParameters->GetBeCWmax (), edcaParameters->GetBeAifsn (), 32 * MicroSeconds (edcaParameters->GetBeTxopLimit ())); + SetEdcaParameters (AC_BK, edcaParameters->GetBkCWmin (), edcaParameters->GetBkCWmax (), edcaParameters->GetBkAifsn (), 32 * MicroSeconds (edcaParameters->GetBkTxopLimit ())); + SetEdcaParameters (AC_VI, edcaParameters->GetViCWmin (), edcaParameters->GetViCWmax (), edcaParameters->GetViAifsn (), 32 * MicroSeconds (edcaParameters->GetViTxopLimit ())); + SetEdcaParameters (AC_VO, edcaParameters->GetVoCWmin (), edcaParameters->GetVoCWmax (), edcaParameters->GetVoAifsn (), 32 * MicroSeconds (edcaParameters->GetVoTxopLimit ())); } GetWifiRemoteStationManager (linkId)->SetQosSupport (apAddr, qosSupported);