[leaf-commits] src/bering-uclibc4/source/hash-shaper buildtool.cfg, 1.1.1.1, 1.2 hsh.conf, 1.1.1.1, 1.2 hsh.sh, 1.1.1.1, 1.2

Andrew <[email protected]> Mon, 22 Nov 2010 18:12:56 +0000
Newsgroups gmane.linux.leaf.cvs
Message-ID <[email protected]>
Update of /cvsroot/leaf/src/bering-uclibc4/source/hash-shaper
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14742

Modified Files:
	buildtool.cfg hsh.conf hsh.sh 
Log Message:
Updated to support multiple outgoing interfaces


Index: hsh.sh
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc4/source/hash-shaper/hsh.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** hsh.sh	26 Apr 2010 09:02:43 -0000	1.1.1.1
--- hsh.sh	22 Nov 2010 18:12:42 -0000	1.2
***************
*** 46,61 ****
  }
  
! #init
  initdev() {
      echo $UPDEVINIT|sh
!     $tc q d root dev $UPDEV 2>/dev/null
!     $tc q a root dev $UPDEV handle 1: htb default 2
!     $tc c a dev $UPDEV parent 1: classid 1:1 htb rate $URATE ceil $UCEIL $UBURST prio 1 quantum 1514
!     $tc c a dev $UPDEV parent 1: classid 1:2 htb rate $URATE ceil $UCEIL $UBURST prio 2 quantum 1514
!     $tc q a dev $UPDEV parent 1:2 handle 2: sfq perturb 10 quantum 1514
!     $tc f a dev $UPDEV parent 1: prio 10 protocol ip u32
  }
  
! #add rule $1 with addr $2 for table $3 with default speed
  addrule() {
      ar_id=$(($POOLWIDTH*($3+1)+$1))
--- 46,61 ----
  }
  
! #init device $1
  initdev() {
      echo $UPDEVINIT|sh
!     $tc q d root dev $1 2>/dev/null
!     $tc q a root dev $1 handle 1: htb default 2
!     $tc c a dev $1 parent 1: classid 1:1 htb rate $URATE ceil $UCEIL $UBURST prio 1 quantum 1514
!     $tc c a dev $1 parent 1: classid 1:2 htb rate $URATE ceil $UCEIL $UBURST prio 2 quantum 1514
!     $tc q a dev $1 parent 1:2 handle 2: sfq perturb 10 quantum 1514
!     $tc f a dev $1 parent 1: prio 10 protocol ip u32
  }
  
! #add rule $1 with addr $2 for table $3 with default speed on device $4
  addrule() {
      ar_id=$(($POOLWIDTH*($3+1)+$1))
***************
*** 64,84 ****
      ar_h1=$(hex $1)
      ar_h3=$(hex $3)
!     $tc c a dev $UPDEV parent 1:1 classid 1:$ar_id htb rate $URATE ceil $UCEIL $UBURST prio 1 quantum 1514
!     $tc c a dev $UPDEV parent 1:$ar_id classid 1:$ar_id1 htb rate $UHRATE ceil $UCEIL $UBURST prio 2 quantum 1514
!     $tc c a dev $UPDEV parent 1:$ar_id classid 1:$ar_id2 htb rate $UHRATE ceil $UCEIL $UBURST prio 1 quantum 1514
!     $tc q a dev $UPDEV parent 1:$ar_id1 handle $ar_id1: sfq perturb 10 quantum 1514
!     $tc q a dev $UPDEV parent 1:$ar_id2 handle $ar_id2: sfq perturb 10 quantum 1514
!     $tc f a dev $UPDEV parent 1: protocol ip prio 1 u32 ht $ar_h3:$ar_h1: \
  	match ip tos 0x10 0xff flowid 1:$ar_id2
!     $tc f a dev $UPDEV parent 1: protocol ip prio 2 u32 ht $ar_h3:$ar_h1: \
  	match ip protocol 6 0xff match u8 0x45 0xff at 0 match u16 0x0000 0xffc0 at 2 \
  	match u8 0x10 0xff at 33 flowid 1:$ar_id2
!     $tc f a dev $UPDEV parent 1: protocol ip prio 3 u32 ht $ar_h3:$ar_h1: \
  	match ip protocol 1 0xff flowid 1:$ar_id2
!     $tc f a dev $UPDEV parent 1: protocol ip prio 4 u32 ht $ar_h3:$ar_h1: match ip src $2 \
  	flowid 1:$ar_id1
  }
  
