X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=vswitches%2Fovs_dpdk_vhost.py;h=6deb0c25912feac0bfda2794442b3c6c0f2b351b;hb=66029803af7f3d21a0697e3054b7dc3564bc5e7d;hp=13aef173b8c27aa9053d413ace1fb0ee303e9128;hpb=0c4ab9b84ea256d22176ba6c9e89cefe9c212b7e;p=vswitchperf.git diff --git a/vswitches/ovs_dpdk_vhost.py b/vswitches/ovs_dpdk_vhost.py index 13aef173..6deb0c25 100644 --- a/vswitches/ovs_dpdk_vhost.py +++ b/vswitches/ovs_dpdk_vhost.py @@ -114,12 +114,15 @@ class OvsDpdkVhost(IVSwitchOvs): Creates a port of type dpdk. The new port is named dpdk where n is an integer starting from 0. """ + _nics = S.getValue('NICS') bridge = self._bridges[switch_name] dpdk_count = self._get_port_count('type=dpdk') + if dpdk_count == len(_nics): + raise RuntimeError("Can't add phy port! There are only {} ports defined " + "by WHITELIST_NICS parameter!".format(len(_nics))) port_name = 'dpdk' + str(dpdk_count) # PCI info. Please note there must be no blank space, eg must be # like 'options:dpdk-devargs=0000:06:00.0' - _nics = S.getValue('NICS') nic_pci = 'options:dpdk-devargs=' + _nics[dpdk_count]['pci'] params = ['--', 'set', 'Interface', port_name, 'type=dpdk', nic_pci] # multi-queue enable @@ -142,9 +145,18 @@ class OvsDpdkVhost(IVSwitchOvs): from 0 """ bridge = self._bridges[switch_name] - vhost_count = self._get_port_count('type=dpdkvhostuser') - port_name = 'dpdkvhostuser' + str(vhost_count) - params = ['--', 'set', 'Interface', port_name, 'type=dpdkvhostuser'] + + if S.getValue('VSWITCH_VHOSTUSER_SERVER_MODE'): + nic_type = 'dpdkvhostuser' + else: + nic_type = 'dpdkvhostuserclient' + + vhost_count = self._get_port_count('type={}'.format(nic_type)) + port_name = nic_type + str(vhost_count) + params = ['--', 'set', 'Interface', port_name, 'type={}'.format(nic_type)] + if not S.getValue('VSWITCH_VHOSTUSER_SERVER_MODE'): + params += ['--', 'set', 'Interface', port_name, 'options:vhost-server-path=' + '{}{}'.format(S.getValue('TOOLS')['ovs_var_tmp'], port_name)] if S.getValue('VSWITCH_JUMBO_FRAMES_ENABLED'): params += ['mtu_request={}'.format( S.getValue('VSWITCH_JUMBO_FRAMES_SIZE'))]