DiffservQueue

Package: inet.networklayer.diffserv

DiffservQueue

compound module

This is an example queue, that can be used in interfaces of DS core and edge nodes to support the AFxy (RFC 2597) and EF (RFC 3246) PHBs.

The incoming packets are first classified according to their DSCP field. DSCPs other than AFxy and EF are handled as BE (best effort).

EF packets are stored in a dedicated queue, and served first when a packet is requested. Because they can preempt the other queues, the rate of the EF packets should be limited to a fraction of the bandwith of the link. This is achieved by metering the EF traffic with a token bucket meter and dropping packets that does not conform to the traffic profile.

There are other queues for AFx classes and BE. The AFx queues use RED to implement 3 different drop priorities within the class. BE packets are stored in a drop tail queue. Packets from AFxy and BE queues are sheduled by a WRR scheduler, which ensures that the remaining bandwith is allocated among the classes according to the specified weights.

See also: AFxyQueue

BehaviorAggregateClassifier TokenBucketMeter PassivePacketSink DropTailQueue AFxyQueue AFxyQueue AFxyQueue AFxyQueue DropTailQueue WrrScheduler PriorityScheduler

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Extends

Name Type Description
CompoundPacketQueue compound module

This compound module serves as a base module for complex packet queues formed by combining several queueing components.

Parameters

Name Type Default value Description
displayStringTextFormat string "contains %p pk (%l) pushed %u created %c\n popped %o removed %r dropped %d"

determines display string text above the submodule

packetCapacity int -1

maximum number of packets in the queue, no limit by default

dataCapacity int -1b

maximum total length of packets in the queue, no limit by default

interfaceTableModule string

Properties

Name Value Description
display i=block/queue
class CompoundPacketQueue

Gates

Name Direction Size Description
in input
out output

Signals

Name Type Unit
packetRemoved inet::Packet
packetPushed inet::Packet
packetDropped inet::Packet
packetPopped inet::Packet

Statistics

Name Title Source Record Unit Interpolation Mode
packetRemoved packets removed localSignal(packetRemoved) count, sum(packetBytes), vector(packetBytes) none
queueLength queue length count(localSignal(packetPushed)) - count(localSignal(packetPopped)) - count(localSignal(packetRemoved)) - count(packetDropped) max, timeavg, vector sample-hold
queueingTime queueing times queueingTime(packetPopped) histogram, vector s none
packetPushed packets pushed localSignal(packetPushed) count, sum(packetBytes), vector(packetBytes) none
packetDropQueueOverflow packets dropped: queue overflow packetDropReasonIsQueueOverflow(packetDropped) count, sum(packetBytes), vector(packetBytes) none
packetPopped packets popped localSignal(packetPopped) count, sum(packetBytes), vector(packetBytes) none

Unassigned submodule parameters

Name Type Default value Description
classifier.displayStringTextFormat string "classified %p pk (%l)"

determines the text that is written on top of the submodule

efMeter.interfaceTableModule string

The path to the InterfaceTable module

efMeter.cir string "10%"

committed information rate, either absolute bitrate (e.g. "100kbps"), or relative to the link's datarate (e.g. "20%")

efMeter.cbs int 5000B

committed burst size

efMeter.colorAwareMode bool false

enables color-aware mode

sink.displayStringTextFormat string "dropped %p pk (%l)"

determines the text that is written on top of the submodule

sink.consumptionInterval double 0s

elapsed time between subsequent packets allowed to be pushed by the connected packet producer, 0 means any number of packets can be pushed at the same simulation time

efQueue.displayStringTextFormat string "contains %p pk (%l) pushed %u\npopped %o removed %r dropped %d"

determines display string text above the submodule

efQueue.packetCapacity int 5

maximum number of packets in the queue, no limit by default

efQueue.dataCapacity int -1b

maximum total length of packets in the queue, no limit by default

efQueue.dropperClass string "inet::queueing::PacketAtCollectionEndDropper"

determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

efQueue.comparatorClass string ""

determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class

efQueue.bufferModule string ""

relative module path to the IPacketBuffer module used by this queue, implicit buffer by default

af1xQueue.red1.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af1xQueue.red1.pkrate double 150

average packet rate for calculations when queue is empty

af1xQueue.red1.useEcn bool false

if enabled, packets are marked with ECN if applicable

af1xQueue.red1.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af1xQueue.red2.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af1xQueue.red2.pkrate double 150

average packet rate for calculations when queue is empty

af1xQueue.red2.useEcn bool false

if enabled, packets are marked with ECN if applicable

af1xQueue.red2.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af1xQueue.red3.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af1xQueue.red3.pkrate double 150

average packet rate for calculations when queue is empty

af1xQueue.red3.useEcn bool false

if enabled, packets are marked with ECN if applicable

af1xQueue.red3.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af1xQueue.mux.displayStringTextFormat string "passed %p pk (%l)"

