|
Lines 361-372
MinstrelWifiManager::GetDataTxVector (MinstrelWifiRemoteStation *station)
|
Link Here
|
|---|
|
| 361 |
if (!station->m_initialized) |
361 |
if (!station->m_initialized) |
| 362 |
{ |
362 |
{ |
| 363 |
CheckInit (station); |
363 |
CheckInit (station); |
| 364 |
|
|
|
| 365 |
//start the rate at half way |
| 366 |
station->m_txrate = station->m_nModes / 2; |
| 367 |
} |
364 |
} |
| 368 |
WifiMode mode = GetSupported (station, station->m_txrate); |
365 |
WifiMode mode = GetSupported (station, station->m_txrate); |
| 369 |
if (m_currentRate != mode.GetDataRate (channelWidth)) |
366 |
if (m_currentRate != mode.GetDataRate (channelWidth) && !station->m_isSampling) |
| 370 |
{ |
367 |
{ |
| 371 |
NS_LOG_DEBUG ("New datarate: " << mode.GetDataRate (channelWidth)); |
368 |
NS_LOG_DEBUG ("New datarate: " << mode.GetDataRate (channelWidth)); |
| 372 |
m_currentRate = mode.GetDataRate (channelWidth); |
369 |
m_currentRate = mode.GetDataRate (channelWidth); |
|
Lines 431-436
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station)
|
Link Here
|
|---|
|
| 431 |
|
428 |
|
| 432 |
uint32_t idx; |
429 |
uint32_t idx; |
| 433 |
|
430 |
|
|
|
431 |
NS_LOG_DEBUG ("Total: " << station->m_totalPacketsCount << " Sample: " << station->m_samplePacketsCount << " Deferred: " << station->m_numSamplesDeferred); |
| 432 |
|
| 434 |
int delta = (station->m_totalPacketsCount * m_lookAroundRate / 100) - (station->m_samplePacketsCount + station->m_numSamplesDeferred / 2); |
433 |
int delta = (station->m_totalPacketsCount * m_lookAroundRate / 100) - (station->m_samplePacketsCount + station->m_numSamplesDeferred / 2); |
| 435 |
|
434 |
|
| 436 |
NS_LOG_DEBUG ("Decide sampling. Delta: " << delta << " lookAroundRatio: " << m_lookAroundRate); |
435 |
NS_LOG_DEBUG ("Decide sampling. Delta: " << delta << " lookAroundRatio: " << m_lookAroundRate); |
|
Lines 458-463
MinstrelWifiManager::FindRate (MinstrelWifiRemoteStation *station)
|
Link Here
|
|---|
|
| 458 |
//now go through the table and find an index rate |
457 |
//now go through the table and find an index rate |
| 459 |
idx = GetNextSample (station); |
458 |
idx = GetNextSample (station); |
| 460 |
|
459 |
|
|
|
460 |
NS_LOG_DEBUG ("Sample rate = " << idx << "(" << GetSupported (station, idx) << ")"); |
| 461 |
|
| 461 |
//error check |
462 |
//error check |
| 462 |
if (idx >= station->m_nModes) |
463 |
if (idx >= station->m_nModes) |
| 463 |
{ |
464 |
{ |
|
Lines 699-704
MinstrelWifiManager::DoReportRxOk (WifiRemoteStation *st,
|
Link Here
|
|---|
|
| 699 |
double rxSnr, WifiMode txMode) |
700 |
double rxSnr, WifiMode txMode) |
| 700 |
{ |
701 |
{ |
| 701 |
NS_LOG_FUNCTION (this << st << rxSnr << txMode); |
702 |
NS_LOG_FUNCTION (this << st << rxSnr << txMode); |
|
|
703 |
NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelWifiRemoteStation *)st)->m_txrate); |
| 702 |
} |
704 |
} |
| 703 |
|
705 |
|
| 704 |
void |
706 |
void |
|
Lines 723-728
MinstrelWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st)
|
Link Here
|
|---|
|
| 723 |
{ |
725 |
{ |
| 724 |
NS_LOG_FUNCTION (this << st); |
726 |
NS_LOG_FUNCTION (this << st); |
| 725 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
727 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
|
|
728 |
NS_LOG_DEBUG ("Final RTS failed"); |
| 726 |
UpdateRetry (station); |
729 |
UpdateRetry (station); |
| 727 |
} |
730 |
} |
| 728 |
|
731 |
|
|
Lines 731-736
MinstrelWifiManager::DoReportDataFailed (WifiRemoteStation *st)
|
Link Here
|
|---|
|
| 731 |
{ |
734 |
{ |
| 732 |
NS_LOG_FUNCTION (this << st); |
735 |
NS_LOG_FUNCTION (this << st); |
| 733 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
736 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *)st; |
|
|
737 |
NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txrate << "\tlongRetry \t" << station->m_longRetry); |
| 734 |
CheckInit (station); |
738 |
CheckInit (station); |
| 735 |
if (!station->m_initialized) |
739 |
if (!station->m_initialized) |
| 736 |
{ |
740 |
{ |
|
Lines 769-774
MinstrelWifiManager::DoReportDataOk (WifiRemoteStation *st,
|
Link Here
|
|---|
|
| 769 |
{ |
773 |
{ |
| 770 |
station->m_txrate = FindRate (station); |
774 |
station->m_txrate = FindRate (station); |
| 771 |
} |
775 |
} |
|
|
776 |
NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate ); |
| 772 |
} |
777 |
} |
| 773 |
|
778 |
|
| 774 |
void |
779 |
void |
|
Lines 796-801
MinstrelWifiManager::DoReportFinalDataFailed (WifiRemoteStation *st)
|
Link Here
|
|---|
|
| 796 |
{ |
801 |
{ |
| 797 |
station->m_txrate = FindRate (station); |
802 |
station->m_txrate = FindRate (station); |
| 798 |
} |
803 |
} |
|
|
804 |
NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate ); |
| 799 |
} |
805 |
} |
| 800 |
|
806 |
|
| 801 |
void |
807 |
void |
|
Lines 861-872
MinstrelWifiManager::DoNeedDataRetransmission (WifiRemoteStation *st, Ptr<const
|
Link Here
|
|---|
|
| 861 |
{ |
867 |
{ |
| 862 |
return normally; |
868 |
return normally; |
| 863 |
} |
869 |
} |
| 864 |
if (station->m_longRetry > CountRetries (station)) |
870 |
if (station->m_longRetry >= CountRetries (station)) |
| 865 |
{ |
871 |
{ |
|
|
872 |
NS_LOG_DEBUG ("No re-transmission allowed. Retries: " << station->m_longRetry << " Max retries: " << CountRetries (station)); |
| 866 |
return false; |
873 |
return false; |
| 867 |
} |
874 |
} |
| 868 |
else |
875 |
else |
| 869 |
{ |
876 |
{ |
|
|
877 |
NS_LOG_DEBUG ("Re-transmit. Retries: " << station->m_longRetry << " Max retries: " << CountRetries (station)); |
| 870 |
return true; |
878 |
return true; |
| 871 |
} |
879 |
} |
| 872 |
} |
880 |
} |
|
Lines 989-994
MinstrelWifiManager::InitSampleTable (MinstrelWifiRemoteStation *station)
|
Link Here
|
|---|
|
| 989 |
* between 0 and the number of available rates |
997 |
* between 0 and the number of available rates |
| 990 |
*/ |
998 |
*/ |
| 991 |
int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates); |
999 |
int uv = m_uniformRandomVariable->GetInteger (0, numSampleRates); |
|
|
1000 |
NS_LOG_DEBUG("InitSampleTable uv: " << uv); |
| 992 |
newIndex = (i + uv) % numSampleRates; |
1001 |
newIndex = (i + uv) % numSampleRates; |
| 993 |
|
1002 |
|
| 994 |
//this loop is used for filling in other uninitialized places |
1003 |
//this loop is used for filling in other uninitialized places |