wifi: Move duplicated code to add supported VHT MCS to WifiRemoteStationManager::AddStationVhtCapabilities

This commit is contained in:
Sébastien Deronne
2017-11-11 10:28:59 +01:00
parent 217b34c837
commit 93cb08a8be
5 changed files with 29 additions and 76 deletions

View File

@@ -1074,14 +1074,6 @@ ApWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
if (htCapabilities.IsSupportedMcs (0))
{
m_stationManager->AddStationHtCapabilities (from, htCapabilities);
for (uint32_t j = 0; j < m_phy->GetNMcs (); j++)
{
WifiMode mcs = m_phy->GetMcs (j);
if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HT && htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
{
m_stationManager->AddSupportedMcs (from, mcs);
}
}
}
}
if (m_vhtSupported)

View File

@@ -932,7 +932,7 @@ MinstrelHtWifiManager::DoGetDataTxVector (WifiRemoteStation *st)
}
WifiMode mode = GetMcsSupported (station, mcsIndex);
return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (station),
GetPreambleForTransmission (mode, GetAddress (station)), group.sgi ? 400 : 800, GetNumberOfAntennas (), group.streams, GetNess (station), group.chWidth, GetAggregation (station) && !station->m_isSampling, GetStbc (station));
GetPreambleForTransmission (mode, GetAddress (station)), group.sgi ? 400 : 800, GetNumberOfAntennas (), group.streams, GetNess (station), group.chWidth, GetAggregation (station) && !station->m_isSampling, false);
}
}

View File

@@ -565,14 +565,6 @@ StaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
{
m_stationManager->SetRifsPermitted (false);
}
for (uint32_t i = 0; i < m_phy->GetNMcs (); i++)
{
WifiMode mcs = m_phy->GetMcs (i);
if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HT && htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
{
m_stationManager->AddSupportedMcs (hdr->GetAddr2 (), mcs);
}
}
}
}
if (m_vhtSupported)

View File

