|
44 |
|
44 |
|
45 |
namespace ns3 { |
45 |
namespace ns3 { |
46 |
|
46 |
|
47 |
/** |
|
|
48 |
* A struct to contain all information related to a data rate |
49 |
*/ |
50 |
struct RateInfo |
51 |
{ |
52 |
/** |
53 |
* Perfect transmission time calculation, or frame calculation |
54 |
* Given a bit rate and a packet length n bytes |
55 |
*/ |
56 |
Time perfectTxTime; |
57 |
|
58 |
|
59 |
uint32_t retryCount; ///< retry limit |
60 |
uint32_t adjustedRetryCount; ///< adjust the retry limit for this rate |
61 |
uint32_t numRateAttempt; ///< how many number of attempts so far |
62 |
uint32_t numRateSuccess; ///< number of successful pkts |
63 |
uint32_t prob; ///< (# pkts success )/(# total pkts) |
64 |
|
65 |
/** |
66 |
* EWMA calculation |
67 |
* ewma_prob =[prob *(100 - ewma_level) + (ewma_prob_old * ewma_level)]/100 |
68 |
*/ |
69 |
uint32_t ewmaProb; |
70 |
|
71 |
uint32_t prevNumRateAttempt; ///< from last rate |
72 |
uint32_t prevNumRateSuccess; ///< from last rate |
73 |
uint64_t successHist; ///< aggregate of all successes |
74 |
uint64_t attemptHist; ///< aggregate of all attempts |
75 |
uint32_t throughput; ///< throughput of a rate |
76 |
}; |
77 |
|
78 |
/** |
79 |
* Data structure for a Minstrel Rate table |
80 |
* A vector of a struct RateInfo |
81 |
*/ |
82 |
typedef std::vector<struct RateInfo> MinstrelRate; |
83 |
|
84 |
/** |
85 |
* Data structure for a Sample Rate table |
86 |
* A vector of a vector uint32_t |
87 |
*/ |
88 |
typedef std::vector<std::vector<uint32_t> > SampleRate; |
89 |
|
47 |
|
90 |
struct MinstrelWifiRemoteStation : public WifiRemoteStation |
48 |
struct MinstrelWifiRemoteStation : public WifiRemoteStation |
91 |
{ |
49 |
{ |
92 |
Time m_nextStatsUpdate; ///< 10 times every second |
50 |
Time m_nextStatsUpdate; ///< 10 times every second |
93 |
MinstrelRate m_minstrelTable; ///< minstrel table |
|
|
94 |
SampleRate m_sampleTable; ///< sample table |
95 |
|
51 |
|
96 |
/** |
52 |
/** |
97 |
* To keep track of the current position in the our random sample table |
53 |
* To keep track of the current position in the our random sample table |
|
237 |
// Note: we appear to be doing late initialization of the table |
193 |
// Note: we appear to be doing late initialization of the table |
238 |
// to make sure that the set of supported rates has been initialized |
194 |
// to make sure that the set of supported rates has been initialized |
239 |
// before we perform our own initialization. |
195 |
// before we perform our own initialization. |
240 |
station->m_minstrelTable = MinstrelRate(GetNSupported (station)); |
196 |
m_minstrelTable = MinstrelRate(GetNSupported (station)); |
241 |
station->m_sampleTable = SampleRate(GetNSupported (station), std::vector<uint32_t> (m_sampleCol)); |
197 |
m_sampleTable = SampleRate(GetNSupported (station), std::vector<uint32_t> (m_sampleCol)); |
242 |
InitSampleTable (station); |
198 |
InitSampleTable (station); |
243 |
RateInit (station); |
199 |
RateInit (station); |
244 |
station->m_initialized = true; |
200 |
station->m_initialized = true; |
|
305 |
if (!station->m_isSampling) |
261 |
if (!station->m_isSampling) |
306 |
{ |
262 |
{ |
307 |
/// use best throughput rate |
263 |
/// use best throughput rate |
308 |
if (station->m_longRetry < station->m_minstrelTable[station->m_txrate].adjustedRetryCount) |
264 |
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount) |
309 |
{ |
265 |
{ |
310 |
; ///< there's still a few retries left |
266 |
; ///< there's still a few retries left |
311 |
} |
267 |
} |
312 |
|
268 |
|
313 |
/// use second best throughput rate |
269 |
/// use second best throughput rate |
314 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
270 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
315 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
271 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
316 |
{ |
272 |
{ |
317 |
station->m_txrate = station->m_maxTpRate2; |
273 |
station->m_txrate = station->m_maxTpRate2; |
318 |
} |
274 |
} |
319 |
|
275 |
|
320 |
/// use best probability rate |
276 |
/// use best probability rate |
321 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
277 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
322 |
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
278 |
m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
323 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
279 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
324 |
{ |
280 |
{ |
325 |
station->m_txrate = station->m_maxProbRate; |
281 |
station->m_txrate = station->m_maxProbRate; |
326 |
} |
282 |
} |
327 |
|
283 |
|
328 |
/// use lowest base rate |
284 |
/// use lowest base rate |
329 |
else if (station->m_longRetry > (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
285 |
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
330 |
station->m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
286 |
m_minstrelTable[station->m_maxTpRate2].adjustedRetryCount + |
331 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
287 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
332 |
{ |
288 |
{ |
333 |
station->m_txrate = 0; |
289 |
station->m_txrate = 0; |
334 |
} |
290 |
} |
|
341 |
if (station->m_sampleRateSlower) |
297 |
if (station->m_sampleRateSlower) |
342 |
{ |
298 |
{ |
343 |
/// use best throughput rate |
299 |
/// use best throughput rate |
344 |
if (station->m_longRetry < station->m_minstrelTable[station->m_txrate].adjustedRetryCount) |
300 |
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount) |
345 |
{ |
301 |
{ |
346 |
; ///< there are a few retries left |
302 |
; ///< there are a few retries left |
347 |
} |
303 |
} |
348 |
|
304 |
|
349 |
/// use random rate |
305 |
/// use random rate |
350 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
306 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
351 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
307 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
352 |
{ |
308 |
{ |
353 |
station->m_txrate = station->m_sampleRate; |
309 |
station->m_txrate = station->m_sampleRate; |
354 |
} |
310 |
} |
355 |
|
311 |
|
356 |
/// use max probability rate |
312 |
/// use max probability rate |
357 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
313 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
358 |
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
314 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
359 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount )) |
315 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount )) |
360 |
{ |
316 |
{ |
361 |
station->m_txrate = station->m_maxProbRate; |
317 |
station->m_txrate = station->m_maxProbRate; |
362 |
} |
318 |
} |
363 |
|
319 |
|
364 |
/// use lowest base rate |
320 |
/// use lowest base rate |
365 |
else if (station->m_longRetry > (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
321 |
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
366 |
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
322 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount + |
367 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
323 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount)) |
368 |
{ |
324 |
{ |
369 |
station->m_txrate = 0; |
325 |
station->m_txrate = 0; |
370 |
} |
326 |
} |
|
374 |
else |
330 |
else |
375 |
{ |
331 |
{ |
376 |
/// use random rate |
332 |
/// use random rate |
377 |
if (station->m_longRetry < station->m_minstrelTable[station->m_txrate].adjustedRetryCount) |
333 |
if (station->m_longRetry < m_minstrelTable[station->m_txrate].adjustedRetryCount) |
378 |
{ |
334 |
{ |
379 |
; ///< keep using it |
335 |
; ///< keep using it |
380 |
} |
336 |
} |
381 |
|
337 |
|
382 |
/// use the best rate |
338 |
/// use the best rate |
383 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
339 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
384 |
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
340 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
385 |
{ |
341 |
{ |
386 |
station->m_txrate = station->m_maxTpRate; |
342 |
station->m_txrate = station->m_maxTpRate; |
387 |
} |
343 |
} |
388 |
|
344 |
|
389 |
/// use the best probability rate |
345 |
/// use the best probability rate |
390 |
else if (station->m_longRetry <= (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
346 |
else if (station->m_longRetry <= (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
391 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
347 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
392 |
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
348 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
393 |
{ |
349 |
{ |
394 |
station->m_txrate = station->m_maxProbRate; |
350 |
station->m_txrate = station->m_maxProbRate; |
395 |
} |
351 |
} |
396 |
|
352 |
|
397 |
/// use the lowest base rate |
353 |
/// use the lowest base rate |
398 |
else if (station->m_longRetry > (station->m_minstrelTable[station->m_txrate].adjustedRetryCount + |
354 |
else if (station->m_longRetry > (m_minstrelTable[station->m_txrate].adjustedRetryCount + |
399 |
station->m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
355 |
m_minstrelTable[station->m_maxTpRate].adjustedRetryCount + |
400 |
station->m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
356 |
m_minstrelTable[station->m_sampleRate].adjustedRetryCount)) |
401 |
{ |
357 |
{ |
402 |
station->m_txrate = 0; |
358 |
station->m_txrate = 0; |
403 |
} |
359 |
} |
|
416 |
|
372 |
|
417 |
CheckInit (station); |
373 |
CheckInit (station); |
418 |
|
374 |
|
419 |
station->m_minstrelTable[station->m_txrate].numRateSuccess++; |
375 |
m_minstrelTable[station->m_txrate].numRateSuccess++; |
420 |
station->m_minstrelTable[station->m_txrate].numRateAttempt++; |
376 |
m_minstrelTable[station->m_txrate].numRateAttempt++; |
421 |
|
377 |
|
422 |
UpdateRetry (station); |
378 |
UpdateRetry (station); |
423 |
|
379 |
|
424 |
station->m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry; |
380 |
m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry; |
425 |
station->m_packetCount++; |
381 |
station->m_packetCount++; |
426 |
|
382 |
|
427 |
if (GetNSupported (station) >= 1) |
383 |
if (GetNSupported (station) >= 1) |
|
441 |
|
397 |
|
442 |
UpdateRetry (station); |
398 |
UpdateRetry (station); |
443 |
|
399 |
|
444 |
station->m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry; |
400 |
m_minstrelTable[station->m_txrate].numRateAttempt += station->m_retry; |
445 |
station->m_err++; |
401 |
station->m_err++; |
446 |
|
402 |
|
447 |
if (GetNSupported (station) >= 1) |
403 |
if (GetNSupported (station) >= 1) |
|
492 |
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station) |
448 |
MinstrelWifiManager::GetNextSample (MinstrelWifiRemoteStation *station) |
493 |
{ |
449 |
{ |
494 |
uint32_t bitrate; |
450 |
uint32_t bitrate; |
495 |
bitrate = station->m_sampleTable[station->m_index][station->m_col]; |
451 |
bitrate = m_sampleTable[station->m_index][station->m_col]; |
496 |
station->m_index++; |
452 |
station->m_index++; |
497 |
|
453 |
|
498 |
/// bookeeping for m_index and m_col variables |
454 |
/// bookeeping for m_index and m_col variables |
|
573 |
|
529 |
|
574 |
/// is this rate slower than the current best rate |
530 |
/// is this rate slower than the current best rate |
575 |
station->m_sampleRateSlower = |
531 |
station->m_sampleRateSlower = |
576 |
(station->m_minstrelTable[idx].perfectTxTime > station->m_minstrelTable[station->m_maxTpRate].perfectTxTime); |
532 |
(m_minstrelTable[idx].perfectTxTime > m_minstrelTable[station->m_maxTpRate].perfectTxTime); |
577 |
|
533 |
|
578 |
/// using the best rate instead |
534 |
/// using the best rate instead |
579 |
if (station->m_sampleRateSlower) |
535 |
if (station->m_sampleRateSlower) |
|
615 |
{ |
571 |
{ |
616 |
|
572 |
|
617 |
/// calculate the perfect tx time for this rate |
573 |
/// calculate the perfect tx time for this rate |
618 |
txTime = station->m_minstrelTable[i].perfectTxTime; |
574 |
txTime = m_minstrelTable[i].perfectTxTime; |
619 |
|
575 |
|
620 |
/// just for initialization |
576 |
/// just for initialization |
621 |
if (txTime.GetMicroSeconds () == 0) |
577 |
if (txTime.GetMicroSeconds () == 0) |
|
624 |
} |
580 |
} |
625 |
|
581 |
|
626 |
NS_LOG_DEBUG ("m_txrate=" << station->m_txrate << |
582 |
NS_LOG_DEBUG ("m_txrate=" << station->m_txrate << |
627 |
"\t attempt=" << station->m_minstrelTable[i].numRateAttempt << |
583 |
"\t attempt=" << m_minstrelTable[i].numRateAttempt << |
628 |
"\t success=" << station->m_minstrelTable[i].numRateSuccess); |
584 |
"\t success=" << m_minstrelTable[i].numRateSuccess); |
629 |
|
585 |
|
630 |
/// if we've attempted something |
586 |
/// if we've attempted something |
631 |
if (station->m_minstrelTable[i].numRateAttempt) |
587 |
if (m_minstrelTable[i].numRateAttempt) |
632 |
{ |
588 |
{ |
633 |
/** |
589 |
/** |
634 |
* calculate the probability of success |
590 |
* calculate the probability of success |
635 |
* assume probability scales from 0 to 18000 |
591 |
* assume probability scales from 0 to 18000 |
636 |
*/ |
592 |
*/ |
637 |
tempProb = (station->m_minstrelTable[i].numRateSuccess * 18000) / station->m_minstrelTable[i].numRateAttempt; |
593 |
tempProb = (m_minstrelTable[i].numRateSuccess * 18000) / m_minstrelTable[i].numRateAttempt; |
638 |
|
594 |
|
639 |
/// bookeeping |
595 |
/// bookeeping |
640 |
station->m_minstrelTable[i].successHist += station->m_minstrelTable[i].numRateSuccess; |
596 |
m_minstrelTable[i].successHist += m_minstrelTable[i].numRateSuccess; |
641 |
station->m_minstrelTable[i].attemptHist += station->m_minstrelTable[i].numRateAttempt; |
597 |
m_minstrelTable[i].attemptHist += m_minstrelTable[i].numRateAttempt; |
642 |
station->m_minstrelTable[i].prob = tempProb; |
598 |
m_minstrelTable[i].prob = tempProb; |
643 |
|
599 |
|
644 |
/// ewma probability (cast for gcc 3.4 compatibility) |
600 |
/// ewma probability (cast for gcc 3.4 compatibility) |
645 |
tempProb = static_cast<uint32_t>(((tempProb * (100 - m_ewmaLevel)) + (station->m_minstrelTable[i].ewmaProb * m_ewmaLevel) )/100); |
601 |
tempProb = static_cast<uint32_t>(((tempProb * (100 - m_ewmaLevel)) + (m_minstrelTable[i].ewmaProb * m_ewmaLevel) )/100); |
646 |
|
602 |
|
647 |
station->m_minstrelTable[i].ewmaProb = tempProb; |
603 |
m_minstrelTable[i].ewmaProb = tempProb; |
648 |
|
604 |
|
649 |
/// calculating throughput |
605 |
/// calculating throughput |
650 |
station->m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds()); |
606 |
m_minstrelTable[i].throughput = tempProb * (1000000 / txTime.GetMicroSeconds()); |
651 |
|
607 |
|
652 |
} |
608 |
} |
653 |
|
609 |
|
654 |
/// bookeeping |
610 |
/// bookeeping |
655 |
station->m_minstrelTable[i].prevNumRateAttempt = station->m_minstrelTable[i].numRateAttempt; |
611 |
m_minstrelTable[i].prevNumRateAttempt = m_minstrelTable[i].numRateAttempt; |
656 |
station->m_minstrelTable[i].prevNumRateSuccess = station->m_minstrelTable[i].numRateSuccess; |
612 |
m_minstrelTable[i].prevNumRateSuccess = m_minstrelTable[i].numRateSuccess; |
657 |
station->m_minstrelTable[i].numRateSuccess = 0; |
613 |
m_minstrelTable[i].numRateSuccess = 0; |
658 |
station->m_minstrelTable[i].numRateAttempt = 0; |
614 |
m_minstrelTable[i].numRateAttempt = 0; |
659 |
|
615 |
|
660 |
/// Sample less often below 10% and above 95% of success |
616 |
/// Sample less often below 10% and above 95% of success |
661 |
if ((station->m_minstrelTable[i].ewmaProb > 17100) || (station->m_minstrelTable[i].ewmaProb < 1800)) |
617 |
if ((m_minstrelTable[i].ewmaProb > 17100) || (m_minstrelTable[i].ewmaProb < 1800)) |
662 |
{ |
618 |
{ |
663 |
/** |
619 |
/** |
664 |
* retry count denotes the number of retries permitted for each rate |
620 |
* retry count denotes the number of retries permitted for each rate |
665 |
* # retry_count/2 |
621 |
* # retry_count/2 |
666 |
*/ |
622 |
*/ |
667 |
station->m_minstrelTable[i].adjustedRetryCount = station->m_minstrelTable[i].retryCount >> 1; |
623 |
m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount >> 1; |
668 |
if (station->m_minstrelTable[i].adjustedRetryCount > 2) |
624 |
if (m_minstrelTable[i].adjustedRetryCount > 2) |
669 |
{ |
625 |
{ |
670 |
station->m_minstrelTable[i].adjustedRetryCount = 2 ; |
626 |
m_minstrelTable[i].adjustedRetryCount = 2 ; |
671 |
} |
627 |
} |
672 |
} |
628 |
} |
673 |
else |
629 |
else |
674 |
{ |
630 |
{ |
675 |
station->m_minstrelTable[i].adjustedRetryCount = station->m_minstrelTable[i].retryCount; |
631 |
m_minstrelTable[i].adjustedRetryCount = m_minstrelTable[i].retryCount; |
676 |
} |
632 |
} |
677 |
|
633 |
|
678 |
/// if it's 0 allow one retry limit |
634 |
/// if it's 0 allow one retry limit |
679 |
if (station->m_minstrelTable[i].adjustedRetryCount == 0) |
635 |
if (m_minstrelTable[i].adjustedRetryCount == 0) |
680 |
{ |
636 |
{ |
681 |
station->m_minstrelTable[i].adjustedRetryCount = 1; |
637 |
m_minstrelTable[i].adjustedRetryCount = 1; |
682 |
} |
638 |
} |
683 |
} |
639 |
} |
684 |
|
640 |
|
|
688 |
/// go find max throughput, second maximum throughput, high probability succ |
644 |
/// go find max throughput, second maximum throughput, high probability succ |
689 |
for (uint32_t i =0; i < GetNSupported (station); i++) |
645 |
for (uint32_t i =0; i < GetNSupported (station); i++) |
690 |
{ |
646 |
{ |
691 |
NS_LOG_DEBUG ("throughput" << station->m_minstrelTable[i].throughput << |
647 |
NS_LOG_DEBUG ("throughput" << m_minstrelTable[i].throughput << |
692 |
"\n ewma" << station->m_minstrelTable[i].ewmaProb); |
648 |
"\n ewma" << m_minstrelTable[i].ewmaProb); |
693 |
|
649 |
|
694 |
if (max_tp < station->m_minstrelTable[i].throughput) |
650 |
if (max_tp < m_minstrelTable[i].throughput) |
695 |
{ |
651 |
{ |
696 |
index_max_tp = i; |
652 |
index_max_tp = i; |
697 |
max_tp = station->m_minstrelTable[i].throughput; |
653 |
max_tp = m_minstrelTable[i].throughput; |
698 |
} |
654 |
} |
699 |
|
655 |
|
700 |
if (max_prob < station->m_minstrelTable[i].ewmaProb) |
656 |
if (max_prob < m_minstrelTable[i].ewmaProb) |
701 |
{ |
657 |
{ |
702 |
index_max_prob = i; |
658 |
index_max_prob = i; |
703 |
max_prob = station->m_minstrelTable[i].ewmaProb; |
659 |
max_prob = m_minstrelTable[i].ewmaProb; |
704 |
} |
660 |
} |
705 |
} |
661 |
} |
706 |
|
662 |
|
|
709 |
/// find the second highest max |
665 |
/// find the second highest max |
710 |
for (uint32_t i =0; i < GetNSupported (station); i++) |
666 |
for (uint32_t i =0; i < GetNSupported (station); i++) |
711 |
{ |
667 |
{ |
712 |
if ((i != index_max_tp) && (max_tp < station->m_minstrelTable[i].throughput)) |
668 |
if ((i != index_max_tp) && (max_tp < m_minstrelTable[i].throughput)) |
713 |
{ |
669 |
{ |
714 |
index_max_tp2 = i; |
670 |
index_max_tp2 = i; |
715 |
max_tp = station->m_minstrelTable[i].throughput; |
671 |
max_tp = m_minstrelTable[i].throughput; |
716 |
} |
672 |
} |
717 |
} |
673 |
} |
718 |
|
674 |
|
|
739 |
|
695 |
|
740 |
for (uint32_t i = 0; i < GetNSupported (station); i++) |
696 |
for (uint32_t i = 0; i < GetNSupported (station); i++) |
741 |
{ |
697 |
{ |
742 |
station->m_minstrelTable[i].numRateAttempt = 0; |
698 |
m_minstrelTable[i].numRateAttempt = 0; |
743 |
station->m_minstrelTable[i].numRateSuccess = 0; |
699 |
m_minstrelTable[i].numRateSuccess = 0; |
744 |
station->m_minstrelTable[i].prob = 0; |
700 |
m_minstrelTable[i].prob = 0; |
745 |
station->m_minstrelTable[i].ewmaProb = 0; |
701 |
m_minstrelTable[i].ewmaProb = 0; |
746 |
station->m_minstrelTable[i].prevNumRateAttempt = 0; |
702 |
m_minstrelTable[i].prevNumRateAttempt = 0; |
747 |
station->m_minstrelTable[i].prevNumRateSuccess = 0; |
703 |
m_minstrelTable[i].prevNumRateSuccess = 0; |
748 |
station->m_minstrelTable[i].successHist = 0; |
704 |
m_minstrelTable[i].successHist = 0; |
749 |
station->m_minstrelTable[i].attemptHist = 0; |
705 |
m_minstrelTable[i].attemptHist = 0; |
750 |
station->m_minstrelTable[i].throughput = 0; |
706 |
m_minstrelTable[i].throughput = 0; |
751 |
station->m_minstrelTable[i].perfectTxTime = GetCalcTxTime (GetSupported (station, i)); |
707 |
m_minstrelTable[i].perfectTxTime = GetCalcTxTime (GetSupported (station, i)); |
752 |
station->m_minstrelTable[i].retryCount = 1; |
708 |
m_minstrelTable[i].retryCount = 1; |
753 |
station->m_minstrelTable[i].adjustedRetryCount = 1; |
709 |
m_minstrelTable[i].adjustedRetryCount = 1; |
754 |
} |
710 |
} |
755 |
} |
711 |
} |
756 |
|
712 |
|
|
778 |
newIndex = (i + (uint32_t)uv.GetValue ()) % numSampleRates; |
734 |
newIndex = (i + (uint32_t)uv.GetValue ()) % numSampleRates; |
779 |
|
735 |
|
780 |
/// this loop is used for filling in other uninitilized places |
736 |
/// this loop is used for filling in other uninitilized places |
781 |
while (station->m_sampleTable[newIndex][col] != 0) |
737 |
while (m_sampleTable[newIndex][col] != 0) |
782 |
{ |
738 |
{ |
783 |
newIndex = (newIndex + 1)%GetNSupported (station); |
739 |
newIndex = (newIndex + 1)%GetNSupported (station); |
784 |
} |
740 |
} |
785 |
station->m_sampleTable[newIndex][col] = i; |
741 |
m_sampleTable[newIndex][col] = i; |
786 |
|
742 |
|
787 |
} |
743 |
} |
788 |
} |
744 |
} |
|
798 |
{ |
754 |
{ |
799 |
for (uint32_t j = 0; j < m_sampleCol; j++) |
755 |
for (uint32_t j = 0; j < m_sampleCol; j++) |
800 |
{ |
756 |
{ |
801 |
std::cout << station->m_sampleTable[i][j] << "\t"; |
757 |
std::cout << m_sampleTable[i][j] << "\t"; |
802 |
} |
758 |
} |
803 |
std::cout << std::endl; |
759 |
std::cout << std::endl; |
804 |
} |
760 |
} |
|
811 |
|
767 |
|
812 |
for (uint32_t i=0; i < GetNSupported (station); i++) |
768 |
for (uint32_t i=0; i < GetNSupported (station); i++) |
813 |
{ |
769 |
{ |
814 |
std::cout << "index(" << i << ") = " << station->m_minstrelTable[i].perfectTxTime<< "\n"; |
770 |
std::cout << "index(" << i << ") = " << m_minstrelTable[i].perfectTxTime<< "\n"; |
815 |
} |
771 |
} |
816 |
} |
772 |
} |
817 |
|
773 |
|