View | Details | Raw Unified | Return to bug 2950
Collapse All | Expand All

(-)a/src/wifi/model/minstrel-ht-wifi-manager.cc (-45 / +45 lines)
 Lines 231-237    Link Here 
231
                      WifiModeList htMcsList = GetHtDeviceMcsList ();
231
                      WifiModeList htMcsList = GetHtDeviceMcsList ();
232
                      for (uint8_t i = 0; i < MAX_HT_GROUP_RATES; i++)
232
                      for (uint8_t i = 0; i < MAX_HT_GROUP_RATES; i++)
233
                        {
233
                        {
234
                          uint8_t deviceIndex = i + (m_minstrelGroups[groupId].streams - 1) * 8;
234
                          uint16_t deviceIndex = i + (m_minstrelGroups[groupId].streams - 1) * 8;
235
                          WifiMode mode =  htMcsList[deviceIndex];
235
                          WifiMode mode =  htMcsList[deviceIndex];
236
                          AddFirstMpduTxTime (groupId, mode, CalculateFirstMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
236
                          AddFirstMpduTxTime (groupId, mode, CalculateFirstMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
237
                          AddMpduTxTime (groupId, mode, CalculateMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
237
                          AddMpduTxTime (groupId, mode, CalculateMpduTxDuration (GetPhy (), streams, sgi, chWidth, mode));
 Lines 470-476    Link Here 
470
MinstrelHtWifiManager::DoReportRxOk (WifiRemoteStation *st, double rxSnr, WifiMode txMode)
470
MinstrelHtWifiManager::DoReportRxOk (WifiRemoteStation *st, double rxSnr, WifiMode txMode)
471
{
471
{
472
  NS_LOG_FUNCTION (this << st);
472
  NS_LOG_FUNCTION (this << st);
473
  NS_LOG_DEBUG ("DoReportRxOk m_txrate = " << +((MinstrelHtWifiRemoteStation *)st)->m_txrate);
473
  NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelHtWifiRemoteStation *)st)->m_txrate);
474
}
474
}
475
475
476
void
476
void
 Lines 483-489    Link Here 
483
    {
483
    {
484
      return;
484
      return;
485
    }
485
    }
486
  NS_LOG_DEBUG ("DoReportRtsFailed m_txrate = " << +station->m_txrate);
486
  NS_LOG_DEBUG ("DoReportRtsFailed m_txrate = " << station->m_txrate);
487
  station->m_shortRetry++;
487
  station->m_shortRetry++;
488
}
488
}
489
489
 Lines 519-525    Link Here 
519
      return;
519
      return;
520
    }
520
    }
521
521
522
  NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << +station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
522
  NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
523
523
524
  if (!station->m_isHt)
524
  if (!station->m_isHt)
525
    {
525
    {
 Lines 546-552    Link Here 
546
      return;
546
      return;
547
    }
547
    }
548
548
549
  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).");
549
  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).");
550
550
551
  if (!station->m_isHt)
551
  if (!station->m_isHt)
552
    {
552
    {
 Lines 555-561    Link Here 
555
555
556
      m_legacyManager->UpdatePacketCounters (station);
556
      m_legacyManager->UpdatePacketCounters (station);
557
557
558
      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).");
558
      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).");
559
559
560
      UpdateRetry (station);
560
      UpdateRetry (station);
561
      m_legacyManager->UpdateStats (station);
561
      m_legacyManager->UpdateStats (station);
 Lines 574-580    Link Here 
574
574
575
      UpdatePacketCounters (station, 1, 0);
575
      UpdatePacketCounters (station, 1, 0);
576
576
577
      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).");
577
      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).");
578
578
579
      station->m_isSampling = false;
579
      station->m_isSampling = false;
580
      station->m_sampleDeferred = false;
580
      station->m_sampleDeferred = false;
 Lines 591-597    Link Here 
591
        }
591
        }
592
    }
592
    }
593
593
594
  NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
594
  NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate  );
595
}
595
}
596
596
597
void
597
void
 Lines 606-612    Link Here 
606
      return;
606
      return;
607
    }
607
    }
608
608
609
  NS_LOG_DEBUG ("DoReportFinalDataFailed - TxRate=" << +station->m_txrate);
609
  NS_LOG_DEBUG ("DoReportFinalDataFailed - TxRate=" << station->m_txrate);
610
610
611
  if (!station->m_isHt)
611
  if (!station->m_isHt)
612
    {
612
    {
 Lines 638-644    Link Here 
638
          station->m_txrate = FindRate (station);
638
          station->m_txrate = FindRate (station);
639
        }
639
        }
640
    }
640
    }
641
  NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
641
  NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
642
}
642
}
643
643
644
void
644
void
 Lines 658-664    Link Here 
658
      NS_ASSERT_MSG (false,"A-MPDU Tx Status called but no HT or VHT supported.");
658
      NS_ASSERT_MSG (false,"A-MPDU Tx Status called but no HT or VHT supported.");
659
    }
659
    }
660
660
661
  NS_LOG_DEBUG ("DoReportAmpduTxStatus. TxRate=" << +station->m_txrate << " SuccMpdus= " <<
661
  NS_LOG_DEBUG ("DoReportAmpduTxStatus. TxRate=" << station->m_txrate << " SuccMpdus= " <<
662
                +nSuccessfulMpdus << " FailedMpdus= " << +nFailedMpdus);
662
                +nSuccessfulMpdus << " FailedMpdus= " << +nFailedMpdus);
663
663
664
  station->m_ampduPacketCount++;
664
  station->m_ampduPacketCount++;
 Lines 691-697    Link Here 
691
        {
691
        {
692
          station->m_txrate = FindRate (station);
692
          station->m_txrate = FindRate (station);
693
        }
693
        }
694
      NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
694
      NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
695
    }
695
    }
696
}
696
}
697
697
 Lines 793-799    Link Here 
793
          NS_ASSERT_MSG (false,"Max retries reached and m_longRetry not cleared properly. longRetry= " << station->m_longRetry);
793
          NS_ASSERT_MSG (false,"Max retries reached and m_longRetry not cleared properly. longRetry= " << station->m_longRetry);
