aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStepan Andrushko <stepanx.andrushko@intel.com>2018-10-26 19:09:30 +0300
committerAbhijit Sinha <abhijit.sinha@intel.com>2018-11-13 10:16:12 +0000
commit4d52eac9699c45184a236af354b0c6eab62075a6 (patch)
treeacb60538a36c98011ae8a900ff877133bb61e6ca
parent74d047ead13b106cba007c089c111bfca51e8dac (diff)
Distribute dpdk/vhostuser between CPUs for SA OVS
Update Yardstick with ability to distribute DPDK/vhost-user ports/queues between CPU cores. Extended OVS add vhost-user interface command with option "n_rxq", provided in the test case. Ordered ports added to OVS. JIRA: YARDSTICK-1490 Change-Id: I71f5d878a9ee3a11f636762fc16b04ee6bc79e14 Signed-off-by: Stepan Andrushko <stepanx.andrushko@intel.com>
-rw-r--r--yardstick/benchmark/contexts/standalone/ovs_dpdk.py35
-rw-r--r--yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py7
2 files changed, 32 insertions, 10 deletions
diff --git a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
index 42a275455..26a37d0c0 100644
--- a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
+++ b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
@@ -168,12 +168,12 @@ class OvsDpdkContext(base.Context):
def setup_ovs_bridge_add_flows(self):
dpdk_args = ""
- dpdk_list = []
vpath = self.ovs_properties.get("vpath", "/usr/local")
version = self.ovs_properties.get('version', {})
ovs_ver = [int(x) for x in version.get('ovs', self.DEFAULT_OVS).split('.')]
ovs_add_port = ('ovs-vsctl add-port {br} {port} -- '
- 'set Interface {port} type={type_}{dpdk_args}{dpdk_rxq}')
+ 'set Interface {port} type={type_}{dpdk_args}'
+ '{dpdk_rxq}{pmd_rx_aff}')
chmod_vpath = 'chmod 0777 {0}/var/run/openvswitch/dpdkvhostuser*'
cmd_list = [
@@ -187,23 +187,38 @@ class OvsDpdkContext(base.Context):
if queues:
dpdk_rxq = " options:n_rxq={queue}".format(queue=queues)
- ordered_network = collections.OrderedDict(self.networks)
+ # Sorting the array to make sure we execute dpdk0... in the order
+ ordered_network = collections.OrderedDict(
+ sorted(self.networks.items(), key=lambda t: t[1].get('port_num', 0)))
+ pmd_rx_aff_ports = self.ovs_properties.get("dpdk_pmd-rxq-affinity", {})
for index, vnf in enumerate(ordered_network.values()):
if ovs_ver >= [2, 7, 0]:
dpdk_args = " options:dpdk-devargs=%s" % vnf.get("phy_port")
- dpdk_list.append(ovs_add_port.format(
+ affinity = pmd_rx_aff_ports.get(vnf.get("port_num", -1), "")
+ if affinity:
+ pmd_rx_aff = ' other_config:pmd-rxq-affinity=' \
+ '"{affinity}"'.format(affinity=affinity)
+ else:
+ pmd_rx_aff = ""
+ cmd_list.append(ovs_add_port.format(
br=MAIN_BRIDGE, port='dpdk%s' % vnf.get("port_num", 0),
- type_='dpdk', dpdk_args=dpdk_args, dpdk_rxq=dpdk_rxq))
-
- # Sorting the array to make sure we execute dpdk0... in the order
- list.sort(dpdk_list)
- cmd_list.extend(dpdk_list)
+ type_='dpdk', dpdk_args=dpdk_args, dpdk_rxq=dpdk_rxq,
+ pmd_rx_aff=pmd_rx_aff))
# Need to do two for loop to maintain the dpdk/vhost ports.
+ pmd_rx_aff_ports = self.ovs_properties.get("vhost_pmd-rxq-affinity",
+ {})
for index, _ in enumerate(ordered_network):
+ affinity = pmd_rx_aff_ports.get(index)
+ if affinity:
+ pmd_rx_aff = ' other_config:pmd-rxq-affinity=' \
+ '"{affinity}"'.format(affinity=affinity)
+ else:
+ pmd_rx_aff = ""
cmd_list.append(ovs_add_port.format(
br=MAIN_BRIDGE, port='dpdkvhostuser%s' % index,
- type_='dpdkvhostuser', dpdk_args="", dpdk_rxq=""))
+ type_='dpdkvhostuser', dpdk_args="", dpdk_rxq=dpdk_rxq,
+ pmd_rx_aff=pmd_rx_aff))
ovs_flow = ("ovs-ofctl add-flow {0} in_port=%s,action=output:%s".
format(MAIN_BRIDGE))
diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
index 190e83d5f..ab9e632be 100644
--- a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
+++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
@@ -160,6 +160,13 @@ class OvsDpdkContextTestCase(unittest.TestCase):
}
self.ovs_dpdk.wait_for_vswitchd = 0
self.assertIsNone(self.ovs_dpdk.setup_ovs_bridge_add_flows())
+ self.ovs_dpdk.ovs_properties.update(
+ {'dpdk_pmd-rxq-affinity': {'0': "0:1"}})
+ self.ovs_dpdk.ovs_properties.update(
+ {'vhost_pmd-rxq-affinity': {'0': "0:1"}})
+ self.NETWORKS['private_0'].update({'port_num': '0'})
+ self.NETWORKS['public_0'].update({'port_num': '1'})
+ self.ovs_dpdk.setup_ovs_bridge_add_flows()
@mock.patch("yardstick.ssh.SSH")
def test_cleanup_ovs_dpdk_env(self, mock_ssh):