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 eaa0c63cf..cbe7163ed 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-0-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-0-1.pcap differ diff --git a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-1-1.pcap b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-1-1.pcap index 1747c6bc3..96730b748 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-1-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-1-1.pcap differ 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 dd04cebe7..6563289d6 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-2-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-2-1.pcap differ 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 af181764a..87b257b5c 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-3-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-3-1.pcap differ 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 e44c60329..dee205120 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-4-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-proactive-regression-test-4-1.pcap differ diff --git a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-0-1.pcap b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-0-1.pcap index 845996368..8e2ed37de 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-0-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-0-1.pcap differ diff --git a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-1-1.pcap b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-1-1.pcap index 6a66fb7a8..de77ff16d 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-1-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-1-1.pcap differ 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 19de55c72..b5d6c17f1 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-2-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-2-1.pcap differ diff --git a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-3-1.pcap b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-3-1.pcap index 07dfd5dee..d8bf4dc1c 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-3-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-3-1.pcap differ 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 c0d4880a4..8598cdad9 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-4-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-4-1.pcap differ diff --git a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-5-1.pcap b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-5-1.pcap index 083265185..76da658c2 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-5-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-reactive-regression-test-5-1.pcap differ 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 3b6768ae5..3f42ab226 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-0-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-0-1.pcap differ 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 bee8105d8..f8e75cdee 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-1-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-1-1.pcap differ diff --git a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-2-1.pcap b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-2-1.pcap index 51140c842..fcd2dce3b 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-2-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-2-1.pcap differ 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 53683489c..78232ddfe 100644 Binary files a/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-3-1.pcap and b/src/devices/mesh/dot11s/test/hwmp-target-flags-regression-test-3-1.pcap differ diff --git a/src/devices/mesh/mesh-wifi-interface-mac.cc b/src/devices/mesh/mesh-wifi-interface-mac.cc index 4e53a1378..e5404cbaa 100644 --- a/src/devices/mesh/mesh-wifi-interface-mac.cc +++ b/src/devices/mesh/mesh-wifi-interface-mac.cc @@ -81,7 +81,8 @@ MeshWifiInterfaceMac::GetTypeId () ; return tid; } -MeshWifiInterfaceMac::MeshWifiInterfaceMac () +MeshWifiInterfaceMac::MeshWifiInterfaceMac () : + m_standard (WIFI_PHY_STANDARD_80211a) { NS_LOG_FUNCTION (this); @@ -747,7 +748,12 @@ MeshWifiInterfaceMac::FinishConfigureStandard (enum WifiPhyStandard standard) NS_ASSERT (false); break; } + m_standard = standard; +} +WifiPhyStandard +MeshWifiInterfaceMac::GetPhyStandard () const +{ + return m_standard; } - } // namespace ns3 diff --git a/src/devices/mesh/mesh-wifi-interface-mac.h b/src/devices/mesh/mesh-wifi-interface-mac.h index 99bffce06..60bb5b0c5 100644 --- a/src/devices/mesh/mesh-wifi-interface-mac.h +++ b/src/devices/mesh/mesh-wifi-interface-mac.h @@ -159,6 +159,7 @@ public: /// Enable/disable beacons void SetBeaconGeneration (bool enable); void SetQueue (AccessClass ac); + WifiPhyStandard GetPhyStandard () const; virtual void FinishConfigureStandard (enum WifiPhyStandard standard); private: /// Frame receive handler @@ -246,7 +247,8 @@ private: ///\} TracedCallback m_txOkCallback; TracedCallback m_txErrCallback; - + /// Current PHY standard: needed to configure metric + WifiPhyStandard m_standard; }; } // namespace ns3