Skip to content

Commit

Permalink
wifi: Fix static member accessed through instance warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano Avallone committed Oct 13, 2024
1 parent 3f137a3 commit c1b8cee
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 64 deletions.
87 changes: 44 additions & 43 deletions src/wifi/model/he/he-frame-exchange-manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ HeFrameExchangeManager::GetMuRtsDurationId(uint32_t muRtsSize,
// The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8
// of 802.11-2016)
return std::max(m_edca->GetRemainingTxop(m_linkId) -
m_phy->CalculateTxDuration(muRtsSize, muRtsTxVector, m_phy->GetPhyBand()),
WifiPhy::CalculateTxDuration(muRtsSize, muRtsTxVector, m_phy->GetPhyBand()),
Seconds(0));
}

Expand Down Expand Up @@ -365,9 +365,9 @@ HeFrameExchangeManager::SendMuRts(const WifiTxParameters& txParams)
// After transmitting an MU-RTS frame, the STA shall wait for a CTSTimeout interval of
// aSIFSTime + aSlotTime + aRxPHYStartDelay (Sec. 27.2.5.2 of 802.11ax D3.0).
// aRxPHYStartDelay equals the time to transmit the PHY header.
Time timeout = m_phy->CalculateTxDuration(mpdu->GetSize(),
protection->muRtsTxVector,
m_phy->GetPhyBand()) +
Time timeout = WifiPhy::CalculateTxDuration(mpdu->GetSize(),
protection->muRtsTxVector,
m_phy->GetPhyBand()) +
m_phy->GetSifs() + m_phy->GetSlot() +
m_phy->CalculatePhyPreambleAndHeaderDuration(ctsTxVector);

Expand Down Expand Up @@ -622,9 +622,9 @@ HeFrameExchangeManager::SendPsduMap()
}

Ptr<WifiPsdu> triggerPsdu = GetWifiPsdu(m_triggerFrame, acknowledgment->muBarTxVector);
Time txDuration = m_phy->CalculateTxDuration(triggerPsdu->GetSize(),
acknowledgment->muBarTxVector,
m_phy->GetPhyBand());
Time txDuration = WifiPhy::CalculateTxDuration(triggerPsdu->GetSize(),
acknowledgment->muBarTxVector,
m_phy->GetPhyBand());
// update acknowledgmentTime to correctly set the Duration/ID
*acknowledgment->acknowledgmentTime -= (m_phy->GetSifs() + txDuration);
m_triggerFrame->GetHeader().SetDuration(GetPsduDurationId(txDuration, m_txParams));
Expand Down Expand Up @@ -790,7 +790,7 @@ HeFrameExchangeManager::SendPsduMap()
else
{
txDuration =
m_phy->CalculateTxDuration(psduMap, m_txParams.m_txVector, m_phy->GetPhyBand());
WifiPhy::CalculateTxDuration(psduMap, m_txParams.m_txVector, m_phy->GetPhyBand());

// Set Duration/ID
Time durationId = GetPsduDurationId(txDuration, m_txParams);
Expand Down Expand Up @@ -1000,10 +1000,10 @@ HeFrameExchangeManager::CalculateProtectionTime(WifiProtection* protection) cons
uint32_t muRtsSize = WifiMacHeader(WIFI_MAC_CTL_TRIGGER).GetSize() +
muRtsCtsProtection->muRts.GetSerializedSize() + WIFI_MAC_FCS_LENGTH;
muRtsCtsProtection->protectionTime =
m_phy->CalculateTxDuration(muRtsSize,
muRtsCtsProtection->muRtsTxVector,
m_phy->GetPhyBand()) +
m_phy->CalculateTxDuration(GetCtsSize(), ctsTxVector, m_phy->GetPhyBand()) +
WifiPhy::CalculateTxDuration(muRtsSize,
muRtsCtsProtection->muRtsTxVector,
m_phy->GetPhyBand()) +
WifiPhy::CalculateTxDuration(GetCtsSize(), ctsTxVector, m_phy->GetPhyBand()) +
2 * m_phy->GetSifs();
}
else
Expand Down Expand Up @@ -1038,29 +1038,30 @@ HeFrameExchangeManager::CalculateAcknowledgmentTime(WifiAcknowledgment* acknowle
dlMuBarBaAcknowledgment->stationsReplyingWithNormalAck.begin()->second;
duration +=
m_phy->GetSifs() +
m_phy->CalculateTxDuration(GetAckSize(), info.ackTxVector, m_phy->GetPhyBand());
WifiPhy::CalculateTxDuration(GetAckSize(), info.ackTxVector, m_phy->GetPhyBand());
}

