|
|
| 429 |
|
429 |
|
| 430 |
UpdateRetry (station); |
430 |
UpdateRetry (station); |
| 431 |
|
431 |
|
| 432 |
//station->m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry; |
|
|
| 433 |
station->m_packetCount++; |
432 |
station->m_packetCount++; |
| 434 |
|
433 |
|
| 435 |
if (m_nsupported >= 1) |
434 |
if (m_nsupported >= 1) |
|
|
| 443 |
{ |
442 |
{ |
| 444 |
NS_LOG_FUNCTION (st); |
443 |
NS_LOG_FUNCTION (st); |
| 445 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
444 |
MinstrelWifiRemoteStation *station = (MinstrelWifiRemoteStation *) st; |
|
|
445 |
|
| 446 |
CheckInit (station); |
| 447 |
if (!station->m_initialized) |
| 448 |
{ |
| 449 |
return; |
| 450 |
} |
| 451 |
|
| 446 |
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before update)."); |
452 |
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before update)."); |
| 447 |
|
453 |
|
| 448 |
station->m_isSampling = false; |
454 |
station->m_isSampling = false; |
|
|
| 450 |
|
456 |
|
| 451 |
UpdateRetry (station); |
457 |
UpdateRetry (station); |
| 452 |
|
458 |
|
| 453 |
//station->m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry; |
|
|
| 454 |
station->m_err++; |
459 |
station->m_err++; |
| 455 |
|
460 |
|
| 456 |
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update)."); |
461 |
NS_LOG_DEBUG ("DoReportFinalDataFailed m_txrate = " << station->m_txrate << ", attempt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (after update)."); |
|
|
| 793 |
NS_LOG_DEBUG ("max throughput=" << index_max_tp << "(" << GetSupported (station, index_max_tp) << |
798 |
NS_LOG_DEBUG ("max throughput=" << index_max_tp << "(" << GetSupported (station, index_max_tp) << |
| 794 |
")\tsecond max throughput=" << index_max_tp2 << "(" << GetSupported (station, index_max_tp2) << |
799 |
")\tsecond max throughput=" << index_max_tp2 << "(" << GetSupported (station, index_max_tp2) << |
| 795 |
")\tmax prob=" << index_max_prob << "(" << GetSupported (station, index_max_prob) << ")"); |
800 |
")\tmax prob=" << index_max_prob << "(" << GetSupported (station, index_max_prob) << ")"); |
| 796 |
|
|
|
| 797 |
/// reset it |
| 798 |
//RateInit (station); |
| 799 |
} |
801 |
} |
| 800 |
|
802 |
|
| 801 |
void |
803 |
void |
|
|
| 858 |
cw = std::min (cwMax, (cw + 1) * 2); |
860 |
cw = std::min (cwMax, (cw + 1) * 2); |
| 859 |
} |
861 |
} |
| 860 |
|
862 |
|
| 861 |
/* |
|
|
| 862 |
// First, we have to sense idle channel for DIFS (SIFS + 2*SLOT) |
| 863 |
Time tt = GetMac ()->GetSifs () + GetMac ()->GetSlot () + GetMac ()->GetSlot (); |
| 864 |
NS_LOG_DEBUG ("tt (DIFS) = " << tt); |
| 865 |
|
| 866 |
// Next, we add the ACK timeout duration. Since we are given longRetries, the number of ACK timeout |
| 867 |
// is longRetries + 1 (first transmission and longRetries times). |
| 868 |
tt += NanoSeconds ((longRetries + 1) * GetMac ()->GetAckTimeout ()); |
| 869 |
NS_LOG_DEBUG ("tt (DIFS + ACKs) = " << tt << " (ACK TO) = " << GetMac ()->GetAckTimeout ()); |
| 870 |
// Next, we add the time to send (longRetries + 1) DATA. Same logic as ACK timeout. |
| 871 |
// They can be combined, but separated for clarity. |
| 872 |
tt += NanoSeconds ((longRetries + 1) * dataTransmissionTime); |
| 873 |
NS_LOG_DEBUG ("tt (DIFS + ACKs + DATAs) = " << tt); |
| 874 |
|
| 875 |
// Finally, we account for the backoff time between retransmissions. |
| 876 |
// The original minstrel code seems to estimate the time as half the current contention window. |
| 877 |
// The calculation of the original minsrel code is a little bit off (not exactly half) so we do the same. |
| 878 |
// In addition, WIFI_CW_MIN is set to 31 in the original code. |
| 879 |
uint32_t cwMax = 1023; |
| 880 |
uint32_t cw = 31; |
| 881 |
for (uint32_t i = 0; i <= (shortRetries + longRetries); i++) |
| 882 |
{ |
| 883 |
cw = std::min (cwMax, (cw + 1) * 2); // estimate the current contention window size (I think it's a bit off) |
| 884 |
NS_LOG_DEBUG (" cw = " << cw); |
| 885 |
tt += NanoSeconds ((cw / 2) * GetMac ()->GetSlot ()); // average is about half |
| 886 |
NS_LOG_DEBUG (" tt (DIFS + ACKs + DATAs + " << cw << " cw) = " << tt); |
| 887 |
} |
| 888 |
*/ |
| 889 |
return tt; |
863 |
return tt; |
| 890 |
} |
864 |
} |
| 891 |
|
865 |
|
|
|
| 929 |
NS_LOG_DEBUG ("PrintSampleTable=" << station); |
903 |
NS_LOG_DEBUG ("PrintSampleTable=" << station); |
| 930 |
|
904 |
|
| 931 |
uint32_t numSampleRates = m_nsupported; |
905 |
uint32_t numSampleRates = m_nsupported; |
|
|
906 |
std::stringstream table; |
| 932 |
for (uint32_t i = 0; i < numSampleRates; i++) |
907 |
for (uint32_t i = 0; i < numSampleRates; i++) |
| 933 |
{ |
908 |
{ |
| 934 |
for (uint32_t j = 0; j < m_sampleCol; j++) |
909 |
for (uint32_t j = 0; j < m_sampleCol; j++) |
| 935 |
{ |
910 |
{ |
| 936 |
std::cout << station->m_sampleTable[i][j] << "\t"; |
911 |
table << station->m_sampleTable[i][j] << "\t"; |
| 937 |
} |
912 |
} |
| 938 |
std::cout << std::endl; |
913 |
table << std::endl; |
| 939 |
} |
914 |
} |
|
|
915 |
NS_LOG_DEBUG (table.str()); |
| 940 |
} |
916 |
} |
| 941 |
|
917 |
|
| 942 |
void |
918 |
void |