X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Ftools%2Fstreaming%2Fhigh_throughput_limits;fp=tests%2Ftools%2Fstreaming%2Fhigh_throughput_limits;h=ebe5020a69f5bcee1419bbc7dba06fd9b97aac9b;hp=0e71ad04d926268ca23eff2a10e6d95cd62c5dc8;hb=ffaed7f7927871131ffea68d1bddc7402f4e32dd;hpb=0d9c5d7750202aa5f46cd7c6f642fb31fe1556c4 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 }