wifi: Add PHY methods to ease the handling of UL frames
This commit is contained in:
committed by
Stefano Avallone
parent
a4976853d3
commit
f1fad1a6ba
@@ -1180,6 +1180,20 @@ HePhy::IsModeAllowed (uint16_t /* channelWidth */, uint8_t /* nss */)
|
||||
return true;
|
||||
}
|
||||
|
||||
WifiConstPsduMap
|
||||
HePhy::GetWifiConstPsduMap (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) const
|
||||
{
|
||||
uint16_t staId = SU_STA_ID;
|
||||
|
||||
if (txVector.IsUlMu ())
|
||||
{
|
||||
NS_ASSERT (txVector.GetHeMuUserInfoMap ().size () == 1);
|
||||
staId = txVector.GetHeMuUserInfoMap ().begin ()->first;
|
||||
}
|
||||
|
||||
return WifiConstPsduMap ({std::make_pair (staId, psdu)});
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HePhy::GetMaxPsduSize (void) const
|
||||
{
|
||||
|
||||
@@ -416,6 +416,8 @@ protected:
|
||||
*/
|
||||
virtual uint32_t GetMaxPsduSize (void) const override;
|
||||
|
||||
virtual WifiConstPsduMap GetWifiConstPsduMap (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) const override;
|
||||
|
||||
uint64_t m_previouslyTxPpduUid; //!< UID of the previously sent PPDU, used by AP to recognize response HE TB PPDUs
|
||||
uint64_t m_currentHeTbPpduUid; //!< UID of the HE TB PPDU being received
|
||||
|
||||
|
||||
@@ -193,6 +193,12 @@ PhyEntity::CalculatePhyPreambleAndHeaderDuration (const WifiTxVector& txVector)
|
||||
return duration;
|
||||
}
|
||||
|
||||
WifiConstPsduMap
|
||||
PhyEntity::GetWifiConstPsduMap (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) const
|
||||
{
|
||||
return WifiConstPsduMap ({std::make_pair (SU_STA_ID, psdu)});
|
||||
}
|
||||
|
||||
Ptr<const WifiPsdu>
|
||||
PhyEntity::GetAddressedPsduInPpdu (Ptr<const WifiPpdu> ppdu) const
|
||||
{
|
||||
|
||||
@@ -275,6 +275,17 @@ public:
|
||||
bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
|
||||
uint16_t staId) const = 0;
|
||||
|
||||
/**
|
||||
* Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
|
||||
* The STA-ID value is properly determined based on whether the given PSDU has
|
||||
* to be transmitted as a DL or UL frame.
|
||||
*
|
||||
* \param psdu the given PSDU
|
||||
* \param txVector the TXVECTOR to use to send the PSDU
|
||||
* \return a WifiConstPsduMap built from the given PSDU and the given TXVECTOR
|
||||
*/
|
||||
virtual WifiConstPsduMap GetWifiConstPsduMap (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector) const;
|
||||
|
||||
/**
|
||||
* Get the maximum PSDU size in bytes.
|
||||
*
|
||||
|
||||
@@ -1619,6 +1619,12 @@ WifiPhy::CalculateTxDuration (uint32_t size, const WifiTxVector& txVector, WifiP
|
||||
return duration;
|
||||
}
|
||||
|
||||
Time
|
||||
WifiPhy::CalculateTxDuration (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, WifiPhyBand band)
|
||||
{
|
||||
return CalculateTxDuration (GetWifiConstPsduMap (psdu, txVector), txVector, band);
|
||||
}
|
||||
|
||||
Time
|
||||
WifiPhy::CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band)
|
||||
{
|
||||
@@ -1756,13 +1762,17 @@ WifiPhy::NotifyMonitorSniffTx (Ptr<const WifiPsdu> psdu, uint16_t channelFreqMhz
|
||||
}
|
||||
}
|
||||
|
||||
WifiConstPsduMap
|
||||
WifiPhy::GetWifiConstPsduMap (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector)
|
||||
{
|
||||
return GetStaticPhyEntity (txVector.GetModulationClass ())->GetWifiConstPsduMap (psdu, txVector);
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhy::Send (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *psdu << txVector);
|
||||
WifiConstPsduMap psdus;
|
||||
psdus.insert (std::make_pair (SU_STA_ID, psdu));
|
||||
Send (psdus, txVector);
|
||||
Send (GetWifiConstPsduMap (psdu, txVector), txVector);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -121,7 +121,23 @@ public:
|
||||
void EndReceiveInterBss (void);
|
||||
|
||||
/**
|
||||
* \param psdu the PSDU to send
|
||||
* Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
|
||||
* The STA-ID value is properly determined based on whether the given PSDU has
|
||||
* to be transmitted as a DL or UL frame.
|
||||
*
|
||||
* \param psdu the given PSDU
|
||||
* \param txVector the TXVECTOR to use to send the PSDU
|
||||
* \return a WifiConstPsduMap built from the given PSDU and the given TXVECTOR
|
||||
*/
|
||||
static WifiConstPsduMap GetWifiConstPsduMap (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
|
||||
|
||||
/**
|
||||
* This function is a wrapper for the Send variant that accepts a WifiConstPsduMap
|
||||
* as first argument. This function inserts the given PSDU in a WifiConstPsduMap
|
||||
* along with a STA-ID value that is determined based on whether the given PSDU has
|
||||
* to be transmitted as a DL or UL frame.
|
||||
*
|
||||
* \param psdu the PSDU to send (in a SU PPDU)
|
||||
* \param txVector the TXVECTOR that has TX parameters such as mode, the transmission mode to use to send
|
||||
* this PSDU, and txPowerLevel, a power level to use to send the whole PPDU. The real transmission
|
||||
* power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
|
||||
@@ -217,6 +233,21 @@ public:
|
||||
*/
|
||||
static Time CalculateTxDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band,
|
||||
uint16_t staId = SU_STA_ID);
|
||||
/**
|
||||
* This function is a wrapper for the CalculateTxDuration variant that accepts a
|
||||
* WifiConstPsduMap as first argument. This function inserts the given PSDU in a
|
||||
* WifiConstPsduMap along with a STA-ID value that is determined based on whether
|
||||
* the given PSDU has to be transmitted as a DL or UL frame, thus allowing to
|
||||
* properly calculate the TX duration in case the PSDU has to be transmitted as
|
||||
* an UL frame.
|
||||
*
|
||||
* \param psdu the PSDU to transmit
|
||||
* \param txVector the TXVECTOR used for the transmission of the PSDU
|
||||
* \param band the frequency band
|
||||
*
|
||||
* \return the total amount of time this PHY will stay busy for the transmission of the PPDU
|
||||
*/
|
||||
static Time CalculateTxDuration (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, WifiPhyBand band);
|
||||
/**
|
||||
* \param psduMap the PSDU(s) to transmit indexed by STA-ID
|
||||
* \param txVector the TXVECTOR used for the transmission of the PPDU
|
||||
|
||||
Reference in New Issue
Block a user