wifi: Pass link ID to MSDU/MPDU aggregator

This commit is contained in:
Stefano Avallone
2022-09-28 10:37:06 +02:00
committed by Stefano Avallone
parent 86d4562a11
commit 3c9e2fdf27
7 changed files with 55 additions and 31 deletions

View File

@@ -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<WifiMpdu>
EhtFrameExchangeManager::CreateAlias(Ptr<WifiMpdu> mpdu) const
{

View File

@@ -42,6 +42,7 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager
EhtFrameExchangeManager();
~EhtFrameExchangeManager() override;
void SetLinkId(uint8_t linkId) override;
Ptr<WifiMpdu> CreateAlias(Ptr<WifiMpdu> mpdu) const override;
};

View File

@@ -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.
*

View File

@@ -56,14 +56,6 @@ MpduAggregator::GetTypeId()
return tid;
}
MpduAggregator::MpduAggregator()
{
}
MpduAggregator::~MpduAggregator()
{
}
void
MpduAggregator::DoDispose()
{
@@ -78,6 +70,13 @@ MpduAggregator::SetWifiMac(const Ptr<WifiMac> mac)
m_mac = mac;
}
void
MpduAggregator::SetLinkId(uint8_t linkId)
{
NS_LOG_FUNCTION(this << +linkId);
m_linkId = linkId;
}
void
MpduAggregator::Aggregate(Ptr<const WifiMpdu> mpdu, Ptr<Packet> ampdu, bool isSingle)
{
@@ -137,7 +136,7 @@ MpduAggregator::GetMaxAmpduSize(Mac48Address recipient,
return 0;
}
Ptr<WifiRemoteStationManager> stationManager = m_mac->GetWifiRemoteStationManager();
Ptr<WifiRemoteStationManager> stationManager = m_mac->GetWifiRemoteStationManager(m_linkId);
NS_ASSERT(stationManager);
// Retrieve the Capabilities elements advertised by the recipient
@@ -228,7 +227,7 @@ MpduAggregator::GetNextAmpdu(Ptr<WifiMpdu> 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<WifiMpdu> 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);
}
}

View File

@@ -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<const WifiMpdu> mpdu, Ptr<Packet> 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 <i>mpduSize</i> and an A-MPDU of size <i>ampduSize</i>.
@@ -158,7 +165,8 @@ class MpduAggregator : public Object
void DoDispose() override;
private:
Ptr<WifiMac> m_mac; //!< the MAC of this station
Ptr<WifiMac> m_mac; //!< the MAC of this station
uint8_t m_linkId{0}; //!< ID of the link this object is connected to
};
} // namespace ns3

View File

@@ -51,14 +51,6 @@ MsduAggregator::GetTypeId()
return tid;
}
MsduAggregator::MsduAggregator()
{
}
MsduAggregator::~MsduAggregator()
{
}
void
MsduAggregator::DoDispose()
{
@@ -72,7 +64,18 @@ MsduAggregator::SetWifiMac(const Ptr<WifiMac> mac)
{
NS_LOG_FUNCTION(this << mac);
m_mac = mac;
m_htFem = DynamicCast<HtFrameExchangeManager>(m_mac->GetFrameExchangeManager());
m_htFem = DynamicCast<HtFrameExchangeManager>(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<HtFrameExchangeManager>(m_mac->GetFrameExchangeManager(m_linkId));
}
}
uint16_t
@@ -171,7 +174,7 @@ MsduAggregator::GetMaxAmsduSize(Mac48Address recipient,
return 0;
}
Ptr<WifiRemoteStationManager> stationManager = m_mac->GetWifiRemoteStationManager();
Ptr<WifiRemoteStationManager> stationManager = m_mac->GetWifiRemoteStationManager(m_linkId);
NS_ASSERT(stationManager);
// Retrieve the Capabilities elements advertised by the recipient

View File

@@ -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<WifiMac> m_mac; //!< the MAC of this station
Ptr<HtFrameExchangeManager> 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