! #set speed for rule $1 in table $2 with rate $3 kbit
  setspeed() {
      ss_id=$(($POOLWIDTH*($2+1)+$1))
--- 64,84 ----
      ar_h1=$(hex $1)
      ar_h3=$(hex $3)
!     $tc c a dev $4 parent 1:1 classid 1:$ar_id htb rate $URATE ceil $UCEIL $UBURST prio 1 quantum 1514
!     $tc c a dev $4 parent 1:$ar_id classid 1:$ar_id1 htb rate $UHRATE ceil $UCEIL $UBURST prio 2 quantum 1514
!     $tc c a dev $4 parent 1:$ar_id classid 1:$ar_id2 htb rate $UHRATE ceil $UCEIL $UBURST prio 1 quantum 1514
!     $tc q a dev $4 parent 1:$ar_id1 handle $ar_id1: sfq perturb 10 quantum 1514
!     $tc q a dev $4 parent 1:$ar_id2 handle $ar_id2: sfq perturb 10 quantum 1514
!     $tc f a dev $4 parent 1: protocol ip prio 1 u32 ht $ar_h3:$ar_h1: \
  	match ip tos 0x10 0xff flowid 1:$ar_id2
!     $tc f a dev $4 parent 1: protocol ip prio 2 u32 ht $ar_h3:$ar_h1: \
  	match ip protocol 6 0xff match u8 0x45 0xff at 0 match u16 0x0000 0xffc0 at 2 \
  	match u8 0x10 0xff at 33 flowid 1:$ar_id2
!     $tc f a dev $4 parent 1: protocol ip prio 3 u32 ht $ar_h3:$ar_h1: \
  	match ip protocol 1 0xff flowid 1:$ar_id2
!     $tc f a dev $4 parent 1: protocol ip prio 4 u32 ht $ar_h3:$ar_h1: match ip src $2 \
  	flowid 1:$ar_id1
  }
  
! #set speed for rule $1 in table $2 with rate $3 kbit on device $4
  setspeed() {
      ss_id=$(($POOLWIDTH*($2+1)+$1))
***************
*** 86,99 ****
      ss_id2=$(($RULECOUNT*2+$ss_id))
      ss_hr=$(($3/2))
!     $tc c r dev $UPDEV parent 1:1 classid 1:$ss_id htb rate ${3}kbit $UBURST prio 1 quantum 1514
!     $tc c r dev $UPDEV parent 1:$ss_id classid 1:$ss_id1 htb rate ${ss_hr}kbit ceil ${3}kbit $UBURST prio 2 quantum 1514
!     $tc c r dev $UPDEV parent 1:$ss_id classid 1:$ss_id2 htb rate ${ss_hr}kbit ceil ${3}kbit $UBURST prio 1 quantum 1514
  }
  
! #fill table for subnet addr $1, number $2
  addtable() {
      nwidth=$(netwidth $1)
!     $tc f a dev $UPDEV parent 1:1 prio 10 handle $tctr: protocol ip u32 divisor $nwidth
!     $tc f a dev $UPDEV parent 1: protocol ip prio 10 u32 ht 800:: \
          match ip src $(subnet $1) \
          hashkey mask 0x$(hex $(($nwidth-1))) at 12 \
--- 86,99 ----
      ss_id2=$(($RULECOUNT*2+$ss_id))
      ss_hr=$(($3/2))
!     $tc c r dev $4 parent 1:1 classid 1:$ss_id htb rate ${3}kbit $UBURST prio 1 quantum 1514
!     $tc c r dev $4 parent 1:$ss_id classid 1:$ss_id1 htb rate ${ss_hr}kbit ceil ${3}kbit $UBURST prio 2 quantum 1514
!     $tc c r dev $4 parent 1:$ss_id classid 1:$ss_id2 htb rate ${ss_hr}kbit ceil ${3}kbit $UBURST prio 1 quantum 1514
  }
  
! #fill table for subnet addr $1, device $2
  addtable() {
      nwidth=$(netwidth $1)
!     $tc f a dev $2 parent 1:1 prio 10 handle $tctr: protocol ip u32 divisor $nwidth
!     $tc f a dev $2 parent 1: protocol ip prio 10 u32 ht 800:: \
          match ip src $(subnet $1) \
          hashkey mask 0x$(hex $(($nwidth-1))) at 12 \
***************
*** 101,105 ****
      at_t=0
      for at_i in $(lseq $(ip2int $1) $nwidth); do
! 	addrule $at_t $(int2ip $at_i) $tctr
  	at_t=$(($at_t+1))
      done    
--- 101,105 ----
      at_t=0
      for at_i in $(lseq $(ip2int $1) $nwidth); do
! 	addrule $at_t $(int2ip $at_i) $tctr $2
  	at_t=$(($at_t+1))
      done    
***************
*** 137,144 ****
  case "$1" in
      init)
