diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.cc b/src/wifi/model/eht/eht-frame-exchange-manager.cc index 2ed697d3b..4a5563bad 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.cc +++ b/src/wifi/model/eht/eht-frame-exchange-manager.cc @@ -52,6 +52,14 @@ EhtFrameExchangeManager::~EhtFrameExchangeManager() NS_LOG_FUNCTION_NOARGS(); } +void +EhtFrameExchangeManager::SetLinkId(uint8_t linkId) +{ + m_msduAggregator->SetLinkId(linkId); + m_mpduAggregator->SetLinkId(linkId); + HeFrameExchangeManager::SetLinkId(linkId); +} + Ptr EhtFrameExchangeManager::CreateAlias(Ptr mpdu) const { diff --git a/src/wifi/model/eht/eht-frame-exchange-manager.h b/src/wifi/model/eht/eht-frame-exchange-manager.h index c824ac48c..1cc429531 100644 --- a/src/wifi/model/eht/eht-frame-exchange-manager.h +++ b/src/wifi/model/eht/eht-frame-exchange-manager.h @@ -42,6 +42,7 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager EhtFrameExchangeManager(); ~EhtFrameExchangeManager() override; + void SetLinkId(uint8_t linkId) override; Ptr CreateAlias(Ptr mpdu) const override; }; diff --git a/src/wifi/model/frame-exchange-manager.h b/src/wifi/model/frame-exchange-manager.h index 36b48178e..2771e7185 100644 --- a/src/wifi/model/frame-exchange-manager.h +++ b/src/wifi/model/frame-exchange-manager.h @@ -101,7 +101,7 @@ class FrameExchangeManager : public Object * * \param linkId the ID of the link this Frame Exchange Manager is associated with */ - void SetLinkId(uint8_t linkId); + virtual void SetLinkId(uint8_t linkId); /** * Set the MAC layer to use. * diff --git a/src/wifi/model/mpdu-aggregator.cc b/src/wifi/model/mpdu-aggregator.cc index dfa0ef9ce..c9bbf6440 100644 --- a/src/wifi/model/mpdu-aggregator.cc +++ b/src/wifi/model/mpdu-aggregator.cc @@ -56,14 +56,6 @@ MpduAggregator::GetTypeId() return tid; } -MpduAggregator::MpduAggregator() -{ -} - -MpduAggregator::~MpduAggregator() -{ -} - void MpduAggregator::DoDispose() { @@ -78,6 +70,13 @@ MpduAggregator::SetWifiMac(const Ptr mac) m_mac = mac; } +void +MpduAggregator::SetLinkId(uint8_t linkId) +{ + NS_LOG_FUNCTION(this << +linkId); + m_linkId = linkId; +} + void MpduAggregator::Aggregate(Ptr mpdu, Ptr ampdu, bool isSingle) { @@ -137,7 +136,7 @@ MpduAggregator::GetMaxAmpduSize(Mac48Address recipient, return 0; } - Ptr stationManager = m_mac->GetWifiRemoteStationManager(); + Ptr stationManager = m_mac->GetWifiRemoteStationManager(m_linkId); NS_ASSERT(stationManager); // Retrieve the Capabilities elements advertised by the recipient @@ -228,7 +227,7 @@ MpduAggregator::GetNextAmpdu(Ptr mpdu, mpduList.push_back(nextMpdu); // If allowed by the BA agreement, get the next MPDU - auto peekedMpdu = qosTxop->PeekNextMpdu(SINGLE_LINK_OP_ID, tid, recipient, nextMpdu); + auto peekedMpdu = qosTxop->PeekNextMpdu(m_linkId, tid, recipient, nextMpdu); nextMpdu = nullptr; if (peekedMpdu) @@ -242,11 +241,8 @@ MpduAggregator::GetNextAmpdu(Ptr mpdu, // and duration limit are met. Note that the returned MPDU differs from // the peeked MPDU if A-MSDU aggregation is enabled. NS_LOG_DEBUG("Trying to aggregate another MPDU"); - nextMpdu = qosTxop->GetNextMpdu(SINGLE_LINK_OP_ID, - peekedMpdu, - txParams, - availableTime, - false); + nextMpdu = + qosTxop->GetNextMpdu(m_linkId, peekedMpdu, txParams, availableTime, false); } } diff --git a/src/wifi/model/mpdu-aggregator.h b/src/wifi/model/mpdu-aggregator.h index 3c1715931..038d78cb8 100644 --- a/src/wifi/model/mpdu-aggregator.h +++ b/src/wifi/model/mpdu-aggregator.h @@ -57,8 +57,8 @@ class MpduAggregator : public Object */ static TypeId GetTypeId(); - MpduAggregator(); - ~MpduAggregator() override; + MpduAggregator() = default; + ~MpduAggregator() override = default; /** * Aggregate an MPDU to an A-MPDU. @@ -69,6 +69,13 @@ class MpduAggregator : public Object */ static void Aggregate(Ptr mpdu, Ptr ampdu, bool isSingle); + /** + * Set the ID of the link this MPDU aggregator is associated with. + * + * \param linkId the ID of the link this MPDU aggregator is associated with + */ + void SetLinkId(uint8_t linkId); + /** * Compute the size of the A-MPDU resulting from the aggregation of an MPDU of * size mpduSize and an A-MPDU of size ampduSize. @@ -158,7 +165,8 @@ class MpduAggregator : public Object void DoDispose() override; private: - Ptr m_mac; //!< the MAC of this station + Ptr m_mac; //!< the MAC of this station + uint8_t m_linkId{0}; //!< ID of the link this object is connected to }; } // namespace ns3 diff --git a/src/wifi/model/msdu-aggregator.cc b/src/wifi/model/msdu-aggregator.cc index 0c140516d..3295fe71a 100644 --- a/src/wifi/model/msdu-aggregator.cc +++ b/src/wifi/model/msdu-aggregator.cc @@ -51,14 +51,6 @@ MsduAggregator::GetTypeId() return tid; } -MsduAggregator::MsduAggregator() -{ -} - -MsduAggregator::~MsduAggregator() -{ -} - void MsduAggregator::DoDispose() { @@ -72,7 +64,18 @@ MsduAggregator::SetWifiMac(const Ptr mac) { NS_LOG_FUNCTION(this << mac); m_mac = mac; - m_htFem = DynamicCast(m_mac->GetFrameExchangeManager()); + m_htFem = DynamicCast(m_mac->GetFrameExchangeManager(m_linkId)); +} + +void +MsduAggregator::SetLinkId(uint8_t linkId) +{ + NS_LOG_FUNCTION(this << +linkId); + m_linkId = linkId; + if (m_mac) + { + m_htFem = DynamicCast(m_mac->GetFrameExchangeManager(m_linkId)); + } } uint16_t @@ -171,7 +174,7 @@ MsduAggregator::GetMaxAmsduSize(Mac48Address recipient, return 0; } - Ptr stationManager = m_mac->GetWifiRemoteStationManager(); + Ptr stationManager = m_mac->GetWifiRemoteStationManager(m_linkId); NS_ASSERT(stationManager); // Retrieve the Capabilities elements advertised by the recipient diff --git a/src/wifi/model/msdu-aggregator.h b/src/wifi/model/msdu-aggregator.h index d002303b3..36aa921be 100644 --- a/src/wifi/model/msdu-aggregator.h +++ b/src/wifi/model/msdu-aggregator.h @@ -55,8 +55,15 @@ class MsduAggregator : public Object */ static TypeId GetTypeId(); - MsduAggregator(); - ~MsduAggregator() override; + MsduAggregator() = default; + ~MsduAggregator() override = default; + + /** + * Set the ID of the link this MSDU aggregator is associated with. + * + * \param linkId the ID of the link this MSDU aggregator is associated with + */ + void SetLinkId(uint8_t linkId); /** * Compute the size of the A-MSDU resulting from the aggregation of an MSDU of @@ -148,6 +155,7 @@ class MsduAggregator : public Object private: Ptr m_mac; //!< the MAC of this station Ptr m_htFem; //!< the HT Frame Exchange Manager of this station + uint8_t m_linkId{0}; //!< ID of the link this object is connected to }; } // namespace ns3