From: Julien Desfossez Date: Mon, 17 Dec 2012 17:13:38 +0000 (-0500) Subject: Set classes of traffic in high_throughput_limits X-Git-Tag: v2.1.0~37 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=ffaed7f7927871131ffea68d1bddc7402f4e32dd Set classes of traffic in high_throughput_limits This patch creates 2 classes for the bandwidth limited test instead of one. The intent is to have multiple queues in the kernel instead of just one. That way we can prioritize the control port over the data port and make sure it gets its share of the bandwidth. With this update, the control port gets 1/10th of the limit and the data get the remaining 9/10th. If unused, the data connection can borrow the remaining bandwidth. Signed-off-by: Julien Desfossez Signed-off-by: David Goulet --- diff --git a/tests/tools/streaming/high_throughput_limits b/tests/tools/streaming/high_throughput_limits index 0e71ad04d..ebe5020a6 100755 --- a/tests/tools/streaming/high_throughput_limits +++ b/tests/tools/streaming/high_throughput_limits @@ -49,13 +49,27 @@ fi function set_bw_limit { limit=$1 - echo -n "Setting bandwidth limits to ${limit}kbits... " + ctrlportlimit=$(($limit/10)) + # failsafe to have at least 1kbit/s for control (in the case where $1 < 10) + [ $ctrlportlimit = 0 ] && ctrlportlimit=1 + # if $1 < 10, we might bust the limit set here, but the + # parent qdisc (1:) will always limit us to the right max value + dataportlimit=$((9*${ctrlportlimit})) + + echo -n "Setting bandwidth limits to ${limit}kbits, (${ctrlportlimit} for control and ${dataportlimit} for data)... " tc qdisc add dev $DEFAULT_IF root handle 1: htb default 15 >/dev/null 2>&1 - tc class add dev $DEFAULT_IF parent 1: classid 1:1 htb rate ${limit}kbit ceil ${limit}kbit >/dev/null 2>&1 - - tc filter add dev $DEFAULT_IF parent 1: protocol ip u32 match ip dport $SESSIOND_CTRL_PORT 0xffff flowid 1:1 >/dev/null 2>&1 - tc filter add dev $DEFAULT_IF parent 1: protocol ip u32 match ip dport $SESSIOND_DATA_PORT 0xffff flowid 1:1 >/dev/null 2>&1 + # the total bandwidth is the limit set by the user + tc class add dev $DEFAULT_IF parent 1: classid 1:1 htb rate ${limit}kbit ceil ${limit}kbit >/dev/null 2>&1 + # 1/10 of the bandwidth guaranteed and traffic prioritized for the control port + tc class add dev $DEFAULT_IF parent 1:1 classid 1:10 htb rate ${ctrlportlimit}kbit ceil ${limit}kbit prio 1 >/dev/null 2>&1 + # 9/10 of the bandwidth guaranteed and can borrow up to the total bandwidth (if unused) + tc class add dev $DEFAULT_IF parent 1:1 classid 1:11 htb rate ${dataportlimit}kbit ceil ${limit}kbit prio 2 >/dev/null 2>&1 + + # filter to assign control traffic to the 1:10 class + tc filter add dev $DEFAULT_IF parent 1: protocol ip u32 match ip dport $SESSIOND_CTRL_PORT 0xffff flowid 1:10 >/dev/null 2>&1 + # filter to assign data traffic to the 1:11 class + tc filter add dev $DEFAULT_IF parent 1: protocol ip u32 match ip dport $SESSIOND_DATA_PORT 0xffff flowid 1:11 >/dev/null 2>&1 print_ok }