Skip to content

Commit e1711f3

Browse files
committed
Use server receive rate rather than client send()/buffering rate
Fixes mininet#412
1 parent 501eb4f commit e1711f3

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

mininet/net.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,10 @@ def iperf( self, hosts=None, l4Type='TCP', udpBw='10M', format=None ):
689689
"""Run iperf between two hosts.
690690
hosts: list of hosts; if None, uses opposite hosts
691691
l4Type: string, one of [ TCP, UDP ]
692-
returns: results two-element array of server and client speeds"""
692+
returns: results two-element array of [ server, client ] speeds
693+
note: send() is buffered, so client rate can be much higher than
694+
the actual transmission rate; on an unloaded system, server
695+
rate should be much closer to the actual receive rate"""
693696
if not quietRun( 'which telnet' ):
694697
error( 'Cannot find telnet in $PATH - required for iperf test' )
695698
return

mininet/test/test_hifi.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,14 @@ def testLinkBandwidth( self ):
136136
'switch = %s\n'
137137
% ( BW, bw_strs, N, loptsStr, self.switchClass ) )
138138

139-
for bw_str in bw_strs:
140-
bw = float( bw_str.split(' ')[0] )
141-
self.assertWithinTolerance( bw, BW, BW_TOLERANCE, msg )
139+
# On the client side, iperf doesn't wait for ACKs - it simply
140+
# reports how long it took to fill up the TCP send buffer.
141+
# As long as the kernel doesn't wait a long time before
142+
# delivering bytes to the iperf server, its reported data rate
143+
# should be close to the actual receive rate.
144+
serverRate, clientRate = bw_strs
145+
bw = float( serverRate.split(' ')[0] )
146+
self.assertWithinTolerance( bw, BW, BW_TOLERANCE, msg )
142147

143148
def testLinkDelay( self ):
144149
"Verify that link delays are accurate within a bound."

0 commit comments

Comments
 (0)