! 	initdev
! 	for i in $NPOOLS; do
! 	    addtable $i
! 	    tctr=$(($tctr+1))
  	done;;
      set)
--- 137,146 ----
  case "$1" in
      init)
! 	for iface in $UPDEVS; do
! 	    initdev $iface
! 	    for i in $NPOOLS; do
! 		addtable $i $iface
! 		tctr=$(($tctr+1))
! 	    done
  	done;;
      set)
***************
*** 146,150 ****
  	    if [ $(chkip $i $2) -eq 1 ]; then
  		rulenum=$(($(ip2int $2)-$(ip2int $i)))
! 		setspeed $rulenum $tctr $3
  		exit 0
  	    fi
--- 148,158 ----
  	    if [ $(chkip $i $2) -eq 1 ]; then
  		rulenum=$(($(ip2int $2)-$(ip2int $i)))
! 		if [ -z "$4" ]; then
! 		    for iface in $UPDEVS; do
! 			setspeed $rulenum $tctr $3 $iface
! 		    done
! 		else
! 		    setspeed $rulenum $tctr $3 $4
! 		fi
  		exit 0
  	    fi
***************
*** 157,161 ****
  	    if [ $(chkip $i $2) -eq 1 ]; then
  		cl1=$(($POOLWIDTH*($tctr+1)+$(ip2int $2)-$(ip2int $i)))
! 		$tc -s c s dev $UPDEV|grep -A 4 " 1:$cl1 "
  		exit 0
  	    fi
--- 165,176 ----
  	    if [ $(chkip $i $2) -eq 1 ]; then
  		cl1=$(($POOLWIDTH*($tctr+1)+$(ip2int $2)-$(ip2int $i)))
! 		if [ -z "$3" ]; then
! 		    for iface in $UPDEVS; do
! 			echo "Interface $iface"
! 			$tc -s c s dev $iface|grep -A 4 " 1:$cl1 "
! 		    done;
! 		else
! 		    $tc -s c s dev $3|grep -A 4 " 1:$cl1 "
! 		fi
  		exit 0
  	    fi
***************
*** 167,171 ****
  	echo $UPDEVSTOP|sh;;
      *)
! 	echo Usage: "$0 (init|stop|set <ip> <speed in kbit>|cstat <ip>)";;
  esac
  
--- 182,186 ----
  	echo $UPDEVSTOP|sh;;
      *)
! 	echo Usage: "$0 (init|stop|set <ip> <speed in kbit> [iface]|cstat <ip> [iface])";;
  esac
  

Index: hsh.conf
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc4/source/hash-shaper/hsh.conf,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** hsh.conf	26 Apr 2010 09:02:43 -0000	1.1.1.1
--- hsh.conf	22 Nov 2010 18:12:42 -0000	1.2
***************
*** 5,15 ****
  
  POOLS="10.255.0.64/30 10.255.0.0/28"
! UPDEV=ifb0
! UPDEVINIT="$ip l s $UPDEV up 2>/dev/null"
! UPDEVSTOP="$tc q d root dev $UPDEV 2>/dev/null; $ip l s $UPDEV down 2>/dev/null"
  URATE=100Mbit
  UHRATE=50Mbit
  UCEIL=1000Mbit
! UBURST="burst 512k"
  
  
--- 5,16 ----
  
  POOLS="10.255.0.64/30 10.255.0.0/28"
! UPDEVS="ifb0 ifb1"
! UPDEVINIT="$ip l s ifb0 up 2>/dev/null; $ip l s ifb1 up 2>/dev/null"
! UPDEVSTOP="$tc q d root dev ifb0 2>/dev/null; $ip l s ifb0 down 2>/dev/null; \
! $tc q d root dev ifb1 2>/dev/null; $ip l s ifb1 down 2>/dev/null"
  URATE=100Mbit
  UHRATE=50Mbit
  UCEIL=1000Mbit
! UBURST="burst 1024k"
  
  

Index: buildtool.cfg
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc4/source/hash-shaper/buildtool.cfg,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** buildtool.cfg	26 Apr 2010 09:02:43 -0000	1.1.1.1
--- buildtool.cfg	22 Nov 2010 18:12:42 -0000	1.2
***************
*** 26,31 ****
  <Package>
  	<hsh>
! 		Version = 0.1
! 		Revision = 5
  	
  		Help <<EOF
--- 26,31 ----
  <Package>
  	<hsh>
! 		Version = 0.2
! 		Revision = 1
  	
  		Help <<EOF


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev