--- a/src/wifi/model/minstrel-ht-wifi-manager.cc Mon Jul 16 19:43:41 2018 +0300
+++ b/src/wifi/model/minstrel-ht-wifi-manager.cc Mon Jul 16 20:28:07 2018 +0200
@@ -231,7 +231,7 @@
WifiModeList htMcsList = GetHtDeviceMcsList ();
for (uint8_t i = 0; i < MAX_HT_GROUP_RATES; i++)
{
- uint8_t deviceIndex = i + (m_minstrelGroups[groupId].streams - 1) * 8;
+ uint16_t deviceIndex = i + (m_minstrelGroups[groupId].streams - 1) * 8;
WifiMode mode = htMcsList[deviceIndex];
AddFirstMpduTxTime (groupId, mode, CalculateFirstMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
AddMpduTxTime (groupId, mode, CalculateMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
@@ -470,7 +470,7 @@
MinstrelHtWifiManager::DoReportRxOk (WifiRemoteStation *st, double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << st);
- NS_LOG_DEBUG ("DoReportRxOk m_txrate = " << +((MinstrelHtWifiRemoteStation *)st)->m_txrate);
+ NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelHtWifiRemoteStation *)st)->m_txrate);
}
void
@@ -483,7 +483,7 @@
{
return;
}
- NS_LOG_DEBUG ("DoReportRtsFailed m_txrate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("DoReportRtsFailed m_txrate = " << station->m_txrate);
station->m_shortRetry++;
}
@@ -519,7 +519,7 @@
return;
}
- NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << +station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
+ NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
if (!station->m_isHt)
{
@@ -546,7 +546,7 @@
return;
}
- NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << +station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before update).");
+ NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before update).");
if (!station->m_isHt)
{
@@ -555,7 +555,7 @@
m_legacyManager->UpdatePacketCounters (station);
- NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << +station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update).");
+ NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update).");
UpdateRetry (station);
m_legacyManager->UpdateStats (station);
@@ -574,7 +574,7 @@
UpdatePacketCounters (station, 1, 0);
- NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << +station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update).");
+ NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update).");
station->m_isSampling = false;
station->m_sampleDeferred = false;
@@ -591,7 +591,7 @@
}
}
- NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate );
}
void
@@ -606,7 +606,7 @@
return;
}
- NS_LOG_DEBUG ("DoReportFinalDataFailed - TxRate=" << +station->m_txrate);
+ NS_LOG_DEBUG ("DoReportFinalDataFailed - TxRate=" << station->m_txrate);
if (!station->m_isHt)
{
@@ -638,7 +638,7 @@
station->m_txrate = FindRate (station);
}
}
- NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
}
void
@@ -658,7 +658,7 @@
NS_ASSERT_MSG (false,"A-MPDU Tx Status called but no HT or VHT supported.");
}
- NS_LOG_DEBUG ("DoReportAmpduTxStatus. TxRate=" << +station->m_txrate << " SuccMpdus= " <<
+ NS_LOG_DEBUG ("DoReportAmpduTxStatus. TxRate=" << station->m_txrate << " SuccMpdus= " <<
+nSuccessfulMpdus << " FailedMpdus= " << +nFailedMpdus);
station->m_ampduPacketCount++;
@@ -691,7 +691,7 @@
{
station->m_txrate = FindRate (station);
}
- NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
}
}
@@ -793,7 +793,7 @@
NS_ASSERT_MSG (false,"Max retries reached and m_longRetry not cleared properly. longRetry= " << station->m_longRetry);
}
}
- NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
}
void
@@ -852,7 +852,7 @@
}
else
{
- NS_LOG_DEBUG ("DoGetDataMode m_txrate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("DoGetDataMode m_txrate= " << station->m_txrate);
uint8_t rateId = GetRateId (station->m_txrate);
uint8_t groupId = GetGroupId (station->m_txrate);
@@ -898,7 +898,7 @@
}
else
{
- NS_LOG_DEBUG ("DoGetRtsMode m_txrate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
/* RTS is sent in a non-HT frame. RTS with HT is not supported yet in NS3.
* When supported, decision of using HT has to follow rules in Section 9.7.6 from 802.11-2012.
@@ -1022,7 +1022,7 @@
return true;
}
-uint8_t
+uint16_t
MinstrelHtWifiManager::GetNextSample (MinstrelHtWifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
@@ -1030,8 +1030,8 @@
uint8_t index = station->m_groupsTable[sampleGroup].m_index;
uint8_t col = station->m_groupsTable[sampleGroup].m_col;
uint8_t sampleIndex = station->m_sampleTable[index][col];
- uint8_t rateIndex = GetIndex (sampleGroup, sampleIndex);
- NS_LOG_DEBUG ("Next Sample is " << +rateIndex);
+ uint16_t rateIndex = GetIndex (sampleGroup, sampleIndex);
+ NS_LOG_DEBUG ("Next Sample is " << rateIndex);
SetNextSample (station); //Calculate the next sample rate.
return rateIndex;
}
@@ -1067,7 +1067,7 @@
NS_LOG_DEBUG ("New sample set: group= " << +sampleGroup << " index= " << +station->m_sampleTable[index][col]);
}
-uint8_t
+uint16_t
MinstrelHtWifiManager::FindRate (MinstrelHtWifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
@@ -1084,8 +1084,8 @@
//SAMPLING
NS_LOG_DEBUG ("Obtaining a sampling rate");
/// Now go through the table and find an index rate.
- uint8_t sampleIdx = GetNextSample (station);
- NS_LOG_DEBUG ("Sampling rate = " << +sampleIdx);
+ uint16_t sampleIdx = GetNextSample (station);
+ NS_LOG_DEBUG ("Sampling rate = " << sampleIdx);
//Evaluate if the sampling rate selected should be used.
uint8_t sampleGroupId = GetGroupId (sampleIdx);
@@ -1103,8 +1103,8 @@
*/
HtRateInfo sampleRateInfo = station->m_groupsTable[sampleGroupId].m_ratesTable[sampleRateId];
- NS_LOG_DEBUG ("Use sample rate? MaxTpRate= " << +station->m_maxTpRate << " CurrentRate= " << +station->m_txrate <<
- " SampleRate= " << +sampleIdx << " SampleProb= " << sampleRateInfo.ewmaProb);
+ NS_LOG_DEBUG ("Use sample rate? MaxTpRate= " << station->m_maxTpRate << " CurrentRate= " << station->m_txrate <<
+ " SampleRate= " << sampleIdx << " SampleProb= " << sampleRateInfo.ewmaProb);
if (sampleIdx != station->m_maxTpRate && sampleIdx != station->m_maxTpRate2
&& sampleIdx != station->m_maxProbRate && sampleRateInfo.ewmaProb <= 95)
@@ -1139,7 +1139,7 @@
/// set the rate that we're currently sampling
station->m_sampleRate = sampleIdx;
- NS_LOG_DEBUG ("FindRate " << "sampleRate=" << +sampleIdx);
+ NS_LOG_DEBUG ("FindRate " << "sampleRate=" << sampleIdx);
station->m_sampleTries--;
return sampleIdx;
}
@@ -1154,7 +1154,7 @@
/// set the rate that we're currently sampling
station->m_sampleRate = sampleIdx;
- NS_LOG_DEBUG ("FindRate " << "sampleRate=" << +sampleIdx);
+ NS_LOG_DEBUG ("FindRate " << "sampleRate=" << sampleIdx);
station->m_sampleTries--;
return sampleIdx;
}
@@ -1169,7 +1169,7 @@
/// Continue using the best rate.
- NS_LOG_DEBUG ("FindRate " << "maxTpRrate=" << +station->m_maxTpRate);
+ NS_LOG_DEBUG ("FindRate " << "maxTpRrate=" << station->m_maxTpRate);
return station->m_maxTpRate;
}
void
@@ -1281,7 +1281,7 @@
CalculateRetransmits (station, station->m_maxTpRate2);
CalculateRetransmits (station, station->m_maxProbRate);
- NS_LOG_DEBUG ("max tp=" << +station->m_maxTpRate << "\nmax tp2=" << +station->m_maxTpRate2 << "\nmax prob=" << +station->m_maxProbRate);
+ NS_LOG_DEBUG ("max tp=" << station->m_maxTpRate << "\nmax tp2=" << station->m_maxTpRate2 << "\nmax prob=" << station->m_maxProbRate);
if (m_printStats)
{
PrintTable (station);
@@ -1319,7 +1319,7 @@
}
void
-MinstrelHtWifiManager::SetBestProbabilityRate (MinstrelHtWifiRemoteStation *station, uint8_t index)
+MinstrelHtWifiManager::SetBestProbabilityRate (MinstrelHtWifiRemoteStation *station, uint16_t index)
{
GroupInfo *group;
HtRateInfo rate;
@@ -1380,7 +1380,7 @@
* MCS groups.
*/
void
-MinstrelHtWifiManager::SetBestStationThRates (MinstrelHtWifiRemoteStation *station, uint8_t index)
+MinstrelHtWifiManager::SetBestStationThRates (MinstrelHtWifiRemoteStation *station, uint16_t index)
{
uint8_t groupId, rateId;
double th, prob;
@@ -1521,9 +1521,9 @@
}
void
-MinstrelHtWifiManager::CalculateRetransmits (MinstrelHtWifiRemoteStation *station, uint8_t index)
+MinstrelHtWifiManager::CalculateRetransmits (MinstrelHtWifiRemoteStation *station, uint16_t index)
{
- NS_LOG_FUNCTION (this << station << +index);
+ NS_LOG_FUNCTION (this << station << index);
uint8_t groupId = GetGroupId (index);
uint8_t rateId = GetRateId (index);
if (!station->m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated)
@@ -1603,7 +1603,7 @@
//for off-setting to make rates fall between 0 and nModes
uint8_t numSampleRates = m_numRates;
- uint8_t newIndex;
+ uint16_t newIndex;
for (uint8_t col = 0; col < m_nSampleCol; col++)
{
for (uint8_t i = 0; i < numSampleRates; i++ )
@@ -1670,11 +1670,11 @@
of << "VHT" << group.chWidth << " " << giMode << "GI " << (int)group.streams << " ";
}
- uint8_t maxTpRate = station->m_maxTpRate;
- uint8_t maxTpRate2 = station->m_maxTpRate2;
- uint8_t maxProbRate = station->m_maxProbRate;
+ uint16_t maxTpRate = station->m_maxTpRate;
+ uint16_t maxTpRate2 = station->m_maxTpRate2;
+ uint16_t maxProbRate = station->m_maxProbRate;
- uint8_t idx = GetIndex (groupId, i);
+ uint16_t idx = GetIndex (groupId, i);
if (idx == maxTpRate)
{
of << 'A';
@@ -1728,28 +1728,28 @@
}
}
}
-uint8_t
+uint16_t
MinstrelHtWifiManager::GetIndex (uint8_t groupId, uint8_t rateId)
{
NS_LOG_FUNCTION (this << +groupId << +rateId);
- uint8_t index;
+ uint16_t index;
index = groupId * m_numRates + rateId;
return index;
}
uint8_t
-MinstrelHtWifiManager::GetRateId (uint8_t index)
+MinstrelHtWifiManager::GetRateId (uint16_t index)
{
- NS_LOG_FUNCTION (this << +index);
+ NS_LOG_FUNCTION (this << index);
uint8_t id;
id = index % m_numRates;
return id;
}
uint8_t
-MinstrelHtWifiManager::GetGroupId (uint8_t index)
+MinstrelHtWifiManager::GetGroupId (uint16_t index)
{
- NS_LOG_FUNCTION (this << +index);
+ NS_LOG_FUNCTION (this << index);
return index / m_numRates;
}
@@ -1767,7 +1767,7 @@
return MAX_HT_STREAM_GROUPS * MAX_SUPPORTED_STREAMS + MAX_SUPPORTED_STREAMS * 2 * (chWidth == 160 ? 3 : chWidth == 80 ? 2 : chWidth == 40 ? 1 : 0) + MAX_SUPPORTED_STREAMS * sgi + txstreams - 1;
}
-uint8_t
+uint16_t
MinstrelHtWifiManager::GetLowestIndex (MinstrelHtWifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
@@ -1786,10 +1786,10 @@
return GetIndex (groupId, rateId);
}
-uint8_t
+uint16_t
MinstrelHtWifiManager::GetLowestIndex (MinstrelHtWifiRemoteStation *station, uint8_t groupId)
{
- NS_LOG_FUNCTION (this << station);
+ NS_LOG_FUNCTION (this << station << +groupId);
uint8_t rateId = 0;
while (rateId < m_numRates && !station->m_groupsTable[groupId].m_ratesTable[rateId].supported)
--- a/src/wifi/model/minstrel-ht-wifi-manager.h Mon Jul 16 19:43:41 2018 +0300
+++ b/src/wifi/model/minstrel-ht-wifi-manager.h Mon Jul 16 20:28:07 2018 +0200
@@ -112,9 +112,9 @@
uint8_t m_col; //!< Sample table column.
uint8_t m_index; //!< Sample table index.
bool m_supported; //!< If the rates of this group are supported by the station.
- uint8_t m_maxTpRate; //!< The max throughput rate of this group.
- uint8_t m_maxTpRate2; //!< The second max throughput rate of this group.
- uint8_t m_maxProbRate; //!< The highest success probability rate of this group.
+ uint16_t m_maxTpRate; //!< The max throughput rate of this group.
+ uint16_t m_maxTpRate2; //!< The second max throughput rate of this group.
+ uint16_t m_maxProbRate; //!< The highest success probability rate of this group.
HtMinstrelRate m_ratesTable; //!< Information about rates of this group.
};
@@ -125,12 +125,6 @@
typedef std::vector<struct GroupInfo> McsGroupData;
/**
- * Data structure for a Sample Rate table.
- * A vector of a vector uint8_t.
- */
-typedef std::vector<std::vector<uint8_t> > HtSampleRate;
-
-/**
* Constants for maximum values.
*/
@@ -335,7 +329,7 @@
* \param station the wifi remote station
* \returns the next sample
*/
- uint8_t GetNextSample (MinstrelHtWifiRemoteStation *station);
+ uint16_t GetNextSample (MinstrelHtWifiRemoteStation *station);
/**
* Set the next sample from Sample Table.
@@ -350,7 +344,7 @@
* \param station the minstrel HT wifi remote station
* \returns the rate
*/
- uint8_t FindRate (MinstrelHtWifiRemoteStation *station);
+ uint16_t FindRate (MinstrelHtWifiRemoteStation *station);
/**
* Updating the Minstrel Table every 1/10 seconds.
@@ -383,7 +377,7 @@
* \param station the minstrel HT wifi remote station
* \param index the index
*/
- void SetBestStationThRates (MinstrelHtWifiRemoteStation *station, uint8_t index);
+ void SetBestStationThRates (MinstrelHtWifiRemoteStation *station, uint16_t index);
/**
* Set index rate as maxProbRate if it is better than current value.
@@ -391,7 +385,7 @@
* \param station the minstrel HT wifi remote station
* \param index the index
*/
- void SetBestProbabilityRate (MinstrelHtWifiRemoteStation *station, uint8_t index);
+ void SetBestProbabilityRate (MinstrelHtWifiRemoteStation *station, uint16_t index);
/**
* Calculate the number of retransmissions to set for the index rate.
@@ -399,7 +393,7 @@
* \param station the minstrel HT wifi remote station
* \param index the index
*/
- void CalculateRetransmits (MinstrelHtWifiRemoteStation *station, uint8_t index);
+ void CalculateRetransmits (MinstrelHtWifiRemoteStation *station, uint16_t index);
/**
* Calculate the number of retransmissions to set for the (groupId, rateId) rate.
@@ -469,10 +463,10 @@
* Print group statistics.
*
* \param station the minstrel HT wifi remote station
- * \param index the index
+ * \param groupId the group ID
* \param of the output file stream
*/
- void StatsDump (MinstrelHtWifiRemoteStation *station, uint8_t index, std::ofstream &of);
+ void StatsDump (MinstrelHtWifiRemoteStation *station, uint8_t groupId, std::ofstream &of);
/**
* Check for initializations.
@@ -513,7 +507,7 @@
* \param index the index
* \returns the rate ID
*/
- uint8_t GetRateId (uint8_t index);
+ uint8_t GetRateId (uint16_t index);
/**
* Return the groupId from the global index.
@@ -521,7 +515,7 @@
* \param index the index
* \returns the group ID
*/
- uint8_t GetGroupId (uint8_t index);
+ uint8_t GetGroupId (uint16_t index);
/**
* Returns the global index corresponding to the groupId and rateId.
@@ -530,7 +524,7 @@
* \param rateId the rate ID
* \returns the index
*/
- uint8_t GetIndex (uint8_t groupId, uint8_t rateId);
+ uint16_t GetIndex (uint8_t groupId, uint8_t rateId);
/**
* Returns the groupId of a HT MCS with the given number of streams, if using sgi and the channel width used.
@@ -558,7 +552,7 @@
* \param station the minstrel HT wifi remote station
* \returns the lowest global index
*/
- uint8_t GetLowestIndex (MinstrelHtWifiRemoteStation *station);
+ uint16_t GetLowestIndex (MinstrelHtWifiRemoteStation *station);
/**
* Returns the lowest global index of the rates supported by in the group.
@@ -567,7 +561,7 @@
* \param groupId the group ID
* \returns the lowest global index
*/
- uint8_t GetLowestIndex (MinstrelHtWifiRemoteStation *station, uint8_t groupId);
+ uint16_t GetLowestIndex (MinstrelHtWifiRemoteStation *station, uint8_t groupId);
/**
* Returns a list of only the VHT MCS supported by the device.
@@ -581,25 +575,20 @@
*/
WifiModeList GetHtDeviceMcsList (void) const;
- Time m_updateStats; //!< How frequent do we calculate the stats (1/10 seconds).
- uint8_t m_lookAroundRate; //!< The % to try other rates than our current rate.
- uint8_t m_ewmaLevel; //!< Exponential weighted moving average level (or coefficient).
-
- uint8_t m_nSampleCol; //!< Number of sample columns.
- uint32_t m_frameLength; //!< Frame length used for calculate modes TxTime.
-
- uint8_t m_numGroups; //!< Number of groups Minstrel should consider.
- uint8_t m_numRates; //!< Number of rates per group Minstrel should consider.
-
- bool m_useVhtOnly; //!< If only VHT MCS should be used, instead of HT and VHT.
-
- bool m_printStats; //!< If statistics table should be printed.
+ Time m_updateStats; //!< How frequent do we calculate the stats (1/10 seconds).
+ uint8_t m_lookAroundRate; //!< The % to try other rates than our current rate.
+ uint8_t m_ewmaLevel; //!< Exponential weighted moving average level (or coefficient).
+ uint8_t m_nSampleCol; //!< Number of sample columns.
+ uint32_t m_frameLength; //!< Frame length used for calculate modes TxTime.
+ uint8_t m_numGroups; //!< Number of groups Minstrel should consider.
+ uint8_t m_numRates; //!< Number of rates per group Minstrel should consider.
+ bool m_useVhtOnly; //!< If only VHT MCS should be used, instead of HT and VHT.
+ bool m_printStats; //!< If statistics table should be printed.
MinstrelMcsGroups m_minstrelGroups; //!< Global array for groups information.
Ptr<MinstrelWifiManager> m_legacyManager; //!< Pointer to an instance of MinstrelWifiManager. Used when 802.11n/ac not supported.
-
Ptr<UniformRandomVariable> m_uniformRandomVariable; //!< Provides uniform random variables.
TracedValue<uint64_t> m_currentRate; //!< Trace rate changes
--- a/src/wifi/model/minstrel-wifi-manager.cc Mon Jul 16 19:43:41 2018 +0300
+++ b/src/wifi/model/minstrel-wifi-manager.cc Mon Jul 16 20:28:07 2018 +0200
@@ -231,7 +231,7 @@
//for normal rate, we're not currently sampling random rates
if (!station->m_isSampling)
{
- NS_LOG_DEBUG ("Failed with normal rate: current=" << +station->m_txrate << ", sample=" << +station->m_sampleRate << ", maxTp=" << +station->m_maxTpRate << ", maxTp2=" << +station->m_maxTpRate2 << ", maxProb=" << +station->m_maxProbRate);
+ NS_LOG_DEBUG ("Failed with normal rate: current=" << station->m_txrate << ", sample=" << station->m_sampleRate << ", maxTp=" << station->m_maxTpRate << ", maxTp2=" << station->m_maxTpRate2 << ", maxProb=" << station->m_maxProbRate);
//use best throughput rate
if (station->m_longRetry < station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)
{
@@ -269,7 +269,7 @@
//for look-around rate, we're currently sampling random rates
else
{
- NS_LOG_DEBUG ("Failed with look around rate: current=" << +station->m_txrate << ", sample=" << +station->m_sampleRate << ", maxTp=" << +station->m_maxTpRate << ", maxTp2=" << +station->m_maxTpRate2 << ", maxProb=" << +station->m_maxProbRate);
+ NS_LOG_DEBUG ("Failed with look around rate: current=" << station->m_txrate << ", sample=" << station->m_sampleRate << ", maxTp=" << station->m_maxTpRate << ", maxTp2=" << station->m_maxTpRate2 << ", maxProb=" << station->m_maxProbRate);
//current sampling rate is slower than the current best rate
if (station->m_sampleDeferred)
{
@@ -374,7 +374,7 @@
MinstrelWifiManager::GetRtsTxVector (MinstrelWifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
- NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << +station->m_txrate);
+ NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
uint16_t channelWidth = GetChannelWidth (station);
if (channelWidth > 20 && channelWidth != 22)
{
@@ -414,7 +414,7 @@
}
}
-uint8_t
+uint16_t
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
@@ -424,7 +424,7 @@
return 0;
}
- uint8_t idx = 0;
+ uint16_t idx = 0;
NS_LOG_DEBUG ("Total: " << station->m_totalPacketsCount << " Sample: " << station->m_samplePacketsCount << " Deferred: " << station->m_numSamplesDeferred);
int delta = (station->m_totalPacketsCount * m_lookAroundRate / 100) - (station->m_samplePacketsCount + station->m_numSamplesDeferred / 2);
@@ -454,7 +454,7 @@
//now go through the table and find an index rate
idx = GetNextSample (station);
- NS_LOG_DEBUG ("Sample rate = " << +idx << "(" << GetSupported (station, idx) << ")");
+ NS_LOG_DEBUG ("Sample rate = " << idx << "(" << GetSupported (station, idx) << ")");
//error check
if (idx >= station->m_nModes)
@@ -502,18 +502,18 @@
//using the best rate instead
if (station->m_sampleDeferred)
{
- NS_LOG_DEBUG ("The next look around rate is slower than the maximum throughput rate, continue with the maximum throughput rate: " << +station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")");
+ NS_LOG_DEBUG ("The next look around rate is slower than the maximum throughput rate, continue with the maximum throughput rate: " << station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")");
idx = station->m_maxTpRate;
}
}
//continue using the best rate
else
{
- NS_LOG_DEBUG ("Continue using the maximum throughput rate: " << +station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")");
+ NS_LOG_DEBUG ("Continue using the maximum throughput rate: " << station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")");
idx = station->m_maxTpRate;
}
- NS_LOG_DEBUG ("Rate = " << +idx << "(" << GetSupported (station, idx) << ")");
+ NS_LOG_DEBUG ("Rate = " << idx << "(" << GetSupported (station, idx) << ")");
return idx;
}
@@ -534,7 +534,7 @@
NS_LOG_FUNCTION (this);
station->m_nextStatsUpdate = Simulator::Now () + m_updateStats;
NS_LOG_DEBUG ("Next update at " << station->m_nextStatsUpdate);
- NS_LOG_DEBUG ("Currently using rate: " << +station->m_txrate << " (" << GetSupported (station, station->m_txrate) << ")");
+ NS_LOG_DEBUG ("Currently using rate: " << station->m_txrate << " (" << GetSupported (station, station->m_txrate) << ")");
Time txTime;
uint32_t tempProb;
@@ -552,7 +552,7 @@
txTime = Seconds (1);
}
- NS_LOG_DEBUG (i << " " << GetSupported (station, i) <<
+ NS_LOG_DEBUG (+i << " " << GetSupported (station, i) <<
"\t" << station->m_minstrelTable[i].numRateAttempt <<
"\t" << station->m_minstrelTable[i].numRateSuccess);
@@ -686,7 +686,7 @@
NS_LOG_DEBUG ("max throughput=" << +index_max_tp << "(" << GetSupported (station, index_max_tp) <<
")\tsecond max throughput=" << +index_max_tp2 << "(" << GetSupported (station, index_max_tp2) <<
- ")\tmax prob=" << index_max_prob << "(" << GetSupported (station, index_max_prob) << ")");
+ ")\tmax prob=" << +index_max_prob << "(" << GetSupported (station, index_max_prob) << ")");
if (m_printStats)
{
PrintTable (station);
@@ -701,7 +701,7 @@
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st, double rxSnr, WifiMode txMode)
{
NS_LOG_FUNCTION (this << st << rxSnr << txMode);
- NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << +((MinstrelWifiRemoteStation *)st)->m_txrate);
+ NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate);
}
void
@@ -709,7 +709,7 @@
{
NS_LOG_FUNCTION (this << st);
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
- NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << +station->m_txrate);
+ NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate);
station->m_shortRetry++;
}
@@ -732,7 +732,7 @@
{
NS_LOG_FUNCTION (this << st);
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
- NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << +station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
+ NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
CheckInit (station);
if (!station->m_initialized)
{
@@ -755,14 +755,14 @@
return;
}
- NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << +station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before update).");
+ NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before update).");
station->m_minstrelTable[station->m_txrate].numRateSuccess++;
station->m_minstrelTable[station->m_txrate].numRateAttempt++;
UpdatePacketCounters (station);
- NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << +station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update).");
+ NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update).");
UpdateRetry (station);
UpdateStats (station);
@@ -771,7 +771,7 @@
{
station->m_txrate = FindRate (station);
}
- NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
}
void
@@ -799,7 +799,7 @@
{
station->m_txrate = FindRate (station);
}
- NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
+ NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
}
void
@@ -883,11 +883,12 @@
return true;
}
-uint8_t
+uint16_t
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station)
{
NS_LOG_FUNCTION (this << station);
- uint8_t bitrate = station->m_sampleTable[station->m_index][station->m_col];
+ uint16_t bitrate;
+ bitrate = station->m_sampleTable[station->m_index][station->m_col];
station->m_index++;
//bookkeeping for m_index and m_col variables
@@ -982,7 +983,7 @@
//for off-setting to make rates fall between 0 and nModes
uint8_t numSampleRates = station->m_nModes;
- uint8_t newIndex;
+ uint16_t newIndex;
for (uint8_t col = 0; col < m_sampleCol; col++)
{
for (uint8_t i = 0; i < numSampleRates; i++ )
@@ -1027,9 +1028,9 @@
station->m_statsFile << "best _______________rate________________ ________statistics________ ________last_______ ______sum-of________\n" <<
"rate [ name idx airtime max_tp] [avg(tp) avg(prob) sd(prob)] [prob.|retry|suc|att] [#success | #attempts]\n";
- uint8_t maxTpRate = station->m_maxTpRate;
- uint8_t maxTpRate2 = station->m_maxTpRate2;
- uint8_t maxProbRate = station->m_maxProbRate;
+ uint16_t maxTpRate = station->m_maxTpRate;
+ uint16_t maxTpRate2 = station->m_maxTpRate2;
+ uint16_t maxProbRate = station->m_maxProbRate;
for (uint8_t i = 0; i < station->m_nModes; i++)
{
--- a/src/wifi/model/minstrel-wifi-manager.h Mon Jul 16 19:43:41 2018 +0300
+++ b/src/wifi/model/minstrel-wifi-manager.h Mon Jul 16 20:28:07 2018 +0200
@@ -92,20 +92,20 @@
*/
uint8_t m_col; ///< vector index
uint8_t m_index; ///< vector index
- uint8_t m_maxTpRate; ///< the current throughput rate
- uint8_t m_maxTpRate2; ///< second highest throughput rate
- uint8_t m_maxProbRate; ///< rate with highest prob of success
+ uint16_t m_maxTpRate; ///< the current throughput rate
+ uint16_t m_maxTpRate2; ///< second highest throughput rate
+ uint16_t m_maxProbRate; ///< rate with highest prob of success
uint8_t m_nModes; ///< number of modes supported
int m_totalPacketsCount; ///< total number of packets as of now
int m_samplePacketsCount; ///< how many packets we have sample so far
int m_numSamplesDeferred; ///< number samles deferred
bool m_isSampling; ///< a flag to indicate we are currently sampling
- uint8_t m_sampleRate; ///< current sample rate
+ uint16_t m_sampleRate; ///< current sample rate
bool m_sampleDeferred; ///< a flag to indicate sample rate is on the second stage
uint32_t m_shortRetry; ///< short retries such as control packts
uint32_t m_longRetry; ///< long retries such as data packets
uint32_t m_retry; ///< total retries short + long
- uint8_t m_txrate; ///< current transmit rate
+ uint16_t m_txrate; ///< current transmit rate
bool m_initialized; ///< for initializing tables
MinstrelRate m_minstrelTable; ///< minstrel table
SampleRate m_sampleTable; ///< sample table
@@ -203,7 +203,7 @@
* \param station the station object
* \returns the rate
*/
- uint8_t FindRate (MinstrelWifiRemoteStation *station);
+ uint16_t FindRate (MinstrelWifiRemoteStation *station);
/**
* Get data transmit vector
@@ -306,7 +306,7 @@
* \param station the station object
* \returns the next sample
*/
- uint8_t GetNextSample (MinstrelWifiRemoteStation *station);
+ uint16_t GetNextSample (MinstrelWifiRemoteStation *station);
/**
* Estimate the time to transmit the given packet with the given number of retries.