if (!dlMuBarBaAcknowledgment->stationsReplyingWithBlockAck.empty())
{
const auto& info =
dlMuBarBaAcknowledgment->stationsReplyingWithBlockAck.begin()->second;
duration += m_phy->GetSifs() + m_phy->CalculateTxDuration(GetBlockAckSize(info.baType),
info.blockAckTxVector,
m_phy->GetPhyBand());
duration +=
m_phy->GetSifs() + WifiPhy::CalculateTxDuration(GetBlockAckSize(info.baType),
info.blockAckTxVector,
m_phy->GetPhyBand());
}

for (const auto& stations : dlMuBarBaAcknowledgment->stationsSendBlockAckReqTo)
{
const auto& info = stations.second;
duration += m_phy->GetSifs() +
m_phy->CalculateTxDuration(GetBlockAckRequestSize(info.barType),
info.blockAckReqTxVector,
m_phy->GetPhyBand()) +
WifiPhy::CalculateTxDuration(GetBlockAckRequestSize(info.barType),
info.blockAckReqTxVector,
m_phy->GetPhyBand()) +
m_phy->GetSifs() +
m_phy->CalculateTxDuration(GetBlockAckSize(info.baType),
info.blockAckTxVector,
m_phy->GetPhyBand());
WifiPhy::CalculateTxDuration(GetBlockAckSize(info.baType),
info.blockAckTxVector,
m_phy->GetPhyBand());
}

