The XCP queue is responsible for sending back feedback in every packet header which is used by the sender to control rate of sending data packets into the network. XCP uses two control algorithms, the congestion controller and the fairness controller that are executed once every estimation control interval, Te.
In ns the estimation_timer is used to maintain this interval which is based on the average rtt values of the (xcp) flows seen through the router. However there may be better ways of defining this interval. The outstanding queue in the router is measured at a separate interval Tq, for which a queue_timer is used. Finally an rtt_timer is used to measure certain parameters in the router like packet drops, queue size, utilization etc for a given interval Tr, that may either be set by user from tcl scripts or it may use the highest rtt value seen for all flows in the router.
The rtt_timer interval value, Tr maybe set from tcl using the following API:
$queue queue-sample-everyrtt $rtt_value
where $queue is a handle to the xcp router and $rtt_value is the interval for which xcp queue parameters like packet drop , queue size etc shall be measured. See example script under ~ns/tcl/ex/xcp/parking_lot_topo/parking_lot_topo.tcl for use of this API.
On packet arrival the total input traffic seen at the XCP queue is incremented by the size of the packet received. The sum of inversed throughput and sum of rtt by throughput is incremented as well. Values for throughput and rtt are read from the xcp header as set by the TCP source. Each value is normalised by the packet size.
On the event of the estimation timer going off, average rtt of all flows is estimated using the above two sums as follows
avg_rtt = sum_rtt_by_throughput/ sum_inv_throughput
The aggregate feedback is calculated based on the available bandwidth capacity of the router, arriving traffic bandwidth and the persistent queue length in the router. Further detailed explanation of calculations used by the XCP router algorithm can be found in XCP specification available from XCP's website at http://www.isi.edu/isi-xcp/docs/draft-falk-xcp-spec-00.txt
Each packet carries the current throughput value of the flow and a throughput adjustment or the delta_throughput in its header. The XCP router based on the feedback values it calculates in the estimation control timeout, calculates a per-packet throughput adjustment feedback for every packet. Positive feedback is applied equally per-flow while negative feedback is made proportional to each flow's capacity. Also a downsream router can change the delta_throughput value in a packet's header only if the feedback value calculated is less than that in the header (written by an less congested upstream router). The implementation of XCP queue in ns may be found in xcpq.{cc,h}.
Tom Henderson 2011-11-05