mirror of
				https://github.com/xdp-project/bpf-examples.git
				synced 2024-05-06 15:54:53 +00:00 
			
		
		
		
	traffic-pacing-edt: Add HTB shaper script
This is primary to comparing HTB shaper accuracy against EDT Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
This commit is contained in:
		
							
								
								
									
										84
									
								
								traffic-pacing-edt/tc_htb_shaper.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										84
									
								
								traffic-pacing-edt/tc_htb_shaper.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,84 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
# This HTB shaper setup script is available for easier comparing the
 | 
			
		||||
# accuracy against the EDT solution.
 | 
			
		||||
#
 | 
			
		||||
# Author: Jesper Dangaaard Brouer <netoptimizer@brouer.com>
 | 
			
		||||
# License: GPLv2
 | 
			
		||||
#
 | 
			
		||||
basedir=`dirname $0`
 | 
			
		||||
source ${basedir}/functions.sh
 | 
			
		||||
 | 
			
		||||
root_check_run_with_sudo "$@"
 | 
			
		||||
 | 
			
		||||
# Use common parameters
 | 
			
		||||
source ${basedir}/parameters.sh
 | 
			
		||||
 | 
			
		||||
export TC=/sbin/tc
 | 
			
		||||
 | 
			
		||||
# It seems measured BW is TCP goodput, but configured BW is wirespeed.
 | 
			
		||||
# Measurements show around 930Mbit best-case.  Q-in-Q result in MTU
 | 
			
		||||
# 1522 bytes.  TCP goodput segments are 1448 bytes.
 | 
			
		||||
#
 | 
			
		||||
RATE=$((930*1522/1448))Mbit
 | 
			
		||||
##RATE=$((933*1522/1448))Mbit
 | 
			
		||||
##CEIL=$((999*1522/1448))
 | 
			
		||||
#CEIL=1Gbit
 | 
			
		||||
CEIL=980mbit
 | 
			
		||||
 | 
			
		||||
#RATE=500mbit
 | 
			
		||||
#CEIL=577mbit
 | 
			
		||||
 | 
			
		||||
# Each of the HTB root-class(es) get these RATE+CEIL upper bandwidth bounds.
 | 
			
		||||
ROOT_RATE=9000Mbit
 | 
			
		||||
ROOT_CEIL=9500Mbit
 | 
			
		||||
 | 
			
		||||
DEFAULT_RATE=6000Mbit
 | 
			
		||||
DEFAULT_CEIL=6000Mbit
 | 
			
		||||
 | 
			
		||||
TC=/usr/sbin/tc
 | 
			
		||||
VERBOSE=1
 | 
			
		||||
 | 
			
		||||
function tc() {
 | 
			
		||||
    _call_tc "" "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# HTB shaper
 | 
			
		||||
call_tc_allow_fail qdisc del dev "$DEV" root
 | 
			
		||||
#tc qdisc add dev "$DEV" root handle 1: htb default 2
 | 
			
		||||
tc qdisc add dev "$DEV" root handle 1: htb default 16
 | 
			
		||||
 | 
			
		||||
# The root-class set upper bandwidth usage
 | 
			
		||||
tc class add dev "$DEV" parent 1: classid 1:1 \
 | 
			
		||||
       htb rate $ROOT_RATE ceil $ROOT_CEIL
 | 
			
		||||
 | 
			
		||||
# Default class 1:2
 | 
			
		||||
tc class add dev "$DEV" parent 1: classid 1:2 htb \
 | 
			
		||||
        rate "$DEFAULT_RATE" ceil "$DEFAULT_CEIL"
 | 
			
		||||
#       burst 100000 cburst 100000
 | 
			
		||||
tc qdisc add dev $DEV parent 1:2 fq_codel
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Class for vlan 16
 | 
			
		||||
tc class add dev "$DEV" parent 1: classid 1:16 htb rate "$RATE" ceil "$CEIL" \
 | 
			
		||||
        burst $((1522*2)) cburst $((1522*2)) \
 | 
			
		||||
        linklayer ethernet
 | 
			
		||||
#       burst 1522 cburst 1522
 | 
			
		||||
        #burst 1 cburst 1
 | 
			
		||||
#       burst $((1522*2)) cburst $((1522*2))
 | 
			
		||||
#       overhead $((14+4+4)) linklayer ethernet
 | 
			
		||||
#tc qdisc add dev "$DEV" parent 1:16 fq_codel
 | 
			
		||||
tc qdisc add dev "$DEV" parent 1:16 fq_codel quantum $((1514+4+4))
 | 
			
		||||
#tc qdisc add dev "$DEV" parent 1:16 pfifo
 | 
			
		||||
 | 
			
		||||
# parent filter:
 | 
			
		||||
#tc filter add dev "$DEV" parent 1:0 prio 100 protocol 802.1q u32
 | 
			
		||||
#
 | 
			
		||||
# vlan 16:
 | 
			
		||||
#tc filter add dev "$DEV" parent 1:0 prio 100 \
 | 
			
		||||
#        protocol 802.1q \
 | 
			
		||||
#        u32 match u16 0x0010 0x0fff at -4 \
 | 
			
		||||
#        flowid 1:16
 | 
			
		||||
 | 
			
		||||
tc filter add dev $DEV protocol all parent 1:0 prio 101 \
 | 
			
		||||
        basic match "meta(vlan mask 0xfff eq 16)" flowid 1:16
 | 
			
		||||
		Reference in New Issue
	
	Block a user