794
        }
794
        }
795
    }
795
    }
796
  NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
796
  NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
797
}
797
}
798
798
799
void
799
void
 Lines 852-858    Link Here 
852
    }
852
    }
853
  else
853
  else
854
    {
854
    {
855
      NS_LOG_DEBUG ("DoGetDataMode m_txrate = " << +station->m_txrate);
855
      NS_LOG_DEBUG ("DoGetDataMode m_txrate= " << station->m_txrate);
856
856
857
      uint8_t rateId = GetRateId (station->m_txrate);
857
      uint8_t rateId = GetRateId (station->m_txrate);
858
      uint8_t groupId = GetGroupId (station->m_txrate);
858
      uint8_t groupId = GetGroupId (station->m_txrate);
 Lines 898-904    Link Here 
898
    }
898
    }
899
  else
899
  else
900
    {
900
    {
901
      NS_LOG_DEBUG ("DoGetRtsMode m_txrate = " << +station->m_txrate);
901
      NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
902
902
903
      /* RTS is sent in a non-HT frame. RTS with HT is not supported yet in NS3.
903
      /* RTS is sent in a non-HT frame. RTS with HT is not supported yet in NS3.
904
       * When supported, decision of using HT has to follow rules in Section 9.7.6 from 802.11-2012.
904
       * When supported, decision of using HT has to follow rules in Section 9.7.6 from 802.11-2012.
 Lines 1022-1028    Link Here 
1022
  return true;
1022
  return true;
1023
}
1023
}
1024
1024
1025
uint8_t
1025
uint16_t
1026
MinstrelHtWifiManager::GetNextSample (MinstrelHtWifiRemoteStation *station)
1026
MinstrelHtWifiManager::GetNextSample (MinstrelHtWifiRemoteStation *station)
1027
{
1027
{
1028
  NS_LOG_FUNCTION (this << station);
1028
  NS_LOG_FUNCTION (this << station);
 Lines 1030-1037    Link Here 
1030
  uint8_t index = station->m_groupsTable[sampleGroup].m_index;
1030
  uint8_t index = station->m_groupsTable[sampleGroup].m_index;
1031
  uint8_t col = station->m_groupsTable[sampleGroup].m_col;
1031
  uint8_t col = station->m_groupsTable[sampleGroup].m_col;
1032
  uint8_t sampleIndex = station->m_sampleTable[index][col];
1032
  uint8_t sampleIndex = station->m_sampleTable[index][col];
1033
  uint8_t rateIndex = GetIndex (sampleGroup, sampleIndex);
1033
  uint16_t rateIndex = GetIndex (sampleGroup, sampleIndex);
1034
  NS_LOG_DEBUG ("Next Sample is " << +rateIndex);
1034
  NS_LOG_DEBUG ("Next Sample is " << rateIndex);
1035
  SetNextSample (station); //Calculate the next sample rate.
1035
  SetNextSample (station); //Calculate the next sample rate.
1036
  return rateIndex;
1036
  return rateIndex;
1037
}
1037
}
 Lines 1067-1073    Link Here 
1067
  NS_LOG_DEBUG ("New sample set: group= " << +sampleGroup << " index= " << +station->m_sampleTable[index][col]);
1067
  NS_LOG_DEBUG ("New sample set: group= " << +sampleGroup << " index= " << +station->m_sampleTable[index][col]);
1068
}
1068
}
1069
1069
1070
uint8_t
1070
uint16_t
1071
MinstrelHtWifiManager::FindRate (MinstrelHtWifiRemoteStation *station)
1071
MinstrelHtWifiManager::FindRate (MinstrelHtWifiRemoteStation *station)
1072
{
1072
{
1073
  NS_LOG_FUNCTION (this << station);
1073
  NS_LOG_FUNCTION (this << station);
 Lines 1084-1091    Link Here 
1084
      //SAMPLING
1084
      //SAMPLING
1085
      NS_LOG_DEBUG ("Obtaining a sampling rate");
1085
      NS_LOG_DEBUG ("Obtaining a sampling rate");
1086
      /// Now go through the table and find an index rate.
1086
      /// Now go through the table and find an index rate.
1087
      uint8_t sampleIdx = GetNextSample (station);
1087
      uint16_t sampleIdx = GetNextSample (station);
1088
      NS_LOG_DEBUG ("Sampling rate = " << +sampleIdx);
1088
      NS_LOG_DEBUG ("Sampling rate = " << sampleIdx);
1089
1089
1090
      //Evaluate if the sampling rate selected should be used.
1090
      //Evaluate if the sampling rate selected should be used.
1091
      uint8_t sampleGroupId = GetGroupId (sampleIdx);
1091
      uint8_t sampleGroupId = GetGroupId (sampleIdx);
 Lines 1103-1110    Link Here 
1103
           */
1103
           */
1104
          HtRateInfo sampleRateInfo = station->m_groupsTable[sampleGroupId].m_ratesTable[sampleRateId];
1104
          HtRateInfo sampleRateInfo = station->m_groupsTable[sampleGroupId].m_ratesTable[sampleRateId];
1105
1105
1106
          NS_LOG_DEBUG ("Use sample rate? MaxTpRate= " << +station->m_maxTpRate << " CurrentRate= " << +station->m_txrate <<
1106
          NS_LOG_DEBUG ("Use sample rate? MaxTpRate= " << station->m_maxTpRate << " CurrentRate= " << station->m_txrate <<
1107
                        " SampleRate= " << +sampleIdx << " SampleProb= " << sampleRateInfo.ewmaProb);
1107
                        " SampleRate= " << sampleIdx << " SampleProb= " << sampleRateInfo.ewmaProb);
1108
1108
1109
          if (sampleIdx != station->m_maxTpRate && sampleIdx != station->m_maxTpRate2
1109
          if (sampleIdx != station->m_maxTpRate && sampleIdx != station->m_maxTpRate2
1110
              && sampleIdx != station->m_maxProbRate && sampleRateInfo.ewmaProb <= 95)
1110
              && sampleIdx != station->m_maxProbRate && sampleRateInfo.ewmaProb <= 95)
 Lines 1139-1145    Link Here 
1139
                  /// set the rate that we're currently sampling
1139
                  /// set the rate that we're currently sampling
1140
                  station->m_sampleRate = sampleIdx;
1140
                  station->m_sampleRate = sampleIdx;
1141
1141
1142
                  NS_LOG_DEBUG ("FindRate " << "sampleRate=" << +sampleIdx);
1142
                  NS_LOG_DEBUG ("FindRate " << "sampleRate=" << sampleIdx);
1143
                  station->m_sampleTries--;
1143
                  station->m_sampleTries--;
1144
                  return sampleIdx;
1144
                  return sampleIdx;
1145
                }
1145
                }
 Lines 1154-1160    Link Here 
