Initial QoS implementation in 802.11s
This commit is contained in:
@@ -62,18 +62,7 @@ MeshWifiInterfaceMac::GetTypeId ()
|
||||
&MeshWifiInterfaceMac::GetBeaconGeneration
|
||||
),
|
||||
MakeBooleanChecker ()
|
||||
)
|
||||
|
||||
.AddAttribute ("BE", "The DcaTxop object",
|
||||
PointerValue (),
|
||||
MakePointerAccessor (&MeshWifiInterfaceMac::GetBE,
|
||||
&MeshWifiInterfaceMac::SetBE),
|
||||
MakePointerChecker<DcaTxop> ())
|
||||
.AddAttribute ("VO", "The DcaTxop object",
|
||||
PointerValue (),
|
||||
MakePointerAccessor (&MeshWifiInterfaceMac::GetVO,
|
||||
&MeshWifiInterfaceMac::SetVO),
|
||||
MakePointerChecker<DcaTxop> ());
|
||||
);
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -199,10 +188,8 @@ MeshWifiInterfaceMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager>
|
||||
{
|
||||
NS_LOG_FUNCTION (this << stationManager);
|
||||
m_stationManager = stationManager;
|
||||
NS_ASSERT(m_BE != 0);
|
||||
m_BE->SetWifiRemoteStationManager (stationManager);
|
||||
NS_ASSERT(m_VO != 0);
|
||||
m_VO->SetWifiRemoteStationManager (stationManager);
|
||||
for (Queues::const_iterator i = m_queues.begin (); i != m_queues.end (); i ++)
|
||||
i->second->SetWifiRemoteStationManager (stationManager);
|
||||
m_beaconDca->SetWifiRemoteStationManager (stationManager);
|
||||
m_low->SetWifiRemoteStationManager (stationManager);
|
||||
}
|
||||
@@ -293,8 +280,7 @@ MeshWifiInterfaceMac::DoDispose ()
|
||||
m_low = 0;
|
||||
m_dcfManager = 0;
|
||||
m_phy = 0;
|
||||
m_BE = 0;
|
||||
m_VO = 0;
|
||||
m_queues.clear ();
|
||||
m_beaconSendEvent.Cancel ();
|
||||
m_beaconDca = 0;
|
||||
|
||||
@@ -416,7 +402,7 @@ MeshWifiInterfaceMac::ForwardDown (Ptr<const Packet> const_packet, Mac48Address
|
||||
}
|
||||
m_stats.sentFrames ++;
|
||||
m_stats.sentBytes += packet->GetSize ();
|
||||
m_BE->Queue (packet, hdr);
|
||||
m_queues[AC_BK]->Queue (packet, hdr);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -431,7 +417,12 @@ MeshWifiInterfaceMac::SendManagementFrame (Ptr<Packet> packet, const WifiMacHead
|
||||
}
|
||||
m_stats.sentFrames ++;
|
||||
m_stats.sentBytes += packet->GetSize ();
|
||||
m_VO->Queue (packet, header);
|
||||
Queues::iterator i = m_queues.find (AC_VO);
|
||||
if (i == m_queues.end ())
|
||||
{
|
||||
NS_FATAL_ERROR("Voice queue is not set up!");
|
||||
}
|
||||
m_queues[AC_VO]->Queue (packet, header);
|
||||
}
|
||||
|
||||
SupportedRates
|
||||
@@ -671,28 +662,28 @@ MeshWifiInterfaceMac::ResetStats ()
|
||||
m_stats = Statistics::Statistics ();
|
||||
}
|
||||
void
|
||||
MeshWifiInterfaceMac::SetBE (Ptr<DcaTxop> dcaTxop)
|
||||
MeshWifiInterfaceMac::SetQueue (Ptr<DcaTxop> queue, AccessClass ac)
|
||||
{
|
||||
m_BE = dcaTxop;
|
||||
m_BE->SetLow (m_low);
|
||||
m_BE->SetManager (m_dcfManager);
|
||||
}
|
||||
void
|
||||
MeshWifiInterfaceMac::SetVO (Ptr<DcaTxop> dcaTxop)
|
||||
{
|
||||
m_VO = dcaTxop;
|
||||
m_VO->SetLow (m_low);
|
||||
m_VO->SetManager (m_dcfManager);
|
||||
Queues::iterator i = m_queues.find(ac);
|
||||
if(i != m_queues.end ())
|
||||
{
|
||||
NS_LOG_WARN("Queue is already set!");
|
||||
return;
|
||||
}
|
||||
m_queues.insert (std::make_pair(ac, queue));
|
||||
m_queues[ac]->SetLow (m_low);
|
||||
m_queues[ac]->SetManager (m_dcfManager);
|
||||
}
|
||||
Ptr<DcaTxop>
|
||||
MeshWifiInterfaceMac::GetBE () const
|
||||
MeshWifiInterfaceMac::GetQueue (AccessClass ac)
|
||||
{
|
||||
return m_BE;
|
||||
}
|
||||
Ptr<DcaTxop>
|
||||
MeshWifiInterfaceMac::GetVO () const
|
||||
{
|
||||
return m_VO;
|
||||
Queues::iterator i = m_queues.find(ac);
|
||||
if(i != m_queues.end ())
|
||||
{
|
||||
NS_LOG_WARN("Queue is not found! Check access class!");
|
||||
return 0;
|
||||
}
|
||||
return i->second;
|
||||
}
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "ns3/wifi-mac.h"
|
||||
#include "ns3/mesh-wifi-interface-mac-plugin.h"
|
||||
#include "ns3/event-id.h"
|
||||
|
||||
#include "qos-utils.h"
|
||||
namespace ns3 {
|
||||
|
||||
class WifiMacHeader;
|
||||
@@ -160,11 +160,9 @@ public:
|
||||
void ResetStats ();
|
||||
/// Enable/disable beacons
|
||||
void SetBeaconGeneration (bool enable);
|
||||
void SetQueue (Ptr<DcaTxop> queue, AccessClass ac);
|
||||
private:
|
||||
Ptr<DcaTxop> GetBE(void) const;
|
||||
void SetBE (Ptr<DcaTxop> dcaTxop);
|
||||
Ptr<DcaTxop> GetVO(void) const;
|
||||
void SetVO (Ptr<DcaTxop> dcaTxop);
|
||||
Ptr<DcaTxop> GetQueue (AccessClass ac);
|
||||
/// Frame receive handler
|
||||
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
|
||||
/// Forward frame to mesh point
|
||||
@@ -183,10 +181,8 @@ private:
|
||||
private:
|
||||
///\name Wifi MAC internals
|
||||
//\{
|
||||
Ptr<DcaTxop> m_BE;
|
||||
Ptr<DcaTxop> m_BK;
|
||||
Ptr<DcaTxop> m_VI;
|
||||
Ptr<DcaTxop> m_VO;
|
||||
typedef std::map<AccessClass, Ptr<DcaTxop> > Queues;
|
||||
Queues m_queues;
|
||||
Ptr<DcaTxop> m_beaconDca;
|
||||
Ptr<WifiRemoteStationManager> m_stationManager;
|
||||
Ptr<WifiPhy> m_phy;
|
||||
|
||||
@@ -28,8 +28,15 @@ namespace ns3 {
|
||||
|
||||
MeshInterfaceHelper::MeshInterfaceHelper ()
|
||||
{
|
||||
m_Be.SetTypeId ("ns3::DcaTxop");
|
||||
m_Vo.SetTypeId ("ns3::DcaTxop");
|
||||
m_queues.insert (std::make_pair (AC_VO, ObjectFactory ()));
|
||||
m_queues.insert (std::make_pair (AC_VI, ObjectFactory ()));
|
||||
m_queues.insert (std::make_pair (AC_BE, ObjectFactory ()));
|
||||
m_queues.insert (std::make_pair (AC_BK, ObjectFactory ()));
|
||||
|
||||
m_queues[AC_VO].SetTypeId ("ns3::DcaTxop");
|
||||
m_queues[AC_VI].SetTypeId ("ns3::DcaTxop");
|
||||
m_queues[AC_BE].SetTypeId ("ns3::DcaTxop");
|
||||
m_queues[AC_BK].SetTypeId ("ns3::DcaTxop");
|
||||
}
|
||||
|
||||
MeshInterfaceHelper::~MeshInterfaceHelper ()
|
||||
@@ -40,14 +47,6 @@ MeshInterfaceHelper::Default (void)
|
||||
{
|
||||
MeshInterfaceHelper helper;
|
||||
helper.SetType ();
|
||||
helper.SetBeParameters (
|
||||
"MinCw", UintegerValue (15),
|
||||
"MaxCw", UintegerValue (255),
|
||||
"Aifsn", UintegerValue (2));
|
||||
helper.SetVoParameters (
|
||||
"MinCw", UintegerValue (3),
|
||||
"MaxCw", UintegerValue (7),
|
||||
"Aifsn", UintegerValue (2));
|
||||
helper.SetRemoteStationManager ("ns3::ArfWifiManager");
|
||||
return helper;
|
||||
}
|
||||
@@ -73,26 +72,24 @@ MeshInterfaceHelper::SetType (std::string n0, const AttributeValue &v0,
|
||||
m_mac.Set (n7, v7);
|
||||
}
|
||||
void
|
||||
MeshInterfaceHelper::SetBeParameters (std::string n0, const AttributeValue &v0,
|
||||
std::string n1, const AttributeValue &v1,
|
||||
std::string n2, const AttributeValue &v2,
|
||||
std::string n3, const AttributeValue &v3)
|
||||
MeshInterfaceHelper::SetQueueParameters ( AccessClass ac,
|
||||
std::string n0, const AttributeValue &v0,
|
||||
std::string n1, const AttributeValue &v1,
|
||||
std::string n2, const AttributeValue &v2,
|
||||
std::string n3, const AttributeValue &v3)
|
||||
{
|
||||
m_Be.Set (n0, v0);
|
||||
m_Be.Set (n1, v1);
|
||||
m_Be.Set (n2, v2);
|
||||
m_Be.Set (n3, v3);
|
||||
}
|
||||
void
|
||||
MeshInterfaceHelper::SetVoParameters (std::string n0, const AttributeValue &v0,
|
||||
std::string n1, const AttributeValue &v1,
|
||||
std::string n2, const AttributeValue &v2,
|
||||
std::string n3, const AttributeValue &v3)
|
||||
{
|
||||
m_Vo.Set (n0, v0);
|
||||
m_Vo.Set (n1, v1);
|
||||
m_Vo.Set (n2, v2);
|
||||
m_Vo.Set (n3, v3);
|
||||
std::map<AccessClass, ObjectFactory>::iterator queue = m_queues.find (ac);
|
||||
if (queue != m_queues.end ())
|
||||
{
|
||||
queue->second.Set (n0, v0);
|
||||
queue->second.Set (n1, v1);
|
||||
queue->second.Set (n2, v2);
|
||||
queue->second.Set (n3, v3);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_FATAL_ERROR ("Queue is not set!");
|
||||
}
|
||||
}
|
||||
void
|
||||
MeshInterfaceHelper::SetRemoteStationManager (std::string type,
|
||||
@@ -137,11 +134,12 @@ MeshInterfaceHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node>
|
||||
Ptr<WifiMac>
|
||||
MeshInterfaceHelper::Create (void) const
|
||||
{
|
||||
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
|
||||
Ptr<DcaTxop> be = m_Be.Create<DcaTxop> ();
|
||||
Ptr<DcaTxop> vo = m_Vo.Create<DcaTxop> ();
|
||||
mac->SetAttribute ("BE", PointerValue (be));
|
||||
mac->SetAttribute ("VO", PointerValue (vo));
|
||||
Ptr<MeshWifiInterfaceMac> mac = m_mac.Create<MeshWifiInterfaceMac> ();
|
||||
for (std::map<AccessClass, ObjectFactory>::const_iterator i = m_queues.begin (); i != m_queues.end (); i ++)
|
||||
{
|
||||
//Ptr<DcaTxop> dca = i->second->Create ();
|
||||
mac->SetQueue(i->second.Create<DcaTxop> (), i->first);
|
||||
}
|
||||
return mac;
|
||||
}
|
||||
void
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "ns3/wifi-helper.h"
|
||||
#include "ns3/wifi-net-device.h"
|
||||
#include "ns3/mesh-wifi-interface-mac.h"
|
||||
#include "ns3/qos-utils.h"
|
||||
namespace ns3 {
|
||||
|
||||
class MeshInterfaceHelper : public WifiMacHelper
|
||||
@@ -51,23 +52,16 @@ public:
|
||||
std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
|
||||
std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
|
||||
/**
|
||||
* \param ac is access class of the queue to be adjusted
|
||||
* \param type the type of ns3::WifiMac to create.
|
||||
* \param n%d the name of the attribute to set
|
||||
* \param v%d the value of the attribute to set
|
||||
*/
|
||||
void SetBeParameters ( std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
|
||||
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
|
||||
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
|
||||
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue ());
|
||||
/**
|
||||
* \param type the type of ns3::WifiMac to create.
|
||||
* \param n%d the name of the attribute to set
|
||||
* \param v%d the value of the attribute to set
|
||||
*/
|
||||
void SetVoParameters ( std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
|
||||
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
|
||||
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
|
||||
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue ());
|
||||
void SetQueueParameters (AccessClass ac,
|
||||
std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
|
||||
std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
|
||||
std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
|
||||
std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue ());
|
||||
/**
|
||||
* \param type the type of ns3::WifiRemoteStationManager to create.
|
||||
* \param n%d the name of the attribute to set
|
||||
@@ -104,8 +98,9 @@ private:
|
||||
Ptr<WifiMac> Create (void) const;
|
||||
|
||||
ObjectFactory m_mac;
|
||||
ObjectFactory m_Be;
|
||||
ObjectFactory m_Vo;
|
||||
std::map<AccessClass, ObjectFactory> m_queues;
|
||||
//ObjectFactory m_Be;
|
||||
//ObjectFactory m_Vo;
|
||||
ObjectFactory m_stationManager;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user