LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2009 Duy Nguyen | 3 * Copyright (c) 2009 Duy Nguyen |
4 * Copyright (c) 2015 Ghada Badawy | 4 * Copyright (c) 2015 Ghada Badawy |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License version 2 as | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 * or non-HT stations want to associate. | 151 * or non-HT stations want to associate. |
152 */ | 152 */ |
153 m_legacyManager = CreateObject<MinstrelWifiManager> (); | 153 m_legacyManager = CreateObject<MinstrelWifiManager> (); |
154 } | 154 } |
155 | 155 |
156 MinstrelHtWifiManager::~MinstrelHtWifiManager () | 156 MinstrelHtWifiManager::~MinstrelHtWifiManager () |
157 { | 157 { |
158 NS_LOG_FUNCTION (this); | 158 NS_LOG_FUNCTION (this); |
159 if (HasHtSupported ()) | 159 if (HasHtSupported ()) |
160 { | 160 { |
161 for (uint32_t i = 0; i < m_numGroups; i++) | 161 for (uint8_t i = 0; i < m_numGroups; i++) |
162 { | 162 { |
163 m_minstrelGroups[i].ratesFirstMpduTxTimeTable.clear (); | 163 m_minstrelGroups[i].ratesFirstMpduTxTimeTable.clear (); |
164 m_minstrelGroups[i].ratesTxTimeTable.clear (); | 164 m_minstrelGroups[i].ratesTxTimeTable.clear (); |
165 } | 165 } |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 int64_t | 169 int64_t |
170 MinstrelHtWifiManager::AssignStreams (int64_t stream) | 170 MinstrelHtWifiManager::AssignStreams (int64_t stream) |
171 { | 171 { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 246 |
247 // Calculate tx time for all rates of the group | 247 // Calculate tx time for all rates of the group |
248 WifiModeList htMcsList = GetHtDeviceMcsList (); | 248 WifiModeList htMcsList = GetHtDeviceMcsList (); |
249 for (uint8_t i = 0; i < MAX_HT_GROUP_RATES; i++) | 249 for (uint8_t i = 0; i < MAX_HT_GROUP_RATES; i++) |
250 { | 250 { |
251 uint32_t deviceIndex = i + (m_minstrelGroups[groupId].
streams - 1) * 8; | 251 uint32_t deviceIndex = i + (m_minstrelGroups[groupId].
streams - 1) * 8; |
252 WifiMode mode = htMcsList[deviceIndex]; | 252 WifiMode mode = htMcsList[deviceIndex]; |
253 AddFirstMpduTxTime (groupId, mode, CalculateFirstMpduT
xDuration (GetPhy (), streams, sgi, chWidth, mode)); | 253 AddFirstMpduTxTime (groupId, mode, CalculateFirstMpduT
xDuration (GetPhy (), streams, sgi, chWidth, mode)); |
254 AddMpduTxTime (groupId, mode, CalculateMpduTxDuration
(GetPhy (), streams, sgi, chWidth, mode)); | 254 AddMpduTxTime (groupId, mode, CalculateMpduTxDuration
(GetPhy (), streams, sgi, chWidth, mode)); |
255 } | 255 } |
256 NS_LOG_DEBUG ("Initialized group " << groupId << ": (" <<
(uint16_t)streams << "," << (uint16_t)sgi << "," << (uint16_t)chWidth << ")"); | 256 NS_LOG_DEBUG ("Initialized group " << groupId << ": (" <<
static_cast<uint16_t> (streams) << "," << static_cast<uint16_t> (sgi) << "," <<
static_cast<uint16_t> (chWidth) << ")"); |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 if (HasVhtSupported ()) | 262 if (HasVhtSupported ()) |
263 { | 263 { |
264 // Initialize all VHT groups | 264 // Initialize all VHT groups |
265 for (uint16_t chWidth = 20; chWidth <= MAX_VHT_WIDTH; chWidth *= 2) | 265 for (uint16_t chWidth = 20; chWidth <= MAX_VHT_WIDTH; chWidth *= 2) |
266 { | 266 { |
(...skipping 21 matching lines...) Expand all Loading... |
288 for (uint8_t i = 0; i < MAX_VHT_GROUP_RATES; i++) | 288 for (uint8_t i = 0; i < MAX_VHT_GROUP_RATES; i++) |
289 { | 289 { |
290 WifiMode mode = vhtMcsList[i]; | 290 WifiMode mode = vhtMcsList[i]; |
291 // Check for invalid VHT MCSs and do not add time
to array. | 291 // Check for invalid VHT MCSs and do not add time
to array. |
292 if (IsValidMcs (GetPhy (), streams, static_cast<ui
nt8_t>(chWidth), mode)) | 292 if (IsValidMcs (GetPhy (), streams, static_cast<ui
nt8_t>(chWidth), mode)) |
293 { | 293 { |
294 AddFirstMpduTxTime (groupId, mode, CalculateFi
rstMpduTxDuration (GetPhy (), streams, sgi, static_cast<uint8_t>(chWidth), mode)
); | 294 AddFirstMpduTxTime (groupId, mode, CalculateFi
rstMpduTxDuration (GetPhy (), streams, sgi, static_cast<uint8_t>(chWidth), mode)
); |
295 AddMpduTxTime (groupId, mode, CalculateMpduTxD
uration (GetPhy (), streams, sgi, static_cast<uint8_t>(chWidth), mode)); | 295 AddMpduTxTime (groupId, mode, CalculateMpduTxD
uration (GetPhy (), streams, sgi, static_cast<uint8_t>(chWidth), mode)); |
296 } | 296 } |
297 } | 297 } |
298 NS_LOG_DEBUG ("Initialized group " << groupId << ": ("
<< (uint16_t)streams << "," << (uint16_t)sgi << "," << (uint16_t)chWidth << ")"
); | 298 NS_LOG_DEBUG ("Initialized group " << groupId << ": ("
<< static_cast<uint16_t> (streams) << "," << static_cast<uint16_t> (sgi) << ","
<< static_cast<uint16_t> (chWidth) << ")"); |
299 } | 299 } |
300 } | 300 } |
301 } | 301 } |
302 } | 302 } |
303 } | 303 } |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 void | 307 void |
308 MinstrelHtWifiManager::SetupMac (const Ptr<WifiMac> mac) | 308 MinstrelHtWifiManager::SetupMac (const Ptr<WifiMac> mac) |
309 { | 309 { |
310 NS_LOG_FUNCTION (this << mac); | 310 NS_LOG_FUNCTION (this << mac); |
311 m_legacyManager->SetupMac (mac); | 311 m_legacyManager->SetupMac (mac); |
312 WifiRemoteStationManager::SetupMac (mac); | 312 WifiRemoteStationManager::SetupMac (mac); |
313 } | 313 } |
314 | 314 |
315 bool | 315 bool |
316 MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint8_t ch
Width, WifiMode mode) | 316 MinstrelHtWifiManager::IsValidMcs (Ptr<WifiPhy> phy, uint8_t streams, uint8_t ch
Width, WifiMode mode) |
317 { | 317 { |
318 NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)chWidth << mode
); | 318 NS_LOG_FUNCTION (this << phy << static_cast<uint16_t> (streams) << static_cast
<uint16_t> (chWidth) << mode); |
319 WifiTxVector txvector; | 319 WifiTxVector txvector; |
320 txvector.SetNss (streams); | 320 txvector.SetNss (streams); |
321 txvector.SetChannelWidth (chWidth); | 321 txvector.SetChannelWidth (chWidth); |
322 txvector.SetMode (mode); | 322 txvector.SetMode (mode); |
323 return txvector.IsValid (); | 323 return txvector.IsValid (); |
324 } | 324 } |
325 | 325 |
326 Time | 326 Time |
327 MinstrelHtWifiManager::CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t s
treams, uint8_t sgi, uint8_t chWidth, WifiMode mode) | 327 MinstrelHtWifiManager::CalculateFirstMpduTxDuration (Ptr<WifiPhy> phy, uint8_t s
treams, uint8_t sgi, uint8_t chWidth, WifiMode mode) |
328 { | 328 { |
329 NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)sgi << (uint16_
t)chWidth << mode); | 329 NS_LOG_FUNCTION (this << phy << static_cast<uint16_t> (streams) << static_cast
<uint16_t> (sgi) << static_cast<uint16_t> (chWidth) << mode); |
330 | |
331 WifiTxVector txvector; | 330 WifiTxVector txvector; |
332 txvector.SetNss (streams); | 331 txvector.SetNss (streams); |
333 txvector.SetGuardInterval (sgi ? 400 : 800); | 332 txvector.SetGuardInterval (sgi ? 400 : 800); |
334 txvector.SetChannelWidth (chWidth); | 333 txvector.SetChannelWidth (chWidth); |
335 txvector.SetNess (0); | 334 txvector.SetNess (0); |
336 txvector.SetStbc (phy->GetStbc ()); | 335 txvector.SetStbc (phy->GetStbc ()); |
337 txvector.SetMode (mode); | 336 txvector.SetMode (mode); |
338 txvector.SetPreambleType (WIFI_PREAMBLE_HT_MF); | 337 txvector.SetPreambleType (WIFI_PREAMBLE_HT_MF); |
339 return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency ()
, MPDU_IN_AGGREGATE, 0); | 338 return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency ()
, MPDU_IN_AGGREGATE, 0); |
340 } | 339 } |
341 | 340 |
342 Time | 341 Time |
343 MinstrelHtWifiManager::CalculateMpduTxDuration (Ptr<WifiPhy> phy, uint8_t stream
s, uint8_t sgi, uint8_t chWidth, WifiMode mode) | 342 MinstrelHtWifiManager::CalculateMpduTxDuration (Ptr<WifiPhy> phy, uint8_t stream
s, uint8_t sgi, uint8_t chWidth, WifiMode mode) |
344 { | 343 { |
345 NS_LOG_FUNCTION (this << phy << (uint16_t)streams << (uint16_t)sgi << (uint16_
t)chWidth << mode); | 344 NS_LOG_FUNCTION (this << phy << static_cast<uint16_t> (streams) << static_cast
<uint16_t> (sgi) << static_cast<uint16_t> (chWidth) << mode); |
346 | |
347 WifiTxVector txvector; | 345 WifiTxVector txvector; |
348 txvector.SetNss (streams); | 346 txvector.SetNss (streams); |
349 txvector.SetGuardInterval (sgi ? 400 : 800); | 347 txvector.SetGuardInterval (sgi ? 400 : 800); |
350 txvector.SetChannelWidth (chWidth); | 348 txvector.SetChannelWidth (chWidth); |
351 txvector.SetNess (0); | 349 txvector.SetNess (0); |
352 txvector.SetStbc (phy->GetStbc ()); | 350 txvector.SetStbc (phy->GetStbc ()); |
353 txvector.SetMode (mode); | 351 txvector.SetMode (mode); |
354 txvector.SetPreambleType (WIFI_PREAMBLE_NONE); | 352 txvector.SetPreambleType (WIFI_PREAMBLE_NONE); |
355 return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency ()
, MPDU_IN_AGGREGATE, 0); | 353 return phy->CalculateTxDuration (m_frameLength, txvector, phy->GetFrequency ()
, MPDU_IN_AGGREGATE, 0); |
356 } | 354 } |
357 | 355 |
358 Time | 356 Time |
359 MinstrelHtWifiManager::GetFirstMpduTxTime (uint32_t groupId, WifiMode mode) cons
t | 357 MinstrelHtWifiManager::GetFirstMpduTxTime (uint32_t groupId, WifiMode mode) cons
t |
360 { | 358 { |
361 NS_LOG_FUNCTION (this << groupId << mode); | 359 NS_LOG_FUNCTION (this << groupId << mode); |
362 | |
363 for (TxTime::const_iterator i = m_minstrelGroups[groupId].ratesFirstMpduTxTime
Table.begin (); i != m_minstrelGroups[groupId].ratesFirstMpduTxTimeTable.end ();
i++) | 360 for (TxTime::const_iterator i = m_minstrelGroups[groupId].ratesFirstMpduTxTime
Table.begin (); i != m_minstrelGroups[groupId].ratesFirstMpduTxTimeTable.end ();
i++) |
364 { | 361 { |
365 if (mode == i->second) | 362 if (mode == i->second) |
366 { | 363 { |
367 return i->first; | 364 return i->first; |
368 } | 365 } |
369 } | 366 } |
370 NS_ASSERT (false); | 367 NS_ASSERT (false); |
371 return Seconds (0); | 368 return Seconds (0); |
372 } | 369 } |
373 | 370 |
374 void | 371 void |
375 MinstrelHtWifiManager::AddFirstMpduTxTime (uint32_t groupId, WifiMode mode, Time
t) | 372 MinstrelHtWifiManager::AddFirstMpduTxTime (uint32_t groupId, WifiMode mode, Time
t) |
376 { | 373 { |
377 NS_LOG_FUNCTION (this << groupId << mode << t); | 374 NS_LOG_FUNCTION (this << groupId << mode << t); |
378 | |
379 m_minstrelGroups[groupId].ratesFirstMpduTxTimeTable.push_back (std::make_pair
(t, mode)); | 375 m_minstrelGroups[groupId].ratesFirstMpduTxTimeTable.push_back (std::make_pair
(t, mode)); |
380 } | 376 } |
381 | 377 |
382 Time | 378 Time |
383 MinstrelHtWifiManager::GetMpduTxTime (uint32_t groupId, WifiMode mode) const | 379 MinstrelHtWifiManager::GetMpduTxTime (uint32_t groupId, WifiMode mode) const |
384 { | 380 { |
385 NS_LOG_FUNCTION (this << groupId << mode); | 381 NS_LOG_FUNCTION (this << groupId << mode); |
386 | |
387 for (TxTime::const_iterator i = m_minstrelGroups[groupId].ratesTxTimeTable.beg
in (); i != m_minstrelGroups[groupId].ratesTxTimeTable.end (); i++) | 382 for (TxTime::const_iterator i = m_minstrelGroups[groupId].ratesTxTimeTable.beg
in (); i != m_minstrelGroups[groupId].ratesTxTimeTable.end (); i++) |
388 { | 383 { |
389 if (mode == i->second) | 384 if (mode == i->second) |
390 { | 385 { |
391 return i->first; | 386 return i->first; |
392 } | 387 } |
393 } | 388 } |
394 NS_ASSERT (false); | 389 NS_ASSERT (false); |
395 return Seconds (0); | 390 return Seconds (0); |
396 } | 391 } |
397 | 392 |
398 void | 393 void |
399 MinstrelHtWifiManager::AddMpduTxTime (uint32_t groupId, WifiMode mode, Time t) | 394 MinstrelHtWifiManager::AddMpduTxTime (uint32_t groupId, WifiMode mode, Time t) |
400 { | 395 { |
401 NS_LOG_FUNCTION (this << groupId << mode << t); | 396 NS_LOG_FUNCTION (this << groupId << mode << t); |
402 | |
403 m_minstrelGroups[groupId].ratesTxTimeTable.push_back (std::make_pair (t, mode)
); | 397 m_minstrelGroups[groupId].ratesTxTimeTable.push_back (std::make_pair (t, mode)
); |
404 } | 398 } |
405 | 399 |
406 WifiRemoteStation * | 400 WifiRemoteStation * |
407 MinstrelHtWifiManager::DoCreateStation (void) const | 401 MinstrelHtWifiManager::DoCreateStation (void) const |
408 { | 402 { |
409 NS_LOG_FUNCTION (this); | 403 NS_LOG_FUNCTION (this); |
410 | |
411 MinstrelHtWifiRemoteStation *station = new MinstrelHtWifiRemoteStation (); | 404 MinstrelHtWifiRemoteStation *station = new MinstrelHtWifiRemoteStation (); |
412 | 405 |
413 // Initialize variables common to both stations. | 406 // Initialize variables common to both stations. |
414 station->m_nextStatsUpdate = Simulator::Now () + m_updateStats; | 407 station->m_nextStatsUpdate = Simulator::Now () + m_updateStats; |
415 station->m_col = 0; | 408 station->m_col = 0; |
416 station->m_index = 0; | 409 station->m_index = 0; |
417 station->m_maxTpRate = 0; | 410 station->m_maxTpRate = 0; |
418 station->m_maxTpRate2 = 0; | 411 station->m_maxTpRate2 = 0; |
419 station->m_maxProbRate = 0; | 412 station->m_maxProbRate = 0; |
420 station->m_nModes = 0; | 413 station->m_nModes = 0; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 station->m_isHt = false; | 447 station->m_isHt = false; |
455 } | 448 } |
456 | 449 |
457 return station; | 450 return station; |
458 } | 451 } |
459 | 452 |
460 void | 453 void |
461 MinstrelHtWifiManager::CheckInit (MinstrelHtWifiRemoteStation *station) | 454 MinstrelHtWifiManager::CheckInit (MinstrelHtWifiRemoteStation *station) |
462 { | 455 { |
463 NS_LOG_FUNCTION (this << station); | 456 NS_LOG_FUNCTION (this << station); |
464 | |
465 // Note: we appear to be doing late initialization of the table | 457 // Note: we appear to be doing late initialization of the table |
466 // to make sure that the set of supported rates has been initialized | 458 // to make sure that the set of supported rates has been initialized |
467 // before we perform our own initialization. | 459 // before we perform our own initialization. |
468 if (!station->m_initialized) | 460 if (!station->m_initialized) |
469 { | 461 { |
470 /** | 462 /** |
471 * Check if the station supports HT. | 463 * Check if the station supports HT. |
472 * Assume that if the device do not supports HT then | 464 * Assume that if the device do not supports HT then |
473 * the station will not support HT either. | 465 * the station will not support HT either. |
474 * We save from using another check and variable. | 466 * We save from using another check and variable. |
475 */ | 467 */ |
476 if (!GetHtSupported (station) && !GetVhtSupported (station)) | 468 if (!GetHtSupported (station) && !GetVhtSupported (station)) |
477 { | 469 { |
478 NS_LOG_DEBUG ("Non-HT station " << station); | 470 NS_LOG_INFO ("Non-HT station " << station); |
479 station->m_isHt = false; | 471 station->m_isHt = false; |
480 // We will use non-HT minstrel for this station. Initialize the manage
r. | 472 // We will use non-HT minstrel for this station. Initialize the manage
r. |
481 m_legacyManager->SetAttribute ("UpdateStatistics", TimeValue (m_update
Stats)); | 473 m_legacyManager->SetAttribute ("UpdateStatistics", TimeValue (m_update
Stats)); |
482 m_legacyManager->SetAttribute ("LookAroundRate", DoubleValue (m_lookAr
oundRate)); | 474 m_legacyManager->SetAttribute ("LookAroundRate", DoubleValue (m_lookAr
oundRate)); |
483 m_legacyManager->SetAttribute ("EWMA", DoubleValue (m_ewmaLevel)); | 475 m_legacyManager->SetAttribute ("EWMA", DoubleValue (m_ewmaLevel)); |
484 m_legacyManager->SetAttribute ("SampleColumn", UintegerValue (m_nSampl
eCol)); | 476 m_legacyManager->SetAttribute ("SampleColumn", UintegerValue (m_nSampl
eCol)); |
485 m_legacyManager->SetAttribute ("PacketLength", UintegerValue (m_frameL
ength)); | 477 m_legacyManager->SetAttribute ("PacketLength", UintegerValue (m_frameL
ength)); |
486 m_legacyManager->SetAttribute ("PrintStats", BooleanValue (m_printStat
s)); | 478 m_legacyManager->SetAttribute ("PrintStats", BooleanValue (m_printStat
s)); |
487 m_legacyManager->CheckInit (station); | 479 m_legacyManager->CheckInit (station); |
488 } | 480 } |
489 else | 481 else |
490 { | 482 { |
491 NS_LOG_DEBUG ("HT station " << station); | 483 NS_LOG_DEBUG ("HT station " << station); |
492 station->m_isHt = true; | 484 station->m_isHt = true; |
493 station->m_nModes = GetNMcsSupported (station); | 485 station->m_nModes = GetNMcsSupported (station); |
494 station->m_sampleTable = SampleRate (m_numRates, std::vector<uint32_t>
(m_nSampleCol)); | 486 station->m_sampleTable = SampleRate (m_numRates, std::vector<uint32_t>
(m_nSampleCol)); |
495 InitSampleTable (station); | 487 InitSampleTable (station); |
496 RateInit (station); | 488 RateInit (station); |
497 std::ostringstream tmp; | 489 std::ostringstream tmp; |
498 tmp << "minstrel-ht-stats-" << station->m_state->m_address << ".txt"; | 490 tmp << "minstrel-ht-stats-" << station->m_state->m_address << ".txt"; |
499 station->m_statsFile.open (tmp.str ().c_str (), std::ios::out); | 491 station->m_statsFile.open (tmp.str ().c_str (), std::ios::out); |
500 station->m_initialized = true; | 492 station->m_initialized = true; |
501 } | 493 } |
502 } | 494 } |
503 } | 495 } |
504 | 496 |
505 void | 497 void |
506 MinstrelHtWifiManager::DoReportRxOk (WifiRemoteStation *st, | 498 MinstrelHtWifiManager::DoReportRxOk (WifiRemoteStation *st, double rxSnr, WifiMo
de txMode) |
507 double rxSnr, WifiMode txMode) | |
508 { | 499 { |
509 NS_UNUSED(rxSnr); | 500 NS_UNUSED(rxSnr); |
510 NS_UNUSED(txMode); | 501 NS_UNUSED(txMode); |
511 NS_LOG_FUNCTION (this << st); | 502 NS_LOG_FUNCTION (this << st); |
512 | |
513 NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelHtWifiRemoteStation *)st)-
>m_txrate); | 503 NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelHtWifiRemoteStation *)st)-
>m_txrate); |
514 } | 504 } |
515 | 505 |
516 void | 506 void |
517 MinstrelHtWifiManager::DoReportRtsFailed (WifiRemoteStation *st) | 507 MinstrelHtWifiManager::DoReportRtsFailed (WifiRemoteStation *st) |
518 { | 508 { |
519 NS_LOG_FUNCTION (this << st); | 509 NS_LOG_FUNCTION (this << st); |
520 | |
521 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; | 510 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; |
522 | |
523 CheckInit (station); | 511 CheckInit (station); |
524 if (!station->m_initialized) | 512 if (!station->m_initialized) |
525 { | 513 { |
526 return; | 514 return; |
527 } | 515 } |
528 | |
529 NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate); | 516 NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate); |
530 station->m_shortRetry++; | 517 station->m_shortRetry++; |
531 } | 518 } |
532 | 519 |
533 void | 520 void |
534 MinstrelHtWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, Wifi
Mode ctsMode, double rtsSnr) | 521 MinstrelHtWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, Wifi
Mode ctsMode, double rtsSnr) |
535 { | 522 { |
536 NS_UNUSED(ctsSnr); | 523 NS_UNUSED(ctsSnr); |
537 NS_UNUSED(ctsMode); | 524 NS_UNUSED(ctsMode); |
538 NS_UNUSED(rtsSnr); | 525 NS_UNUSED(rtsSnr); |
539 NS_LOG_FUNCTION (this << st); | 526 NS_LOG_FUNCTION (this << st); |
540 | |
541 NS_LOG_DEBUG ("self=" << st << " rts ok"); | 527 NS_LOG_DEBUG ("self=" << st << " rts ok"); |
542 } | 528 } |
543 | 529 |
544 void | 530 void |
545 MinstrelHtWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st) | 531 MinstrelHtWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st) |
546 { | 532 { |
547 NS_LOG_FUNCTION (this << st); | 533 NS_LOG_FUNCTION (this << st); |
548 | |
549 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; | 534 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; |
550 NS_LOG_DEBUG ("Final RTS failed"); | 535 NS_LOG_DEBUG ("Final RTS failed"); |
551 | |
552 CheckInit (station); | 536 CheckInit (station); |
553 if (!station->m_initialized) | 537 if (!station->m_initialized) |
554 { | 538 { |
555 return; | 539 return; |
556 } | 540 } |
557 | |
558 UpdateRetry (station); | 541 UpdateRetry (station); |
559 } | 542 } |
560 | 543 |
561 void | 544 void |
562 MinstrelHtWifiManager::DoReportDataFailed (WifiRemoteStation *st) | 545 MinstrelHtWifiManager::DoReportDataFailed (WifiRemoteStation *st) |
563 { | 546 { |
564 NS_LOG_FUNCTION (this << st); | 547 NS_LOG_FUNCTION (this << st); |
565 | |
566 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; | 548 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; |
567 | 549 |
568 CheckInit (station); | 550 CheckInit (station); |
569 if (!station->m_initialized) | 551 if (!station->m_initialized) |
570 { | 552 { |
571 return; | 553 return; |
572 } | 554 } |
573 | 555 |
| 556 NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m_txr
ate << "\tlongRetry \t" << station->m_longRetry); |
| 557 |
574 if (!station->m_isHt) | 558 if (!station->m_isHt) |
575 { | 559 { |
576 m_legacyManager->UpdateRate (station); | 560 m_legacyManager->UpdateRate (station); |
577 } | 561 } |
578 else | 562 else |
579 { | 563 { |
580 NS_LOG_DEBUG ("DoReportDataFailed " << station << "\t rate " << station->m
_txrate << "\tlongRetry \t" << station->m_longRetry); | |
581 | |
582 uint32_t rateId = GetRateId (station->m_txrate); | 564 uint32_t rateId = GetRateId (station->m_txrate); |
583 uint32_t groupId = GetGroupId (station->m_txrate); | 565 uint32_t groupId = GetGroupId (station->m_txrate); |
584 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt++; //
Increment the attempts counter for the rate used. | 566 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt++; //
Increment the attempts counter for the rate used. |
585 | |
586 UpdateRate (station); | 567 UpdateRate (station); |
587 } | 568 } |
588 } | 569 } |
589 | 570 |
590 void | 571 void |
591 MinstrelHtWifiManager::DoReportDataOk (WifiRemoteStation *st, | 572 MinstrelHtWifiManager::DoReportDataOk (WifiRemoteStation *st, double ackSnr, Wif
iMode ackMode, double dataSnr) |
592 double ackSnr, WifiMode ackMode, double d
ataSnr) | |
593 { | 573 { |
594 NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr); | 574 NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr); |
595 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; | 575 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; |
596 | 576 |
597 CheckInit (station); | 577 CheckInit (station); |
598 if (!station->m_initialized) | 578 if (!station->m_initialized) |
599 { | 579 { |
600 return; | 580 return; |
601 } | 581 } |
602 | 582 |
603 NS_LOG_DEBUG ("Data OK - Txrate = " << station->m_txrate ); | 583 NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", attempt
= " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", success
= " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (before u
pdate)."); |
604 | 584 |
605 if (!station->m_isHt) | 585 if (!station->m_isHt) |
606 { | 586 { |
607 station->m_minstrelTable[station->m_txrate].numRateSuccess++; | 587 station->m_minstrelTable[station->m_txrate].numRateSuccess++; |
608 station->m_minstrelTable[station->m_txrate].numRateAttempt++; | 588 station->m_minstrelTable[station->m_txrate].numRateAttempt++; |
609 | 589 |
610 m_legacyManager->UpdatePacketCounters (station); | 590 m_legacyManager->UpdatePacketCounters (station); |
| 591 |
| 592 NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", atte
mpt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", succ
ess = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (afte
r update)."); |
611 | 593 |
612 UpdateRetry (station); | 594 UpdateRetry (station); |
613 m_legacyManager->UpdateStats (station); | 595 m_legacyManager->UpdateStats (station); |
614 | 596 |
615 if (station->m_nModes >= 1) | 597 if (station->m_nModes >= 1) |
616 { | 598 { |
617 station->m_txrate = m_legacyManager->FindRate (station); | 599 station->m_txrate = m_legacyManager->FindRate (station); |
618 } | 600 } |
619 } | 601 } |
620 else | 602 else |
621 { | 603 { |
622 uint32_t rateId = GetRateId (station->m_txrate); | 604 uint32_t rateId = GetRateId (station->m_txrate); |
623 uint32_t groupId = GetGroupId (station->m_txrate); | 605 uint32_t groupId = GetGroupId (station->m_txrate); |
624 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateSuccess++; | 606 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateSuccess++; |
625 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt++; | 607 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt++; |
626 | 608 |
627 UpdatePacketCounters (station, 1, 0); | 609 UpdatePacketCounters (station, 1, 0); |
628 | 610 |
| 611 NS_LOG_DEBUG ("DoReportDataOk m_txrate = " << station->m_txrate << ", atte
mpt = " << station->m_minstrelTable[station->m_txrate].numRateAttempt << ", succ
ess = " << station->m_minstrelTable[station->m_txrate].numRateSuccess << " (afte
r update)."); |
| 612 |
629 station->m_isSampling = false; | 613 station->m_isSampling = false; |
630 station->m_sampleDeferred = false; | 614 station->m_sampleDeferred = false; |
631 | 615 |
632 UpdateRetry (station); | 616 UpdateRetry (station); |
633 if (Simulator::Now () >= station->m_nextStatsUpdate) | 617 if (Simulator::Now () >= station->m_nextStatsUpdate) |
634 { | 618 { |
635 UpdateStats (station); | 619 UpdateStats (station); |
636 } | 620 } |
637 | 621 |
638 if (station->m_nModes >= 1) | 622 if (station->m_nModes >= 1) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 { | 671 { |
688 station->m_txrate = FindRate (station); | 672 station->m_txrate = FindRate (station); |
689 } | 673 } |
690 } | 674 } |
691 NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate ); | 675 NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate ); |
692 } | 676 } |
693 | 677 |
694 void | 678 void |
695 MinstrelHtWifiManager::DoReportAmpduTxStatus (WifiRemoteStation *st, uint8_t nSu
ccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr) | 679 MinstrelHtWifiManager::DoReportAmpduTxStatus (WifiRemoteStation *st, uint8_t nSu
ccessfulMpdus, uint8_t nFailedMpdus, double rxSnr, double dataSnr) |
696 { | 680 { |
697 NS_LOG_FUNCTION (this << st << (uint16_t)nSuccessfulMpdus << (uint16_t)nFailed
Mpdus << rxSnr << dataSnr); | 681 NS_LOG_FUNCTION (this << st << static_cast<uint16_t> (nSuccessfulMpdus) << sta
tic_cast<uint16_t> (nFailedMpdus) << rxSnr << dataSnr); |
698 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; | 682 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; |
699 | 683 |
700 CheckInit (station); | 684 CheckInit (station); |
701 if (!station->m_initialized) | 685 if (!station->m_initialized) |
702 { | 686 { |
703 return; | 687 return; |
704 } | 688 } |
705 | 689 |
706 if (!station->m_isHt) | 690 if (!station->m_isHt) |
707 { | 691 { |
708 NS_ASSERT_MSG (false,"A-MPDU Tx Status called but no HT or VHT supported."
); | 692 NS_ASSERT_MSG (false,"A-MPDU Tx Status called but no HT or VHT supported."
); |
709 } | 693 } |
710 | 694 |
711 NS_LOG_DEBUG ("DoReportAmpduTxStatus. TxRate=" << station->m_txrate << " SuccM
pdus= " << | 695 NS_LOG_DEBUG ("DoReportAmpduTxStatus. TxRate=" << station->m_txrate << " SuccM
pdus= " << |
712 (uint16_t)nSuccessfulMpdus << " FailedMpdus= " << (uint16_t)nFai
ledMpdus); | 696 static_cast<uint16_t> (nSuccessfulMpdus) << " FailedMpdus= " <<
static_cast<uint16_t> (nFailedMpdus)); |
713 | 697 |
714 station->m_ampduPacketCount++; | 698 station->m_ampduPacketCount++; |
715 station->m_ampduLen += nSuccessfulMpdus + nFailedMpdus; | 699 station->m_ampduLen += nSuccessfulMpdus + nFailedMpdus; |
716 | 700 |
717 UpdatePacketCounters (station, nSuccessfulMpdus, nFailedMpdus); | 701 UpdatePacketCounters (station, nSuccessfulMpdus, nFailedMpdus); |
718 | 702 |
719 uint32_t rateId = GetRateId (station->m_txrate); | 703 uint32_t rateId = GetRateId (station->m_txrate); |
720 uint32_t groupId = GetGroupId (station->m_txrate); | 704 uint32_t groupId = GetGroupId (station->m_txrate); |
721 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateSuccess += nSucces
sfulMpdus; | 705 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateSuccess += nSucces
sfulMpdus; |
722 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt += nSucces
sfulMpdus + nFailedMpdus; | 706 station->m_groupsTable[groupId].m_ratesTable[rateId].numRateAttempt += nSucces
sfulMpdus + nFailedMpdus; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 } | 829 } |
846 NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate); | 830 NS_LOG_DEBUG ("Next rate to use TxRate = " << station->m_txrate); |
847 } | 831 } |
848 | 832 |
849 void | 833 void |
850 MinstrelHtWifiManager::UpdateRetry (MinstrelHtWifiRemoteStation *station) | 834 MinstrelHtWifiManager::UpdateRetry (MinstrelHtWifiRemoteStation *station) |
851 { | 835 { |
852 NS_LOG_FUNCTION (this << station); | 836 NS_LOG_FUNCTION (this << station); |
853 station->m_shortRetry = 0; | 837 station->m_shortRetry = 0; |
854 station->m_longRetry = 0; | 838 station->m_longRetry = 0; |
855 | |
856 } | 839 } |
857 | 840 |
858 void | 841 void |
859 MinstrelHtWifiManager::UpdatePacketCounters (MinstrelHtWifiRemoteStation *statio
n, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus) | 842 MinstrelHtWifiManager::UpdatePacketCounters (MinstrelHtWifiRemoteStation *statio
n, uint8_t nSuccessfulMpdus, uint8_t nFailedMpdus) |
860 { | 843 { |
861 NS_LOG_FUNCTION (this << station << (uint16_t)nSuccessfulMpdus << (uint16_t)nF
ailedMpdus); | 844 NS_LOG_FUNCTION (this << station << static_cast<uint16_t> (nSuccessfulMpdus) <
< static_cast<uint16_t> (nFailedMpdus)); |
862 | 845 |
863 station->m_totalPacketsCount += nSuccessfulMpdus + nFailedMpdus; | 846 station->m_totalPacketsCount += nSuccessfulMpdus + nFailedMpdus; |
864 if (station->m_isSampling) | 847 if (station->m_isSampling) |
865 { | 848 { |
866 station->m_samplePacketsCount += nSuccessfulMpdus + nFailedMpdus; | 849 station->m_samplePacketsCount += nSuccessfulMpdus + nFailedMpdus; |
867 } | 850 } |
868 if (station->m_totalPacketsCount == ~0) | 851 if (station->m_totalPacketsCount == ~0) |
869 { | 852 { |
870 station->m_samplePacketsCount = 0; | 853 station->m_samplePacketsCount = 0; |
871 station->m_totalPacketsCount = 0; | 854 station->m_totalPacketsCount = 0; |
872 } | 855 } |
873 | 856 |
874 if (!station->m_sampleWait && !station->m_sampleTries && station->m_sampleCoun
t > 0) | 857 if (!station->m_sampleWait && !station->m_sampleTries && station->m_sampleCoun
t > 0) |
875 { | 858 { |
876 station->m_sampleWait = static_cast<uint32_t>(16 + 2 * station->m_avgAmpdu
Len); | 859 station->m_sampleWait = static_cast<uint32_t>(16 + 2 * station->m_avgAmpdu
Len); |
877 station->m_sampleTries = 1; | 860 station->m_sampleTries = 1; |
878 station->m_sampleCount--; | 861 station->m_sampleCount--; |
879 } | 862 } |
880 | 863 } |
881 } | 864 |
882 void | 865 void |
883 MinstrelHtWifiManager::DoDisposeStation (WifiRemoteStation *st) | 866 MinstrelHtWifiManager::DoDisposeStation (WifiRemoteStation *st) |
884 { | 867 { |
885 NS_LOG_FUNCTION (this << st); | 868 NS_LOG_FUNCTION (this << st); |
886 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; | 869 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; |
887 station->DisposeStation (); | 870 station->DisposeStation (); |
888 } | 871 } |
889 | 872 |
890 WifiTxVector | 873 WifiTxVector |
891 MinstrelHtWifiManager::DoGetDataTxVector (WifiRemoteStation *st) | 874 MinstrelHtWifiManager::DoGetDataTxVector (WifiRemoteStation *st) |
(...skipping 17 matching lines...) Expand all Loading... |
909 } | 892 } |
910 | 893 |
911 return vector; | 894 return vector; |
912 } | 895 } |
913 else | 896 else |
914 { | 897 { |
915 NS_LOG_DEBUG ("DoGetDataMode m_txrate= " << station->m_txrate); | 898 NS_LOG_DEBUG ("DoGetDataMode m_txrate= " << station->m_txrate); |
916 | 899 |
917 uint32_t rateId = GetRateId (station->m_txrate); | 900 uint32_t rateId = GetRateId (station->m_txrate); |
918 uint32_t groupId = GetGroupId (station->m_txrate); | 901 uint32_t groupId = GetGroupId (station->m_txrate); |
919 uint32_t mcsIndex = station->m_groupsTable[groupId].m_ratesTable[rateId].m
csIndex; | 902 uint8_t mcsIndex = static_cast<uint8_t> (station->m_groupsTable[groupId].m
_ratesTable[rateId].mcsIndex); |
920 | 903 |
921 NS_LOG_DEBUG ("DoGetDataMode rateId= " << rateId << " groupId= " << groupI
d << " mode= " << GetMcsSupported (station, mcsIndex)); | 904 NS_LOG_DEBUG ("DoGetDataMode rateId= " << rateId << " groupId= " << groupI
d << " mode= " << GetMcsSupported (station, mcsIndex)); |
922 | 905 |
923 McsGroup group = m_minstrelGroups[groupId]; | 906 McsGroup group = m_minstrelGroups[groupId]; |
924 | 907 |
925 // Check consistency of rate selected. | 908 // Check consistency of rate selected. |
926 if ((group.sgi && !GetShortGuardInterval (station)) || group.chWidth > Get
ChannelWidth (station) || group.streams > GetNumberOfSupportedStreams (station
)) | 909 if ((group.sgi && !GetShortGuardInterval (station)) || group.chWidth > Get
ChannelWidth (station) || group.streams > GetNumberOfSupportedStreams (station
)) |
927 { | 910 { |
928 NS_ASSERT_MSG (false,"Inconsistent group selected. Group: (" << (uint1
6_t)group.streams << "," << (uint16_t)group.sgi << "," << (uint16_t)group.chWidt
h << ")" << | 911 NS_ASSERT_MSG (false, "Inconsistent group selected. Group: (" << stati
c_cast<uint16_t> (group.streams) << |
929 " Station capabilities: (" << GetNumberOfSupportedStrea
ms (station) << "," << GetShortGuardInterval (station) << "," << GetChannelWidth
(station) << ")"); | 912 "," << static_cast<uint16_t> (group.sgi) << "," << stat
ic_cast<uint16_t> (group.chWidth) << ")" << |
| 913 " Station capabilities: (" << GetNumberOfSupportedStrea
ms (station) << |
| 914 "," << GetShortGuardInterval (station) << "," << GetCha
nnelWidth (station) << ")"); |
930 } | 915 } |
931 | 916 |
932 uint64_t dataRate = GetMcsSupported (station, mcsIndex).GetDataRate (group
.chWidth, group.sgi ? 400 : 800, group.streams); | 917 uint64_t dataRate = GetMcsSupported (station, mcsIndex).GetDataRate (group
.chWidth, group.sgi ? 400 : 800, group.streams); |
933 if (!station->m_isSampling) | 918 if (!station->m_isSampling) |
934 { | 919 { |
935 m_rateChange (dataRate, station->m_state->m_address); | 920 m_rateChange (dataRate, station->m_state->m_address); |
936 } | 921 } |
937 WifiMode mode = GetMcsSupported (station, mcsIndex); | 922 WifiMode mode = GetMcsSupported (station, mcsIndex); |
938 return WifiTxVector (mode, GetDefaultTxPowerLevel (), static_cast<uint8_t>
(GetLongRetryCount (station)), | 923 return WifiTxVector (mode, GetDefaultTxPowerLevel (), static_cast<uint8_t>
(GetLongRetryCount (station)), |
939 GetPreambleForTransmission (mode, GetAddress (station
)), group.sgi ? 400 : 800, GetNumberOfAntennas (), group.streams, (uint8_t)GetNe
ss (station), group.chWidth, GetAggregation (station) && !station->m_isSampling,
false); | 924 GetPreambleForTransmission (mode, GetAddress (station
)), group.sgi ? 400 : 800, GetNumberOfAntennas (), group.streams, (uint8_t)GetNe
ss (station), GetChannelWidthForTransmission (mode, group.chWidth), GetAggregati
on (station) && !station->m_isSampling, false); |
940 } | 925 } |
941 } | 926 } |
942 | 927 |
943 WifiTxVector | 928 WifiTxVector |
944 MinstrelHtWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) | 929 MinstrelHtWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) |
945 { | 930 { |
946 NS_LOG_FUNCTION (this << st); | 931 NS_LOG_FUNCTION (this << st); |
947 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; | 932 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; |
948 | 933 |
949 if (!station->m_initialized) | 934 if (!station->m_initialized) |
(...skipping 18 matching lines...) Expand all Loading... |
968 * directed to the same receiving STA. If no rate in the BSSBasicRateSet p
arameter meets | 953 * directed to the same receiving STA. If no rate in the BSSBasicRateSet p
arameter meets |
969 * these conditions, the control frame shall be transmitted at a rate no h
igher than the | 954 * these conditions, the control frame shall be transmitted at a rate no h
igher than the |
970 * highest mandatory rate of the attached PHY that is less than or equal t
o the rate | 955 * highest mandatory rate of the attached PHY that is less than or equal t
o the rate |
971 * or non-HT reference rate (see 9.7.9) of the previously transmitted fram
e that was | 956 * or non-HT reference rate (see 9.7.9) of the previously transmitted fram
e that was |
972 * directed to the same receiving STA." | 957 * directed to the same receiving STA." |
973 */ | 958 */ |
974 | 959 |
975 // As we are in Minstrel HT, assume the last rate was an HT rate. | 960 // As we are in Minstrel HT, assume the last rate was an HT rate. |
976 uint32_t rateId = GetRateId (station->m_txrate); | 961 uint32_t rateId = GetRateId (station->m_txrate); |
977 uint32_t groupId = GetGroupId (station->m_txrate); | 962 uint32_t groupId = GetGroupId (station->m_txrate); |
978 uint32_t mcsIndex = station->m_groupsTable[groupId].m_ratesTable[rateId].m
csIndex; | 963 uint8_t mcsIndex = static_cast<uint8_t> (station->m_groupsTable[groupId].m
_ratesTable[rateId].mcsIndex); |
979 | 964 |
980 WifiMode lastRate = GetMcsSupported (station, mcsIndex); | 965 WifiMode lastRate = GetMcsSupported (station, mcsIndex); |
981 uint64_t lastDataRate = lastRate.GetNonHtReferenceRate (); | 966 uint64_t lastDataRate = lastRate.GetNonHtReferenceRate (); |
982 uint32_t nBasicRates = GetNBasicModes (); | 967 uint8_t nBasicRates = GetNBasicModes (); |
983 | 968 |
984 WifiMode rtsRate; | 969 WifiMode rtsRate; |
985 bool rateFound = false; | 970 bool rateFound = false; |
986 | 971 |
987 for (uint32_t i = 0; i < nBasicRates; i++) | 972 for (uint8_t i = 0; i < nBasicRates; i++) |
988 { | 973 { |
989 uint64_t rate = GetBasicMode (i).GetDataRate (20); | 974 uint64_t rate = GetBasicMode (i).GetDataRate (20); |
990 if (rate <= lastDataRate) | 975 if (rate <= lastDataRate) |
991 { | 976 { |
992 rtsRate = GetBasicMode (i); | 977 rtsRate = GetBasicMode (i); |
993 rateFound = true; | 978 rateFound = true; |
994 } | 979 } |
995 } | 980 } |
996 | 981 |
997 if (!rateFound) | 982 if (!rateFound) |
998 { | 983 { |
999 Ptr<WifiPhy> phy = GetPhy (); | 984 Ptr<WifiPhy> phy = GetPhy (); |
1000 uint8_t nSupportRates = phy->GetNModes (); | 985 uint8_t nSupportRates = phy->GetNModes (); |
1001 for (uint8_t i = 0; i < nSupportRates; i++) | 986 for (uint8_t i = 0; i < nSupportRates; i++) |
1002 { | 987 { |
1003 uint64_t rate = phy->GetMode (i).GetDataRate (20); | 988 uint64_t rate = phy->GetMode (i).GetDataRate (20); |
1004 if (rate <= lastDataRate) | 989 if (rate <= lastDataRate) |
1005 { | 990 { |
1006 rtsRate = phy->GetMode (i); | 991 rtsRate = phy->GetMode (i); |
1007 rateFound = true; | 992 rateFound = true; |
1008 } | 993 } |
1009 } | 994 } |
1010 } | 995 } |
1011 | 996 |
1012 NS_ASSERT (rateFound); | 997 NS_ASSERT (rateFound); |
1013 | 998 |
1014 return WifiTxVector (rtsRate, GetDefaultTxPowerLevel (), static_cast<uint8
_t>(GetShortRetryCount (station)), GetPreambleForTransmission (rtsRate, GetAddre
ss (station)), | 999 return WifiTxVector (rtsRate, GetDefaultTxPowerLevel (), static_cast<uint8
_t>(GetShortRetryCount (station)), GetPreambleForTransmission (rtsRate, GetAddre
ss (station)), |
1015 800, 1, 1, 0, GetChannelWidth (station), GetAggregati
on (station), false); | 1000 800, 1, 1, 0, GetChannelWidthForTransmission (rtsRate
, GetChannelWidth (station)), GetAggregation (station), false); |
1016 } | 1001 } |
1017 } | 1002 } |
1018 | 1003 |
1019 bool | 1004 bool |
1020 MinstrelHtWifiManager::DoNeedDataRetransmission (WifiRemoteStation *st, Ptr<cons
t Packet> packet, bool normally) | 1005 MinstrelHtWifiManager::DoNeedDataRetransmission (WifiRemoteStation *st, Ptr<cons
t Packet> packet, bool normally) |
1021 { | 1006 { |
1022 NS_LOG_FUNCTION (this << st << packet << normally); | 1007 NS_LOG_FUNCTION (this << st << packet << normally); |
1023 | 1008 |
1024 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; | 1009 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; |
1025 | 1010 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 uint32_t maxProbRateId = GetRateId (station->m_maxProbRate); | 1173 uint32_t maxProbRateId = GetRateId (station->m_maxProbRate); |
1189 | 1174 |
1190 uint8_t maxTpStreams = m_minstrelGroups[maxTpGroupId].streams; | 1175 uint8_t maxTpStreams = m_minstrelGroups[maxTpGroupId].streams; |
1191 uint8_t sampleStreams = m_minstrelGroups[sampleGroupId].streams; | 1176 uint8_t sampleStreams = m_minstrelGroups[sampleGroupId].streams; |
1192 | 1177 |
1193 Time sampleDuration = sampleRateInfo.perfectTxTime; | 1178 Time sampleDuration = sampleRateInfo.perfectTxTime; |
1194 Time maxTp2Duration = station->m_groupsTable[maxTp2GroupId].m_rate
sTable[maxTp2RateId].perfectTxTime; | 1179 Time maxTp2Duration = station->m_groupsTable[maxTp2GroupId].m_rate
sTable[maxTp2RateId].perfectTxTime; |
1195 Time maxProbDuration = station->m_groupsTable[maxProbGroupId].m_ra
tesTable[maxProbRateId].perfectTxTime; | 1180 Time maxProbDuration = station->m_groupsTable[maxProbGroupId].m_ra
tesTable[maxProbRateId].perfectTxTime; |
1196 | 1181 |
1197 NS_LOG_DEBUG ("Use sample rate? SampleDuration= " << sampleDuratio
n << " maxTp2Duration= " << maxTp2Duration << | 1182 NS_LOG_DEBUG ("Use sample rate? SampleDuration= " << sampleDuratio
n << " maxTp2Duration= " << maxTp2Duration << |
1198 " maxProbDuration= " << maxProbDuration << " sampleS
treams= " << (uint16_t)sampleStreams << | 1183 " maxProbDuration= " << maxProbDuration << " sampleS
treams= " << static_cast<uint16_t> (sampleStreams) << |
1199 " maxTpStreams= " << (uint16_t)maxTpStreams); | 1184 " maxTpStreams= " << static_cast<uint16_t> (maxTpStr
eams)); |
1200 if (sampleDuration < maxTp2Duration || (sampleStreams < maxTpStrea
ms && sampleDuration < maxProbDuration)) | 1185 if (sampleDuration < maxTp2Duration || (sampleStreams < maxTpStrea
ms && sampleDuration < maxProbDuration)) |
1201 { | 1186 { |
1202 /// Set flag that we are currently sampling. | 1187 /// Set flag that we are currently sampling. |
1203 station->m_isSampling = true; | 1188 station->m_isSampling = true; |
1204 | 1189 |
1205 /// set the rate that we're currently sampling | 1190 /// set the rate that we're currently sampling |
1206 station->m_sampleRate = sampleIdx; | 1191 station->m_sampleRate = sampleIdx; |
1207 | 1192 |
1208 NS_LOG_DEBUG ("FindRate " << "sampleRate=" << sampleIdx); | 1193 NS_LOG_DEBUG ("FindRate " << "sampleRate=" << sampleIdx); |
1209 station->m_sampleTries--; | 1194 station->m_sampleTries--; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 station->m_ampduLen = 0; | 1244 station->m_ampduLen = 0; |
1260 station->m_ampduPacketCount = 0; | 1245 station->m_ampduPacketCount = 0; |
1261 } | 1246 } |
1262 | 1247 |
1263 /* Initialize global rate indexes */ | 1248 /* Initialize global rate indexes */ |
1264 station->m_maxTpRate = GetLowestIndex (station); | 1249 station->m_maxTpRate = GetLowestIndex (station); |
1265 station->m_maxTpRate2 = GetLowestIndex (station); | 1250 station->m_maxTpRate2 = GetLowestIndex (station); |
1266 station->m_maxProbRate = GetLowestIndex (station); | 1251 station->m_maxProbRate = GetLowestIndex (station); |
1267 | 1252 |
1268 /// Update throughput and EWMA for each rate inside each group. | 1253 /// Update throughput and EWMA for each rate inside each group. |
1269 for (uint32_t j = 0; j < m_numGroups; j++) | 1254 for (uint8_t j = 0; j < m_numGroups; j++) |
1270 { | 1255 { |
1271 if (station->m_groupsTable[j].m_supported) | 1256 if (station->m_groupsTable[j].m_supported) |
1272 { | 1257 { |
1273 station->m_sampleCount++; | 1258 station->m_sampleCount++; |
1274 | 1259 |
1275 /* (re)Initialize group rate indexes */ | 1260 /* (re)Initialize group rate indexes */ |
1276 station->m_groupsTable[j].m_maxTpRate = GetLowestIndex (station, j); | 1261 station->m_groupsTable[j].m_maxTpRate = GetLowestIndex (station, j); |
1277 station->m_groupsTable[j].m_maxTpRate2 = GetLowestIndex (station, j); | 1262 station->m_groupsTable[j].m_maxTpRate2 = GetLowestIndex (station, j); |
1278 station->m_groupsTable[j].m_maxProbRate = GetLowestIndex (station, j); | 1263 station->m_groupsTable[j].m_maxProbRate = GetLowestIndex (station, j); |
1279 | 1264 |
1280 for (uint32_t i = 0; i < m_numRates; i++) | 1265 for (uint8_t i = 0; i < m_numRates; i++) |
1281 { | 1266 { |
1282 if (station->m_groupsTable[j].m_ratesTable[i].supported) | 1267 if (station->m_groupsTable[j].m_ratesTable[i].supported) |
1283 { | 1268 { |
1284 station->m_groupsTable[j].m_ratesTable[i].retryUpdated = false
; | 1269 station->m_groupsTable[j].m_ratesTable[i].retryUpdated = false
; |
1285 | 1270 |
1286 NS_LOG_DEBUG (i << " " << GetMcsSupported (station, station->
m_groupsTable[j].m_ratesTable[i].mcsIndex) << | 1271 NS_LOG_DEBUG (i << " " << GetMcsSupported (station, static_cas
t<uint8_t> (station->m_groupsTable[j].m_ratesTable[i].mcsIndex)) << |
1287 "\t attempt=" << station->m_groupsTable[j].m_rat
esTable[i].numRateAttempt << | 1272 "\t attempt=" << station->m_groupsTable[j].m_rat
esTable[i].numRateAttempt << |
1288 "\t success=" << station->m_groupsTable[j].m_rat
esTable[i].numRateSuccess); | 1273 "\t success=" << station->m_groupsTable[j].m_rat
esTable[i].numRateSuccess); |
1289 | 1274 |
1290 /// If we've attempted something. | 1275 /// If we've attempted something. |
1291 if (station->m_groupsTable[j].m_ratesTable[i].numRateAttempt >
0) | 1276 if (station->m_groupsTable[j].m_ratesTable[i].numRateAttempt >
0) |
1292 { | 1277 { |
1293 station->m_groupsTable[j].m_ratesTable[i].numSamplesSkippe
d = 0; | 1278 station->m_groupsTable[j].m_ratesTable[i].numSamplesSkippe
d = 0; |
1294 /** | 1279 /** |
1295 * Calculate the probability of success. | 1280 * Calculate the probability of success. |
1296 * Assume probability scales from 0 to 100. | 1281 * Assume probability scales from 0 to 100. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 { | 1496 { |
1512 NS_LOG_FUNCTION (this << station); | 1497 NS_LOG_FUNCTION (this << station); |
1513 NS_LOG_DEBUG ("RateInit=" << station); | 1498 NS_LOG_DEBUG ("RateInit=" << station); |
1514 | 1499 |
1515 station->m_groupsTable = McsGroupData (m_numGroups); | 1500 station->m_groupsTable = McsGroupData (m_numGroups); |
1516 | 1501 |
1517 /** | 1502 /** |
1518 * Initialize groups supported by the receiver. | 1503 * Initialize groups supported by the receiver. |
1519 */ | 1504 */ |
1520 NS_LOG_DEBUG ("Supported groups by station:"); | 1505 NS_LOG_DEBUG ("Supported groups by station:"); |
1521 for (uint32_t groupId = 0; groupId < m_numGroups; groupId++) | 1506 for (uint8_t groupId = 0; groupId < m_numGroups; groupId++) |
1522 { | 1507 { |
1523 if (m_minstrelGroups[groupId].isSupported) | 1508 if (m_minstrelGroups[groupId].isSupported) |
1524 { | 1509 { |
1525 station->m_groupsTable[groupId].m_supported = false; | 1510 station->m_groupsTable[groupId].m_supported = false; |
1526 if (!(!GetVhtSupported (station) && m_minstrelGroups[groupId].isVht)
///Is VHT supported by the receiver? | 1511 if (!(!GetVhtSupported (station) && m_minstrelGroups[groupId].isVht)
///Is VHT supported by the receiver? |
1527 && (m_minstrelGroups[groupId].isVht || !GetVhtSupported (station)
|| !m_useVhtOnly) ///If it is an HT MCS, check if VHT only is disabled | 1512 && (m_minstrelGroups[groupId].isVht || !GetVhtSupported (station)
|| !m_useVhtOnly) ///If it is an HT MCS, check if VHT only is disabled |
1528 && !(!GetShortGuardInterval (station) && m_minstrelGroups[groupId]
.sgi) ///Is SGI supported by the receiver? | 1513 && !(!GetShortGuardInterval (station) && m_minstrelGroups[groupId]
.sgi) ///Is SGI supported by the receiver? |
1529 && (GetChannelWidth (station) >= m_minstrelGroups[groupId].chWidth
) ///Is channel width supported by the receiver? | 1514 && (GetChannelWidth (station) >= m_minstrelGroups[groupId].chWidth
) ///Is channel width supported by the receiver? |
1530 && (GetNumberOfSupportedStreams (station) >= m_minstrelGroups[grou
pId].streams)) ///Are streams supported by the receiver? | 1515 && (GetNumberOfSupportedStreams (station) >= m_minstrelGroups[grou
pId].streams)) ///Are streams supported by the receiver? |
1531 { | 1516 { |
1532 NS_LOG_DEBUG ("Group " << groupId << ": (" << (uint16_t)m_minstrel
Groups[groupId].streams << | 1517 NS_LOG_DEBUG ("Group " << groupId << ": (" << static_cast<uint16_t
> (m_minstrelGroups[groupId].streams) << |
1533 "," << (uint16_t)m_minstrelGroups[groupId].sgi << ",
" << (uint16_t)m_minstrelGroups[groupId].chWidth << ")"); | 1518 "," << static_cast<uint16_t> (m_minstrelGroups[group
Id].sgi) << "," << static_cast<uint16_t> (m_minstrelGroups[groupId].chWidth) <<
")"); |
1534 | 1519 |
1535 station->m_groupsTable[groupId].m_supported = true;
///Group supported. | 1520 station->m_groupsTable[groupId].m_supported = true;
///Group supported. |
1536 station->m_groupsTable[groupId].m_col = 0; | 1521 station->m_groupsTable[groupId].m_col = 0; |
1537 station->m_groupsTable[groupId].m_index = 0; | 1522 station->m_groupsTable[groupId].m_index = 0; |
1538 | 1523 |
1539 station->m_groupsTable[groupId].m_ratesTable = HtMinstrelRate (m_n
umRates); ///Create the rate list for the group. | 1524 station->m_groupsTable[groupId].m_ratesTable = HtMinstrelRate (m_n
umRates); ///Create the rate list for the group. |
1540 for (uint32_t i = 0; i < m_numRates; i++) | 1525 for (uint8_t i = 0; i < m_numRates; i++) |
1541 { | 1526 { |
1542 station->m_groupsTable[groupId].m_ratesTable[i].supported = fa
lse; | 1527 station->m_groupsTable[groupId].m_ratesTable[i].supported = fa
lse; |
1543 } | 1528 } |
1544 | 1529 |
1545 // Initialize all modes supported by the remote station that belon
g to the current group. | 1530 // Initialize all modes supported by the remote station that belon
g to the current group. |
1546 for (uint32_t i = 0; i < station->m_nModes; i++) | 1531 for (uint8_t i = 0; i < station->m_nModes; i++) |
1547 { | 1532 { |
1548 WifiMode mode = GetMcsSupported (station, i); | 1533 WifiMode mode = GetMcsSupported (station, i); |
1549 | 1534 |
1550 ///Use the McsValue as the index in the rate table. | 1535 ///Use the McsValue as the index in the rate table. |
1551 ///This way, MCSs not supported are not initialized. | 1536 ///This way, MCSs not supported are not initialized. |
1552 uint32_t rateId = mode.GetMcsValue (); | 1537 uint32_t rateId = mode.GetMcsValue (); |
1553 if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT) | 1538 if (mode.GetModulationClass () == WIFI_MOD_CLASS_HT) |
1554 { | 1539 { |
1555 rateId %= MAX_HT_GROUP_RATES; | 1540 rateId %= MAX_HT_GROUP_RATES; |
1556 } | 1541 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 | 1600 |
1616 if (station->m_groupsTable[groupId].m_ratesTable[rateId].ewmaProb < 1) | 1601 if (station->m_groupsTable[groupId].m_ratesTable[rateId].ewmaProb < 1) |
1617 { | 1602 { |
1618 station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 1; | 1603 station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 1; |
1619 } | 1604 } |
1620 else | 1605 else |
1621 { | 1606 { |
1622 station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 2; | 1607 station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 2; |
1623 station->m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated = true; | 1608 station->m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated = true; |
1624 | 1609 |
1625 dataTxTime = GetFirstMpduTxTime (groupId, GetMcsSupported (station, statio
n->m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex)) + | 1610 dataTxTime = GetFirstMpduTxTime (groupId, GetMcsSupported (station, static
_cast<uint8_t> (station->m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex)))
+ |
1626 GetMpduTxTime (groupId, GetMcsSupported (station, station->m_groupsTable
[groupId].m_ratesTable[rateId].mcsIndex)) * static_cast<uint32_t>(station->m_avg
AmpduLen - 1); | 1611 GetMpduTxTime (groupId, GetMcsSupported (station, static_cast<uint8_t> (
station->m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex))) * static_cast<u
int32_t>(station->m_avgAmpduLen - 1); |
1627 | 1612 |
1628 /* Contention time for first 2 tries */ | 1613 /* Contention time for first 2 tries */ |
1629 cwTime = (cw / 2) * slotTime; | 1614 cwTime = (cw / 2) * slotTime; |
1630 cw = Min ((cw + 1) * 2, cwMax); | 1615 cw = Min ((cw + 1) * 2, cwMax); |
1631 cwTime += (cw / 2) * slotTime; | 1616 cwTime += (cw / 2) * slotTime; |
1632 cw = Min ((cw + 1) * 2, cwMax); | 1617 cw = Min ((cw + 1) * 2, cwMax); |
1633 | 1618 |
1634 /* Total TX time for data and Contention after first 2 tries */ | 1619 /* Total TX time for data and Contention after first 2 tries */ |
1635 txTime = cwTime + 2 * (dataTxTime + ackTime); | 1620 txTime = cwTime + 2 * (dataTxTime + ackTime); |
1636 | 1621 |
(...skipping 28 matching lines...) Expand all Loading... |
1665 } | 1650 } |
1666 | 1651 |
1667 void | 1652 void |
1668 MinstrelHtWifiManager::InitSampleTable (MinstrelHtWifiRemoteStation *station) | 1653 MinstrelHtWifiManager::InitSampleTable (MinstrelHtWifiRemoteStation *station) |
1669 { | 1654 { |
1670 NS_LOG_DEBUG ("InitSampleTable=" << this); | 1655 NS_LOG_DEBUG ("InitSampleTable=" << this); |
1671 | 1656 |
1672 station->m_col = station->m_index = 0; | 1657 station->m_col = station->m_index = 0; |
1673 | 1658 |
1674 //for off-setting to make rates fall between 0 and nModes | 1659 //for off-setting to make rates fall between 0 and nModes |
1675 uint32_t numSampleRates = m_numRates; | 1660 uint8_t numSampleRates = m_numRates; |
1676 | 1661 |
1677 uint32_t newIndex; | 1662 uint32_t newIndex; |
1678 for (uint32_t col = 0; col < m_nSampleCol; col++) | 1663 for (uint32_t col = 0; col < m_nSampleCol; col++) |
1679 { | 1664 { |
1680 for (uint32_t i = 0; i < numSampleRates; i++ ) | 1665 for (uint32_t i = 0; i < numSampleRates; i++ ) |
1681 { | 1666 { |
1682 /** | 1667 /** |
1683 * The next two lines basically tries to generate a random number | 1668 * The next two lines basically tries to generate a random number |
1684 * between 0 and the number of available rates | 1669 * between 0 and the number of available rates |
1685 */ | 1670 */ |
(...skipping 11 matching lines...) Expand all Loading... |
1697 } | 1682 } |
1698 | 1683 |
1699 void | 1684 void |
1700 MinstrelHtWifiManager::PrintTable (MinstrelHtWifiRemoteStation *station) | 1685 MinstrelHtWifiManager::PrintTable (MinstrelHtWifiRemoteStation *station) |
1701 { | 1686 { |
1702 NS_LOG_FUNCTION (this << station); | 1687 NS_LOG_FUNCTION (this << station); |
1703 NS_LOG_DEBUG ("PrintTable=" << station); | 1688 NS_LOG_DEBUG ("PrintTable=" << station); |
1704 | 1689 |
1705 station->m_statsFile << " best ____________rate__________ _
_______statistics________ ________last_______ ______sum-of________\n" << | 1690 station->m_statsFile << " best ____________rate__________ _
_______statistics________ ________last_______ ______sum-of________\n" << |
1706 " mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(pr
ob)] [prob.|retry|suc|att] [#success | #attempts]\n"; | 1691 " mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob) sd(pr
ob)] [prob.|retry|suc|att] [#success | #attempts]\n"; |
1707 for (uint32_t i = 0; i < m_numGroups; i++) | 1692 for (uint8_t i = 0; i < m_numGroups; i++) |
1708 { | 1693 { |
1709 StatsDump (station, i, station->m_statsFile); | 1694 StatsDump (station, i, station->m_statsFile); |
1710 } | 1695 } |
1711 | 1696 |
1712 station->m_statsFile << "\nTotal packet count:: ideal " << Max (0, station-
>m_totalPacketsCount - station->m_samplePacketsCount) << | 1697 station->m_statsFile << "\nTotal packet count:: ideal " << Max (0, station-
>m_totalPacketsCount - station->m_samplePacketsCount) << |
1713 " lookaround " << station->m_samplePacketsCount << "\n"; | 1698 " lookaround " << station->m_samplePacketsCount << "\n"; |
1714 station->m_statsFile << "Average # of aggregated frames per A-MPDU: " << stati
on->m_avgAmpduLen << "\n\n"; | 1699 station->m_statsFile << "Average # of aggregated frames per A-MPDU: " << stati
on->m_avgAmpduLen << "\n\n"; |
1715 | 1700 |
1716 station->m_statsFile.flush (); | 1701 station->m_statsFile.flush (); |
1717 } | 1702 } |
1718 | 1703 |
1719 void | 1704 void |
1720 MinstrelHtWifiManager::StatsDump (MinstrelHtWifiRemoteStation *station, uint32_t
groupId, std::ofstream &of) | 1705 MinstrelHtWifiManager::StatsDump (MinstrelHtWifiRemoteStation *station, uint32_t
groupId, std::ofstream &of) |
1721 { | 1706 { |
1722 uint32_t numRates = m_numRates; | 1707 uint8_t numRates = m_numRates; |
1723 McsGroup group = m_minstrelGroups[groupId]; | 1708 McsGroup group = m_minstrelGroups[groupId]; |
1724 Time txTime; | 1709 Time txTime; |
1725 char giMode; | 1710 char giMode; |
1726 if (group.sgi) | 1711 if (group.sgi) |
1727 { | 1712 { |
1728 giMode = 'S'; | 1713 giMode = 'S'; |
1729 } | 1714 } |
1730 else | 1715 else |
1731 { | 1716 { |
1732 giMode = 'L'; | 1717 giMode = 'L'; |
1733 } | 1718 } |
1734 for (uint32_t i = 0; i < numRates; i++) | 1719 for (uint8_t i = 0; i < numRates; i++) |
1735 { | 1720 { |
1736 if (station->m_groupsTable[groupId].m_supported && station->m_groupsTable[
groupId].m_ratesTable[i].supported) | 1721 if (station->m_groupsTable[groupId].m_supported && station->m_groupsTable[
groupId].m_ratesTable[i].supported) |
1737 { | 1722 { |
1738 if (!group.isVht) | 1723 if (!group.isVht) |
1739 { | 1724 { |
1740 of << "HT" << group.chWidth << " " << giMode << "GI " << (int)g
roup.streams << " "; | 1725 of << "HT" << group.chWidth << " " << giMode << "GI " << (int)g
roup.streams << " "; |
1741 } | 1726 } |
1742 else | 1727 else |
1743 { | 1728 { |
1744 of << "VHT" << group.chWidth << " " << giMode << "GI " << (int)
group.streams << " "; | 1729 of << "VHT" << group.chWidth << " " << giMode << "GI " << (int)
group.streams << " "; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 of << std::setw (4) << " MCS" << (group.streams - 1) * 8 + i; | 1764 of << std::setw (4) << " MCS" << (group.streams - 1) * 8 + i; |
1780 } | 1765 } |
1781 else | 1766 else |
1782 { | 1767 { |
1783 of << std::setw (7) << " MCS" << i << "/" << (int) group.streams
; | 1768 of << std::setw (7) << " MCS" << i << "/" << (int) group.streams
; |
1784 } | 1769 } |
1785 | 1770 |
1786 of << " " << std::setw (3) << idx << " "; | 1771 of << " " << std::setw (3) << idx << " "; |
1787 | 1772 |
1788 /* tx_time[rate(i)] in usec */ | 1773 /* tx_time[rate(i)] in usec */ |
1789 txTime = GetFirstMpduTxTime (groupId, GetMcsSupported (station, statio
n->m_groupsTable[groupId].m_ratesTable[i].mcsIndex)); | 1774 txTime = GetFirstMpduTxTime (groupId, GetMcsSupported (station, static
_cast<uint8_t> (station->m_groupsTable[groupId].m_ratesTable[i].mcsIndex))); |
1790 of << std::setw (6) << txTime.GetMicroSeconds () << " "; | 1775 of << std::setw (6) << txTime.GetMicroSeconds () << " "; |
1791 | 1776 |
1792 of << std::setw (7) << CalculateThroughput (station, groupId, i, 100)
/ 100 << " " << | 1777 of << std::setw (7) << CalculateThroughput (station, groupId, i, 100)
/ 100 << " " << |
1793 std::setw (7) << station->m_groupsTable[groupId].m_ratesTable[i].thr
oughput / 100 << " " << | 1778 std::setw (7) << station->m_groupsTable[groupId].m_ratesTable[i].thr
oughput / 100 << " " << |
1794 std::setw (7) << station->m_groupsTable[groupId].m_ratesTable[i].ewm
aProb << " " << | 1779 std::setw (7) << station->m_groupsTable[groupId].m_ratesTable[i].ewm
aProb << " " << |
1795 std::setw (7) << station->m_groupsTable[groupId].m_ratesTable[i].ewm
sdProb << " " << | 1780 std::setw (7) << station->m_groupsTable[groupId].m_ratesTable[i].ewm
sdProb << " " << |
1796 std::setw (7) << station->m_groupsTable[groupId].m_ratesTable[i].pro
b << " " << | 1781 std::setw (7) << station->m_groupsTable[groupId].m_ratesTable[i].pro
b << " " << |
1797 std::setw (2) << station->m_groupsTable[groupId].m_ratesTable[i].ret
ryCount << " " << | 1782 std::setw (2) << station->m_groupsTable[groupId].m_ratesTable[i].ret
ryCount << " " << |
1798 std::setw (3) << station->m_groupsTable[groupId].m_ratesTable[i].pre
vNumRateSuccess << " " << | 1783 std::setw (3) << station->m_groupsTable[groupId].m_ratesTable[i].pre
vNumRateSuccess << " " << |
1799 std::setw (3) << station->m_groupsTable[groupId].m_ratesTable[i].pre
vNumRateAttempt << " " << | 1784 std::setw (3) << station->m_groupsTable[groupId].m_ratesTable[i].pre
vNumRateAttempt << " " << |
1800 std::setw (9) << station->m_groupsTable[groupId].m_ratesTable[i].suc
cessHist << " " << | 1785 std::setw (9) << station->m_groupsTable[groupId].m_ratesTable[i].suc
cessHist << " " << |
1801 std::setw (9) << station->m_groupsTable[groupId].m_ratesTable[i].att
emptHist << "\n"; | 1786 std::setw (9) << station->m_groupsTable[groupId].m_ratesTable[i].att
emptHist << "\n"; |
1802 } | 1787 } |
1803 } | 1788 } |
1804 } | 1789 } |
1805 uint32_t | 1790 uint32_t |
1806 MinstrelHtWifiManager::GetIndex (uint32_t groupId, uint32_t rateId) | 1791 MinstrelHtWifiManager::GetIndex (uint32_t groupId, uint32_t rateId) |
1807 { | 1792 { |
1808 NS_LOG_FUNCTION (this << groupId << rateId); | 1793 NS_LOG_FUNCTION (this << groupId << rateId); |
1809 uint32_t index; | 1794 uint32_t index; |
1810 index = groupId * m_numRates + rateId; | 1795 index = groupId * m_numRates + rateId; |
1811 return index; | 1796 return index; |
1812 } | 1797 } |
1813 | 1798 |
1814 uint32_t | 1799 uint32_t |
1815 MinstrelHtWifiManager::GetRateId (uint32_t index) | 1800 MinstrelHtWifiManager::GetRateId (uint32_t index) |
1816 { | 1801 { |
1817 NS_LOG_FUNCTION (this << index); | 1802 NS_LOG_FUNCTION (this << index); |
1818 | |
1819 uint32_t id; | 1803 uint32_t id; |
1820 id = index % m_numRates; | 1804 id = index % m_numRates; |
1821 return id; | 1805 return id; |
1822 } | 1806 } |
1823 | 1807 |
1824 uint32_t | 1808 uint32_t |
1825 MinstrelHtWifiManager::GetGroupId (uint32_t index) | 1809 MinstrelHtWifiManager::GetGroupId (uint32_t index) |
1826 { | 1810 { |
1827 NS_LOG_FUNCTION (this << index); | 1811 NS_LOG_FUNCTION (this << index); |
1828 | |
1829 return index / m_numRates; | 1812 return index / m_numRates; |
1830 } | 1813 } |
1831 | 1814 |
1832 uint32_t | 1815 uint32_t |
1833 MinstrelHtWifiManager::GetHtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t chW
idth) | 1816 MinstrelHtWifiManager::GetHtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t chW
idth) |
1834 { | 1817 { |
1835 NS_LOG_FUNCTION (this << (uint16_t)txstreams << (uint16_t)sgi << (uint16_t)chW
idth); | 1818 NS_LOG_FUNCTION (this << static_cast<uint16_t> (txstreams) << static_cast<uint
16_t> (sgi) << static_cast<uint16_t> (chWidth)); |
1836 | |
1837 return MAX_SUPPORTED_STREAMS * 2 * (chWidth == 40 ? 1 : 0) + MAX_SUPPORTED_STR
EAMS * sgi + txstreams - 1; | 1819 return MAX_SUPPORTED_STREAMS * 2 * (chWidth == 40 ? 1 : 0) + MAX_SUPPORTED_STR
EAMS * sgi + txstreams - 1; |
1838 } | 1820 } |
1839 | 1821 |
1840 uint32_t | 1822 uint32_t |
1841 MinstrelHtWifiManager::GetVhtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t ch
Width) | 1823 MinstrelHtWifiManager::GetVhtGroupId (uint8_t txstreams, uint8_t sgi, uint8_t ch
Width) |
1842 { | 1824 { |
1843 NS_LOG_FUNCTION (this << (uint16_t)txstreams << (uint16_t)sgi << (uint16_t)chW
idth); | 1825 NS_LOG_FUNCTION (this << static_cast<uint16_t> (txstreams) << static_cast<uint
16_t> (sgi) << static_cast<uint16_t> (chWidth)); |
1844 | |
1845 return MAX_HT_STREAM_GROUPS * MAX_SUPPORTED_STREAMS + MAX_SUPPORTED_STREAMS *
2 * (chWidth == 160 ? 3 : chWidth == 80 ? 2 : chWidth == 40 ? 1 : 0) + MAX_SUPPO
RTED_STREAMS * sgi + txstreams - 1; | 1826 return MAX_HT_STREAM_GROUPS * MAX_SUPPORTED_STREAMS + MAX_SUPPORTED_STREAMS *
2 * (chWidth == 160 ? 3 : chWidth == 80 ? 2 : chWidth == 40 ? 1 : 0) + MAX_SUPPO
RTED_STREAMS * sgi + txstreams - 1; |
1846 } | 1827 } |
1847 | 1828 |
1848 uint32_t | 1829 uint32_t |
1849 MinstrelHtWifiManager::GetLowestIndex (MinstrelHtWifiRemoteStation *station) | 1830 MinstrelHtWifiManager::GetLowestIndex (MinstrelHtWifiRemoteStation *station) |
1850 { | 1831 { |
1851 NS_LOG_FUNCTION (this << station); | 1832 NS_LOG_FUNCTION (this << station); |
1852 | 1833 |
1853 uint32_t groupId = 0; | 1834 uint32_t groupId = 0; |
1854 uint32_t rateId = 0; | 1835 uint32_t rateId = 0; |
(...skipping 16 matching lines...) Expand all Loading... |
1871 | 1852 |
1872 uint32_t rateId = 0; | 1853 uint32_t rateId = 0; |
1873 while (rateId < m_numRates && !station->m_groupsTable[groupId].m_ratesTable[ra
teId].supported) | 1854 while (rateId < m_numRates && !station->m_groupsTable[groupId].m_ratesTable[ra
teId].supported) |
1874 { | 1855 { |
1875 rateId++; | 1856 rateId++; |
1876 } | 1857 } |
1877 NS_ASSERT (station->m_groupsTable[groupId].m_supported && station->m_groupsTab
le[groupId].m_ratesTable[rateId].supported); | 1858 NS_ASSERT (station->m_groupsTable[groupId].m_supported && station->m_groupsTab
le[groupId].m_ratesTable[rateId].supported); |
1878 return GetIndex (groupId, rateId); | 1859 return GetIndex (groupId, rateId); |
1879 } | 1860 } |
1880 | 1861 |
1881 | |
1882 WifiModeList | 1862 WifiModeList |
1883 MinstrelHtWifiManager::GetVhtDeviceMcsList (void) const | 1863 MinstrelHtWifiManager::GetVhtDeviceMcsList (void) const |
1884 { | 1864 { |
1885 WifiModeList vhtMcsList; | 1865 WifiModeList vhtMcsList; |
1886 Ptr<WifiPhy> phy = GetPhy (); | 1866 Ptr<WifiPhy> phy = GetPhy (); |
1887 for (uint8_t i = 0; i < phy->GetNMcs (); i++) | 1867 for (uint8_t i = 0; i < phy->GetNMcs (); i++) |
1888 { | 1868 { |
1889 WifiMode mode = phy->GetMcs(i); | 1869 WifiMode mode = phy->GetMcs (i); |
1890 if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT) | 1870 if (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT) |
1891 { | 1871 { |
1892 vhtMcsList.push_back (mode); | 1872 vhtMcsList.push_back (mode); |
1893 } | 1873 } |
1894 } | 1874 } |
1895 return vhtMcsList; | 1875 return vhtMcsList; |
1896 } | 1876 } |
1897 | 1877 |
1898 WifiModeList | 1878 WifiModeList |
1899 MinstrelHtWifiManager::GetHtDeviceMcsList (void) const | 1879 MinstrelHtWifiManager::GetHtDeviceMcsList (void) const |
(...skipping 15 matching lines...) Expand all Loading... |
1915 MinstrelHtWifiManager::SetHeSupported (bool enable) | 1895 MinstrelHtWifiManager::SetHeSupported (bool enable) |
1916 { | 1896 { |
1917 //HE is not supported yet by this algorithm. | 1897 //HE is not supported yet by this algorithm. |
1918 if (enable) | 1898 if (enable) |
1919 { | 1899 { |
1920 NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rat
es"); | 1900 NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rat
es"); |
1921 } | 1901 } |
1922 } | 1902 } |
1923 | 1903 |
1924 } // namespace ns3 | 1904 } // namespace ns3 |
1925 | |
1926 | |
1927 | |
1928 | |
1929 | |
LEFT | RIGHT |