@@ -840,7 +840,7 @@ WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHe
v.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mode, m_wifiPhy->GetShortGuardInterval (), m_wifiPhy->GetGuardInterval ()));
v.SetNss (1);
v.SetNess (0);
v.SetStbc (false);
v.SetStbc (m_wifiPhy->GetStbc ());
return v;
}
if (!IsLowLatency ())
@@ -1480,7 +1480,7 @@ WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode
v.SetGuardInterval (DoGetCtsTxGuardInterval (address, ctsMode));
v.SetNss (DoGetCtsTxNss (address, ctsMode));
v.SetNess (DoGetCtsTxNess (address, ctsMode));
v.SetStbc (DoGetCtsTxStbc (address, ctsMode));
v.SetStbc (m_wifiPhy->GetStbc ());
return v;
}
@@ -1497,7 +1497,7 @@ WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMod
v.SetGuardInterval (DoGetAckTxGuardInterval (address, ackMode));
v.SetNss (DoGetAckTxNss (address, ackMode));
v.SetNess (DoGetAckTxNess (address, ackMode));
v.SetStbc (DoGetAckTxStbc (address, ackMode));
v.SetStbc (m_wifiPhy->GetStbc ());
return v;
}
@@ -1514,7 +1514,7 @@ WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode bl
v.SetGuardInterval (DoGetBlockAckTxGuardInterval (address, blockAckMode));
v.SetNss (DoGetBlockAckTxNss (address, blockAckMode));
v.SetNess (DoGetBlockAckTxNess (address, blockAckMode));
v.SetStbc (DoGetBlockAckTxStbc (address, blockAckMode));
v.SetStbc (m_wifiPhy->GetStbc ());
return v;
}
@@ -1548,12 +1548,6 @@ WifiRemoteStationManager::DoGetCtsTxNess (Mac48Address address, WifiMode ctsMode
return 0;
}
bool
WifiRemoteStationManager::DoGetCtsTxStbc (Mac48Address address, WifiMode ctsMode)
{
return m_wifiPhy->GetStbc ();
}
uint8_t
WifiRemoteStationManager::DoGetAckTxPowerLevel (Mac48Address address, WifiMode ackMode)
{
@@ -1584,12 +1578,6 @@ WifiRemoteStationManager::DoGetAckTxNess (Mac48Address address, WifiMode ackMode
return 0;
}
bool
WifiRemoteStationManager::DoGetAckTxStbc (Mac48Address address, WifiMode ackMode)
{
return m_wifiPhy->GetStbc ();
}
uint8_t
WifiRemoteStationManager::DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode)
{
@@ -1620,12 +1608,6 @@ WifiRemoteStationManager::DoGetBlockAckTxNess (Mac48Address address, WifiMode bl
return 0;
}
bool
WifiRemoteStationManager::DoGetBlockAckTxStbc (Mac48Address address, WifiMode blockAckMode)
{
return m_wifiPhy->GetStbc ();
}
uint8_t
WifiRemoteStationManager::GetDefaultTxPowerLevel (void) const
{
@@ -1664,6 +1646,7 @@ WifiRemoteStationManager::LookupState (Mac48Address address) const
state->m_ness = 0;
state->m_aggregation = false;
state->m_stbc = false;
state->m_ldpc = false;
state->m_qosSupported = false;
state->m_htSupported = false;
state->m_vhtSupported = false;
@@ -1736,10 +1719,18 @@ WifiRemoteStationManager::AddStationHtCapabilities (Mac48Address from, HtCapabil
{
state->m_channelWidth = 20;
}
state->m_htSupported = true;
SetQosSupport (from, true);
state->m_greenfield = htCapabilities.GetGreenfield ();
state->m_streams = htCapabilities.GetRxHighestSupportedAntennas ();
for (uint32_t j = 0; j < m_wifiPhy->GetNMcs (); j++)
{
WifiMode mcs = m_wifiPhy->GetMcs (j);
if (mcs.GetModulationClass () == WIFI_MOD_CLASS_HT && htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
{
AddSupportedMcs (from, mcs);
}
}
state->m_htSupported = true;
}
void
@@ -1763,6 +1754,19 @@ WifiRemoteStationManager::AddStationVhtCapabilities (Mac48Address from, VhtCapab
{
state->m_channelWidth = m_wifiPhy->GetChannelWidth ();
}
state->m_ldpc = (vhtCapabilities.GetRxLdpc () != 0);
state->m_stbc = (vhtCapabilities.GetTxStbc () != 0 && vhtCapabilities.GetRxStbc () != 0);
for (uint8_t i = 1; i <= m_wifiPhy->GetMaxSupportedTxSpatialStreams (); i++)
{
for (uint32_t j = 0; j < m_wifiPhy->GetNMcs (); j++)
{
WifiMode mcs = m_wifiPhy->GetMcs (j);
if (mcs.GetModulationClass () == WIFI_MOD_CLASS_VHT && vhtCapabilities.IsSupportedMcs (mcs.GetMcsValue (), i))
{
AddSupportedMcs (from, mcs);
}
}
}
state->m_vhtSupported = true;
}
@@ -2046,12 +2050,6 @@ WifiRemoteStationManager::GetAggregation (const WifiRemoteStation *station) cons
return station->m_state->m_aggregation;
}
bool
WifiRemoteStationManager::GetStbc (const WifiRemoteStation *station) const
{
return station->m_state->m_stbc;
}
uint8_t
WifiRemoteStationManager::GetNumberOfSupportedStreams (const WifiRemoteStation *station) const
{

View File

@@ -1050,15 +1050,6 @@ protected:
* false otherwise
*/
bool GetAggregation (const WifiRemoteStation *station) const;
/**
* Return whether the given station supports space-time block coding (STBC).
*
* \param station the station being queried
*
* \return true if the station supports STBC,
* false otherwise
*/
bool GetStbc (const WifiRemoteStation *station) const;
/**
* Return whether the station supports Greenfield or not.
*
@@ -1258,13 +1249,6 @@ private:
* \return the CTS transmit NESS
*/
virtual uint8_t DoGetCtsTxNess (Mac48Address address, WifiMode ctsMode);
/**
* \param address the address of the recipient
* \param ctsMode the mode to be used
*
* \return the CTS transmit STBC
*/
virtual bool DoGetCtsTxStbc (Mac48Address address, WifiMode ctsMode);
/**
* \param address the address of the recipient
* \param ctsMode the mode to be used
@@ -1293,13 +1277,6 @@ private:
* \return the ack transmit NESS
*/
virtual uint8_t DoGetAckTxNess (Mac48Address address, WifiMode ackMode);
/**
* \param address the address of the recipient
* \param ackMode the mode to be used
*
* \return the ack transmit STBC
*/
virtual bool DoGetAckTxStbc (Mac48Address address, WifiMode ackMode);
/**
* \param address the address of the recipient
* \param ctsMode the mode to be used
@@ -1328,13 +1305,6 @@ private:
* \return the block ack transmit NESS
*/
virtual uint8_t DoGetBlockAckTxNess (Mac48Address address, WifiMode blockAckMode);
/**
* \param address the address of the recipient
* \param blockAckMode the mode to be used
*
* \return the block ack transmit STBC
*/
virtual bool DoGetBlockAckTxStbc (Mac48Address address, WifiMode blockAckMode);
/**
* This method is a pure virtual method that must be implemented by the sub-class.
@@ -1604,6 +1574,7 @@ struct WifiRemoteStationState
uint8_t m_streams; //!< Number of supported streams by the remote station
uint32_t m_ness; //!< Number of streams in beamforming of the remote station
bool m_stbc; //!< Flag if STBC is supported by the remote station
bool m_ldpc; //!< Flag if LDPC is supported by the remote station
bool m_aggregation; //!< Flag if MPDU aggregation is used by the remote station
bool m_greenfield; //!< Flag if greenfield is supported by the remote station
bool m_shortPreamble; //!< Flag if short PLCP preamble is supported by the remote station