wifi: Get most recent RSSI received on other links if none is available on the current link
This commit is contained in:
committed by
Stefano Avallone
parent
1dab5bacdd
commit
b934b68cb8
@@ -121,4 +121,37 @@ EhtFrameExchangeManager::ForwardPsduDown(Ptr<const WifiPsdu> psdu, WifiTxVector&
|
||||
HeFrameExchangeManager::ForwardPsduDown(psdu, txVector);
|
||||
}
|
||||
|
||||
std::optional<double>
|
||||
EhtFrameExchangeManager::GetMostRecentRssi(const Mac48Address& address) const
|
||||
{
|
||||
auto optRssi = HeFrameExchangeManager::GetMostRecentRssi(address);
|
||||
|
||||
if (optRssi)
|
||||
{
|
||||
return optRssi;
|
||||
}
|
||||
|
||||
auto mldAddress = GetWifiRemoteStationManager()->GetMldAddress(address);
|
||||
|
||||
if (!mldAddress)
|
||||
{
|
||||
// not an MLD, nothing else can be done
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
for (uint8_t linkId = 0; linkId < m_mac->GetNLinks(); linkId++)
|
||||
{
|
||||
std::optional<Mac48Address> linkAddress;
|
||||
if (linkId != m_linkId &&
|
||||
(linkAddress = m_mac->GetWifiRemoteStationManager(linkId)->GetAffiliatedStaAddress(
|
||||
*mldAddress)) &&
|
||||
(optRssi = m_mac->GetWifiRemoteStationManager(linkId)->GetMostRecentRssi(*linkAddress)))
|
||||
{
|
||||
return optRssi;
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -45,6 +45,17 @@ class EhtFrameExchangeManager : public HeFrameExchangeManager
|
||||
void SetLinkId(uint8_t linkId) override;
|
||||
Ptr<WifiMpdu> CreateAliasIfNeeded(Ptr<WifiMpdu> mpdu) const override;
|
||||
|
||||
/**
|
||||
* Get the RSSI (in dBm) of the most recent packet received from the station having
|
||||
* the given address. If there is no such information for the given station and the
|
||||
* station is affiliated with an MLD, return the RSSI (in dBm) of the most recent
|
||||
* packet received from another station of the same MLD.
|
||||
*
|
||||
* \param address of the remote station
|
||||
* \return the RSSI (in dBm) of the most recent packet received from the remote station
|
||||
*/
|
||||
std::optional<double> GetMostRecentRssi(const Mac48Address& address) const override;
|
||||
|
||||
protected:
|
||||
void ForwardPsduDown(Ptr<const WifiPsdu> psdu, WifiTxVector& txVector) override;
|
||||
};
|
||||
|
||||
@@ -1195,10 +1195,12 @@ HeFrameExchangeManager::GetHeTbTxVector(CtrlTriggerHeader trigger, Mac48Address
|
||||
*
|
||||
* Refer to section 27.3.14.2 (Power pre-correction) of 802.11ax Draft 4.0 for more details.
|
||||
*/
|
||||
auto optRssi = GetMostRecentRssi(triggerSender);
|
||||
NS_ASSERT(optRssi);
|
||||
int8_t pathLossDb =
|
||||
trigger.GetApTxPower() -
|
||||
static_cast<int8_t>(GetWifiRemoteStationManager()->GetMostRecentRssi(
|
||||
triggerSender)); // cast RSSI to be on equal footing with AP Tx power information
|
||||
static_cast<int8_t>(
|
||||
*optRssi); // cast RSSI to be on equal footing with AP Tx power information
|
||||
double reqTxPowerDbm = static_cast<double>(userInfoIt->GetUlTargetRssi() + pathLossDb);
|
||||
|
||||
// Convert the transmit power to a power level
|
||||
@@ -1231,6 +1233,12 @@ HeFrameExchangeManager::GetHeTbTxVector(CtrlTriggerHeader trigger, Mac48Address
|
||||
return v;
|
||||
}
|
||||
|
||||
std::optional<double>
|
||||
HeFrameExchangeManager::GetMostRecentRssi(const Mac48Address& address) const
|
||||
{
|
||||
return GetWifiRemoteStationManager()->GetMostRecentRssi(address);
|
||||
}
|
||||
|
||||
void
|
||||
HeFrameExchangeManager::SetTargetRssi(CtrlTriggerHeader& trigger) const
|
||||
{
|
||||
@@ -1244,8 +1252,9 @@ HeFrameExchangeManager::SetTargetRssi(CtrlTriggerHeader& trigger) const
|
||||
const auto staList = m_apMac->GetStaList(m_linkId);
|
||||
auto itAidAddr = staList.find(userInfo.GetAid12());
|
||||
NS_ASSERT(itAidAddr != staList.end());
|
||||
int8_t rssi = static_cast<int8_t>(
|
||||
GetWifiRemoteStationManager()->GetMostRecentRssi(itAidAddr->second));
|
||||
auto optRssi = GetMostRecentRssi(itAidAddr->second);
|
||||
NS_ASSERT(optRssi);
|
||||
int8_t rssi = static_cast<int8_t>(*optRssi);
|
||||
rssi = (rssi >= -20)
|
||||
? -20
|
||||
: ((rssi <= -110) ? -110 : rssi); // cap so as to keep within [-110; -20] dBm
|
||||
|
||||
@@ -93,6 +93,15 @@ class HeFrameExchangeManager : public VhtFrameExchangeManager
|
||||
*/
|
||||
virtual void SetTargetRssi(CtrlTriggerHeader& trigger) const;
|
||||
|
||||
/**
|
||||
* Get the RSSI (in dBm) of the most recent packet received from the station having
|
||||
* the given address.
|
||||
*
|
||||
* \param address of the remote station
|
||||
* \return the RSSI (in dBm) of the most recent packet received from the remote station
|
||||
*/
|
||||
virtual std::optional<double> GetMostRecentRssi(const Mac48Address& address) const;
|
||||
|
||||
protected:
|
||||
void DoDispose() override;
|
||||
|
||||
|
||||
@@ -1338,7 +1338,7 @@ WifiRemoteStationManager::GetInfo(Mac48Address address)
|
||||
return LookupState(address)->m_info;
|
||||
}
|
||||
|
||||
double
|
||||
std::optional<double>
|
||||
WifiRemoteStationManager::GetMostRecentRssi(Mac48Address address) const
|
||||
{
|
||||
auto stationIt = m_stations.find(address);
|
||||
@@ -1346,8 +1346,11 @@ WifiRemoteStationManager::GetMostRecentRssi(Mac48Address address) const
|
||||
auto station = stationIt->second;
|
||||
auto rssi = station->m_rssiAndUpdateTimePair.first;
|
||||
auto ts = station->m_rssiAndUpdateTimePair.second;
|
||||
NS_ASSERT_MSG(ts.IsStrictlyPositive(), "address: " << address << " ts:" << ts);
|
||||
return rssi;
|
||||
if (ts.IsStrictlyPositive())
|
||||
{
|
||||
return rssi;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::shared_ptr<WifiRemoteStationState>
|
||||
|
||||
@@ -973,7 +973,7 @@ class WifiRemoteStationManager : public Object
|
||||
* to estimate the target UL RSSI info to put in the
|
||||
* Trigger frame to send to the remote station.
|
||||
*/
|
||||
double GetMostRecentRssi(Mac48Address address) const;
|
||||
std::optional<double> GetMostRecentRssi(Mac48Address address) const;
|
||||
/**
|
||||
* Set the default transmission power level
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user