1154
                      /// set the rate that we're currently sampling
1154
                      /// set the rate that we're currently sampling
1155
                      station->m_sampleRate = sampleIdx;
1155
                      station->m_sampleRate = sampleIdx;
1156
1156
1157
                      NS_LOG_DEBUG ("FindRate " << "sampleRate=" << +sampleIdx);
1157
                      NS_LOG_DEBUG ("FindRate " << "sampleRate=" << sampleIdx);
1158
                      station->m_sampleTries--;
1158
                      station->m_sampleTries--;
1159
                      return sampleIdx;
1159
                      return sampleIdx;
1160
                    }
1160
                    }
 Lines 1169-1175    Link Here 
1169
1169
1170
  ///	Continue using the best rate.
1170
  ///	Continue using the best rate.
1171
1171
1172
  NS_LOG_DEBUG ("FindRate " << "maxTpRrate=" << +station->m_maxTpRate);
1172
  NS_LOG_DEBUG ("FindRate " << "maxTpRrate=" << station->m_maxTpRate);
1173
  return station->m_maxTpRate;
1173
  return station->m_maxTpRate;
1174
}
1174
}
1175
void
1175
void
 Lines 1281-1287    Link Here 
1281
  CalculateRetransmits (station, station->m_maxTpRate2);
1281
  CalculateRetransmits (station, station->m_maxTpRate2);
1282
  CalculateRetransmits (station, station->m_maxProbRate);
1282
  CalculateRetransmits (station, station->m_maxProbRate);
1283
1283
1284
  NS_LOG_DEBUG ("max tp=" << +station->m_maxTpRate << "\nmax tp2=" << +station->m_maxTpRate2 << "\nmax prob=" << +station->m_maxProbRate);
1284
  NS_LOG_DEBUG ("max tp=" << station->m_maxTpRate << "\nmax tp2=" <<  station->m_maxTpRate2 << "\nmax prob=" << station->m_maxProbRate);
1285
  if (m_printStats)
1285
  if (m_printStats)
1286
    {
1286
    {
1287
      PrintTable (station);
1287
      PrintTable (station);
 Lines 1319-1325    Link Here 
1319
}
1319
}
1320
1320
1321
void
1321
void
1322
MinstrelHtWifiManager::SetBestProbabilityRate (MinstrelHtWifiRemoteStation *station, uint8_t index)
1322
MinstrelHtWifiManager::SetBestProbabilityRate (MinstrelHtWifiRemoteStation *station, uint16_t index)
1323
{
1323
{
1324
  GroupInfo *group;
1324
  GroupInfo *group;
1325
  HtRateInfo rate;
1325
  HtRateInfo rate;
 Lines 1380-1386    Link Here 
1380
 * MCS groups.
1380
 * MCS groups.
1381
 */
1381
 */
1382
void
1382
void
1383
MinstrelHtWifiManager::SetBestStationThRates (MinstrelHtWifiRemoteStation *station, uint8_t index)
1383
MinstrelHtWifiManager::SetBestStationThRates (MinstrelHtWifiRemoteStation *station, uint16_t index)
1384
{
1384
{
1385
  uint8_t groupId, rateId;
1385
  uint8_t groupId, rateId;
1386
  double th, prob;
1386
  double th, prob;
 Lines 1521-1529    Link Here 
1521
}
1521
}
1522
1522
1523
void
1523
void
1524
MinstrelHtWifiManager::CalculateRetransmits (MinstrelHtWifiRemoteStation *station, uint8_t index)
1524
MinstrelHtWifiManager::CalculateRetransmits (MinstrelHtWifiRemoteStation *station, uint16_t index)
1525
{
1525
{
1526
  NS_LOG_FUNCTION (this << station << +index);
1526
  NS_LOG_FUNCTION (this << station << index);
1527
  uint8_t groupId = GetGroupId (index);
1527
  uint8_t groupId = GetGroupId (index);
1528
  uint8_t rateId = GetRateId (index);
1528
  uint8_t rateId = GetRateId (index);
1529
  if (!station->m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated)
1529
  if (!station->m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated)
 Lines 1603-1609    Link Here 
1603
  //for off-setting to make rates fall between 0 and nModes
1603
  //for off-setting to make rates fall between 0 and nModes
1604
  uint8_t numSampleRates = m_numRates;
1604
  uint8_t numSampleRates = m_numRates;
1605
1605
1606
  uint8_t newIndex;
1606
  uint16_t newIndex;
1607
  for (uint8_t col = 0; col < m_nSampleCol; col++)
1607
  for (uint8_t col = 0; col < m_nSampleCol; col++)
1608
    {
1608
    {
1609
      for (uint8_t i = 0; i < numSampleRates; i++ )
1609
      for (uint8_t i = 0; i < numSampleRates; i++ )
 Lines 1670-1680    Link Here 
1670
              of << "VHT" << group.chWidth << "   " << giMode << "GI  " << (int)group.streams << "   ";
1670
              of << "VHT" << group.chWidth << "   " << giMode << "GI  " << (int)group.streams << "   ";
1671
            }
1671
            }
1672
1672
1673
          uint8_t maxTpRate = station->m_maxTpRate;
1673
          uint16_t maxTpRate = station->m_maxTpRate;
1674
          uint8_t maxTpRate2 = station->m_maxTpRate2;
1674
          uint16_t maxTpRate2 = station->m_maxTpRate2;
1675
          uint8_t maxProbRate = station->m_maxProbRate;
1675
          uint16_t maxProbRate = station->m_maxProbRate;
1676
1676
1677
          uint8_t idx = GetIndex (groupId, i);
1677
          uint16_t idx = GetIndex (groupId, i);
1678
          if (idx == maxTpRate)
1678
          if (idx == maxTpRate)
1679
            {
1679
            {
1680
              of << 'A';
1680
              of << 'A';
 Lines 1728-1755    Link Here 
1728
        }
1728
        }
1729
    }
1729
    }
1730
}
1730
}
1731
uint8_t
1731
uint16_t
1732
MinstrelHtWifiManager::GetIndex (uint8_t groupId, uint8_t rateId)
1732
MinstrelHtWifiManager::GetIndex (uint8_t groupId, uint8_t rateId)
1733
{
1733
{
1734
  NS_LOG_FUNCTION (this << +groupId << +rateId);
1734
  NS_LOG_FUNCTION (this << +groupId << +rateId);
1735
  uint8_t index;
1735
  uint16_t index;
1736
  index = groupId * m_numRates + rateId;
1736
  index = groupId * m_numRates + rateId;
1737
  return index;
1737
  return index;
1738
}
1738
}
1739
1739
1740
uint8_t
1740
uint8_t
1741
MinstrelHtWifiManager::GetRateId (uint8_t index)
1741
MinstrelHtWifiManager::GetRateId (uint16_t index)
1742
{
1742
{
1743
  NS_LOG_FUNCTION (this << +index);
1743
  NS_LOG_FUNCTION (this << index);
1744
  uint8_t id;
1744
  uint8_t id;
1745
  id = index % m_numRates;
1745
  id = index % m_numRates;
1746
  return id;
1746
  return id;
1747
}
1747
}
1748
1748
1749
uint8_t
1749
uint8_t
1750
MinstrelHtWifiManager::GetGroupId (uint8_t index)
1750
MinstrelHtWifiManager::GetGroupId (uint16_t index)
1751
{
1751
{
1752
  NS_LOG_FUNCTION (this << +index);
1752
  NS_LOG_FUNCTION (this << index);
1753
  return index / m_numRates;
1753
  return index / m_numRates;
1754
}
1754
}
1755
1755
 Lines 1767-1773    Link Here 
