|
Lines 858-891
MinstrelWifiManager::CalculateTimeUnicastPacket (Time dataTransmissionTime, uint
|
Link Here
|
|---|
|
| 858 |
cw = std::min (cwMax, (cw + 1) * 2); |
858 |
cw = std::min (cwMax, (cw + 1) * 2); |
| 859 |
} |
859 |
} |
| 860 |
|
860 |
|
| 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; |
861 |
return tt; |
| 890 |
} |
862 |
} |
| 891 |
|
863 |
|
|
Lines 929-942
MinstrelWifiManager::PrintSampleTable (MinstrelWifiRemoteStation *station)
|
Link Here
|
|---|
|
| 929 |
NS_LOG_DEBUG ("PrintSampleTable=" << station); |
901 |
NS_LOG_DEBUG ("PrintSampleTable=" << station); |
| 930 |
|
902 |
|
| 931 |
uint32_t numSampleRates = m_nsupported; |
903 |
uint32_t numSampleRates = m_nsupported; |
|
|
904 |
std::stringstream table; |
| 932 |
for (uint32_t i = 0; i < numSampleRates; i++) |
905 |
for (uint32_t i = 0; i < numSampleRates; i++) |
| 933 |
{ |
906 |
{ |
| 934 |
for (uint32_t j = 0; j < m_sampleCol; j++) |
907 |
for (uint32_t j = 0; j < m_sampleCol; j++) |
| 935 |
{ |
908 |
{ |
| 936 |
std::cout << station->m_sampleTable[i][j] << "\t"; |
909 |
table << station->m_sampleTable[i][j] << "\t"; |
| 937 |
} |
910 |
} |
| 938 |
std::cout << std::endl; |
911 |
table << std::endl; |
| 939 |
} |
912 |
} |
|
|
913 |
NS_LOG_DEBUG (table.str()); |
| 940 |
} |
914 |
} |
| 941 |
|
915 |
|
| 942 |
void |
916 |
void |