summaryrefslogtreecommitdiffstats
path: root/vswitches
diff options
context:
space:
mode:
Diffstat (limited to 'vswitches')
-rw-r--r--vswitches/ovs_dpdk_vhost.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/vswitches/ovs_dpdk_vhost.py b/vswitches/ovs_dpdk_vhost.py
index 154d5357..2e726a43 100644
--- a/vswitches/ovs_dpdk_vhost.py
+++ b/vswitches/ovs_dpdk_vhost.py
@@ -15,6 +15,7 @@
"""VSPERF VSwitch implementation using DPDK and vhost ports
"""
+import logging
from conf import settings
from vswitches.vswitch import IVSwitch
from src.ovs import VSwitchd, OFBridge
@@ -33,11 +34,17 @@ class OvsDpdkVhost(IVSwitch):
implementation. For generic information of the nature of the methods,
see the interface.
"""
+
+ _logger = logging.getLogger()
+
def __init__(self):
vswitchd_args = ['--dpdk']
vswitchd_args += settings.getValue('VSWITCHD_DPDK_ARGS')
vswitchd_args += _VSWITCHD_CONST_ARGS
+ self._logger.info("Inserting VHOST modules into kernel...")
+ dpdk.insert_vhost_modules()
+
self._vswitchd = VSwitchd(vswitchd_args=vswitchd_args,
expected_cmd=
r'EAL: Master l*core \d+ is ready')
@@ -58,6 +65,7 @@ class OvsDpdkVhost(IVSwitch):
"""
self._vswitchd.kill()
dpdk.cleanup()
+ dpdk.remove_vhost_modules()
def add_switch(self, switch_name):
"""See IVswitch for general description
@@ -109,9 +117,16 @@ class OvsDpdkVhost(IVSwitch):
"""
bridge = self._bridges[switch_name]
# Changed dpdkvhost to dpdkvhostuser to be able to run in Qemu 2.2
- vhost_count = self._get_port_count(bridge, 'type=dpdkvhostuser')
- port_name = 'dpdkvhostuser' + str(vhost_count)
- params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostuser']
+ vhost_method = settings.getValue('VHOST_METHOD')
+ if vhost_method == "cuse":
+ vhost_count = self._get_port_count(bridge, 'type=dpdkvhostcuse')
+ port_name = 'dpdkvhostcuse' + str(vhost_count)
+ params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostcuse']
+ else:
+ vhost_count = self._get_port_count(bridge, 'type=dpdkvhostuser')
+ port_name = 'dpdkvhostuser' + str(vhost_count)
+ params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostuser']
+
of_port = bridge.add_port(port_name, params)
return (port_name, of_port)