1767
  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;
1767
  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;
1768
}
1768
}
1769
1769
1770
uint8_t
1770
uint16_t
1771
MinstrelHtWifiManager::GetLowestIndex (MinstrelHtWifiRemoteStation *station)
1771
MinstrelHtWifiManager::GetLowestIndex (MinstrelHtWifiRemoteStation *station)
1772
{
1772
{
1773
  NS_LOG_FUNCTION (this << station);
1773
  NS_LOG_FUNCTION (this << station);
 Lines 1786-1795    Link Here 
1786
  return GetIndex (groupId, rateId);
1786
  return GetIndex (groupId, rateId);
1787
}
1787
}
1788
1788
1789
uint8_t
1789
uint16_t
1790
MinstrelHtWifiManager::GetLowestIndex (MinstrelHtWifiRemoteStation *station, uint8_t groupId)
1790
MinstrelHtWifiManager::GetLowestIndex (MinstrelHtWifiRemoteStation *station, uint8_t groupId)
1791
{
1791
{
1792
  NS_LOG_FUNCTION (this << station);
1792
  NS_LOG_FUNCTION (this << station << +groupId);
1793
1793
1794
  uint8_t rateId = 0;
1794
  uint8_t rateId = 0;
1795
  while (rateId < m_numRates && !station->m_groupsTable[groupId].m_ratesTable[rateId].supported)
1795
  while (rateId < m_numRates && !station->m_groupsTable[groupId].m_ratesTable[rateId].supported)
(-)a/src/wifi/model/minstrel-ht-wifi-manager.h (-35 / +24 lines)
 Lines 112-120    Link Here 
112
  uint8_t m_col;                  //!< Sample table column.
112
  uint8_t m_col;                  //!< Sample table column.
113
  uint8_t m_index;                //!< Sample table index.
113
  uint8_t m_index;                //!< Sample table index.
114
  bool m_supported;               //!< If the rates of this group are supported by the station.
114
  bool m_supported;               //!< If the rates of this group are supported by the station.
115
  uint8_t m_maxTpRate;            //!< The max throughput rate of this group.
115
  uint16_t m_maxTpRate;           //!< The max throughput rate of this group.
116
  uint8_t m_maxTpRate2;           //!< The second max throughput rate of this group.
116
  uint16_t m_maxTpRate2;          //!< The second max throughput rate of this group.
117
  uint8_t m_maxProbRate;          //!< The highest success probability rate of this group.
117
  uint16_t m_maxProbRate;         //!< The highest success probability rate of this group.
118
  HtMinstrelRate m_ratesTable;    //!< Information about rates of this group.
118
  HtMinstrelRate m_ratesTable;    //!< Information about rates of this group.
119
};
119
};
120
120
 Lines 125-136    Link Here 
125
typedef std::vector<struct GroupInfo> McsGroupData;
125
typedef std::vector<struct GroupInfo> McsGroupData;
126
126
127
/**
127
/**
128
 * Data structure for a Sample Rate table.
129
 * A vector of a vector uint8_t.
130
 */
131
typedef std::vector<std::vector<uint8_t> > HtSampleRate;
132
133
/**
134
 * Constants for maximum values.
128
 * Constants for maximum values.
135
 */
129
 */
136
130
 Lines 335-341    Link Here 
335
   * \param station the wifi remote station
329
   * \param station the wifi remote station
336
   * \returns the next sample
330
   * \returns the next sample
337
   */
331
   */
338
  uint8_t GetNextSample (MinstrelHtWifiRemoteStation *station);
332
  uint16_t GetNextSample (MinstrelHtWifiRemoteStation *station);
339
333
340
  /**
334
  /**
341
   * Set the next sample from Sample Table.
335
   * Set the next sample from Sample Table.
 Lines 350-356    Link Here 
350
   * \param station the minstrel HT wifi remote station
344
   * \param station the minstrel HT wifi remote station
351
   * \returns the rate
345
   * \returns the rate
352
   */
346
   */
