diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index 9ceea2b75..667b0c0ba 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -1435,29 +1435,29 @@ StaWifiMac::UpdateApInfo(const MgtFrameType& frame, 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_BE, + edcaParameters->GetBeCWmin(), + edcaParameters->GetBeCWmax(), + edcaParameters->GetBeAifsn(), + 32 * MicroSeconds(edcaParameters->GetBeTxopLimit())}, linkId); - SetEdcaParameters(AC_BK, - edcaParameters->GetBkCWmin(), - edcaParameters->GetBkCWmax(), - edcaParameters->GetBkAifsn(), - 32 * MicroSeconds(edcaParameters->GetBkTxopLimit()), + SetEdcaParameters({AC_BK, + edcaParameters->GetBkCWmin(), + edcaParameters->GetBkCWmax(), + edcaParameters->GetBkAifsn(), + 32 * MicroSeconds(edcaParameters->GetBkTxopLimit())}, linkId); - SetEdcaParameters(AC_VI, - edcaParameters->GetViCWmin(), - edcaParameters->GetViCWmax(), - edcaParameters->GetViAifsn(), - 32 * MicroSeconds(edcaParameters->GetViTxopLimit()), + SetEdcaParameters({AC_VI, + edcaParameters->GetViCWmin(), + edcaParameters->GetViCWmax(), + edcaParameters->GetViAifsn(), + 32 * MicroSeconds(edcaParameters->GetViTxopLimit())}, linkId); - SetEdcaParameters(AC_VO, - edcaParameters->GetVoCWmin(), - edcaParameters->GetVoCWmax(), - edcaParameters->GetVoAifsn(), - 32 * MicroSeconds(edcaParameters->GetVoTxopLimit()), + SetEdcaParameters({AC_VO, + edcaParameters->GetVoCWmin(), + edcaParameters->GetVoCWmax(), + edcaParameters->GetVoAifsn(), + 32 * MicroSeconds(edcaParameters->GetVoTxopLimit())}, linkId); } GetWifiRemoteStationManager(linkId)->SetQosSupport(apAddr, qosSupported); @@ -1533,29 +1533,29 @@ StaWifiMac::UpdateApInfo(const MgtFrameType& frame, const auto& muEdcaParameters = frame.template Get(); if (muEdcaParameters.has_value()) { - SetMuEdcaParameters(AC_BE, - muEdcaParameters->GetMuCwMin(AC_BE), - muEdcaParameters->GetMuCwMax(AC_BE), - muEdcaParameters->GetMuAifsn(AC_BE), - muEdcaParameters->GetMuEdcaTimer(AC_BE), + SetMuEdcaParameters({AC_BE, + muEdcaParameters->GetMuCwMin(AC_BE), + muEdcaParameters->GetMuCwMax(AC_BE), + muEdcaParameters->GetMuAifsn(AC_BE), + muEdcaParameters->GetMuEdcaTimer(AC_BE)}, linkId); - SetMuEdcaParameters(AC_BK, - muEdcaParameters->GetMuCwMin(AC_BK), - muEdcaParameters->GetMuCwMax(AC_BK), - muEdcaParameters->GetMuAifsn(AC_BK), - muEdcaParameters->GetMuEdcaTimer(AC_BK), + SetMuEdcaParameters({AC_BK, + muEdcaParameters->GetMuCwMin(AC_BK), + muEdcaParameters->GetMuCwMax(AC_BK), + muEdcaParameters->GetMuAifsn(AC_BK), + muEdcaParameters->GetMuEdcaTimer(AC_BK)}, linkId); - SetMuEdcaParameters(AC_VI, - muEdcaParameters->GetMuCwMin(AC_VI), - muEdcaParameters->GetMuCwMax(AC_VI), - muEdcaParameters->GetMuAifsn(AC_VI), - muEdcaParameters->GetMuEdcaTimer(AC_VI), + SetMuEdcaParameters({AC_VI, + muEdcaParameters->GetMuCwMin(AC_VI), + muEdcaParameters->GetMuCwMax(AC_VI), + muEdcaParameters->GetMuAifsn(AC_VI), + muEdcaParameters->GetMuEdcaTimer(AC_VI)}, linkId); - SetMuEdcaParameters(AC_VO, - muEdcaParameters->GetMuCwMin(AC_VO), - muEdcaParameters->GetMuCwMax(AC_VO), - muEdcaParameters->GetMuAifsn(AC_VO), - muEdcaParameters->GetMuEdcaTimer(AC_VO), + SetMuEdcaParameters({AC_VO, + muEdcaParameters->GetMuCwMin(AC_VO), + muEdcaParameters->GetMuCwMax(AC_VO), + muEdcaParameters->GetMuAifsn(AC_VO), + muEdcaParameters->GetMuEdcaTimer(AC_VO)}, linkId); } @@ -1722,33 +1722,23 @@ StaWifiMac::SetState(MacState value) } void -StaWifiMac::SetEdcaParameters(AcIndex ac, - uint32_t cwMin, - uint32_t cwMax, - uint8_t aifsn, - Time txopLimit, - uint8_t linkId) +StaWifiMac::SetEdcaParameters(const EdcaParams& params, uint8_t linkId) { - Ptr edca = GetQosTxop(ac); - edca->SetMinCw(cwMin, linkId); - edca->SetMaxCw(cwMax, linkId); - edca->SetAifsn(aifsn, linkId); - edca->SetTxopLimit(txopLimit, linkId); + Ptr edca = GetQosTxop(params.ac); + edca->SetMinCw(params.cwMin, linkId); + edca->SetMaxCw(params.cwMax, linkId); + edca->SetAifsn(params.aifsn, linkId); + edca->SetTxopLimit(params.txopLimit, linkId); } void -StaWifiMac::SetMuEdcaParameters(AcIndex ac, - uint16_t cwMin, - uint16_t cwMax, - uint8_t aifsn, - Time muEdcaTimer, - uint8_t linkId) +StaWifiMac::SetMuEdcaParameters(const MuEdcaParams& params, uint8_t linkId) { - Ptr edca = GetQosTxop(ac); - edca->SetMuCwMin(cwMin, linkId); - edca->SetMuCwMax(cwMax, linkId); - edca->SetMuAifsn(aifsn, linkId); - edca->SetMuEdcaTimer(muEdcaTimer, linkId); + Ptr edca = GetQosTxop(params.ac); + edca->SetMuCwMin(params.cwMin, linkId); + edca->SetMuCwMax(params.cwMax, linkId); + edca->SetMuAifsn(params.aifsn, linkId); + edca->SetMuEdcaTimer(params.muEdcaTimer, linkId); } void diff --git a/src/wifi/model/sta-wifi-mac.h b/src/wifi/model/sta-wifi-mac.h index 10fef4216..731e9a6e8 100644 --- a/src/wifi/model/sta-wifi-mac.h +++ b/src/wifi/model/sta-wifi-mac.h @@ -500,38 +500,47 @@ class StaWifiMac : public WifiMac * \param value the new state */ void SetState(MacState value); + + /** + * EDCA Parameters + */ + struct EdcaParams + { + AcIndex ac; //!< the access category + uint32_t cwMin; //!< the minimum contention window size + uint32_t cwMax; //!< the maximum contention window size + uint8_t aifsn; //!< the number of slots that make up an AIFS + Time txopLimit; //!< the TXOP limit + }; + /** * Set the EDCA parameters for the given link. * - * \param ac the access class - * \param cwMin the minimum contention window size - * \param cwMax the maximum contention window size - * \param aifsn the number of slots that make up an AIFS - * \param txopLimit the TXOP limit + * \param params the EDCA parameters * \param linkId the ID of the given link */ - void SetEdcaParameters(AcIndex ac, - uint32_t cwMin, - uint32_t cwMax, - uint8_t aifsn, - Time txopLimit, - uint8_t linkId); + void SetEdcaParameters(const EdcaParams& params, uint8_t linkId); + + /** + * MU EDCA Parameters + */ + struct MuEdcaParams + { + AcIndex ac; //!< the access category + uint32_t cwMin; //!< the minimum contention window size + uint32_t cwMax; //!< the maximum contention window size + uint8_t aifsn; //!< the number of slots that make up an AIFS + Time muEdcaTimer; //!< the MU EDCA timer + }; + /** * Set the MU EDCA parameters for the given link. * - * \param ac the Access Category - * \param cwMin the minimum contention window size - * \param cwMax the maximum contention window size - * \param aifsn the number of slots that make up an AIFS - * \param muEdcaTimer the MU EDCA timer + * \param params the MU EDCA parameters * \param linkId the ID of the given link */ - void SetMuEdcaParameters(AcIndex ac, - uint16_t cwMin, - uint16_t cwMax, - uint8_t aifsn, - Time muEdcaTimer, - uint8_t linkId); + void SetMuEdcaParameters(const MuEdcaParams& params, uint8_t linkId); + /** * Return the Capability information for the given link. *