dlMuBarBaAcknowledgment->acknowledgmentTime = duration;
Expand All @@ -1080,10 +1081,10 @@ HeFrameExchangeManager::CalculateAcknowledgmentTime(WifiAcknowledgment* acknowle
const auto& info = stations.second;
NS_ASSERT(info.blockAckTxVector.GetHeMuUserInfoMap().size() == 1);
uint16_t staId = info.blockAckTxVector.GetHeMuUserInfoMap().begin()->first;
Time currBlockAckDuration = m_phy->CalculateTxDuration(GetBlockAckSize(info.baType),
info.blockAckTxVector,
m_phy->GetPhyBand(),
staId);
Time currBlockAckDuration = WifiPhy::CalculateTxDuration(GetBlockAckSize(info.baType),
info.blockAckTxVector,
m_phy->GetPhyBand(),
staId);
// update the max duration among all the Block Ack responses
if (currBlockAckDuration > duration)
{
Expand All @@ -1106,9 +1107,9 @@ HeFrameExchangeManager::CalculateAcknowledgmentTime(WifiAcknowledgment* acknowle
}
dlMuTfMuBarAcknowledgment->acknowledgmentTime =
m_phy->GetSifs() +
m_phy->CalculateTxDuration(muBarSize,
dlMuTfMuBarAcknowledgment->muBarTxVector,
m_phy->GetPhyBand()) +
WifiPhy::CalculateTxDuration(muBarSize,
dlMuTfMuBarAcknowledgment->muBarTxVector,
m_phy->GetPhyBand()) +
m_phy->GetSifs() + duration;
}
/*
Expand All @@ -1126,10 +1127,10 @@ HeFrameExchangeManager::CalculateAcknowledgmentTime(WifiAcknowledgment* acknowle
const auto& info = stations.second;
NS_ASSERT(info.blockAckTxVector.GetHeMuUserInfoMap().size() == 1);
uint16_t staId = info.blockAckTxVector.GetHeMuUserInfoMap().begin()->first;
Time currBlockAckDuration = m_phy->CalculateTxDuration(GetBlockAckSize(info.baType),
info.blockAckTxVector,
m_phy->GetPhyBand(),
staId);
Time currBlockAckDuration = WifiPhy::CalculateTxDuration(GetBlockAckSize(info.baType),
info.blockAckTxVector,
m_phy->GetPhyBand(),
staId);
// update the max duration among all the Block Ack responses
if (currBlockAckDuration > duration)
{
Expand All @@ -1152,9 +1153,9 @@ HeFrameExchangeManager::CalculateAcknowledgmentTime(WifiAcknowledgment* acknowle
{
auto ulMuMultiStaBa = static_cast<WifiUlMuMultiStaBa*>(acknowledgment);

Time duration = m_phy->CalculateTxDuration(GetBlockAckSize(ulMuMultiStaBa->baType),
ulMuMultiStaBa->multiStaBaTxVector,
m_phy->GetPhyBand());
Time duration = WifiPhy::CalculateTxDuration(GetBlockAckSize(ulMuMultiStaBa->baType),
ulMuMultiStaBa->multiStaBaTxVector,
m_phy->GetPhyBand());
ulMuMultiStaBa->acknowledgmentTime = m_phy->GetSifs() + duration;
}
/*
Expand Down Expand Up @@ -1246,10 +1247,10 @@ HeFrameExchangeManager::GetTxDuration(uint32_t ppduPayloadSize,

uint16_t staId = (txParams.m_txVector.IsDlMu() ? m_apMac->GetAssociationId(receiver, m_linkId)
: m_staMac->GetAssociationId());
Time psduDuration = m_phy->CalculateTxDuration(ppduPayloadSize,
txParams.m_txVector,
m_phy->GetPhyBand(),
staId);
Time psduDuration = WifiPhy::CalculateTxDuration(ppduPayloadSize,
txParams.m_txVector,
m_phy->GetPhyBand(),
staId);

return txParams.m_txDuration ? std::max(psduDuration, *txParams.m_txDuration) : psduDuration;
}
Expand Down Expand Up @@ -1682,9 +1683,9 @@ HeFrameExchangeManager::SendMultiStaBlockAck(const WifiTxParameters& txParams, T
Ptr<WifiPsdu> psdu =
GetWifiPsdu(Create<WifiMpdu>(packet, hdr), acknowledgment->multiStaBaTxVector);
Time txDuration = m_phy->CalculateTxDuration(GetBlockAckSize(acknowledgment->baType),
acknowledgment->multiStaBaTxVector,
m_phy->GetPhyBand());
Time txDuration = WifiPhy::CalculateTxDuration(GetBlockAckSize(acknowledgment->baType),
acknowledgment->multiStaBaTxVector,
m_phy->GetPhyBand());
/**
* In a BlockAck frame transmitted in response to a frame carried in HE TB PPDU under
* single protection settings, the Duration/ID field is set to the value obtained from
Expand Down
23 changes: 12 additions & 11 deletions src/wifi/model/ht/ht-frame-exchange-manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -634,22 +634,23 @@ HtFrameExchangeManager::CalculateAcknowledgmentTime(WifiAcknowledgment* acknowle
if (acknowledgment->method == WifiAcknowledgment::BLOCK_ACK)
{
auto blockAcknowledgment = static_cast<WifiBlockAck*>(acknowledgment);
Time baTxDuration = m_phy->CalculateTxDuration(GetBlockAckSize(blockAcknowledgment->baType),
blockAcknowledgment->blockAckTxVector,
m_phy->GetPhyBand());
Time baTxDuration =
WifiPhy::CalculateTxDuration(GetBlockAckSize(blockAcknowledgment->baType),
blockAcknowledgment->blockAckTxVector,
m_phy->GetPhyBand());
blockAcknowledgment->acknowledgmentTime = m_phy->GetSifs() + baTxDuration;
}
else if (acknowledgment->method == WifiAcknowledgment::BAR_BLOCK_ACK)
{
auto barBlockAcknowledgment = static_cast<WifiBarBlockAck*>(acknowledgment);
Time barTxDuration =
m_phy->CalculateTxDuration(GetBlockAckRequestSize(barBlockAcknowledgment->barType),
barBlockAcknowledgment->blockAckReqTxVector,
m_phy->GetPhyBand());
WifiPhy::CalculateTxDuration(GetBlockAckRequestSize(barBlockAcknowledgment->barType),
barBlockAcknowledgment->blockAckReqTxVector,
m_phy->GetPhyBand());
Time baTxDuration =
m_phy->CalculateTxDuration(GetBlockAckSize(barBlockAcknowledgment->baType),
barBlockAcknowledgment->blockAckTxVector,
m_phy->GetPhyBand());
WifiPhy::CalculateTxDuration(GetBlockAckSize(barBlockAcknowledgment->baType),
barBlockAcknowledgment->blockAckTxVector,
m_phy->GetPhyBand());
barBlockAcknowledgment->acknowledgmentTime =
2 * m_phy->GetSifs() + barTxDuration + baTxDuration;
}
Expand Down Expand Up @@ -979,7 +980,7 @@ HtFrameExchangeManager::SendPsdu()
NS_LOG_FUNCTION(this);
Time txDuration =
m_phy->CalculateTxDuration(m_psdu->GetSize(), m_txParams.m_txVector, m_phy->GetPhyBand());
WifiPhy::CalculateTxDuration(m_psdu->GetSize(), m_txParams.m_txVector, m_phy->GetPhyBand());
NS_ASSERT(m_txParams.m_acknowledgment);
Expand Down Expand Up @@ -1495,7 +1496,7 @@ HtFrameExchangeManager::SendBlockAck(const RecipientBlockAckAgreement& agreement
// time, in microseconds between the end of the PPDU carrying the frame that
// elicited the response and the end of the PPDU carrying the BlockAck frame.
Time baDurationId = durationId - m_phy->GetSifs() -
m_phy->CalculateTxDuration(psdu, blockAckTxVector, m_phy->GetPhyBand());
WifiPhy::CalculateTxDuration(psdu, blockAckTxVector, m_phy->GetPhyBand());
// The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8 of 802.11-2016)
if (baDurationId.IsStrictlyNegative())
{
Expand Down
23 changes: 13 additions & 10 deletions src/wifi/model/qos-frame-exchange-manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ QosFrameExchangeManager::SendCfEndIfNeeded()

auto mpdu = Create<WifiMpdu>(Create<Packet>(), cfEnd);
auto txDuration =
m_phy->CalculateTxDuration(mpdu->GetSize(), cfEndTxVector, m_phy->GetPhyBand());
WifiPhy::CalculateTxDuration(mpdu->GetSize(), cfEndTxVector, m_phy->GetPhyBand());

// Send the CF-End frame if the remaining duration is long enough to transmit this frame
if (m_edca->GetRemainingTxop(m_linkId) > txDuration)
Expand Down Expand Up @@ -484,9 +484,10 @@ QosFrameExchangeManager::GetFrameDurationId(const WifiMacHeader& header,
// is set to cover the remaining TXOP time (Sec. 9.2.5.2 of 802.11-2016).
// The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8
// of 802.11-2016)
return std::max(m_edca->GetRemainingTxop(m_linkId) -
m_phy->CalculateTxDuration(size, txParams.m_txVector, m_phy->GetPhyBand()),
*txParams.m_acknowledgment->acknowledgmentTime);
return std::max(
m_edca->GetRemainingTxop(m_linkId) -
WifiPhy::CalculateTxDuration(size, txParams.m_txVector, m_phy->GetPhyBand()),
*txParams.m_acknowledgment->acknowledgmentTime);
}

Time
Expand All @@ -511,9 +512,10 @@ QosFrameExchangeManager::GetRtsDurationId(const WifiTxVector& rtsTxVector,
// is set to cover the remaining TXOP time (Sec. 9.2.5.2 of 802.11-2016).
// The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8
// of 802.11-2016)
return std::max(m_edca->GetRemainingTxop(m_linkId) -
m_phy->CalculateTxDuration(GetRtsSize(), rtsTxVector, m_phy->GetPhyBand()),
Seconds(0));
return std::max(
m_edca->GetRemainingTxop(m_linkId) -
WifiPhy::CalculateTxDuration(GetRtsSize(), rtsTxVector, m_phy->GetPhyBand()),
Seconds(0));
}

Time
Expand All @@ -538,9 +540,10 @@ QosFrameExchangeManager::GetCtsToSelfDurationId(const WifiTxVector& ctsTxVector,
// is set to cover the remaining TXOP time (Sec. 9.2.5.2 of 802.11-2016).
// The TXOP holder may exceed the TXOP limit in some situations (Sec. 10.22.2.8
// of 802.11-2016)
return std::max(m_edca->GetRemainingTxop(m_linkId) -
m_phy->CalculateTxDuration(GetCtsSize(), ctsTxVector, m_phy->GetPhyBand()),
Seconds(0));
return std::max(
m_edca->GetRemainingTxop(m_linkId) -
WifiPhy::CalculateTxDuration(GetCtsSize(), ctsTxVector, m_phy->GetPhyBand()),
Seconds(0));
}

void
Expand Down

0 comments on commit c1b8cee

Please sign in to comment.