353
  uint8_t FindRate (MinstrelHtWifiRemoteStation *station);
347
  uint16_t FindRate (MinstrelHtWifiRemoteStation *station);
354
348
355
  /**
349
  /**
356
   * Updating the Minstrel Table every 1/10 seconds.
350
   * Updating the Minstrel Table every 1/10 seconds.
 Lines 383-389    Link Here 
383
   * \param station the minstrel HT wifi remote station
377
   * \param station the minstrel HT wifi remote station
384
   * \param index the index
378
   * \param index the index
385
   */
379
   */
386
  void SetBestStationThRates (MinstrelHtWifiRemoteStation *station, uint8_t index);
380
  void SetBestStationThRates (MinstrelHtWifiRemoteStation *station, uint16_t index);
387
381
388
  /**
382
  /**
389
   * Set index rate as maxProbRate if it is better than current value.
383
   * Set index rate as maxProbRate if it is better than current value.
 Lines 391-397    Link Here 
391
   * \param station the minstrel HT wifi remote station
385
   * \param station the minstrel HT wifi remote station
392
   * \param index the index
386
   * \param index the index
393
   */
387
   */
394
  void SetBestProbabilityRate (MinstrelHtWifiRemoteStation *station, uint8_t index);
388
  void SetBestProbabilityRate (MinstrelHtWifiRemoteStation *station, uint16_t index);
395
389
396
  /**
390
  /**
397
   * Calculate the number of retransmissions to set for the index rate.
391
   * Calculate the number of retransmissions to set for the index rate.
 Lines 399-405    Link Here 
399
   * \param station the minstrel HT wifi remote station
393
   * \param station the minstrel HT wifi remote station
400
   * \param index the index
394
   * \param index the index
401
   */
395
   */
402
  void CalculateRetransmits (MinstrelHtWifiRemoteStation *station, uint8_t index);
396
  void CalculateRetransmits (MinstrelHtWifiRemoteStation *station, uint16_t index);
403
397
404
  /**
398
  /**
405
   * Calculate the number of retransmissions to set for the (groupId, rateId) rate.
399
   * Calculate the number of retransmissions to set for the (groupId, rateId) rate.
 Lines 469-478    Link Here 
469
   * Print group statistics.
463
   * Print group statistics.
470
   *
464
   *
471
   * \param station the minstrel HT wifi remote station
465
   * \param station the minstrel HT wifi remote station
472
   * \param index the index
466
   * \param groupId the group ID
473
   * \param of the output file stream
467
   * \param of the output file stream
474
   */
468
   */
475
  void StatsDump (MinstrelHtWifiRemoteStation *station, uint8_t index, std::ofstream &of);
469
  void StatsDump (MinstrelHtWifiRemoteStation *station, uint8_t groupId, std::ofstream &of);
476
470
477
  /**
471
  /**
478
   * Check for initializations.
472
   * Check for initializations.
 Lines 513-519    Link Here 
513
   * \param index the index
507
   * \param index the index
514
   * \returns the rate ID
508
   * \returns the rate ID
515
   */
509
   */
516
  uint8_t GetRateId (uint8_t index);
510
  uint8_t GetRateId (uint16_t index);
517
511
518
  /**
512
  /**
519
   * Return the groupId from the global index.
513
   * Return the groupId from the global index.
 Lines 521-527    Link Here 
521
   * \param index the index
515
   * \param index the index
522
   * \returns the group ID
516
   * \returns the group ID
523
   */
517
   */
524
  uint8_t GetGroupId (uint8_t index);
518
  uint8_t GetGroupId (uint16_t index);
525
519
526
  /**
520
  /**
527
   * Returns the global index corresponding to the groupId and rateId.
521
   * Returns the global index corresponding to the groupId and rateId.
 Lines 530-536    Link Here 
530
   * \param rateId the rate ID
524
   * \param rateId the rate ID
531
   * \returns the index
525
   * \returns the index
532
   */
526
   */
533
  uint8_t GetIndex (uint8_t groupId, uint8_t rateId);
527
  uint16_t GetIndex (uint8_t groupId, uint8_t rateId);
534
528
535
  /**
529
  /**
536
   * Returns the groupId of a HT MCS with the given number of streams, if using sgi and the channel width used.
530
   * Returns the groupId of a HT MCS with the given number of streams, if using sgi and the channel width used.
 Lines 558-564    Link Here 
558
   * \param station the minstrel HT wifi remote station
552
   * \param station the minstrel HT wifi remote station
559
   * \returns the lowest global index
553
   * \returns the lowest global index
560
   */
554
   */
561
  uint8_t GetLowestIndex (MinstrelHtWifiRemoteStation *station);
555
  uint16_t GetLowestIndex (MinstrelHtWifiRemoteStation *station);
562
556
563
  /**
557
  /**
564
   * Returns the lowest global index of the rates supported by in the group.
558
   * Returns the lowest global index of the rates supported by in the group.
 Lines 567-573    Link Here 
567
   * \param groupId the group ID
561
   * \param groupId the group ID
568
   * \returns the lowest global index
562
   * \returns the lowest global index
569
   */
563
   */
570
  uint8_t GetLowestIndex (MinstrelHtWifiRemoteStation *station, uint8_t groupId);
564
  uint16_t GetLowestIndex (MinstrelHtWifiRemoteStation *station, uint8_t groupId);
571
565
572
  /**
566
  /**
573
   * Returns a list of only the VHT MCS supported by the device.
567
   * Returns a list of only the VHT MCS supported by the device.
 Lines 581-605    Link Here 
581
   */
575
   */
582
  WifiModeList GetHtDeviceMcsList (void) const;
576
  WifiModeList GetHtDeviceMcsList (void) const;
583
577
584
  Time m_updateStats;         //!< How frequent do we calculate the stats (1/10 seconds).
578
  Time m_updateStats;        //!< How frequent do we calculate the stats (1/10 seconds).
585
  uint8_t m_lookAroundRate;    //!< The % to try other rates than our current rate.
579
  uint8_t m_lookAroundRate;  //!< The % to try other rates than our current rate.
586
  uint8_t m_ewmaLevel;        //!< Exponential weighted moving average level (or coefficient).
