Skip to content
Snippets Groups Projects
Commit e09254ee authored by Andrew Ferguson's avatar Andrew Ferguson
Browse files

Adjust numbering to support tc-based switch QoS

both the reference switch and Open vSwitch assume ids with major 1
can be used for tc-based QoS
parent e5a15ced
No related branches found
No related tags found
No related merge requests found
...@@ -196,36 +196,36 @@ def bwCmds( self, bw=None, speedup=0, use_hfsc=False, use_tbf=False, ...@@ -196,36 +196,36 @@ def bwCmds( self, bw=None, speedup=0, use_hfsc=False, use_tbf=False,
# are specifying the correct sizes. For now I have used # are specifying the correct sizes. For now I have used
# the same settings we had in the mininet-hifi code. # the same settings we had in the mininet-hifi code.
if use_hfsc: if use_hfsc:
cmds += [ '%s qdisc add dev %s root handle 1:0 hfsc default 1', cmds += [ '%s qdisc add dev %s root handle 5:0 hfsc default 1',
'%s class add dev %s parent 1:0 classid 1:1 hfsc sc ' '%s class add dev %s parent 5:0 classid 5:1 hfsc sc '
+ 'rate %fMbit ul rate %fMbit' % ( bw, bw ) ] + 'rate %fMbit ul rate %fMbit' % ( bw, bw ) ]
elif use_tbf: elif use_tbf:
if latency_ms is None: if latency_ms is None:
latency_ms = 15 * 8 / bw latency_ms = 15 * 8 / bw
cmds += [ '%s qdisc add dev %s root handle 1: tbf ' + cmds += [ '%s qdisc add dev %s root handle 5: tbf ' +
'rate %fMbit burst 15000 latency %fms' % 'rate %fMbit burst 15000 latency %fms' %
( bw, latency_ms ) ] ( bw, latency_ms ) ]
else: else:
cmds += [ '%s qdisc add dev %s root handle 1:0 htb default 1', cmds += [ '%s qdisc add dev %s root handle 5:0 htb default 1',
'%s class add dev %s parent 1:0 classid 1:1 htb ' + '%s class add dev %s parent 5:0 classid 5:1 htb ' +
'rate %fMbit burst 15k' % bw ] 'rate %fMbit burst 15k' % bw ]
parent = ' parent 1:1 ' parent = ' parent 5:1 '
# ECN or RED # ECN or RED
if enable_ecn: if enable_ecn:
cmds += [ '%s qdisc add dev %s' + parent + cmds += [ '%s qdisc add dev %s' + parent +
'handle 10: red limit 1000000 ' + 'handle 6: red limit 1000000 ' +
'min 30000 max 35000 avpkt 1500 ' + 'min 30000 max 35000 avpkt 1500 ' +
'burst 20 ' + 'burst 20 ' +
'bandwidth %fmbit probability 1 ecn' % bw ] 'bandwidth %fmbit probability 1 ecn' % bw ]
parent = ' parent 10: ' parent = ' parent 6: '
elif enable_red: elif enable_red:
cmds += [ '%s qdisc add dev %s' + parent + cmds += [ '%s qdisc add dev %s' + parent +
'handle 10: red limit 1000000 ' + 'handle 6: red limit 1000000 ' +
'min 30000 max 35000 avpkt 1500 ' + 'min 30000 max 35000 avpkt 1500 ' +
'burst 20 ' + 'burst 20 ' +
'bandwidth %fmbit probability 1' % bw ] 'bandwidth %fmbit probability 1' % bw ]
parent = ' parent 10: ' parent = ' parent 6: '
return cmds, parent return cmds, parent
@staticmethod @staticmethod
...@@ -251,7 +251,8 @@ def delayCmds( parent, delay=None, jitter=None, ...@@ -251,7 +251,8 @@ def delayCmds( parent, delay=None, jitter=None,
cmds = [ '%s qdisc add dev %s ' + parent + cmds = [ '%s qdisc add dev %s ' + parent +
' handle 10: netem ' + ' handle 10: netem ' +
netemargs ] netemargs ]
return cmds parent = ' parent 10:1 '
return cmds, parent
def tc( self, cmd, tc='tc' ): def tc( self, cmd, tc='tc' ):
"Execute tc command for our interface" "Execute tc command for our interface"
...@@ -289,9 +290,10 @@ def config( self, bw=None, delay=None, jitter=None, loss=None, ...@@ -289,9 +290,10 @@ def config( self, bw=None, delay=None, jitter=None, loss=None,
cmds += bwcmds cmds += bwcmds
# Delay/jitter/loss/max_queue_size using netem # Delay/jitter/loss/max_queue_size using netem
cmds += self.delayCmds( delay=delay, jitter=jitter, loss=loss, delaycmds, parent = self.delayCmds( delay=delay, jitter=jitter, loss=loss,
max_queue_size=max_queue_size, max_queue_size=max_queue_size,
parent=parent ) parent=parent )
cmds += delaycmds
# Ugly but functional: display configuration info # Ugly but functional: display configuration info
stuff = ( ( [ '%.2fMbit' % bw ] if bw is not None else [] ) + stuff = ( ( [ '%.2fMbit' % bw ] if bw is not None else [] ) +
...@@ -308,6 +310,7 @@ def config( self, bw=None, delay=None, jitter=None, loss=None, ...@@ -308,6 +310,7 @@ def config( self, bw=None, delay=None, jitter=None, loss=None,
debug( "cmds:", cmds, '\n' ) debug( "cmds:", cmds, '\n' )
debug( "outputs:", tcoutputs, '\n' ) debug( "outputs:", tcoutputs, '\n' )
result[ 'tcoutputs'] = tcoutputs result[ 'tcoutputs'] = tcoutputs
result[ 'parent' ] = parent
return result return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment