wifi: Fill BSS color in TxVector and add trace source to be fired at the end of 802.11ax preamble

This commit is contained in:
Sébastien Deronne
2018-12-03 21:48:44 +01:00
parent 2bd74fdbd7
commit 90ec7fb73c
6 changed files with 85 additions and 2 deletions

View File

@@ -62,6 +62,7 @@ us a note on ns-developers mailing list.</p>
</li>
<li>New attributes <b>QosTxop::AddBaResponseTimeout</b> and <b>QosTxop::FailedAddBaTimeout</b> 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.
</li>
<li> Added a new trace source <b>EndOfHePreamble</b> in WifiPhy for tracing end of preamble (after training fields) for received 802.11ax packets.</li>
</ul>
<h2>Changes to existing API:</h2>
<ul>

View File

@@ -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<const Packet> packet, uint16_t channelFreqMhz
m_phyMonitorSniffTxTrace (packet, channelFreqMhz, txVector, aMpdu);
}
void
WifiPhy::NotifyEndOfHePreamble (HePreambleParameters params)
{
m_phyEndOfHePreambleTrace (params);
}
void
WifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, MpduType mpdutype)
{
@@ -2654,6 +2664,13 @@ WifiPhy::StartReceivePacket (Ptr<Packet> 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
{

View File

@@ -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<Ptr<const Packet>, 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<HePreambleParameters> m_phyEndOfHePreambleTrace;
/**
* This vector holds the set of transmission modes that this
* WifiPhy(-derived class) can support. In conversation we call this

View File

@@ -588,6 +588,14 @@ WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHe
txVector.SetChannelWidth (GetChannelWidthForTransmission (mgtMode, m_wifiPhy->GetChannelWidth ()));
txVector.SetGuardInterval (ConvertGuardIntervalToNanoSeconds (mgtMode, DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ())));
}
Ptr<WifiNetDevice> device = DynamicCast<WifiNetDevice> (m_wifiPhy->GetDevice ());
Ptr<HeConfiguration> heConfiguration = device->GetHeConfiguration ();
if (heConfiguration)
{
UintegerValue bssColor;
heConfiguration->GetAttribute ("BssColor", bssColor);
txVector.SetBssColor (bssColor.Get ());
}
return txVector;
}

View File

@@ -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
{

View File

@@ -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 */