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

(-)a/src/wifi/model/ideal-wifi-manager.cc (-9 / +11 lines)
 Lines 264-270   IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st) Link Here 
264
  std::vector<WifiTxVector> candidateTxVectors;
264
  std::vector<WifiTxVector> candidateTxVectors;
265
  WifiTxVector txVector;
265
  WifiTxVector txVector;
266
  WifiMode mode;
266
  WifiMode mode;
267
  uint8_t nss = 1;
267
  uint8_t nss;
268
  uint8_t selectedNss = 1;
268
  txVector.SetChannelWidth (GetPhy ()->GetChannelWidth ());
269
  txVector.SetChannelWidth (GetPhy ()->GetChannelWidth ());
269
  txVector.SetGuardInterval (GetPhy ()->GetShortGuardInterval () ? 400 : 800);
270
  txVector.SetGuardInterval (GetPhy ()->GetShortGuardInterval () ? 400 : 800);
270
  if (station->m_lastSnrObserved == station->m_lastSnrCached)
271
  if (station->m_lastSnrObserved == station->m_lastSnrCached)
 Lines 272-278   IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st) Link Here 
272
      // SNR has not changed, so skip the search and use the last
273
      // SNR has not changed, so skip the search and use the last
273
      // mode selected
274
      // mode selected
274
      maxMode = station->m_lastMode;
275
      maxMode = station->m_lastMode;
275
      nss = station->m_nss;
276
      selectedNss = station->m_nss;
276
      NS_LOG_DEBUG ("Using cached mode = " << maxMode.GetUniqueName () <<
277
      NS_LOG_DEBUG ("Using cached mode = " << maxMode.GetUniqueName () <<
277
                    " last snr observed " << station->m_lastSnrObserved <<
278
                    " last snr observed " << station->m_lastSnrObserved <<
278
                    " cached " << station->m_lastSnrCached);
279
                    " cached " << station->m_lastSnrCached);
 Lines 326-343   IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st) Link Here 
326
                                station->m_lastSnrObserved);
327
                                station->m_lastSnrObserved);
327
                  maxThreshold = threshold;
328
                  maxThreshold = threshold;
328
                  maxMode = mode;
329
                  maxMode = mode;
330
                  selectedNss = nss;
329
                }
331
                }
330
            }
332
            }
331
        }
333
        }
332
      else
334
      else
333
        {
335
        {
334
          // Non-HT selection
336
          // Non-HT selection
335
          nss = 1;
337
          selectedNss = 1;
336
          for (uint32_t i = 0; i < GetNSupported (station); i++)
338
          for (uint32_t i = 0; i < GetNSupported (station); i++)
337
            {
339
            {
338
              mode = GetSupported (station, i);
340
              mode = GetSupported (station, i);
339
              txVector.SetMode (mode);
341
              txVector.SetMode (mode);
340
              txVector.SetNss (nss);
342
              txVector.SetNss (selectedNss);
341
              txVector.SetChannelWidth (GetChannelWidthForMode (mode));
343
              txVector.SetChannelWidth (GetChannelWidthForMode (mode));
342
              double threshold = GetSnrThreshold (txVector);
344
              double threshold = GetSnrThreshold (txVector);
343
              NS_LOG_DEBUG ("mode = " << mode.GetUniqueName () <<
345
              NS_LOG_DEBUG ("mode = " << mode.GetUniqueName () <<
 Lines 358-373   IdealWifiManager::DoGetDataTxVector (WifiRemoteStation *st) Link Here 
358
      NS_LOG_DEBUG ("Updating cached values for station to " <<  maxMode.GetUniqueName () << " snr " << station->m_lastSnrObserved);
360
      NS_LOG_DEBUG ("Updating cached values for station to " <<  maxMode.GetUniqueName () << " snr " << station->m_lastSnrObserved);
359
      station->m_lastSnrCached = station->m_lastSnrObserved;
361
      station->m_lastSnrCached = station->m_lastSnrObserved;
360
      station->m_lastMode = maxMode;
362
      station->m_lastMode = maxMode;
361
      station->m_nss = nss;
363
      station->m_nss = selectedNss;
362
    }
364
    }
363
  uint8_t channelWidth = GetChannelWidth (station);
365
  uint8_t channelWidth = GetChannelWidth (station);
364
  NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << (uint16_t) channelWidth);
366
  NS_LOG_DEBUG ("Found maxMode: " << maxMode << " channelWidth: " << (uint16_t) channelWidth);
365
  if (m_currentRate != maxMode.GetDataRate (channelWidth, GetPhy ()->GetShortGuardInterval (), nss))
367
  if (m_currentRate != maxMode.GetDataRate (channelWidth, GetPhy ()->GetShortGuardInterval (), selectedNss))
366
    {
368
    {
367
      NS_LOG_DEBUG ("New datarate: " << maxMode.GetDataRate (channelWidth, GetPhy ()->GetShortGuardInterval (), nss));
369
      NS_LOG_DEBUG ("New datarate: " << maxMode.GetDataRate (channelWidth, GetPhy ()->GetShortGuardInterval (), selectedNss));
368
      m_currentRate = maxMode.GetDataRate (channelWidth, GetPhy ()->GetShortGuardInterval (), nss);
370
      m_currentRate = maxMode.GetDataRate (channelWidth, GetPhy ()->GetShortGuardInterval (), selectedNss);
369
    }
371
    }
370
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (maxMode, GetAddress (station)), false, GetNumberOfAntennas (), nss, 0, channelWidth, GetAggregation (station), false);
372
  return WifiTxVector (maxMode, GetDefaultTxPowerLevel (), GetLongRetryCount (station), GetPreambleForTransmission (maxMode, GetAddress (station)), false, GetNumberOfAntennas (), selectedNss, 0, channelWidth, GetAggregation (station), false);
371
}
373
}
372
374
373
WifiTxVector
375
WifiTxVector

Return to bug 2647