From f668fcadb24a1411defa66b679719c868554cf62 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Wed, 2 Dec 2009 19:58:59 +0300 Subject: [PATCH] Mesh:Dot11s: fixed airtime metric --- src/devices/mesh/dot11s/airtime-metric.cc | 34 ++++++++++++++---- src/devices/mesh/dot11s/airtime-metric.h | 2 ++ src/devices/mesh/dot11s/hwmp-protocol.cc | 1 + .../hwmp-proactive-regression-test-0-1.pcap | Bin 8082 -> 8082 bytes .../hwmp-proactive-regression-test-1-1.pcap | Bin 13024 -> 13024 bytes .../hwmp-proactive-regression-test-2-1.pcap | Bin 14332 -> 14332 bytes .../hwmp-proactive-regression-test-3-1.pcap | Bin 13660 -> 13660 bytes .../hwmp-proactive-regression-test-4-1.pcap | Bin 8790 -> 8790 bytes .../hwmp-reactive-regression-test-0-1.pcap | Bin 10772 -> 10772 bytes .../hwmp-reactive-regression-test-1-1.pcap | Bin 15544 -> 15544 bytes .../hwmp-reactive-regression-test-2-1.pcap | Bin 13894 -> 13894 bytes .../hwmp-reactive-regression-test-3-1.pcap | Bin 9793 -> 9793 bytes .../hwmp-reactive-regression-test-4-1.pcap | Bin 11487 -> 11487 bytes .../hwmp-reactive-regression-test-5-1.pcap | Bin 9280 -> 9280 bytes ...hwmp-target-flags-regression-test-0-1.pcap | Bin 10632 -> 10632 bytes ...hwmp-target-flags-regression-test-1-1.pcap | Bin 14952 -> 14952 bytes ...hwmp-target-flags-regression-test-2-1.pcap | Bin 13418 -> 13418 bytes ...hwmp-target-flags-regression-test-3-1.pcap | Bin 7392 -> 7392 bytes src/devices/mesh/mesh-wifi-interface-mac.cc | 10 ++++-- src/devices/mesh/mesh-wifi-interface-mac.h | 4 ++- 20 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/devices/mesh/dot11s/airtime-metric.cc b/src/devices/mesh/dot11s/airtime-metric.cc index b1b6e2863..127430df9 100644 --- a/src/devices/mesh/dot11s/airtime-metric.cc +++ b/src/devices/mesh/dot11s/airtime-metric.cc @@ -30,12 +30,6 @@ AirtimeLinkMetricCalculator::GetTypeId () static TypeId tid = TypeId ("ns3::dot11s::AirtimeLinkMetricCalculator") .SetParent () .AddConstructor () - .AddAttribute ( "OverheadNanosec", - "Overhead expressed in nanoseconds:DIFS+ SIFS + 2 * PREAMBLE + ACK", - UintegerValue (108000), - MakeUintegerAccessor (&AirtimeLinkMetricCalculator::m_overheadNanosec), - MakeUintegerChecker (1) - ) .AddAttribute ( "TestLength", "Rate should be estimated using test length.", UintegerValue (1024), @@ -60,7 +54,32 @@ AirtimeLinkMetricCalculator::GetTypeId () ; return tid; } - +AirtimeLinkMetricCalculator::AirtimeLinkMetricCalculator () : + m_overheadNanosec (0) +{} +void +AirtimeLinkMetricCalculator::SetPhyStandard (WifiPhyStandard standard) +{ + switch (standard) { + case WIFI_PHY_STANDARD_80211a: + case WIFI_PHY_STANDARD_holland: + // 2 * PREAMBLE + DIFS + SIFS + ACK + m_overheadNanosec = (2 * 16 + 34 + 16 + 44) * 1000; + break; + case WIFI_PHY_STANDARD_80211b: + m_overheadNanosec = (2 * 144 + 50 + 16 + 304) * 1000; + break; + case WIFI_PHY_STANDARD_80211_10Mhz: + m_overheadNanosec = (2 * 32 + 58 + 32 + 88) * 1000; + break; + case WIFI_PHY_STANDARD_80211_5Mhz: + m_overheadNanosec = (2 * 64 + 106 + 64 + 176) * 1000; + break; + default: + NS_ASSERT (false); + break; + } +} uint32_t AirtimeLinkMetricCalculator::CalculateMetric (Mac48Address peerAddress, Ptr mac) { @@ -80,6 +99,7 @@ AirtimeLinkMetricCalculator::CalculateMetric (Mac48Address peerAddress, PtrGetStationManager ()->Lookup (peerAddress); NS_ASSERT (station != 0); + NS_ASSERT (m_overheadNanosec != 0); Ptr test_frame = Create (m_testLength + m_meshHeaderLength); uint32_t rate = station->GetDataMode (test_frame, m_testLength + m_meshHeaderLength).GetDataRate (); diff --git a/src/devices/mesh/dot11s/airtime-metric.h b/src/devices/mesh/dot11s/airtime-metric.h index 0f98cc480..0440ea9e1 100644 --- a/src/devices/mesh/dot11s/airtime-metric.h +++ b/src/devices/mesh/dot11s/airtime-metric.h @@ -42,7 +42,9 @@ namespace dot11s { class AirtimeLinkMetricCalculator : public Object { public: + AirtimeLinkMetricCalculator (); static TypeId GetTypeId (); + void SetPhyStandard (WifiPhyStandard standard); uint32_t CalculateMetric (Mac48Address peerAddress, Ptr mac); private: /// Overhead expressed in nanoseconds:DIFS + SIFS + 2 * PREAMBLE + ACK diff --git a/src/devices/mesh/dot11s/hwmp-protocol.cc b/src/devices/mesh/dot11s/hwmp-protocol.cc index ae9b39765..f9c5eb90c 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc @@ -710,6 +710,7 @@ HwmpProtocol::Install (Ptr mp) //Installing airtime link metric: Ptr metric = CreateObject (); mac->SetLinkMetricCallback (MakeCallback (&AirtimeLinkMetricCalculator::CalculateMetric, metric)); + metric->SetPhyStandard (mac->GetPhyStandard ()); } mp->SetRoutingProtocol (this); // Mesh point aggregates all installed protocols diff --git a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-0-1.pcap b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-0-1.pcap index eaa0c63cf1d103a95680959a2425e450a21ee15b..cbe7163ed62b1c9ceefe2f0a0ba15522fb0db8a6 100644 GIT binary patch delta 76 zcmbPaKgoW>R~E)4lfSX-Wt={F3u_Rg^=5W9duGPR~E)alfSX-Wt=*B3u_Rg`DS)DduGP9lifK%Labatj82;)xLO667BEcy iAT2ietJE@}xPy%7DfkMKQKk%_k-p0QSDD{C~baIhE tG?N?SPqLT+^i*Bya&0qxpyQL<{ diff --git a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-2-1.pcap b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-2-1.pcap index dd04cebe74ad62642987b775918cf7fead77cade..6563289d62c2d75d5d642be16db1de99dc0ed70f 100644 GIT binary patch delta 80 zcmey9|0jRLKX%6HlmD~dWn41ZkzIW97mjeo>6?8x3pg0p0|kU9Ul3dcR8TEcz_ bXPL|_3{n&=tSQHsHM!L=2gvzk$i)T#GT$B4 delta 80 zcmey9|0jRLKX%5clmD~dWn47bkzIW97mjeoshfQ`3pg0p0tJL8Ul3dcR8TEcz_<&_ bXPL|_3{n&=tSQHsF}c++2gvzk$i)T#FdrSl diff --git a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-3-1.pcap b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-3-1.pcap index af181764ae3ab86bbf1e545bb30370ebdb975b73..87b257b5c4b5f7b67e2f63398b62219cb14b01d0 100644 GIT binary patch delta 83 zcmcbUbth|sB?se@$s2`*C;M`&Vw^tt2S)*uHRI#}HnGhOoCaKsdw_C#f#Ufh1&r~V kABfzPWZVc=epYW4W7gyf{UAoa$*1)L7_&CZ7&x#305A(4djJ3c delta 83 zcmcbUbth|sB?sf8$s2`*C;M`&Vw^hp2S)*uIpgF2HnGhOoCaKsyMS_gf#Ufh1&q;~ kABfzPWLytcepYW4W5(nP{UAoK$*1)L7&A7@7&x#304y^eVE_OC diff --git a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-4-1.pcap b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-4-1.pcap index e44c60329d97c0708555a148312ca8b18bb273e3..dee2051207d8c2a70461ff584f3723fde9a2ec42 100644 GIT binary patch delta 79 zcmccSa?NFf6D#AA$e%JI{AW}Eu+_DKKTH~jLq@#-b0zmb0zCnffD;yzKonO2#*>&7YyoPs1r@U=S#1vL diff --git a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-2-1.pcap b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-2-1.pcap index 19de55c7264109cec230d698ff6a3041f5f216cc..b5d6c17f1b04ee17136bb6b0fc68c273b4bdf941 100644 GIT binary patch delta 44 ycmX?>b1Y|rfH32#$%4WmjEb1Y|rfH32V$%4WmjJA{0faImgyM^-@4JT`fLF3^Cr(0&S5m2%psD)cxH2{$QeNZcjXWF delta 44 zcmX@;bI@l)qY$I*LF3b0*Ig&S5m1%psD)cx-d2$QeNZb!iXT diff --git a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-4-1.pcap b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-4-1.pcap index c0d4880a42bb885c146b8bbea33138bd2f97423f..8598cdad95612fc96bb1b4fa1b560ad0ea36f268 100644 GIT binary patch delta 117 zcmcZ~c|UT)7ZJuAlfR0DFy>G865Y!i9cl=x;ZNfSoKyv_Ae-XQ9<^ji?MQx-%` mo~Izbd7nH;9?axY1S_>yddn!1$H2hA$Oa@B7+Aq1kN^Nj!W}ID delta 102 zcmX@$alm84F@DDM$;bKkGS1oDDzKJ=F=ukUl=x;ZNfSoKoXz!8-XQ9<^ji?MQx-%` mo~Izbd7nH;9?axY1S_>yddn!1!@$76$Oa@B7+Aq1kN^Nc`W+Jh diff --git a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-0-1.pcap b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-0-1.pcap index 3b6768ae5645a68725176bdb04725eaea78fa8b0..3f42ab2263edc198b500ccdc13d580faea316b74 100644 GIT binary patch delta 33 rcmV++0N($IQ;1Wrwg&;1leY(M0j9Gi2(JnOI+NBCy#bfAloRw7-{TD` delta 33 rcmV++0N($IQ;1Wrwg&-~leY(M0i?4g2(JnOHj~y8y#bZ8loRw7-%kx7 diff --git a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-1-1.pcap b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-1-1.pcap index bee8105d8ccd4105c884c4b84e6199356c8f0dda..f8e75cdee126aec09121ccf8a1cf738644901404 100644 GIT binary patch delta 51 zcmaD+@}guz8yDmB$?aTw8JBH#<<8}0w4S_KA_yqNCK8JA67z$Lm_iQAf+(Ry;6SOHM@yjTd6731U!Vq%l6#VvsX PrQ$h^7MmZ5cgO$$oWT^j delta 60 zcmaEr@hW439~a})$^Kk>8JA36z$Lm_iQAf+(R^~8SOHM@yjTd68RO&&Vq%l6#VvsX PrQ$h^CYv9LcgO$$nyVD1 diff --git a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-3-1.pcap b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-3-1.pcap index 53683489cbf7e590d1e6722e52f06d866ca17601..78232ddfe01405594332e3a318a2ff9861e9e464 100644 GIT binary patch delta 26 icmaE0`M`2RBM+nX m_txOkCallback; TracedCallback m_txErrCallback; - + /// Current PHY standard: needed to configure metric + WifiPhyStandard m_standard; }; } // namespace ns3