determines the text that is written on top of the submodule

af1xQueue.queue.displayStringTextFormat string "contains %p pk (%l) pushed %u\npopped %o removed %r dropped %d"

determines display string text above the submodule

af1xQueue.queue.packetCapacity int -1

maximum number of packets in the queue, no limit by default

af1xQueue.queue.dataCapacity int -1b

maximum total length of packets in the queue, no limit by default

af1xQueue.queue.dropperClass string ""

determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

af1xQueue.queue.comparatorClass string ""

determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class

af1xQueue.queue.bufferModule string ""

relative module path to the IPacketBuffer module used by this queue, implicit buffer by default

af2xQueue.red1.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af2xQueue.red1.pkrate double 150

average packet rate for calculations when queue is empty

af2xQueue.red1.useEcn bool false

if enabled, packets are marked with ECN if applicable

af2xQueue.red1.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af2xQueue.red2.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af2xQueue.red2.pkrate double 150

average packet rate for calculations when queue is empty

af2xQueue.red2.useEcn bool false

if enabled, packets are marked with ECN if applicable

af2xQueue.red2.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af2xQueue.red3.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af2xQueue.red3.pkrate double 150

average packet rate for calculations when queue is empty

af2xQueue.red3.useEcn bool false

if enabled, packets are marked with ECN if applicable

af2xQueue.red3.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af2xQueue.mux.displayStringTextFormat string "passed %p pk (%l)"

determines the text that is written on top of the submodule

af2xQueue.queue.displayStringTextFormat string "contains %p pk (%l) pushed %u\npopped %o removed %r dropped %d"

determines display string text above the submodule

af2xQueue.queue.packetCapacity int -1

maximum number of packets in the queue, no limit by default

af2xQueue.queue.dataCapacity int -1b

maximum total length of packets in the queue, no limit by default

af2xQueue.queue.dropperClass string ""

determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

af2xQueue.queue.comparatorClass string ""

determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class

af2xQueue.queue.bufferModule string ""

relative module path to the IPacketBuffer module used by this queue, implicit buffer by default

af3xQueue.red1.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af3xQueue.red1.pkrate double 150

average packet rate for calculations when queue is empty

af3xQueue.red1.useEcn bool false

if enabled, packets are marked with ECN if applicable

af3xQueue.red1.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af3xQueue.red2.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af3xQueue.red2.pkrate double 150

average packet rate for calculations when queue is empty

af3xQueue.red2.useEcn bool false

if enabled, packets are marked with ECN if applicable

af3xQueue.red2.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af3xQueue.red3.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af3xQueue.red3.pkrate double 150

average packet rate for calculations when queue is empty

af3xQueue.red3.useEcn bool false

if enabled, packets are marked with ECN if applicable

af3xQueue.red3.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af3xQueue.mux.displayStringTextFormat string "passed %p pk (%l)"

determines the text that is written on top of the submodule

af3xQueue.queue.displayStringTextFormat string "contains %p pk (%l) pushed %u\npopped %o removed %r dropped %d"

determines display string text above the submodule

af3xQueue.queue.packetCapacity int -1

maximum number of packets in the queue, no limit by default

af3xQueue.queue.dataCapacity int -1b

maximum total length of packets in the queue, no limit by default

af3xQueue.queue.dropperClass string ""

determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

af3xQueue.queue.comparatorClass string ""

determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class

af3xQueue.queue.bufferModule string ""

relative module path to the IPacketBuffer module used by this queue, implicit buffer by default

af4xQueue.red1.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af4xQueue.red1.pkrate double 150

average packet rate for calculations when queue is empty

af4xQueue.red1.useEcn bool false

if enabled, packets are marked with ECN if applicable

af4xQueue.red1.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af4xQueue.red2.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af4xQueue.red2.pkrate double 150

average packet rate for calculations when queue is empty

af4xQueue.red2.useEcn bool false

if enabled, packets are marked with ECN if applicable

af4xQueue.red2.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af4xQueue.red3.displayStringTextFormat string "dropped %d/%p pk (%k/%l)"

determines the text that is written on top of the submodule

af4xQueue.red3.pkrate double 150

average packet rate for calculations when queue is empty

af4xQueue.red3.useEcn bool false

if enabled, packets are marked with ECN if applicable

af4xQueue.red3.packetCapacity int int(maxth)

packets are dropped if queue length is greater

af4xQueue.mux.displayStringTextFormat string "passed %p pk (%l)"

determines the text that is written on top of the submodule

af4xQueue.queue.displayStringTextFormat string "contains %p pk (%l) pushed %u\npopped %o removed %r dropped %d"

determines display string text above the submodule

af4xQueue.queue.packetCapacity int -1

maximum number of packets in the queue, no limit by default

af4xQueue.queue.dataCapacity int -1b

maximum total length of packets in the queue, no limit by default

