Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RX TX queue tuning before running iperf test #2780

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions io/net/iperf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,38 @@ def test(self):
messages using multiple threads or processes.
"""
speed = int(read_file("/sys/class/net/%s/speed" % self.iface))
if speed == 100000:
iperf_pthread = 10
elif speed == 25000:
iperf_pthread = 4
os.chdir(self.iperf)
cmd = "./iperf -c %s" % self.peer_ip
if self.networkinterface.is_vnic() or self.hbond:
cmd = "iperf -c %s -P %s -t 20 -i 5" % (self.peer_ip, iperf_pthread)
else:
cmd = "./iperf -c %s" % self.peer_ip
result = process.run(cmd, shell=True, ignore_status=True)
nping_result = self.nping()
if result.exit_status:
self.fail("FAIL: Iperf Run failed")
for line in result.stdout.decode("utf-8").splitlines():
if 'local {}'.format(self.ipaddr) in line:
id = line[3]
for line in result.stdout.decode("utf-8").splitlines():
if id in line and 'Mbits/sec' in line:
tput = int(line.split()[6])
elif id in line and 'Gbits/sec' in line:
tput = int(float(line.split()[6])) * 1000
elif id in line and 'Kbits/sec' in line:
tput = int(float(line.split()[6])) / 1000
if self.networkinterface.is_vnic() or self.hbond:
for line in result.stdout.decode("utf-8").splitlines():
if 'SUM' in line and 'Mbits/sec' in line:
tput = int(line.split()[5])
elif 'SUM' in line and 'Gbits/sec' in line:
tput = int(float(line.split()[5])) * 1000
elif 'SUM' in line and 'Kbits/sec' in line:
tput = int(float(line.split()[5])) / 1000
else:
for line in result.stdout.decode("utf-8").splitlines():
if 'local {}'.format(self.ipaddr) in line:
id = line[3]
for line in result.stdout.decode("utf-8").splitlines():
if id in line and 'Mbits/sec' in line:
tput = int(line.split()[6])
elif id in line and 'Gbits/sec' in line:
tput = int(float(line.split()[6])) * 1000
elif id in line and 'Kbits/sec' in line:
tput = int(float(line.split()[6])) / 1000
if tput < (int(self.expected_tp) * speed) / 100:
self.fail("FAIL: Throughput Actual - %s%%, Expected - %s%%"
", Throughput Actual value - %s "
Expand Down
44 changes: 43 additions & 1 deletion io/net/virt-net/network_virtualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from avocado.utils import wait
from pexpect import pxssh
import re
from avocado.utils.network.hosts import RemoteHost

IS_POWER_NV = 'PowerNV' in open('/proc/cpuinfo', 'r').read()
IS_KVM_GUEST = 'qemu' in open('/proc/cpuinfo', 'r').read()
Expand Down Expand Up @@ -121,6 +122,8 @@ def setUp(self):
self.mac_id = [mac.replace(':', '') for mac in self.mac_id]
self.netmask = self.params.get('netmasks', default=None).split(' ')
self.peer_ip = self.params.get('peer_ip', default=None).split(' ')
self.peer_user = self.params.get('peer_user', default=None)
self.peer_password = self.params.get('peer_password', default=None)
self.host_public_ip = self.params.get('host_public_ip', default=None)
self.host_user = self.params.get('user_name', default=None)
self.host_password = self.params.get('host_password', default=None)
Expand Down Expand Up @@ -223,7 +226,7 @@ def install_packages(self):
'''
smm = SoftwareManager()
packages = ['ksh', 'src', 'rsct.basic', 'rsct.core.utils',
'rsct.core', 'DynamicRM', 'powerpc-utils']
'rsct.core', 'DynamicRM', 'powerpc-utils', 'irqbalance']
detected_distro = distro.detect()
if detected_distro.name == "Ubuntu":
packages.extend(['python-paramiko'])
Expand All @@ -241,6 +244,39 @@ def install_packages(self):
process.system("dpkg -i %s/%s" % (self.workdir, deb),
ignore_status=True, sudo=True)

def tune_rxtx_queue(self):
"""
Increase rx/tx queues to 16 for test interface
"""
self.remotehost = RemoteHost(self.peer_ip[0], self.peer_user,
password=self.peer_password)
peer_interface = self.remotehost.get_interface_by_ipaddr(self.peer_ip[0]).name
cmd = "ethtool -L %s rx 16 tx 16" % peer_interface
output = self.session.cmd(cmd)
if not output:
self.cancel("Unable to tune RX and TX queue in peer")
device = self.find_device(self.mac_id[0])
cmd = "ethtool -L %s rx 16 tx 16" % device
result = process.run(cmd)
if result.exit_status:
self.cancel("Unable to tune RX and TX queue in host")

def enable_irqbalance(self):
"""
Enable irqbalance service on host and peer
"""
cmd_start = "systemctl start irqbalance"
self.session.cmd(cmd_start)
cmd_status = "systemctl status irqbalance"
output = self.session.cmd(cmd_status).stdout_text.splitlines()
for line in output:
if re.search("Active: active (running)", line):
self.log("irqbalance service is active in peer")
process.system(cmd_start)
for line in process.system_output(cmd_status).decode("utf-8").splitlines():
if re.search("Active: active (running)", line):
self.log("irqbalance service is active in host")

def test_add(self):
'''
Network virtualized device add operation
Expand Down Expand Up @@ -277,6 +313,10 @@ def test_add(self):
virtualized device")
if networkinterface.ping_check(self.peer_ip[0], count=5) is not None:
self.fail("Ping failed with active vnic device")
self.session = Session(self.peer_ip[0], user=self.peer_user,
password=self.peer_password)
self.enable_irqbalance()
self.tune_rxtx_queue()
self.check_dmesg_error()

def test_backingdevadd(self):
Expand Down Expand Up @@ -1096,3 +1136,5 @@ def tearDown(self):
result = process.run(cmd, shell=True, ignore_status=True)
if result.exit_status:
self.log.debug("failed to disable debug mode")
self.tune_rxtx_queue()
self.session.quit()
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ mac_id:
user_name: ""
host_public_ip: ""
host_password: ""
peer_user: ""
peer_password: ""
Loading