wifi: Add initial EHT capabilities IE

This commit is contained in:
Sébastien Deronne
2021-03-06 15:51:46 +01:00
committed by Stefano Avallone
parent 7294ea57ab
commit e62e13ab25
14 changed files with 534 additions and 49 deletions

View File

@@ -25,6 +25,7 @@ set(source_files
model/channel-access-manager.cc
model/ctrl-headers.cc
model/edca-parameter-set.cc
model/eht/eht-capabilities.cc
model/eht/eht-configuration.cc
model/error-rate-model.cc
model/extended-capabilities.cc
@@ -160,6 +161,7 @@ set(header_files
model/channel-access-manager.h
model/ctrl-headers.h
model/edca-parameter-set.h
model/eht/eht-capabilities.h
model/eht/eht-configuration.h
model/error-rate-model.h
model/extended-capabilities.h

View File

@@ -27,6 +27,7 @@
#include "ns3/ht-capabilities.h"
#include "ns3/vht-capabilities.h"
#include "ns3/he-capabilities.h"
#include "ns3/eht-capabilities.h"
namespace ns3 {
@@ -97,6 +98,10 @@ AdhocWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
{
GetWifiRemoteStationManager ()->AddStationHeCapabilities (to, GetHeCapabilities ());
}
if (GetEhtSupported ())
{
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (to, GetEhtCapabilities ());
}
GetWifiRemoteStationManager ()->AddAllSupportedModes (to);
GetWifiRemoteStationManager ()->RecordDisassociated (to);
}
@@ -197,6 +202,10 @@ AdhocWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
{
GetWifiRemoteStationManager ()->AddStationHeCapabilities (from, GetHeCapabilities ());
}
if (GetEhtSupported ())
{
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (from, GetEhtCapabilities ());
}
GetWifiRemoteStationManager ()->AddAllSupportedModes (from);
GetWifiRemoteStationManager ()->RecordDisassociated (from);
}

View File

@@ -770,6 +770,10 @@ ApWifiMac::SendProbeResp (Mac48Address to)
probe.SetHeOperation (GetHeOperation ());
probe.SetMuEdcaParameterSet (GetMuEdcaParameterSet ());
}
if (GetEhtSupported ())
{
probe.SetEhtCapabilities (GetEhtCapabilities ());
}
packet->AddHeader (probe);
if (!GetQosSupported ())
@@ -875,6 +879,10 @@ ApWifiMac::SendAssocResp (Mac48Address to, bool success, bool isReassoc)
assoc.SetHeOperation (GetHeOperation ());
assoc.SetMuEdcaParameterSet (GetMuEdcaParameterSet ());
}
if (GetEhtSupported ())
{
assoc.SetEhtCapabilities (GetEhtCapabilities ());
}
packet->AddHeader (assoc);
if (!GetQosSupported ())
@@ -946,6 +954,10 @@ ApWifiMac::SendOneBeacon (void)
beacon.SetHeOperation (GetHeOperation ());
beacon.SetMuEdcaParameterSet (GetMuEdcaParameterSet ());
}
if (GetEhtSupported ())
{
beacon.SetEhtCapabilities (GetEhtCapabilities ());
}
packet->AddHeader (beacon);
//The beacon has it's own special queue, so we load it in there
@@ -1118,13 +1130,13 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
if (GetHtSupported ())
{
//check whether the HT STA supports all MCSs in Basic MCS Set
HtCapabilities htcapabilities = assocReq.GetHtCapabilities ();
if (htcapabilities.IsSupportedMcs (0))
HtCapabilities htCapabilities = assocReq.GetHtCapabilities ();
if (htCapabilities.IsSupportedMcs (0))
{
for (uint8_t i = 0; i < GetWifiRemoteStationManager ()->GetNBasicMcs (); i++)
{
WifiMode mcs = GetWifiRemoteStationManager ()->GetBasicMcs (i);
if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
if (!htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
{
problem = true;
break;
@@ -1135,13 +1147,13 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
if (GetVhtSupported ())
{
//check whether the VHT STA supports all MCSs in Basic MCS Set
VhtCapabilities vhtcapabilities = assocReq.GetVhtCapabilities ();
if (vhtcapabilities.GetVhtCapabilitiesInfo () != 0)
VhtCapabilities vhtCapabilities = assocReq.GetVhtCapabilities ();
if (vhtCapabilities.GetVhtCapabilitiesInfo () != 0)
{
for (uint8_t i = 0; i < GetWifiRemoteStationManager ()->GetNBasicMcs (); i++)
{
WifiMode mcs = GetWifiRemoteStationManager ()->GetBasicMcs (i);
if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
if (!vhtCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
{
problem = true;
break;
@@ -1152,13 +1164,13 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
if (GetHeSupported ())
{
//check whether the HE STA supports all MCSs in Basic MCS Set
HeCapabilities hecapabilities = assocReq.GetHeCapabilities ();
if (hecapabilities.GetSupportedMcsAndNss () != 0)
HeCapabilities heCapabilities = assocReq.GetHeCapabilities ();
if (heCapabilities.GetSupportedMcsAndNss () != 0)
{
for (uint8_t i = 0; i < GetWifiRemoteStationManager ()->GetNBasicMcs (); i++)
{
WifiMode mcs = GetWifiRemoteStationManager ()->GetBasicMcs (i);
if (!hecapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
if (!heCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
{
problem = true;
break;
@@ -1166,6 +1178,12 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
}
}
}
if (GetEhtSupported ())
{
//check whether the EHT STA supports all MCSs in Basic MCS Set
EhtCapabilities ehtCapabilities = assocReq.GetEhtCapabilities ();
//TODO: to be completed
}
if (problem)
{
NS_LOG_DEBUG ("One of the Basic Rate set mode is not supported by the station: send association response with an error status");
@@ -1232,6 +1250,18 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
}
}
}
if (GetEhtSupported ())
{
EhtCapabilities ehtCapabilities = assocReq.GetEhtCapabilities ();
//TODO: once we support non constant rate managers, we should add checks here whether EHT is supported by the peer
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (from, ehtCapabilities);
for (const auto & mcs : GetWifiPhy ()->GetMcsList (WIFI_MOD_CLASS_EHT))
{
//TODO: Add check whether MCS is supported from the capabilities
GetWifiRemoteStationManager ()->AddSupportedMcs (hdr->GetAddr2 (), mcs);
//here should add a control to add basic MCS when it is implemented
}
}
GetWifiRemoteStationManager ()->RecordWaitAssocTxOk (from);
NS_LOG_DEBUG ("Send association response with success status");
SendAssocResp (hdr->GetAddr2 (), true, false);
@@ -1256,13 +1286,13 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
if (GetHtSupported ())
{
//check whether the HT STA supports all MCSs in Basic MCS Set
HtCapabilities htcapabilities = reassocReq.GetHtCapabilities ();
if (htcapabilities.IsSupportedMcs (0))
HtCapabilities htCapabilities = reassocReq.GetHtCapabilities ();
if (htCapabilities.IsSupportedMcs (0))
{
for (uint8_t i = 0; i < GetWifiRemoteStationManager ()->GetNBasicMcs (); i++)
{
WifiMode mcs = GetWifiRemoteStationManager ()->GetBasicMcs (i);
if (!htcapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
if (!htCapabilities.IsSupportedMcs (mcs.GetMcsValue ()))
{
problem = true;
break;
@@ -1273,13 +1303,13 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
if (GetVhtSupported ())
{
//check whether the VHT STA supports all MCSs in Basic MCS Set
VhtCapabilities vhtcapabilities = reassocReq.GetVhtCapabilities ();
if (vhtcapabilities.GetVhtCapabilitiesInfo () != 0)
VhtCapabilities vhtCapabilities = reassocReq.GetVhtCapabilities ();
if (vhtCapabilities.GetVhtCapabilitiesInfo () != 0)
{
for (uint8_t i = 0; i < GetWifiRemoteStationManager ()->GetNBasicMcs (); i++)
{
WifiMode mcs = GetWifiRemoteStationManager ()->GetBasicMcs (i);
if (!vhtcapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
if (!vhtCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
{
problem = true;
break;
@@ -1290,13 +1320,13 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
if (GetHeSupported ())
{
//check whether the HE STA supports all MCSs in Basic MCS Set
HeCapabilities hecapabilities = reassocReq.GetHeCapabilities ();
if (hecapabilities.GetSupportedMcsAndNss () != 0)
HeCapabilities heCapabilities = reassocReq.GetHeCapabilities ();
if (heCapabilities.GetSupportedMcsAndNss () != 0)
{
for (uint8_t i = 0; i < GetWifiRemoteStationManager ()->GetNBasicMcs (); i++)
{
WifiMode mcs = GetWifiRemoteStationManager ()->GetBasicMcs (i);
if (!hecapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
if (!heCapabilities.IsSupportedTxMcs (mcs.GetMcsValue ()))
{
problem = true;
break;
@@ -1304,6 +1334,12 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
}
}
}
if (GetEhtSupported ())
{
//check whether the EHT STA supports all MCSs in Basic MCS Set
EhtCapabilities ehtCapabilities = reassocReq.GetEhtCapabilities ();
//TODO: to be completed
}
if (problem)
{
NS_LOG_DEBUG ("One of the Basic Rate set mode is not supported by the station: send reassociation response with an error status");
@@ -1370,6 +1406,18 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
}
}
}
if (GetEhtSupported ())
{
EhtCapabilities ehtCapabilities = reassocReq.GetEhtCapabilities ();
//TODO: once we support non constant rate managers, we should add checks here whether HE is supported by the peer
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (from, ehtCapabilities);
for (const auto & mcs : GetWifiPhy ()->GetMcsList (WIFI_MOD_CLASS_HE))
{
//TODO: Add check whether MCS is supported from the capabilities
GetWifiRemoteStationManager ()->AddSupportedMcs (hdr->GetAddr2 (), mcs);
//here should add a control to add basic MCS when it is implemented
}
}
GetWifiRemoteStationManager ()->RecordWaitAssocTxOk (from);
NS_LOG_DEBUG ("Send reassociation response with success status");
SendAssocResp (hdr->GetAddr2 (), true, true);

View File

@@ -0,0 +1,99 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2021 DERONNE SOFTWARE ENGINEERING
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Sébastien Deronne <sebastien.deronne@gmail.com>
*/
#include "eht-capabilities.h"
namespace ns3 {
EhtCapabilities::EhtCapabilities ()
: m_ehtSupported (0)
{
}
WifiInformationElementId
EhtCapabilities::ElementId () const
{
return IE_EXTENSION;
}
WifiInformationElementId
EhtCapabilities::ElementIdExt () const
{
return IE_EXT_EHT_CAPABILITIES;
}
void
EhtCapabilities::SetEhtSupported (uint8_t ehtSupported)
{
m_ehtSupported = ehtSupported;
}
uint8_t
EhtCapabilities::GetInformationFieldSize () const
{
//we should not be here if EHT is not supported
NS_ASSERT (m_ehtSupported > 0);
return 0; //FIXME
}
Buffer::Iterator
EhtCapabilities::Serialize (Buffer::Iterator i) const
{
if (m_ehtSupported < 1)
{
return i;
}
return WifiInformationElement::Serialize (i);
}
uint16_t
EhtCapabilities::GetSerializedSize () const
{
if (m_ehtSupported < 1)
{
return 0;
}
return WifiInformationElement::GetSerializedSize ();
}
void
EhtCapabilities::SerializeInformationField (Buffer::Iterator start) const
{
if (m_ehtSupported == 1)
{
//TODO
}
}
uint8_t
EhtCapabilities::DeserializeInformationField (Buffer::Iterator start, uint8_t length)
{
//TODO
return length;
}
std::ostream &
operator << (std::ostream &os, const EhtCapabilities &ehtCapabilities)
{
//TODO
return os;
}
} //namespace ns3

View File

@@ -0,0 +1,77 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2021 DERONNE SOFTWARE ENGINEERING
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Sébastien Deronne <sebastien.deronne@gmail.com>
*/
#ifndef EHT_CAPABILITIES_H
#define EHT_CAPABILITIES_H
#include "ns3/wifi-information-element.h"
namespace ns3 {
/**
* \ingroup wifi
*
* The IEEE 802.11be EHT Capabilities
*/
class EhtCapabilities : public WifiInformationElement
{
public:
EhtCapabilities ();
/**
* Set EHT supported
* \param ehtSupported the EHT supported indicator
*/
void SetEhtSupported (uint8_t ehtSupported);
// Implementations of pure virtual methods, or overridden from base class.
WifiInformationElementId ElementId () const;
WifiInformationElementId ElementIdExt () const;
uint8_t GetInformationFieldSize () const;
void SerializeInformationField (Buffer::Iterator start) const;
uint8_t DeserializeInformationField (Buffer::Iterator start, uint8_t length);
/*
* This information element is a bit special in that it is only
* included if the STA is an EHT STA. To support this we
* override the Serialize and GetSerializedSize methods of
* WifiInformationElement.
*/
Buffer::Iterator Serialize (Buffer::Iterator start) const;
uint16_t GetSerializedSize () const;
private:
//TODO: add fields
/// This is used to decide if this element should be added to the frame or not
uint8_t m_ehtSupported;
};
/**
* output stream output operator
* \param os the output stream
* \param ehtCapabilities the EHT capabilities
* \returns the output stream
*/
std::ostream &operator << (std::ostream &os, const EhtCapabilities &ehtCapabilities);
} //namespace ns3
#endif /* HE_CAPABILITY_H */

View File

@@ -102,6 +102,18 @@ MgtProbeRequestHeader::GetHeCapabilities (void) const
return m_heCapability;
}
void
MgtProbeRequestHeader::SetEhtCapabilities (EhtCapabilities ehtCapabilities)
{
m_ehtCapability = ehtCapabilities;
}
EhtCapabilities
MgtProbeRequestHeader::GetEhtCapabilities (void) const
{
return m_ehtCapability;
}
SupportedRates
MgtProbeRequestHeader::GetSupportedRates (void) const
{
@@ -119,6 +131,7 @@ MgtProbeRequestHeader::GetSerializedSize (void) const
size += m_htCapability.GetSerializedSize ();
size += m_vhtCapability.GetSerializedSize ();
size += m_heCapability.GetSerializedSize ();
size += m_ehtCapability.GetSerializedSize ();
return size;
}
@@ -147,7 +160,8 @@ MgtProbeRequestHeader::Print (std::ostream &os) const
<< "Extended Capabilities=" << m_extendedCapability << " , "
<< "HT Capabilities=" << m_htCapability << " , "
<< "VHT Capabilities=" << m_vhtCapability << " , "
<< "HE Capabilities=" << m_heCapability;
<< "HE Capabilities=" << m_heCapability << " , "
<< "EHT Capabilities=" << m_ehtCapability;
}
void
@@ -161,6 +175,7 @@ MgtProbeRequestHeader::Serialize (Buffer::Iterator start) const
i = m_htCapability.Serialize (i);
i = m_vhtCapability.Serialize (i);
i = m_heCapability.Serialize (i);
i = m_ehtCapability.Serialize (i);
}
uint32_t
@@ -174,6 +189,7 @@ MgtProbeRequestHeader::Deserialize (Buffer::Iterator start)
i = m_htCapability.DeserializeIfPresent (i);
i = m_vhtCapability.DeserializeIfPresent (i);
i = m_heCapability.DeserializeIfPresent (i);
i = m_ehtCapability.DeserializeIfPresent (i);
return i.GetDistanceFrom (start);
}
@@ -312,6 +328,18 @@ MgtProbeResponseHeader::GetHeOperation (void) const
return m_heOperation;
}
void
MgtProbeResponseHeader::SetEhtCapabilities (EhtCapabilities ehtCapabilities)
{
m_ehtCapability = ehtCapabilities;
}
EhtCapabilities
MgtProbeResponseHeader::GetEhtCapabilities (void) const
{
return m_ehtCapability;
}
void
MgtProbeResponseHeader::SetSsid (Ssid ssid)
{
@@ -416,6 +444,7 @@ MgtProbeResponseHeader::GetSerializedSize (void) const
size += m_heCapability.GetSerializedSize ();
size += m_heOperation.GetSerializedSize ();
size += m_muEdcaParameterSet.GetSerializedSize ();
size += m_ehtCapability.GetSerializedSize ();
return size;
}
@@ -431,21 +460,13 @@ MgtProbeResponseHeader::Print (std::ostream &os) const
<< "VHT Capabilities=" << m_vhtCapability << " , "
<< "VHT Operation=" << m_vhtOperation << " , "
<< "HE Capabilities=" << m_heCapability << " , "
<< "HE Operation=" << m_heOperation;
<< "HE Operation=" << m_heOperation << " , "
<< "EHT Capabilities=" << m_ehtCapability;
}
void
MgtProbeResponseHeader::Serialize (Buffer::Iterator start) const
{
//timestamp
//beacon interval
//capability information
//SSID
//supported rates
//FH parameter set
//DS parameter set
//CF parameter set
//IBSS parameter set
Buffer::Iterator i = start;
i.WriteHtolsbU64 (Simulator::Now ().GetMicroSeconds ());
i.WriteHtolsbU16 (static_cast<uint16_t> (m_beaconInterval / 1024));
@@ -464,6 +485,7 @@ MgtProbeResponseHeader::Serialize (Buffer::Iterator start) const
i = m_heCapability.Serialize (i);
i = m_heOperation.Serialize (i);
i = m_muEdcaParameterSet.Serialize (i);
i = m_ehtCapability.Serialize (i);
}
uint32_t
@@ -488,6 +510,7 @@ MgtProbeResponseHeader::Deserialize (Buffer::Iterator start)
i = m_heCapability.DeserializeIfPresent (i);
i = m_heOperation.DeserializeIfPresent (i);
i = m_muEdcaParameterSet.DeserializeIfPresent (i);
i = m_ehtCapability.DeserializeIfPresent (i);
return i.GetDistanceFrom (start);
}
@@ -604,6 +627,18 @@ MgtAssocRequestHeader::GetHeCapabilities (void) const
return m_heCapability;
}
void
MgtAssocRequestHeader::SetEhtCapabilities (EhtCapabilities ehtCapabilities)
{
m_ehtCapability = ehtCapabilities;
}
EhtCapabilities
MgtAssocRequestHeader::GetEhtCapabilities (void) const
{
return m_ehtCapability;
}
Ssid
MgtAssocRequestHeader::GetSsid (void) const
{
@@ -652,6 +687,7 @@ MgtAssocRequestHeader::GetSerializedSize (void) const
size += m_htCapability.GetSerializedSize ();
size += m_vhtCapability.GetSerializedSize ();
size += m_heCapability.GetSerializedSize ();
size += m_ehtCapability.GetSerializedSize ();
return size;
}
@@ -663,7 +699,8 @@ MgtAssocRequestHeader::Print (std::ostream &os) const
<< "Extended Capabilities=" << m_extendedCapability << " , "
<< "HT Capabilities=" << m_htCapability << " , "
<< "VHT Capabilities=" << m_vhtCapability << " , "
<< "HE Capabilities=" << m_heCapability;
<< "HE Capabilities=" << m_heCapability << " , "
<< "EHT Capabilities=" << m_ehtCapability;
}
void
@@ -679,6 +716,7 @@ MgtAssocRequestHeader::Serialize (Buffer::Iterator start) const
i = m_htCapability.Serialize (i);
i = m_vhtCapability.Serialize (i);
i = m_heCapability.Serialize (i);
i = m_ehtCapability.Serialize (i);
}
uint32_t
@@ -694,6 +732,7 @@ MgtAssocRequestHeader::Deserialize (Buffer::Iterator start)
i = m_htCapability.DeserializeIfPresent (i);
i = m_vhtCapability.DeserializeIfPresent (i);
i = m_heCapability.DeserializeIfPresent (i);
i = m_ehtCapability.DeserializeIfPresent (i);
return i.GetDistanceFrom (start);
}
@@ -791,6 +830,18 @@ MgtReassocRequestHeader::GetHeCapabilities (void) const
return m_heCapability;
}
void
MgtReassocRequestHeader::SetEhtCapabilities (EhtCapabilities ehtCapabilities)
{
m_ehtCapability = ehtCapabilities;
}
EhtCapabilities
MgtReassocRequestHeader::GetEhtCapabilities (void) const
{
return m_ehtCapability;
}
Ssid
MgtReassocRequestHeader::GetSsid (void) const
{
@@ -846,6 +897,7 @@ MgtReassocRequestHeader::GetSerializedSize (void) const
size += m_htCapability.GetSerializedSize ();
size += m_vhtCapability.GetSerializedSize ();
size += m_heCapability.GetSerializedSize ();
size += m_ehtCapability.GetSerializedSize ();
return size;
}
@@ -858,7 +910,8 @@ MgtReassocRequestHeader::Print (std::ostream &os) const
<< "Extended Capabilities=" << m_extendedCapability << " , "
<< "HT Capabilities=" << m_htCapability << " , "
<< "VHT Capabilities=" << m_vhtCapability << " , "
<< "HE Capabilities=" << m_heCapability;
<< "HE Capabilities=" << m_heCapability << " , "
<< "EHT Capabilities=" << m_ehtCapability;
}
void
@@ -875,6 +928,7 @@ MgtReassocRequestHeader::Serialize (Buffer::Iterator start) const
i = m_htCapability.Serialize (i);
i = m_vhtCapability.Serialize (i);
i = m_heCapability.Serialize (i);
i = m_ehtCapability.Serialize (i);
}
uint32_t
@@ -891,6 +945,7 @@ MgtReassocRequestHeader::Deserialize (Buffer::Iterator start)
i = m_htCapability.DeserializeIfPresent (i);
i = m_vhtCapability.DeserializeIfPresent (i);
i = m_heCapability.DeserializeIfPresent (i);
i = m_ehtCapability.DeserializeIfPresent (i);
return i.GetDistanceFrom (start);
}
@@ -1030,6 +1085,18 @@ MgtAssocResponseHeader::GetHeOperation (void) const
return m_heOperation;
}
void
MgtAssocResponseHeader::SetEhtCapabilities (EhtCapabilities ehtCapabilities)
{
m_ehtCapability = ehtCapabilities;
}
EhtCapabilities
MgtAssocResponseHeader::GetEhtCapabilities (void) const
{
return m_ehtCapability;
}
void
MgtAssocResponseHeader::SetAssociationId (uint16_t aid)
{
@@ -1114,6 +1181,7 @@ MgtAssocResponseHeader::GetSerializedSize (void) const
size += m_heCapability.GetSerializedSize ();
size += m_heOperation.GetSerializedSize ();
size += m_muEdcaParameterSet.GetSerializedSize ();
size += m_ehtCapability.GetSerializedSize ();
return size;
}
@@ -1130,7 +1198,8 @@ MgtAssocResponseHeader::Print (std::ostream &os) const
<< "VHT Capabilities=" << m_vhtCapability << " , "
<< "VHT Operation=" << m_vhtOperation << " , "
<< "HE Capabilities=" << m_heCapability << " , "
<< "HE Operation=" << m_heOperation;
<< "HE Operation=" << m_heOperation << " , "
<< "EHT Capabilities=" << m_ehtCapability;
}
void
@@ -1152,6 +1221,7 @@ MgtAssocResponseHeader::Serialize (Buffer::Iterator start) const
i = m_heCapability.Serialize (i);
i = m_heOperation.Serialize (i);
i = m_muEdcaParameterSet.Serialize (i);
i = m_ehtCapability.Serialize (i);
}
uint32_t
@@ -1173,6 +1243,7 @@ MgtAssocResponseHeader::Deserialize (Buffer::Iterator start)
i = m_heCapability.DeserializeIfPresent (i);
i = m_heOperation.DeserializeIfPresent (i);
i = m_muEdcaParameterSet.DeserializeIfPresent (i);
i = m_ehtCapability.DeserializeIfPresent (i);
return i.GetDistanceFrom (start);
}

View File

@@ -39,6 +39,7 @@
#include "ns3/he-capabilities.h"
#include "ns3/he-operation.h"
#include "ns3/mu-edca-parameter-set.h"
#include "ns3/eht-capabilities.h"
namespace ns3 {
@@ -100,6 +101,12 @@ public:
* \param heCapabilities HE capabilities
*/
void SetHeCapabilities (HeCapabilities heCapabilities);
/**
* Set the EHT capabilities.
*
* \param ehtCapabilities EHT capabilities
*/
void SetEhtCapabilities (EhtCapabilities ehtCapabilities);
/**
* Return the Capability information.
*
@@ -130,6 +137,12 @@ public:
* \return HE capabilities
*/
HeCapabilities GetHeCapabilities (void) const;
/**
* Return the EHT capabilities.
*
* \return EHT capabilities
*/
EhtCapabilities GetEhtCapabilities (void) const;
/**
* Return the Service Set Identifier (SSID).
*
@@ -171,6 +184,7 @@ private:
VhtCapabilities m_vhtCapability; //!< VHT capabilities
HeCapabilities m_heCapability; //!< HE capabilities
uint16_t m_listenInterval; //!< listen interval
EhtCapabilities m_ehtCapability; //!< EHT capabilities
};
@@ -232,6 +246,12 @@ public:
* \param heCapabilities HE capabilities
*/
void SetHeCapabilities (HeCapabilities heCapabilities);
/**
* Set the EHT capabilities.
*
* \param ehtCapabilities EHT capabilities
*/
void SetEhtCapabilities (EhtCapabilities ehtCapabilities);
/**
* Return the Capability information.
*
@@ -262,6 +282,12 @@ public:
* \return HE capabilities
*/
HeCapabilities GetHeCapabilities (void) const;
/**
* Return the EHT capabilities.
*
* \return EHT capabilities
*/
EhtCapabilities GetEhtCapabilities (void) const;
/**
* Return the Service Set Identifier (SSID).
*
@@ -309,6 +335,7 @@ private:
VhtCapabilities m_vhtCapability; //!< VHT capabilities
HeCapabilities m_heCapability; //!< HE capabilities
uint16_t m_listenInterval; //!< listen interval
EhtCapabilities m_ehtCapability; //!< EHT capabilities
};
@@ -382,6 +409,12 @@ public:
* \return HE operation
*/
HeOperation GetHeOperation (void) const;
/**
* Return the EHT capabilities.
*
* \return EHT capabilities
*/
EhtCapabilities GetEhtCapabilities (void) const;
/**
* Return the association ID.
*
@@ -490,6 +523,12 @@ public:
* \param heOperation HE operation
*/
void SetHeOperation (HeOperation heOperation);
/**
* Set the EHT capabilities.
*
* \param ehtCapabilities EHT capabilities
*/
void SetEhtCapabilities (EhtCapabilities ehtCapabilities);
/**
* Register this type.
@@ -518,6 +557,7 @@ private:
HeCapabilities m_heCapability; //!< HE capabilities
HeOperation m_heOperation; //!< HE operation
MuEdcaParameterSet m_muEdcaParameterSet; //!< MU EDCA Parameter Set
EhtCapabilities m_ehtCapability; //!< EHT capabilities
};
@@ -566,6 +606,12 @@ public:
* \param heCapabilities HE capabilities
*/
void SetHeCapabilities (HeCapabilities heCapabilities);
/**
* Set the EHT capabilities.
*
* \param ehtCapabilities EHT capabilities
*/
void SetEhtCapabilities (EhtCapabilities ehtCapabilities);
/**
* Return the Service Set Identifier (SSID).
*
@@ -602,6 +648,12 @@ public:
* \return HE capabilities
*/
HeCapabilities GetHeCapabilities (void) const;
/**
* Return the EHT capabilities.
*
* \return EHT capabilities
*/
EhtCapabilities GetEhtCapabilities (void) const;
/**
* Register this type.
@@ -621,7 +673,8 @@ private:
ExtendedCapabilities m_extendedCapability; //!< extended capabilities
HtCapabilities m_htCapability; //!< HT capabilities
VhtCapabilities m_vhtCapability; //!< VHT capabilities
HeCapabilities m_heCapability; //!< HE capabilities
HeCapabilities m_heCapability; //!< HE capabilities
EhtCapabilities m_ehtCapability; //!< EHT capabilities
};
@@ -707,6 +760,12 @@ public:
* \return HE operation
*/
HeOperation GetHeOperation (void) const;
/**
* Return the EHT capabilities.
*
* \return EHT capabilities
*/
EhtCapabilities GetEhtCapabilities (void) const;
/**
* Return the ERP information.
*
@@ -773,6 +832,12 @@ public:
* \param heOperation HE operation
*/
void SetHeOperation (HeOperation heOperation);
/**
* Set the EHT capabilities.
*
* \param ehtCapabilities EHT capabilities
*/
void SetEhtCapabilities (EhtCapabilities ehtCapabilities);
/**
* Set the Service Set Identifier (SSID).
*
@@ -847,10 +912,11 @@ private:
VhtCapabilities m_vhtCapability; //!< VHT capabilities
VhtOperation m_vhtOperation; //!< VHT operation
HeCapabilities m_heCapability; //!< HE capabilities
HeOperation m_heOperation; //!< HE operation
HeOperation m_heOperation; //!< HE operation
ErpInformation m_erpInformation; //!< ERP information
EdcaParameterSet m_edcaParameterSet; //!< EDCA Parameter Set
MuEdcaParameterSet m_muEdcaParameterSet; //!< MU EDCA Parameter Set
EhtCapabilities m_ehtCapability; //!< EHT capabilities
};

View File

@@ -1,7 +1,8 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006, 2009 INRIA
* Copyright (c) 2009 MIRKO BANCHI
* Copyright (c) 2009 MIRKO BANCHICONFLICT (content): Merge conflict in src/wifi/model/sta-wifi-mac.cc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -174,6 +175,10 @@ StaWifiMac::SendProbeRequest (void)
{
probe.SetHeCapabilities (GetHeCapabilities ());
}
if (GetEhtSupported ())
{
probe.SetEhtCapabilities (GetEhtCapabilities ());
}
packet->AddHeader (probe);
if (!GetQosSupported ())
@@ -225,6 +230,10 @@ StaWifiMac::SendAssociationRequest (bool isReassoc)
{
assoc.SetHeCapabilities (GetHeCapabilities ());
}
if (GetEhtSupported ())
{
assoc.SetEhtCapabilities (GetEhtCapabilities ());
}
packet->AddHeader (assoc);
}
else
@@ -248,6 +257,10 @@ StaWifiMac::SendAssociationRequest (bool isReassoc)
{
reassoc.SetHeCapabilities (GetHeCapabilities ());
}
if (GetEhtSupported ())
{
reassoc.SetEhtCapabilities (GetEhtCapabilities ());
}
packet->AddHeader (reassoc);
}
@@ -874,6 +887,12 @@ StaWifiMac::UpdateApInfoFromBeacon (MgtBeaconHeader beacon, Mac48Address apAddr,
muEdcaParameters.GetMuAifsn (AC_VO), muEdcaParameters.GetMuEdcaTimer (AC_VO));
}
}
if (GetEhtSupported ())
{
EhtCapabilities ehtCapabilities = beacon.GetEhtCapabilities ();
//TODO: once we support non constant rate managers, we should add checks here whether EHT is supported by the peer
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (apAddr, ehtCapabilities);
}
GetWifiRemoteStationManager ()->SetShortPreambleEnabled (isShortPreambleEnabled);
GetWifiRemoteStationManager ()->SetShortSlotTimeEnabled (capabilities.IsShortSlotTime ());
}
@@ -1026,10 +1045,10 @@ StaWifiMac::UpdateApInfoFromAssocResp (MgtAssocResponseHeader assocResp, Mac48Ad
}
if (GetHeSupported ())
{
HeCapabilities hecapabilities = assocResp.GetHeCapabilities ();
if (hecapabilities.GetSupportedMcsAndNss () != 0)
HeCapabilities heCapabilities = assocResp.GetHeCapabilities ();
if (heCapabilities.GetSupportedMcsAndNss () != 0)
{
GetWifiRemoteStationManager ()->AddStationHeCapabilities (apAddr, hecapabilities);
GetWifiRemoteStationManager ()->AddStationHeCapabilities (apAddr, heCapabilities);
HeOperation heOperation = assocResp.GetHeOperation ();
GetHeConfiguration ()->SetAttribute ("BssColor", UintegerValue (heOperation.GetBssColor ()));
}
@@ -1047,6 +1066,12 @@ StaWifiMac::UpdateApInfoFromAssocResp (MgtAssocResponseHeader assocResp, Mac48Ad
muEdcaParameters.GetMuAifsn (AC_VO), muEdcaParameters.GetMuEdcaTimer (AC_VO));
}
}
if (GetEhtSupported ())
{
EhtCapabilities ehtCapabilities = assocResp.GetEhtCapabilities ();
//TODO: once we support non constant rate managers, we should add checks here whether EHT is supported by the peer
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (apAddr, ehtCapabilities);
}
for (const auto & mode : GetWifiPhy ()->GetModeList ())
{
if (rates.IsSupportedRate (mode.GetDataRate (GetWifiPhy ()->GetChannelWidth ())))
@@ -1099,6 +1124,11 @@ StaWifiMac::UpdateApInfoFromAssocResp (MgtAssocResponseHeader assocResp, Mac48Ad
}
}
}
if (GetEhtSupported ())
{
EhtCapabilities ehtCapabilities = assocResp.GetEhtCapabilities ();
//TODO: to be completed
}
}
SupportedRates

View File

@@ -71,7 +71,7 @@ VhtCapabilities::SetVhtSupported (uint8_t vhtSupported)
uint8_t
VhtCapabilities::GetInformationFieldSize () const
{
//we should not be here if vht is not supported
//we should not be here if VHT is not supported
NS_ASSERT (m_vhtSupported > 0);
return 12;
}

View File

@@ -193,6 +193,8 @@ typedef uint8_t WifiInformationElementId;
#define IE_EXT_UORA_PARAMETER_SET ((WifiInformationElementId)37)
#define IE_EXT_MU_EDCA_PARAMETER_SET ((WifiInformationElementId)38)
#define IE_EXT_EHT_CAPABILITIES ((WifiInformationElementId)108)
/**
* \brief Information element, as defined in 802.11-2007 standard
* \ingroup wifi
@@ -274,7 +276,8 @@ public:
// Each subclass must implement these pure virtual functions:
/**
* \returns Own unique Element ID
* Get the wifi information element ID
* \returns the wifi information element ID
*/
virtual WifiInformationElementId ElementId () const = 0;
/**
@@ -307,7 +310,8 @@ public:
uint8_t length) = 0;
/**
* \returns Own unique Element ID Extension
* Get the wifi information element ID extension
* \returns the wifi information element ID extension
*/
virtual WifiInformationElementId ElementIdExt () const;

View File

@@ -1396,6 +1396,18 @@ WifiMac::GetHeCapabilities (void) const
return capabilities;
}
EhtCapabilities
WifiMac::GetEhtCapabilities (void) const
{
NS_LOG_FUNCTION (this);
EhtCapabilities capabilities;
if (GetEhtSupported ())
{
//TODO: fill in EHT capabilities
}
return capabilities;
}
uint32_t
WifiMac::GetMaxAmpduSize (AcIndex ac) const
{

View File

@@ -377,6 +377,12 @@ public:
* \return the HE capabilities that we support
*/
HeCapabilities GetHeCapabilities (void) const;
/**
* Return the EHT capabilities of the device.
*
* \return the EHT capabilities that we support
*/
EhtCapabilities GetEhtCapabilities (void) const;
/**
* Return whether the device supports QoS.

View File

@@ -1252,6 +1252,7 @@ WifiRemoteStationManager::LookupState (Mac48Address address) const
state->m_htCapabilities = 0;
state->m_vhtCapabilities = 0;
state->m_heCapabilities = 0;
state->m_ehtCapabilities = 0;
state->m_channelWidth = m_wifiPhy->GetChannelWidth ();
state->m_guardInterval = GetGuardInterval ();
state->m_ness = 0;
@@ -1293,8 +1294,7 @@ void
WifiRemoteStationManager::SetQosSupport (Mac48Address from, bool qosSupported)
{
NS_LOG_FUNCTION (this << from << qosSupported);
WifiRemoteStationState *state;
state = LookupState (from);
WifiRemoteStationState *state = LookupState (from);
state->m_qosSupported = qosSupported;
}
@@ -1303,8 +1303,7 @@ WifiRemoteStationManager::AddStationHtCapabilities (Mac48Address from, HtCapabil
{
//Used by all stations to record HT capabilities of remote stations
NS_LOG_FUNCTION (this << from << htCapabilities);
WifiRemoteStationState *state;
state = LookupState (from);
WifiRemoteStationState *state = LookupState (from);
if (htCapabilities.GetSupportedChannelWidth () == 1)
{
state->m_channelWidth = 40;
@@ -1329,8 +1328,7 @@ WifiRemoteStationManager::AddStationVhtCapabilities (Mac48Address from, VhtCapab
{
//Used by all stations to record VHT capabilities of remote stations
NS_LOG_FUNCTION (this << from << vhtCapabilities);
WifiRemoteStationState *state;
state = LookupState (from);
WifiRemoteStationState *state = LookupState (from);
if (vhtCapabilities.GetSupportedChannelWidthSet () == 1)
{
state->m_channelWidth = 160;
@@ -1363,8 +1361,7 @@ WifiRemoteStationManager::AddStationHeCapabilities (Mac48Address from, HeCapabil
{
//Used by all stations to record HE capabilities of remote stations
NS_LOG_FUNCTION (this << from << heCapabilities);
WifiRemoteStationState *state;
state = LookupState (from);
WifiRemoteStationState *state = LookupState (from);
if ((m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_5GHZ) || (m_wifiPhy->GetPhyBand () == WIFI_PHY_BAND_6GHZ))
{
if (heCapabilities.GetChannelWidthSet () & 0x04)
@@ -1412,6 +1409,17 @@ WifiRemoteStationManager::AddStationHeCapabilities (Mac48Address from, HeCapabil
SetQosSupport (from, true);
}
void
WifiRemoteStationManager::AddStationEhtCapabilities (Mac48Address from, EhtCapabilities ehtCapabilities)
{
//Used by all stations to record EHT capabilities of remote stations
NS_LOG_FUNCTION (this << from << ehtCapabilities);
WifiRemoteStationState *state = LookupState (from);
//TODO: to be completed
state->m_ehtCapabilities = Create<const EhtCapabilities> (ehtCapabilities);
SetQosSupport (from, true);
}
Ptr<const HtCapabilities>
WifiRemoteStationManager::GetStationHtCapabilities (Mac48Address from)
{
@@ -1430,6 +1438,12 @@ WifiRemoteStationManager::GetStationHeCapabilities (Mac48Address from)
return LookupState (from)->m_heCapabilities;
}
Ptr<const EhtCapabilities>
WifiRemoteStationManager::GetStationEhtCapabilities (Mac48Address from)
{
return LookupState (from)->m_ehtCapabilities;
}
bool
WifiRemoteStationManager::GetLdpcSupported (Mac48Address address) const
{
@@ -1792,6 +1806,12 @@ WifiRemoteStationManager::GetHeSupported (const WifiRemoteStation *station) cons
return (station->m_state->m_heCapabilities != 0);
}
bool
WifiRemoteStationManager::GetEhtSupported (const WifiRemoteStation *station) const
{
return (station->m_state->m_ehtCapabilities != 0);
}
uint8_t
WifiRemoteStationManager::GetNMcsSupported (const WifiRemoteStation *station) const
{
@@ -1885,6 +1905,12 @@ WifiRemoteStationManager::GetHeSupported (Mac48Address address) const
return (LookupState (address)->m_heCapabilities != 0);
}
bool
WifiRemoteStationManager::GetEhtSupported (Mac48Address address) const
{
return (LookupState (address)->m_ehtCapabilities != 0);
}
void
WifiRemoteStationManager::SetDefaultTxPowerLevel (uint8_t txPower)
{

View File

@@ -34,6 +34,7 @@
#include "ns3/ht-capabilities.h"
#include "ns3/vht-capabilities.h"
#include "ns3/he-capabilities.h"
#include "ns3/eht-capabilities.h"
namespace ns3 {
@@ -102,6 +103,8 @@ struct WifiRemoteStationState
Ptr<const HtCapabilities> m_htCapabilities; //!< remote station HT capabilities
Ptr<const VhtCapabilities> m_vhtCapabilities; //!< remote station VHT capabilities
Ptr<const HeCapabilities> m_heCapabilities; //!< remote station HE capabilities
Ptr<const EhtCapabilities> m_ehtCapabilities; //!< remote station EHT capabilities
uint16_t m_channelWidth; //!< Channel width (in MHz) supported by the remote station
uint16_t m_guardInterval; //!< HE Guard interval duration (in nanoseconds) supported by the remote station
uint8_t m_ness; //!< Number of extended spatial streams of the remote station
@@ -238,6 +241,13 @@ public:
* \param heCapabilities the HE capabilities of the station
*/
void AddStationHeCapabilities (Mac48Address from, HeCapabilities heCapabilities);
/**
* Records EHT capabilities of the remote station.
*
* \param from the address of the station being recorded
* \param ehtCapabilities the EHT capabilities of the station
*/
void AddStationEhtCapabilities (Mac48Address from, EhtCapabilities ehtCapabilities);
/**
* Return the HT capabilities sent by the remote station.
*
@@ -259,6 +269,13 @@ public:
* \return the HE capabilities sent by the remote station
*/
Ptr<const HeCapabilities> GetStationHeCapabilities (Mac48Address from);
/**
* Return the EHT capabilities sent by the remote station.
*
* \param from the address of the remote station
* \return the EHT capabilities sent by the remote station
*/
Ptr<const EhtCapabilities> GetStationEhtCapabilities (Mac48Address from);
/**
* Return whether the device has HT capability support enabled.
*
@@ -572,6 +589,15 @@ public:
* false otherwise
*/
bool GetHeSupported (Mac48Address address) const;
/**
* Return whether the station supports EHT or not.
*
* \param address the address of the station
*
* \return true if EHT is supported by the station,
* false otherwise
*/
bool GetEhtSupported (Mac48Address address) const;
/**
* Return a mode for non-unicast packets.
@@ -998,6 +1024,15 @@ protected:
* false otherwise
*/
bool GetHeSupported (const WifiRemoteStation *station) const;
/**
* Return whether the given station is EHT capable.
*
* \param station the station being queried
*
* \return true if the station has EHT capabilities,
* false otherwise
*/
bool GetEhtSupported (const WifiRemoteStation *station) const;
/**
* Return the WifiMode supported by the specified station at the specified index.
*