wifi: MAC retrieves time to end MAC RX event from PHY

This commit is contained in:
Stefano Avallone
2025-02-04 09:08:20 +01:00
parent 91fe6c0616
commit 4e76f3b7e6
4 changed files with 52 additions and 0 deletions

View File

@@ -844,6 +844,27 @@ PhyEntity::GetReceptionStatus(Ptr<WifiMpdu> mpdu,
}
}
std::optional<Time>
PhyEntity::GetTimeToMacHdrEnd(uint16_t staId) const
{
const auto it = m_endOfMacHdrEvents.find(staId);
if (it == m_endOfMacHdrEvents.cend())
{
return std::nullopt;
}
for (const auto& endOfMacHdrEvent : it->second)
{
if (endOfMacHdrEvent.IsPending())
{
return Simulator::GetDelayLeft(endOfMacHdrEvent);
}
}
return std::nullopt;
}
std::pair<MHz_u, WifiSpectrumBandInfo>
PhyEntity::GetChannelWidthAndBand(const WifiTxVector& txVector, uint16_t /* staId */) const
{

View File

@@ -409,6 +409,15 @@ class PhyEntity : public SimpleRefCount<PhyEntity>
*/
void CancelRunningEndPreambleDetectionEvents();
/**
* Get the remaining time to the end of the MAC header reception of the next MPDU being
* received from the given STA, if any.
*
* @param staId the STA-ID of the transmitter; equals SU_STA_ID for SU PPDUs
* @return the remaining time to the end of the MAC header reception of the next MPDU, if any
*/
virtual std::optional<Time> GetTimeToMacHdrEnd(uint16_t staId) const;
/**
* Return the STA ID that has been assigned to the station this PHY belongs to.
* This is typically called for MU PPDUs, in order to pick the correct PSDU.

View File

@@ -1797,6 +1797,19 @@ WifiPhy::NotifyMonitorSniffTx(Ptr<const WifiPsdu> psdu,
}
}
std::optional<Time>
WifiPhy::GetTimeToMacHdrEnd(uint16_t staId) const
{
for (auto& [modClass, phyEntity] : m_phyEntities)
{
if (auto remTime = phyEntity->GetTimeToMacHdrEnd(staId))
{
return remTime;
}
}
return std::nullopt;
}
WifiConstPsduMap
WifiPhy::GetWifiConstPsduMap(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector)
{

View File

@@ -894,6 +894,15 @@ class WifiPhy : public Object
*/
dB_u GetRxGain() const;
/**
* Get the remaining time to the end of the MAC header reception of the next MPDU being
* received from the given STA, if any.
*
* @param staId the STA-ID of the transmitter; equals SU_STA_ID for SU PPDUs
* @return the remaining time to the end of the MAC header reception of the next MPDU, if any
*/
std::optional<Time> GetTimeToMacHdrEnd(uint16_t staId) const;
/**
* Sets the device this PHY is associated with.
*