wifi: Remove GetAckTxTime() and GetBlockAckTxTime() functions

This commit is contained in:
Stefano Avallone
2025-03-05 14:11:17 +01:00
parent 2a90d4dddc
commit 9c53352039
7 changed files with 27 additions and 62 deletions

View File

@@ -92,7 +92,7 @@ AirtimeLinkMetricCalculator::CalculateMetric(Mac48Address peerAddress,
(uint32_t)((double)(/*Overhead + payload*/
// DIFS + SIFS + AckTxTime = 2 * SIFS + 2 * SLOT + AckTxTime
2 * mac->GetWifiPhy()->GetSifs() + 2 * mac->GetWifiPhy()->GetSlot() +
mac->GetWifiPhy()->GetAckTxTime() +
GetEstimatedAckTxTime(txVector) +
WifiPhy::CalculateTxDuration(m_testFrame->GetSize(),
txVector,
mac->GetWifiPhy()->GetPhyBand()))

View File

@@ -1811,9 +1811,7 @@ MinstrelHtWifiManager::CalculateRetransmits(MinstrelHtWifiRemoteStation* station
uint32_t cwMax = 1023;
Time cwTime;
Time txTime;
Time dataTxTime;
const auto slotTime = GetPhy()->GetSlot();
const auto ackTime = GetPhy()->GetSifs() + GetPhy()->GetBlockAckTxTime();
if (station->m_groupsTable[groupId].m_ratesTable[rateId].ewmaProb < 1)
{
@@ -1824,16 +1822,15 @@ MinstrelHtWifiManager::CalculateRetransmits(MinstrelHtWifiRemoteStation* station
station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 2;
station->m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated = true;
dataTxTime =
GetFirstMpduTxTime(
groupId,
GetMcsSupported(station,
station->m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex)) +
GetMpduTxTime(
groupId,
GetMcsSupported(station,
station->m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex)) *
(station->m_avgAmpduLen - 1);
auto mode =
GetMcsSupported(station, station->m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex);
WifiTxVector txVector;
txVector.SetMode(mode);
txVector.SetPreambleType(GetPreambleForTransmission(mode.GetModulationClass()));
const auto dataTxTime = GetFirstMpduTxTime(groupId, mode) +
GetMpduTxTime(groupId, mode) * (station->m_avgAmpduLen - 1);
const auto ackTime = GetPhy()->GetSifs() + GetEstimatedAckTxTime(txVector);
/* Contention time for first 2 tries */
cwTime = (cw / 2) * slotTime;

View File

@@ -1038,7 +1038,7 @@ MinstrelWifiManager::RateInit(MinstrelWifiRemoteStation* station)
{
NS_LOG_DEBUG(" Checking " << retries << " retries");
totalTxTimeWithGivenRetries =
CalculateTimeUnicastPacket(station->m_minstrelTable[i].perfectTxTime, 0, retries);
CalculateTimeUnicastPacket(GetSupported(station, i), 0, retries);
NS_LOG_DEBUG(" totalTxTimeWithGivenRetries = " << totalTxTimeWithGivenRetries);
if (totalTxTimeWithGivenRetries > MilliSeconds(6))
{
@@ -1053,22 +1053,28 @@ MinstrelWifiManager::RateInit(MinstrelWifiRemoteStation* station)
}
Time
MinstrelWifiManager::CalculateTimeUnicastPacket(Time dataTransmissionTime,
MinstrelWifiManager::CalculateTimeUnicastPacket(WifiMode mode,
uint32_t shortRetries,
uint32_t longRetries)
{
NS_LOG_FUNCTION(this << dataTransmissionTime << shortRetries << longRetries);
NS_LOG_FUNCTION(this << mode << shortRetries << longRetries);
// See rc80211_minstrel.c
// First transmission (Data + Ack timeout)
Time tt = dataTransmissionTime + GetPhy()->GetSifs() + GetPhy()->GetAckTxTime();
WifiTxVector txVector;
txVector.SetMode(mode);
txVector.SetPreambleType(
GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()));
const auto oneTxTime =
GetCalcTxTime(mode) + GetPhy()->GetSifs() + GetEstimatedAckTxTime(txVector);
auto tt = oneTxTime;
uint32_t cwMax = 1023;
uint32_t cw = 31;
for (uint32_t retry = 0; retry < longRetries; retry++)
{
// Add one re-transmission (Data + Ack timeout)
tt += dataTransmissionTime + GetPhy()->GetSifs() + GetPhy()->GetAckTxTime();
tt += oneTxTime;
// Add average back off (half the current contention window)
tt += (cw / 2.0) * GetPhy()->GetSlot();

View File

@@ -314,14 +314,12 @@ class MinstrelWifiManager : public WifiRemoteStationManager
* - Data transmission
* - backoffs according to CW
*
* @param dataTransmissionTime the data transmission time
* @param mode the WiFi mode used to transmit the data frame
* @param shortRetries short retries
* @param longRetries long retries
* @returns the unicast packet time
*/
Time CalculateTimeUnicastPacket(Time dataTransmissionTime,
uint32_t shortRetries,
uint32_t longRetries);
Time CalculateTimeUnicastPacket(WifiMode mode, uint32_t shortRetries, uint32_t longRetries);
/**
* Print Sample Table.

View File

@@ -389,8 +389,6 @@ WifiPhy::WifiPhy()
m_sifs(),
m_slot(),
m_pifs(),
m_ackTxTime(),
m_blockAckTxTime(),
m_powerRestricted(false),
m_channelAccessRequested(false),
m_txSpatialStreams(1),
@@ -856,18 +854,6 @@ WifiPhy::GetPifs() const
return m_pifs;
}
Time
WifiPhy::GetAckTxTime() const
{
return m_ackTxTime;
}
Time
WifiPhy::GetBlockAckTxTime() const
{
return m_blockAckTxTime;
}
void
WifiPhy::Configure80211a()
{
@@ -880,7 +866,6 @@ WifiPhy::Configure80211a()
SetPifs(GetSifs() + GetSlot());
// See Table 10-5 "Determination of the EstimatedAckTxTime based on properties
// of the PPDU causing the EIFS" of 802.11-2016
m_ackTxTime = MicroSeconds(44);
}
void
@@ -897,7 +882,6 @@ WifiPhy::Configure80211b()
SetPifs(GetSifs() + GetSlot());
// See Table 10-5 "Determination of the EstimatedAckTxTime based on properties
// of the PPDU causing the EIFS" of 802.11-2016
m_ackTxTime = MicroSeconds(304);
}
void
@@ -925,7 +909,6 @@ WifiPhy::Configure80211p()
SetSifs(MicroSeconds(32));
SetSlot(MicroSeconds(13));
SetPifs(GetSifs() + GetSlot());
m_ackTxTime = MicroSeconds(88);
}
else if (GetChannelWidth() == MHz_u{5})
{
@@ -935,7 +918,6 @@ WifiPhy::Configure80211p()
SetSifs(MicroSeconds(64));
SetSlot(MicroSeconds(21));
SetPifs(GetSifs() + GetSlot());
m_ackTxTime = MicroSeconds(176);
}
else
{
@@ -956,10 +938,6 @@ WifiPhy::Configure80211n()
Configure80211a();
}
AddPhyEntity(WIFI_MOD_CLASS_HT, Create<HtPhy>(m_txSpatialStreams));
// See Table 10-5 "Determination of the EstimatedAckTxTime based on properties
// of the PPDU causing the EIFS" of 802.11-2016
m_blockAckTxTime = MicroSeconds(68);
}
void

View File

@@ -429,18 +429,6 @@ class WifiPhy : public Object
* @return the PIFS duration
*/
Time GetPifs() const;
/**
* Return the estimated Ack TX time for this PHY.
*
* @return the estimated Ack TX time
*/
Time GetAckTxTime() const;
/**
* Return the estimated BlockAck TX time for this PHY.
*
* @return the estimated BlockAck TX time
*/
Time GetBlockAckTxTime() const;
/**
* Get the maximum PSDU size in bytes for the given modulation class.
@@ -1611,11 +1599,9 @@ class WifiPhy : public Object
WifiPhyOperatingChannel m_operatingChannel; //!< Operating channel
bool m_fixedPhyBand; //!< True to prohibit changing PHY band after initialization
Time m_sifs; //!< Short Interframe Space (SIFS) duration
Time m_slot; //!< Slot duration
Time m_pifs; //!< PCF Interframe Space (PIFS) duration
Time m_ackTxTime; //!< estimated Ack TX time
Time m_blockAckTxTime; //!< estimated BlockAck TX time
Time m_sifs; //!< Short Interframe Space (SIFS) duration
Time m_slot; //!< Slot duration
Time m_pifs; //!< PCF Interframe Space (PIFS) duration
dBm_u m_rxSensitivity; //!< Receive sensitivity threshold
dBm_u m_ccaEdThreshold; //!< Clear channel assessment (CCA) energy detection (ED) threshold

View File

@@ -628,7 +628,7 @@ WifiTxopTest::CheckResults()
tStart = m_txPsdus[2].txStart;
auto apPhy = apDev->GetPhy(SINGLE_LINK_OP_ID);
auto eifsNoDifs = apPhy->GetSifs() + apPhy->GetAckTxTime();
auto eifsNoDifs = apPhy->GetSifs() + GetEstimatedAckTxTime(m_txPsdus[1].txVector);
NS_TEST_EXPECT_MSG_GT_OR_EQ(
tStart - tEnd,