580
  uint8_t m_ewmaLevel;       //!< Exponential weighted moving average level (or coefficient).
587
581
  uint8_t m_nSampleCol;      //!< Number of sample columns.
588
  uint8_t m_nSampleCol;       //!< Number of sample columns.
582
  uint32_t m_frameLength;    //!< Frame length used for calculate modes TxTime.
589
  uint32_t m_frameLength;     //!< Frame length used for calculate modes TxTime.
583
  uint8_t m_numGroups;       //!< Number of groups Minstrel should consider.
590
584
  uint8_t m_numRates;        //!< Number of rates per group Minstrel should consider.
591
  uint8_t m_numGroups;         //!< Number of groups Minstrel should consider.
585
  bool m_useVhtOnly;         //!< If only VHT MCS should be used, instead of HT and VHT.
592
  uint8_t m_numRates;          //!< Number of rates per group Minstrel should consider.
586
  bool m_printStats;         //!< If statistics table should be printed.
593
594
  bool m_useVhtOnly;           //!< If only VHT MCS should be used, instead of HT and VHT.
595
596
  bool m_printStats;           //!< If statistics table should be printed.
597
587
598
  MinstrelMcsGroups m_minstrelGroups;                 //!< Global array for groups information.
588
  MinstrelMcsGroups m_minstrelGroups;                 //!< Global array for groups information.
599
589
600
  Ptr<MinstrelWifiManager> m_legacyManager;           //!< Pointer to an instance of MinstrelWifiManager. Used when 802.11n/ac not supported.
590
  Ptr<MinstrelWifiManager> m_legacyManager;           //!< Pointer to an instance of MinstrelWifiManager. Used when 802.11n/ac not supported.
601
591
602
603
  Ptr<UniformRandomVariable> m_uniformRandomVariable; //!< Provides uniform random variables.
592
  Ptr<UniformRandomVariable> m_uniformRandomVariable; //!< Provides uniform random variables.
604
593
605
  TracedValue<uint64_t> m_currentRate; //!< Trace rate changes
594
  TracedValue<uint64_t> m_currentRate; //!< Trace rate changes
(-)a/src/wifi/model/minstrel-wifi-manager.cc (-25 / +26 lines)
 Lines 231-237    Link Here 
231
  //for normal rate, we're not currently sampling random rates
231
  //for normal rate, we're not currently sampling random rates
232
  if (!station->m_isSampling)
232
  if (!station->m_isSampling)
233
    {
233
    {
234
      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);
234
      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);
235
      //use best throughput rate
235
      //use best throughput rate
236
      if (station->m_longRetry < station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)
236
      if (station->m_longRetry < station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)
237
        {
237
        {
 Lines 269-275    Link Here 
269
  //for look-around rate, we're currently sampling random rates
269
  //for look-around rate, we're currently sampling random rates
270
  else
270
  else
271
    {
271
    {
272
      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);
272
      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);
273
      //current sampling rate is slower than the current best rate
273
      //current sampling rate is slower than the current best rate
274
      if (station->m_sampleDeferred)
274
      if (station->m_sampleDeferred)
275
        {
275
        {
 Lines 374-380    Link Here 
374
MinstrelWifiManager::GetRtsTxVector (MinstrelWifiRemoteStation *station)
374
MinstrelWifiManager::GetRtsTxVector (MinstrelWifiRemoteStation *station)
375
{
375
{
376
  NS_LOG_FUNCTION (this << station);
376
  NS_LOG_FUNCTION (this << station);
377
  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << +station->m_txrate);
377
  NS_LOG_DEBUG ("DoGetRtsMode m_txrate=" << station->m_txrate);
378
  uint16_t channelWidth = GetChannelWidth (station);
378
  uint16_t channelWidth = GetChannelWidth (station);
379
  if (channelWidth > 20 && channelWidth != 22)
379
  if (channelWidth > 20 && channelWidth != 22)
380
    {
380
    {
 Lines 414-420    Link Here 
414
    }
414
    }
415
}
415
}
416
416
417
uint8_t
417
uint16_t
418
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station)
418
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station)
419
{
419
{
420
  NS_LOG_FUNCTION (this << station);
420
  NS_LOG_FUNCTION (this << station);
 Lines 424-430    Link Here 
424
      return 0;
424
      return 0;
425
    }
425
    }
426
426
427
  uint8_t idx = 0;
427
  uint16_t idx = 0;
428
  NS_LOG_DEBUG ("Total: " << station->m_totalPacketsCount << "  Sample: " << station->m_samplePacketsCount << "  Deferred: " << station->m_numSamplesDeferred);
428
  NS_LOG_DEBUG ("Total: " << station->m_totalPacketsCount << "  Sample: " << station->m_samplePacketsCount << "  Deferred: " << station->m_numSamplesDeferred);
429
429
430
  int delta = (station->m_totalPacketsCount * m_lookAroundRate / 100) - (station->m_samplePacketsCount + station->m_numSamplesDeferred / 2);
430
  int delta = (station->m_totalPacketsCount * m_lookAroundRate / 100) - (station->m_samplePacketsCount + station->m_numSamplesDeferred / 2);
 Lines 454-460    Link Here 
454
      //now go through the table and find an index rate
454
      //now go through the table and find an index rate
455
      idx = GetNextSample (station);
455
      idx = GetNextSample (station);
456
456
457
      NS_LOG_DEBUG ("Sample rate = " << +idx << "(" << GetSupported (station, idx) << ")");
457
      NS_LOG_DEBUG ("Sample rate = " << idx << "(" << GetSupported (station, idx) << ")");
458
458
459
      //error check
459
      //error check
460
      if (idx >= station->m_nModes)
460
      if (idx >= station->m_nModes)
 Lines 502-519    Link Here 
502
      //using the best rate instead
502
      //using the best rate instead
503
      if (station->m_sampleDeferred)
503
      if (station->m_sampleDeferred)
504
        {
504
        {
505
          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) << ")");
505
          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) << ")");
506
          idx = station->m_maxTpRate;
506
          idx = station->m_maxTpRate;
507
        }
507
        }
508
    }
508
    }
509
  //continue using the best rate