af4xQueue.queue.dropperClass string ""

determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

af4xQueue.queue.comparatorClass string ""

determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class

af4xQueue.queue.bufferModule string ""

relative module path to the IPacketBuffer module used by this queue, implicit buffer by default

beQueue.displayStringTextFormat string "contains %p pk (%l) pushed %u\npopped %o removed %r dropped %d"

determines display string text above the submodule

beQueue.packetCapacity int 100

maximum number of packets in the queue, no limit by default

beQueue.dataCapacity int -1b

maximum total length of packets in the queue, no limit by default

beQueue.dropperClass string "inet::queueing::PacketAtCollectionEndDropper"

determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

beQueue.comparatorClass string ""

determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class

beQueue.bufferModule string ""

relative module path to the IPacketBuffer module used by this queue, implicit buffer by default

wrr.displayStringTextFormat string "scheduled %p pk (%l)"

determines the text that is written on top of the submodule

wrr.weights string "1 1 1 1 1"
priority.displayStringTextFormat string "scheduled %p pk (%l)"

determines the text that is written on top of the submodule

Source code

//
// This is an example queue, that can be used in
// interfaces of DS core and edge nodes to support
// the AFxy (RFC 2597) and EF (RFC 3246) PHBs.
//
// The incoming packets are first classified according to
// their DSCP field. DSCPs other than AFxy and EF are handled
// as BE (best effort).
//
// EF packets are stored in a dedicated queue, and served first
// when a packet is requested. Because they can preempt the other
// queues, the rate of the EF packets should be limited to a fraction
// of the bandwith of the link. This is achieved by metering the EF
// traffic with a token bucket meter and dropping packets that
// does not conform to the traffic profile.
//
// There are other queues for AFx classes and BE. The AFx queues
// use RED to implement 3 different drop priorities within the class.
// BE packets are stored in a drop tail queue.
// Packets from AFxy and BE queues are sheduled by a WRR scheduler,
// which ensures that the remaining bandwith is allocated among the classes
// according to the specified weights.
//
// @see ~AFxyQueue
//
module DiffservQueue extends CompoundPacketQueue
{
    parameters:
        string interfaceTableModule;
        *.interfaceTableModule = default(absPath(interfaceTableModule));
    submodules:
        classifier: BehaviorAggregateClassifier {
            dscps = "EF AF11 AF12 AF13 AF21 AF22 AF23 AF31 AF32 AF33 AF41 AF42 AF43";
            @display("p=100,330");
        }
        efMeter: TokenBucketMeter {
            cir = default("10%"); // reserved EF bandwith as percentage of datarate of the interface
            cbs = default(5000B); // 5 1000B packets
            @display("p=250,130");
        }
        sink: PassivePacketSink {
            @display("p=400,80");
        }
        efQueue: DropTailQueue {
            packetCapacity = default(5); // keep low, for low delay and jitter
            @display("p=400,180");
        }
        af1xQueue: AFxyQueue {
            @display("p=250,230");
        }
        af2xQueue: AFxyQueue {
            @display("p=250,330");
        }
        af3xQueue: AFxyQueue {
            @display("p=250,430");
        }
        af4xQueue: AFxyQueue {
            @display("p=250,530");
        }
        beQueue: DropTailQueue {
            @display("p=250,630");
        }
        wrr: WrrScheduler {
            weights = default("1 1 1 1 1");
            @display("p=400,330");
        }
        priority: PriorityScheduler {
            @display("p=550,330");
        }

    connections:
        in --> classifier.in;
        classifier.out++ --> efMeter.in;
        classifier.out++ --> af1xQueue.afx1In;
        classifier.out++ --> af1xQueue.afx2In;
        classifier.out++ --> af1xQueue.afx3In;
        classifier.out++ --> af2xQueue.afx1In;
        classifier.out++ --> af2xQueue.afx2In;
        classifier.out++ --> af2xQueue.afx3In;
        classifier.out++ --> af3xQueue.afx1In;
        classifier.out++ --> af3xQueue.afx2In;
        classifier.out++ --> af3xQueue.afx3In;
        classifier.out++ --> af4xQueue.afx1In;
        classifier.out++ --> af4xQueue.afx2In;
        classifier.out++ --> af4xQueue.afx3In;
        classifier.defaultOut --> beQueue.in;

        efMeter.greenOut --> { @display("ls=green"); } --> efQueue.in;
        efMeter.redOut --> { @display("ls=red"); } --> sink.in;

        af1xQueue.out --> wrr.in++;
        af2xQueue.out --> wrr.in++;
        af3xQueue.out --> wrr.in++;
        af4xQueue.out --> wrr.in++;
        beQueue.out --> wrr.in++;
        efQueue.out --> priority.in++;
        wrr.out --> priority.in++;
        priority.out --> out;
}

File: src/inet/networklayer/diffserv/DiffservQueue.ned