From 90ec7fb73ceb43bd5030f4b99a5d3bb316df111b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Deronne?=
Date: Mon, 3 Dec 2018 21:48:44 +0100
Subject: [PATCH] wifi: Fill BSS color in TxVector and add trace source to be
fired at the end of 802.11ax preamble
---
CHANGES.html | 1 +
src/wifi/model/wifi-phy.cc | 17 +++++++++++
src/wifi/model/wifi-phy.h | 29 +++++++++++++++++++
src/wifi/model/wifi-remote-station-manager.cc | 8 +++++
src/wifi/model/wifi-tx-vector.cc | 17 ++++++++++-
src/wifi/model/wifi-tx-vector.h | 15 +++++++++-
6 files changed, 85 insertions(+), 2 deletions(-)
diff --git a/CHANGES.html b/CHANGES.html
index f78fbb808..35824a2fc 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -62,6 +62,7 @@ us a note on ns-developers mailing list.
New attributes QosTxop::AddBaResponseTimeout and QosTxop::FailedAddBaTimeout have been added to set the timeout to wait for an ADDBA response after the ACK to the ADDBA request is received and to set the timeout after a failed BA agreement, respectively.
+ Added a new trace source EndOfHePreamble in WifiPhy for tracing end of preamble (after training fields) for received 802.11ax packets.
Changes to existing API:
diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc
index 673dae01f..bc75bd687 100644
--- a/src/wifi/model/wifi-phy.cc
+++ b/src/wifi/model/wifi-phy.cc
@@ -367,6 +367,10 @@ WifiPhy::GetTypeId (void)
"in monitor mode to sniff all frames being transmitted",
MakeTraceSourceAccessor (&WifiPhy::m_phyMonitorSniffTxTrace),
"ns3::WifiPhy::MonitorSnifferTxTracedCallback")
+ .AddTraceSource ("EndOfHePreamble",
+ "Trace source indicating the end of the 802.11ax preamble (after training fields)",
+ MakeTraceSourceAccessor (&WifiPhy::m_phyEndOfHePreambleTrace),
+ "ns3::WifiPhy::EndOfHePreambleTracedCallback")
;
return tid;
}
@@ -2380,6 +2384,12 @@ WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz
m_phyMonitorSniffTxTrace (packet, channelFreqMhz, txVector, aMpdu);
}
+void
+WifiPhy::NotifyEndOfHePreamble (HePreambleParameters params)
+{
+ m_phyEndOfHePreambleTrace (params);
+}
+
void
WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype)
{
@@ -2654,6 +2664,13 @@ WifiPhy::StartReceivePacket (Ptr packet,
{
NS_LOG_DEBUG ("receiving plcp payload"); //endReceive is already scheduled
m_plcpSuccess = true;
+ if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HE)
+ {
+ HePreambleParameters params;
+ params.rssiW = event->GetRxPowerW ();
+ params.bssColor = txVector.GetBssColor ();
+ NotifyEndOfHePreamble (params);
+ }
}
else //mode is not allowed
{
diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h
index ffaa194db..d84c956f0 100644
--- a/src/wifi/model/wifi-phy.h
+++ b/src/wifi/model/wifi-phy.h
@@ -59,6 +59,13 @@ struct MpduInfo
uint32_t mpduRefNumber; ///< MPDU ref number
};
+// Parameters for receive HE preamble
+struct HePreambleParameters
+{
+ double rssiW; ///< RSSI in W
+ uint8_t bssColor; ///< BSS color
+};
+
/**
* \brief 802.11 PHY layer model
* \ingroup wifi
@@ -1203,6 +1210,21 @@ public:
WifiTxVector txVector,
MpduInfo aMpdu);
+ /**
+ * Public method used to fire a EndOfHePreamble trace once both HE SIG fields have been received, as well as training fields.
+ *
+ * \param params the HE preamble parameters
+ */
+ void NotifyEndOfHePreamble (HePreambleParameters params);
+
+ /**
+ * TracedCallback signature for end of HE-SIG-A events.
+ *
+ *
+ * \param params the HE preamble parameters
+ */
+ typedef void (* EndOfHePreambleCallback)(HePreambleParameters params);
+
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that
@@ -1753,6 +1775,13 @@ private:
*/
TracedCallback, uint16_t, WifiTxVector, MpduInfo> m_phyMonitorSniffTxTrace;
+ /**
+ * A trace source that indiates the end of both HE SIG fields as well as training fields for received 802.11ax packets
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback m_phyEndOfHePreambleTrace;
+
/**
* This vector holds the set of transmission modes that this
* WifiPhy(-derived class) can support. In conversation we call this
diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc
index 8e598e71f..5f687ff3e 100644
--- a/src/wifi/model/wifi-remote-station-manager.cc
+++ b/src/wifi/model/wifi-remote-station-manager.cc
@@ -588,6 +588,14 @@ WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHe
txVector.SetChannelWidth (GetChannelWidthForTransmission (mgtMode, m_wifiPhy->GetChannelWidth ()));
txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, DynamicCast (m_wifiPhy->GetDevice ())));
}
+ Ptr device = DynamicCast (m_wifiPhy->GetDevice ());
+ Ptr heConfiguration = device->GetHeConfiguration ();
+ if (heConfiguration)
+ {
+ UintegerValue bssColor;
+ heConfiguration->GetAttribute ("BssColor", bssColor);
+ txVector.SetBssColor (bssColor.Get ());
+ }
return txVector;
}
diff --git a/src/wifi/model/wifi-tx-vector.cc b/src/wifi/model/wifi-tx-vector.cc
index 40cc5cf12..5cc3f23b6 100644
--- a/src/wifi/model/wifi-tx-vector.cc
+++ b/src/wifi/model/wifi-tx-vector.cc
@@ -32,6 +32,7 @@ WifiTxVector::WifiTxVector ()
m_ness (0),
m_aggregation (false),
m_stbc (false),
+ m_bssColor (0),
m_modeInitialized (false),
m_txPowerLevelInitialized (false)
{
@@ -46,7 +47,8 @@ WifiTxVector::WifiTxVector (WifiMode mode,
uint8_t ness,
uint16_t channelWidth,
bool aggregation,
- bool stbc)
+ bool stbc,
+ uint8_t bssColor)
: m_mode (mode),
m_txPowerLevel (powerLevel),
m_preamble (preamble),
@@ -57,6 +59,7 @@ WifiTxVector::WifiTxVector (WifiMode mode,
m_ness (ness),
m_aggregation (aggregation),
m_stbc (stbc),
+ m_bssColor (bssColor),
m_modeInitialized (true),
m_txPowerLevelInitialized (true)
{
@@ -192,6 +195,18 @@ WifiTxVector::SetStbc (bool stbc)
m_stbc = stbc;
}
+void
+WifiTxVector::SetBssColor (uint8_t color)
+{
+ m_bssColor = color;
+}
+
+uint8_t
+WifiTxVector::GetBssColor (void) const
+{
+ return m_bssColor;
+}
+
bool
WifiTxVector::IsValid (void) const
{
diff --git a/src/wifi/model/wifi-tx-vector.h b/src/wifi/model/wifi-tx-vector.h
index 2d684e207..4edee3e6a 100644
--- a/src/wifi/model/wifi-tx-vector.h
+++ b/src/wifi/model/wifi-tx-vector.h
@@ -75,6 +75,7 @@ public:
* \param channelWidth the channel width in MHz
* \param aggregation enable or disable MPDU aggregation
* \param stbc enable or disable STBC
+ * \param bssColor the BSS color
*/
WifiTxVector (WifiMode mode,
uint8_t powerLevel,
@@ -85,7 +86,8 @@ public:
uint8_t ness,
uint16_t channelWidth,
bool aggregation,
- bool stbc);
+ bool stbc,
+ uint8_t bssColor = 0);
/**
* \returns the selected payload transmission mode
*/
@@ -191,6 +193,16 @@ public:
* \param stbc enable or disable STBC
*/
void SetStbc (bool stbc);
+ /**
+ * Set the BSS color
+ * \param color the BSS color
+ */
+ void SetBssColor (uint8_t color);
+ /**
+ * Get the BSS color
+ * \return the BSS color
+ */
+ uint8_t GetBssColor (void) const;
/**
* The standard disallows certain combinations of WifiMode, number of
* spatial streams, and channel widths. This method can be used to
@@ -216,6 +228,7 @@ private:
uint8_t m_ness; /**< number of spatial streams in beamforming */
bool m_aggregation; /**< Flag whether the PSDU contains A-MPDU. */
bool m_stbc; /**< STBC used or not */
+ uint8_t m_bssColor; /**< BSS color */
bool m_modeInitialized; /**< Internal initialization flag */
bool m_txPowerLevelInitialized; /**< Internal initialization flag */