509
  //continue using the best rate
510
  else
510
  else
511
    {
511
    {
512
      NS_LOG_DEBUG ("Continue using the maximum throughput rate: " << +station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")");
512
      NS_LOG_DEBUG ("Continue using the maximum throughput rate: " << station->m_maxTpRate << "(" << GetSupported (station, station->m_maxTpRate) << ")");
513
      idx = station->m_maxTpRate;
513
      idx = station->m_maxTpRate;
514
    }
514
    }
515
515
516
  NS_LOG_DEBUG ("Rate = " << +idx << "(" << GetSupported (station, idx) << ")");
516
  NS_LOG_DEBUG ("Rate = " << idx << "(" << GetSupported (station, idx) << ")");
517
517
518
  return idx;
518
  return idx;
519
}
519
}
 Lines 534-540    Link Here 
534
  NS_LOG_FUNCTION (this);
534
  NS_LOG_FUNCTION (this);
535
  station->m_nextStatsUpdate = Simulator::Now () + m_updateStats;
535
  station->m_nextStatsUpdate = Simulator::Now () + m_updateStats;
536
  NS_LOG_DEBUG ("Next update at " << station->m_nextStatsUpdate);
536
  NS_LOG_DEBUG ("Next update at " << station->m_nextStatsUpdate);
537
  NS_LOG_DEBUG ("Currently using rate: " << +station->m_txrate << " (" << GetSupported (station, station->m_txrate) << ")");
537
  NS_LOG_DEBUG ("Currently using rate: " << station->m_txrate << " (" << GetSupported (station, station->m_txrate) << ")");
538
538
539
  Time txTime;
539
  Time txTime;
540
  uint32_t tempProb;
540
  uint32_t tempProb;
 Lines 552-558    Link Here 
552
          txTime = Seconds (1);
552
          txTime = Seconds (1);
553
        }
553
        }
554
554
555
      NS_LOG_DEBUG (i << " " << GetSupported (station, i) <<
555
      NS_LOG_DEBUG (+i << " " << GetSupported (station, i) <<
556
                    "\t" << station->m_minstrelTable[i].numRateAttempt <<
556
                    "\t" << station->m_minstrelTable[i].numRateAttempt <<
557
                    "\t" << station->m_minstrelTable[i].numRateSuccess);
557
                    "\t" << station->m_minstrelTable[i].numRateSuccess);
558
558
 Lines 686-692    Link Here 
686
686
687
  NS_LOG_DEBUG ("max throughput=" << +index_max_tp << "(" << GetSupported (station, index_max_tp) <<
687
  NS_LOG_DEBUG ("max throughput=" << +index_max_tp << "(" << GetSupported (station, index_max_tp) <<
688
                ")\tsecond max throughput=" << +index_max_tp2 << "(" << GetSupported (station, index_max_tp2) <<
688
                ")\tsecond max throughput=" << +index_max_tp2 << "(" << GetSupported (station, index_max_tp2) <<
689
                ")\tmax prob=" << index_max_prob << "(" << GetSupported (station, index_max_prob) << ")");
689
                ")\tmax prob=" << +index_max_prob << "(" << GetSupported (station, index_max_prob) << ")");
690
  if (m_printStats)
690
  if (m_printStats)
691
    {
691
    {
692
      PrintTable (station);
692
      PrintTable (station);
 Lines 701-707    Link Here 
701
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st, double rxSnr, WifiMode txMode)
701
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st, double rxSnr, WifiMode txMode)
702
{
702
{
703
  NS_LOG_FUNCTION (this << st << rxSnr << txMode);
703
  NS_LOG_FUNCTION (this << st << rxSnr << txMode);
704
  NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << +((MinstrelWifiRemoteStation *)st)->m_txrate);
704
  NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate);
705
}
705
}
706
706
707
void
707
void
 Lines 709-715    Link Here 
709
{
709
{
710
  NS_LOG_FUNCTION (this << st);
710
  NS_LOG_FUNCTION (this << st);
711
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
711
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
712
  NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << +station->m_txrate);
712
  NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate);
713
  station->m_shortRetry++;
713
  station->m_shortRetry++;
714
}
714
}
715
715
 Lines 732-738    Link Here 
732
{
732
{
733
  NS_LOG_FUNCTION (this << st);
733
  NS_LOG_FUNCTION (this << st);
734
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
734
  MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st;
735
  NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << +station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
735
  NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry);
736
  CheckInit (station);
736
  CheckInit (station);
737
  if (!station->m_initialized)
737
  if (!station->m_initialized)
738
    {
738
    {
 Lines 755-768    Link Here 
755
      return;
755
      return;
756
    }
756
    }
757
757
758
  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).");
758
  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).");
759
759
760
  station->m_minstrelTable[station->m_txrate].numRateSuccess++;
760
  station->m_minstrelTable[station->m_txrate].numRateSuccess++;
761
  station->m_minstrelTable[station->m_txrate].numRateAttempt++;
761
  station->m_minstrelTable[station->m_txrate].numRateAttempt++;
762
762
763
  UpdatePacketCounters (station);
763
  UpdatePacketCounters (station);
764
764
765
  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).");
765
  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).");
766
766
767
  UpdateRetry (station);
767
  UpdateRetry (station);
768
  UpdateStats (station);
768
  UpdateStats (station);
 Lines 771-777    Link Here 
771
    {
771
    {
772
      station->m_txrate = FindRate (station);
772
      station->m_txrate = FindRate (station);
773
    }
773
    }
774
  NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
774
  NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
775
}
775
}
776
776
777
void
777
void
 Lines 799-805    Link Here 
799
    {
799
    {
800
      station->m_txrate = FindRate (station);
800
      station->m_txrate = FindRate (station);
801
    }
801
    }
802
  NS_LOG_DEBUG ("Next rate to use TxRate = " << +station->m_txrate);
802
  NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate);
803
}
803
}
804
804
805
void
805
void
 Lines 883-893    Link Here 
883
  return true;
883
  return true;
