在体系结构上,ns-3 将设备层
与互联网主机的 IP 层或流量控制层
分开。
第一个排队层是ns-3中所谓的“流量控制层”;在这里,通过使用排队规则,主动队列管理(RFC7567)和由于服务质量(QoS)而确定的优先级以独立于设备的方式进行。
第二个排队层通常位于网络设备对象中。不同的设备(例如 LTE、Wi-Fi)对这些队列有不同的实现。这种双层方法反映了实践中发现的情况(提供优先级的软件队列和特定于链接类型的硬件队列)。
在实践中,它可能比这更复杂。例如,地址解析协议有一个小队列。Linux 中的 Wi-Fi 有四层排队
流量控制(即通知流量控制层的能力)由以下 NetDevice 支持:
- Point-To-Point
- Csma
- Wi-Fi
- SimpleNetDevice
ns-3中可用的队列模型
流量控制层
- PFifoFastQueueDisc: The default maximum size is 1000 packets
- FifoQueueDisc: The default maximum size is 1000 packets
- RedQueueDisc: The default maximum size is 25 packets
- CoDelQueueDisc: The default maximum size is 1500 kilobytes
- FqCoDelQueueDisc: The default maximum size is 10240 packets
- PieQueueDisc: The default maximum size is 25 packets
- MqQueueDisc: This queue disc has no limits on its capacity
- TbfQueueDisc: The default maximum size is 1000 packets
默认情况下,当将 IPv4 或 IPv6 地址分配给与网络设备关联的接口时,将在网络设备上安装pfifo_fast排队规则,除非已在网络设备上安装了排队规则。
设备层
- PointToPointNetDevice: The default configuration (as set by the helper) is to install a DropTail queue of default size (100 packets)
- CsmaNetDevice: The default configuration (as set by the helper) is to install a DropTail queue of default size (100 packets)
- WiFiNetDevice: The default configuration is to install a DropTail queue of default size (100 packets) for non-QoS stations and four DropTail queues of default size (100 packets) for QoS stations
- SimpleNetDevice: The default configuration is to install a DropTail queue of default size (100 packets)
- LTENetDevice: Queueing occurs at the RLC layer (RLC UM default buffer is 10 * 1024 bytes, RLC AM does not have a buffer limit).
- UanNetDevice: There is a default 10 packet queue at the MAC layer
更改队列的默认值
通过设备帮助程序修改 NetDevice 使用的队列类型
NodeContainer nodes;
nodes.Create (2);
PointToPointHelper p2p;
//更改队列的关键一步
p2p.SetQueue ("ns3::DropTailQueue", "MaxSize", StringValue ("50p"));
NetDeviceContainer devices = p2p.Install (nodes);
通过流量控制帮助程序修改安装在 NetDevice 上的队列光盘的类型(也就是流量控制层的队列):
InternetStackHelper stack;
stack.Install (nodes);
//流量控制帮助程序
TrafficControlHelper tch;
//修改队列光盘
tch.SetRootQueueDisc ("ns3::CoDelQueueDisc", "MaxSize", StringValue ("1000p"));
tch.Install (devices);
通过流量控制帮助程序在支持它的设备上启用 BQL:
InternetStackHelper stack;
stack.Install (nodes);
TrafficControlHelper tch;
tch.SetRootQueueDisc ("ns3::CoDelQueueDisc", "MaxSize", StringValue ("1000p"));
tch.SetQueueLimits ("ns3::DynamicQueueLimits", "HoldTime", StringValue ("4ms"));
tch.Install (devices);