Left: | ||
Right: |
OLD | NEW |
---|---|
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 { |
267 for (uint8_t sgi = 0; sgi <= 1; sgi++) | 267 for (uint8_t sgi = 0; sgi <= 1; sgi++) |
268 { | 268 { |
269 for (uint8_t streams = 1; streams <= MAX_SUPPORTED_STREAMS; st reams++) | 269 for (uint8_t streams = 1; streams <= MAX_SUPPORTED_STREAMS; st reams++) |
270 { | 270 { |
271 uint32_t groupId = GetVhtGroupId (streams, sgi, chWidth); | 271 uint32_t groupId = GetVhtGroupId (streams, sgi, static_cas t<uint8_t>(chWidth)); |
S. Deronne
2018/02/17 08:13:15
chWidth should be defined as uint8_t, same suggest
| |
272 | 272 |
273 m_minstrelGroups[groupId].streams = streams; | 273 m_minstrelGroups[groupId].streams = streams; |
274 m_minstrelGroups[groupId].sgi = sgi; | 274 m_minstrelGroups[groupId].sgi = sgi; |
275 m_minstrelGroups[groupId].chWidth = chWidth; | 275 m_minstrelGroups[groupId].chWidth = static_cast<uint8_t>(c hWidth); |
276 m_minstrelGroups[groupId].isVht = true; | 276 m_minstrelGroups[groupId].isVht = true; |
277 m_minstrelGroups[groupId].isSupported = false; | 277 m_minstrelGroups[groupId].isSupported = false; |
278 | 278 |
279 // Check capabilities of the device | 279 // Check capabilities of the device |
280 if (!(!GetPhy ()->GetShortGuardInterval () && m_minstrelGr oups[groupId].sgi) ///Is SGI supported by the transmitter? | 280 if (!(!GetPhy ()->GetShortGuardInterval () && m_minstrelGr oups[groupId].sgi) ///Is SGI supported by the transmitter? |
281 && (GetPhy ()->GetChannelWidth () >= m_minstrelGroups[ groupId].chWidth) ///Is channel width supported by the transmitter ? | 281 && (GetPhy ()->GetChannelWidth () >= m_minstrelGroups[ groupId].chWidth) ///Is channel width supported by the transmitter ? |
282 && (GetPhy ()->GetMaxSupportedTxSpatialStreams () >= m _minstrelGroups[groupId].streams)) ///Are streams supported by the transmitter? | 282 && (GetPhy ()->GetMaxSupportedTxSpatialStreams () >= m _minstrelGroups[groupId].streams)) ///Are streams supported by the transmitter? |
283 { | 283 { |
284 m_minstrelGroups[groupId].isSupported = true; | 284 m_minstrelGroups[groupId].isSupported = true; |
285 | 285 |
286 // Calculate tx time for all rates of the group | 286 // Calculate tx time for all rates of the group |
287 WifiModeList vhtMcsList = GetVhtDeviceMcsList (); | 287 WifiModeList vhtMcsList = GetVhtDeviceMcsList (); |
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, 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, 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, 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 << ": (" << static_cast<uint16_t> (streams) << "," << static_cast<uint16_t> (sgi) << "," << static_cast<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 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 station->m_statsFile.open (tmp.str ().c_str (), std::ios::out); | 499 station->m_statsFile.open (tmp.str ().c_str (), std::ios::out); |
500 station->m_initialized = true; | 500 station->m_initialized = true; |
501 } | 501 } |
502 } | 502 } |
503 } | 503 } |
504 | 504 |
505 void | 505 void |
506 MinstrelHtWifiManager::DoReportRxOk (WifiRemoteStation *st, | 506 MinstrelHtWifiManager::DoReportRxOk (WifiRemoteStation *st, |
507 double rxSnr, WifiMode txMode) | 507 double rxSnr, WifiMode txMode) |
508 { | 508 { |
509 NS_UNUSED(rxSnr); | |
510 NS_UNUSED(txMode); | |
509 NS_LOG_FUNCTION (this << st); | 511 NS_LOG_FUNCTION (this << st); |
510 | 512 |
511 NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelHtWifiRemoteStation *)st)- >m_txrate); | 513 NS_LOG_DEBUG ("DoReportRxOk m_txrate=" << ((MinstrelHtWifiRemoteStation *)st)- >m_txrate); |
512 } | 514 } |
513 | 515 |
514 void | 516 void |
515 MinstrelHtWifiManager::DoReportRtsFailed (WifiRemoteStation *st) | 517 MinstrelHtWifiManager::DoReportRtsFailed (WifiRemoteStation *st) |
516 { | 518 { |
517 NS_LOG_FUNCTION (this << st); | 519 NS_LOG_FUNCTION (this << st); |
518 | 520 |
519 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; | 521 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; |
520 | 522 |
521 CheckInit (station); | 523 CheckInit (station); |
522 if (!station->m_initialized) | 524 if (!station->m_initialized) |
523 { | 525 { |
524 return; | 526 return; |
525 } | 527 } |
526 | 528 |
527 NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate); | 529 NS_LOG_DEBUG ("DoReportRtsFailed m_txrate=" << station->m_txrate); |
528 station->m_shortRetry++; | 530 station->m_shortRetry++; |
529 } | 531 } |
530 | 532 |
531 void | 533 void |
532 MinstrelHtWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, Wifi Mode ctsMode, double rtsSnr) | 534 MinstrelHtWifiManager::DoReportRtsOk (WifiRemoteStation *st, double ctsSnr, Wifi Mode ctsMode, double rtsSnr) |
533 { | 535 { |
536 NS_UNUSED(ctsSnr); | |
537 NS_UNUSED(ctsMode); | |
538 NS_UNUSED(rtsSnr); | |
534 NS_LOG_FUNCTION (this << st); | 539 NS_LOG_FUNCTION (this << st); |
535 | 540 |
536 NS_LOG_DEBUG ("self=" << st << " rts ok"); | 541 NS_LOG_DEBUG ("self=" << st << " rts ok"); |
537 } | 542 } |
538 | 543 |
539 void | 544 void |
540 MinstrelHtWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st) | 545 MinstrelHtWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *st) |
541 { | 546 { |
542 NS_LOG_FUNCTION (this << st); | 547 NS_LOG_FUNCTION (this << st); |
543 | 548 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
865 station->m_samplePacketsCount += nSuccessfulMpdus + nFailedMpdus; | 870 station->m_samplePacketsCount += nSuccessfulMpdus + nFailedMpdus; |
866 } | 871 } |
867 if (station->m_totalPacketsCount == ~0) | 872 if (station->m_totalPacketsCount == ~0) |
868 { | 873 { |
869 station->m_samplePacketsCount = 0; | 874 station->m_samplePacketsCount = 0; |
870 station->m_totalPacketsCount = 0; | 875 station->m_totalPacketsCount = 0; |
871 } | 876 } |
872 | 877 |
873 if (!station->m_sampleWait && !station->m_sampleTries && station->m_sampleCoun t > 0) | 878 if (!station->m_sampleWait && !station->m_sampleTries && station->m_sampleCoun t > 0) |
874 { | 879 { |
875 station->m_sampleWait = 16 + 2 * station->m_avgAmpduLen; | 880 station->m_sampleWait = static_cast<uint32_t>(16 + 2 * station->m_avgAmpdu Len); |
S. Deronne
2018/02/17 08:13:15
needed because of m_avgAmpduLen? then change it to
| |
876 station->m_sampleTries = 1; | 881 station->m_sampleTries = 1; |
877 station->m_sampleCount--; | 882 station->m_sampleCount--; |
878 } | 883 } |
879 | 884 |
880 } | 885 } |
881 void | 886 void |
882 MinstrelHtWifiManager::DoDisposeStation (WifiRemoteStation *st) | 887 MinstrelHtWifiManager::DoDisposeStation (WifiRemoteStation *st) |
883 { | 888 { |
884 NS_LOG_FUNCTION (this << st); | 889 NS_LOG_FUNCTION (this << st); |
885 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; | 890 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 " Station capabilities: (" << GetNumberOfSupportedStrea ms (station) << | 934 " Station capabilities: (" << GetNumberOfSupportedStrea ms (station) << |
930 "," << GetShortGuardInterval (station) << "," << GetCha nnelWidth (station) << ")"); | 935 "," << GetShortGuardInterval (station) << "," << GetCha nnelWidth (station) << ")"); |
931 } | 936 } |
932 | 937 |
933 uint64_t dataRate = GetMcsSupported (station, mcsIndex).GetDataRate (group .chWidth, group.sgi ? 400 : 800, group.streams); | 938 uint64_t dataRate = GetMcsSupported (station, mcsIndex).GetDataRate (group .chWidth, group.sgi ? 400 : 800, group.streams); |
934 if (!station->m_isSampling) | 939 if (!station->m_isSampling) |
935 { | 940 { |
936 m_rateChange (dataRate, station->m_state->m_address); | 941 m_rateChange (dataRate, station->m_state->m_address); |
937 } | 942 } |
938 WifiMode mode = GetMcsSupported (station, mcsIndex); | 943 WifiMode mode = GetMcsSupported (station, mcsIndex); |
939 return WifiTxVector (mode, GetDefaultTxPowerLevel (), GetLongRetryCount (s tation), | 944 return WifiTxVector (mode, GetDefaultTxPowerLevel (), static_cast<uint8_t> (GetLongRetryCount (station)), |
940 GetPreambleForTransmission (mode, GetAddress (station )), group.sgi ? 400 : 800, GetNumberOfAntennas (), group.streams, GetNess (stati on), GetChannelWidthForTransmission (mode, group.chWidth), GetAggregation (stati on) && !station->m_isSampling, false); | 945 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); |
941 } | 946 } |
942 } | 947 } |
943 | 948 |
944 WifiTxVector | 949 WifiTxVector |
945 MinstrelHtWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) | 950 MinstrelHtWifiManager::DoGetRtsTxVector (WifiRemoteStation *st) |
946 { | 951 { |
947 NS_LOG_FUNCTION (this << st); | 952 NS_LOG_FUNCTION (this << st); |
948 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; | 953 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *) st; |
949 | 954 |
950 if (!station->m_initialized) | 955 if (!station->m_initialized) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1005 if (rate <= lastDataRate) | 1010 if (rate <= lastDataRate) |
1006 { | 1011 { |
1007 rtsRate = phy->GetMode (i); | 1012 rtsRate = phy->GetMode (i); |
1008 rateFound = true; | 1013 rateFound = true; |
1009 } | 1014 } |
1010 } | 1015 } |
1011 } | 1016 } |
1012 | 1017 |
1013 NS_ASSERT (rateFound); | 1018 NS_ASSERT (rateFound); |
1014 | 1019 |
1015 return WifiTxVector (rtsRate, GetDefaultTxPowerLevel (), GetShortRetryCoun t (station), GetPreambleForTransmission (rtsRate, GetAddress (station)), | 1020 return WifiTxVector (rtsRate, GetDefaultTxPowerLevel (), static_cast<uint8 _t>(GetShortRetryCount (station)), GetPreambleForTransmission (rtsRate, GetAddre ss (station)), |
1016 800, 1, 1, 0, GetChannelWidthForTransmission (rtsRate , GetChannelWidth (station)), GetAggregation (station), false); | 1021 800, 1, 1, 0, GetChannelWidthForTransmission (rtsRate , GetChannelWidth (station)), GetAggregation (station), false); |
1017 } | 1022 } |
1018 } | 1023 } |
1019 | 1024 |
1020 bool | 1025 bool |
1021 MinstrelHtWifiManager::DoNeedDataRetransmission (WifiRemoteStation *st, Ptr<cons t Packet> packet, bool normally) | 1026 MinstrelHtWifiManager::DoNeedDataRetransmission (WifiRemoteStation *st, Ptr<cons t Packet> packet, bool normally) |
1022 { | 1027 { |
1023 NS_LOG_FUNCTION (this << st << packet << normally); | 1028 NS_LOG_FUNCTION (this << st << packet << normally); |
1024 | 1029 |
1025 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; | 1030 MinstrelHtWifiRemoteStation *station = (MinstrelHtWifiRemoteStation *)st; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1302 station->m_groupsTable[j].m_ratesTable[i].prob = tempProb; | 1307 station->m_groupsTable[j].m_ratesTable[i].prob = tempProb; |
1303 | 1308 |
1304 if (station->m_groupsTable[j].m_ratesTable[i].successHist == 0) | 1309 if (station->m_groupsTable[j].m_ratesTable[i].successHist == 0) |
1305 { | 1310 { |
1306 station->m_groupsTable[j].m_ratesTable[i].ewmaProb = t empProb; | 1311 station->m_groupsTable[j].m_ratesTable[i].ewmaProb = t empProb; |
1307 } | 1312 } |
1308 else | 1313 else |
1309 { | 1314 { |
1310 station->m_groupsTable[j].m_ratesTable[i].ewmsdProb = CalculateEwmsd (station->m_groupsTable[j].m_ratesTable[i].ewmsdProb, | 1315 station->m_groupsTable[j].m_ratesTable[i].ewmsdProb = CalculateEwmsd (station->m_groupsTable[j].m_ratesTable[i].ewmsdProb, |
1311 tempProb, station->m_groupsTable[j].m_ratesTable[i].ewmaProb, | 1316 tempProb, station->m_groupsTable[j].m_ratesTable[i].ewmaProb, |
1312 m_ewmaLevel); | 1317 static_cast<uint32_t>(m_ewmaLevel)); |
S. Deronne
2018/02/17 08:13:15
needed because of m_ewmaLevel? then change it to u
| |
1313 /// EWMA probability | 1318 /// EWMA probability |
1314 tempProb = (tempProb * (100 - m_ewmaLevel) + station-> m_groupsTable[j].m_ratesTable[i].ewmaProb * m_ewmaLevel) / 100; | 1319 tempProb = (tempProb * (100 - m_ewmaLevel) + station-> m_groupsTable[j].m_ratesTable[i].ewmaProb * m_ewmaLevel) / 100; |
1315 station->m_groupsTable[j].m_ratesTable[i].ewmaProb = t empProb; | 1320 station->m_groupsTable[j].m_ratesTable[i].ewmaProb = t empProb; |
1316 } | 1321 } |
1317 | 1322 |
1318 station->m_groupsTable[j].m_ratesTable[i].throughput = Cal culateThroughput (station, j, i, tempProb); | 1323 station->m_groupsTable[j].m_ratesTable[i].throughput = Cal culateThroughput (station, j, i, tempProb); |
1319 | 1324 |
1320 station->m_groupsTable[j].m_ratesTable[i].successHist += s tation->m_groupsTable[j].m_ratesTable[i].numRateSuccess; | 1325 station->m_groupsTable[j].m_ratesTable[i].successHist += s tation->m_groupsTable[j].m_ratesTable[i].numRateSuccess; |
1321 station->m_groupsTable[j].m_ratesTable[i].attemptHist += s tation->m_groupsTable[j].m_ratesTable[i].numRateAttempt; | 1326 station->m_groupsTable[j].m_ratesTable[i].attemptHist += s tation->m_groupsTable[j].m_ratesTable[i].numRateAttempt; |
1322 } | 1327 } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1617 if (station->m_groupsTable[groupId].m_ratesTable[rateId].ewmaProb < 1) | 1622 if (station->m_groupsTable[groupId].m_ratesTable[rateId].ewmaProb < 1) |
1618 { | 1623 { |
1619 station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 1; | 1624 station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 1; |
1620 } | 1625 } |
1621 else | 1626 else |
1622 { | 1627 { |
1623 station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 2; | 1628 station->m_groupsTable[groupId].m_ratesTable[rateId].retryCount = 2; |
1624 station->m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated = true; | 1629 station->m_groupsTable[groupId].m_ratesTable[rateId].retryUpdated = true; |
1625 | 1630 |
1626 dataTxTime = GetFirstMpduTxTime (groupId, GetMcsSupported (station, statio n->m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex)) + | 1631 dataTxTime = GetFirstMpduTxTime (groupId, GetMcsSupported (station, statio n->m_groupsTable[groupId].m_ratesTable[rateId].mcsIndex)) + |
1627 GetMpduTxTime (groupId, GetMcsSupported (station, station->m_groupsTable [groupId].m_ratesTable[rateId].mcsIndex)) * (station->m_avgAmpduLen - 1); | 1632 GetMpduTxTime (groupId, GetMcsSupported (station, station->m_groupsTable [groupId].m_ratesTable[rateId].mcsIndex)) * static_cast<uint32_t>(station->m_avg AmpduLen - 1); |
1628 | 1633 |
1629 /* Contention time for first 2 tries */ | 1634 /* Contention time for first 2 tries */ |
1630 cwTime = (cw / 2) * slotTime; | 1635 cwTime = (cw / 2) * slotTime; |
1631 cw = Min ((cw + 1) * 2, cwMax); | 1636 cw = Min ((cw + 1) * 2, cwMax); |
1632 cwTime += (cw / 2) * slotTime; | 1637 cwTime += (cw / 2) * slotTime; |
1633 cw = Min ((cw + 1) * 2, cwMax); | 1638 cw = Min ((cw + 1) * 2, cwMax); |
1634 | 1639 |
1635 /* Total TX time for data and Contention after first 2 tries */ | 1640 /* Total TX time for data and Contention after first 2 tries */ |
1636 txTime = cwTime + 2 * (dataTxTime + ackTime); | 1641 txTime = cwTime + 2 * (dataTxTime + ackTime); |
1637 | 1642 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1919 NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rat es"); | 1924 NS_FATAL_ERROR ("WifiRemoteStationManager selected does not support HE rat es"); |
1920 } | 1925 } |
1921 } | 1926 } |
1922 | 1927 |
1923 } // namespace ns3 | 1928 } // namespace ns3 |
1924 | 1929 |
1925 | 1930 |
1926 | 1931 |
1927 | 1932 |
1928 | 1933 |
OLD | NEW |