884
}
884
}
885
885
886
uint8_t
886
uint16_t
887
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station)
887
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station)
888
{
888
{
889
  NS_LOG_FUNCTION (this << station);
889
  NS_LOG_FUNCTION (this << station);
890
  uint8_t bitrate = station->m_sampleTable[station->m_index][station->m_col];
890
  uint16_t bitrate;
891
  bitrate = station->m_sampleTable[station->m_index][station->m_col];
891
  station->m_index++;
892
  station->m_index++;
892
893
893
  //bookkeeping for m_index and m_col variables
894
  //bookkeeping for m_index and m_col variables
 Lines 982-988    Link Here 
982
  //for off-setting to make rates fall between 0 and nModes
983
  //for off-setting to make rates fall between 0 and nModes
983
  uint8_t numSampleRates = station->m_nModes;
984
  uint8_t numSampleRates = station->m_nModes;
984
985
985
  uint8_t newIndex;
986
  uint16_t newIndex;
986
  for (uint8_t col = 0; col < m_sampleCol; col++)
987
  for (uint8_t col = 0; col < m_sampleCol; col++)
987
    {
988
    {
988
      for (uint8_t i = 0; i < numSampleRates; i++ )
989
      for (uint8_t i = 0; i < numSampleRates; i++ )
 Lines 1027-1035    Link Here 
1027
  station->m_statsFile << "best   _______________rate________________    ________statistics________    ________last_______    ______sum-of________\n" <<
1028
  station->m_statsFile << "best   _______________rate________________    ________statistics________    ________last_______    ______sum-of________\n" <<
1028
    "rate  [      name       idx airtime max_tp]  [avg(tp) avg(prob) sd(prob)]  [prob.|retry|suc|att]  [#success | #attempts]\n";
1029
    "rate  [      name       idx airtime max_tp]  [avg(tp) avg(prob) sd(prob)]  [prob.|retry|suc|att]  [#success | #attempts]\n";
1029
1030
1030
  uint8_t maxTpRate = station->m_maxTpRate;
1031
  uint16_t maxTpRate = station->m_maxTpRate;
1031
  uint8_t maxTpRate2 = station->m_maxTpRate2;
1032
  uint16_t maxTpRate2 = station->m_maxTpRate2;
1032
  uint8_t maxProbRate = station->m_maxProbRate;
1033
  uint16_t maxProbRate = station->m_maxProbRate;
1033
1034
1034
  for (uint8_t i = 0; i < station->m_nModes; i++)
1035
  for (uint8_t i = 0; i < station->m_nModes; i++)
1035
    {
1036
    {
(-)a/src/wifi/model/minstrel-wifi-manager.h (-7 / +7 lines)
 Lines 92-111    Link Here 
92
   */
92
   */
93
  uint8_t m_col;                 ///< vector index
93
  uint8_t m_col;                 ///< vector index
94
  uint8_t m_index;               ///< vector index
94
  uint8_t m_index;               ///< vector index
95
  uint8_t m_maxTpRate;           ///< the current throughput rate
95
  uint16_t m_maxTpRate;          ///< the current throughput rate
96
  uint8_t m_maxTpRate2;          ///< second highest throughput rate
96
  uint16_t m_maxTpRate2;         ///< second highest throughput rate
97
  uint8_t m_maxProbRate;         ///< rate with highest prob of success
97
  uint16_t m_maxProbRate;        ///< rate with highest prob of success
98
  uint8_t m_nModes;              ///< number of modes supported
98
  uint8_t m_nModes;              ///< number of modes supported
99
  int m_totalPacketsCount;       ///< total number of packets as of now
99
  int m_totalPacketsCount;       ///< total number of packets as of now
100
  int m_samplePacketsCount;      ///< how many packets we have sample so far
100
  int m_samplePacketsCount;      ///< how many packets we have sample so far
101
  int m_numSamplesDeferred;      ///< number samles deferred
101
  int m_numSamplesDeferred;      ///< number samles deferred
102
  bool m_isSampling;             ///< a flag to indicate we are currently sampling
102
  bool m_isSampling;             ///< a flag to indicate we are currently sampling
103
  uint8_t m_sampleRate;          ///< current sample rate
103
  uint16_t m_sampleRate;         ///< current sample rate
104
  bool m_sampleDeferred;         ///< a flag to indicate sample rate is on the second stage
104
  bool m_sampleDeferred;         ///< a flag to indicate sample rate is on the second stage
105
  uint32_t m_shortRetry;         ///< short retries such as control packts
105
  uint32_t m_shortRetry;         ///< short retries such as control packts
106
  uint32_t m_longRetry;          ///< long retries such as data packets
106
  uint32_t m_longRetry;          ///< long retries such as data packets
107
  uint32_t m_retry;              ///< total retries short + long
107
  uint32_t m_retry;              ///< total retries short + long
108
  uint8_t m_txrate;              ///< current transmit rate
108
  uint16_t m_txrate;             ///< current transmit rate
109
  bool m_initialized;            ///< for initializing tables
109
  bool m_initialized;            ///< for initializing tables
110
  MinstrelRate m_minstrelTable;  ///< minstrel table
110
  MinstrelRate m_minstrelTable;  ///< minstrel table
111
  SampleRate m_sampleTable;      ///< sample table
111
  SampleRate m_sampleTable;      ///< sample table
 Lines 203-209    Link Here 
203
   * \param station the station object
203
   * \param station the station object
204
   * \returns the rate
204
   * \returns the rate
205
   */
205
   */
206
  uint8_t FindRate (MinstrelWifiRemoteStation *station);
206
  uint16_t FindRate (MinstrelWifiRemoteStation *station);
207
207
208
  /**
208
  /**
209
   * Get data transmit vector
209
   * Get data transmit vector
 Lines 306-312    Link Here 
306
   * \param station the station object
306
   * \param station the station object
307
   * \returns the next sample
307
   * \returns the next sample
308
   */
308
   */
309
  uint8_t GetNextSample (MinstrelWifiRemoteStation *station);
309
  uint16_t GetNextSample (MinstrelWifiRemoteStation *station);
310
310
311
  /**
311
  /**
312
   * Estimate the time to transmit the given packet with the given number of retries.
312
   * Estimate the time to transmit the given packet with the given number of retries.

Return to bug 2950