aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dpdk/dpdk.py13
-rw-r--r--src/ovs/ofctl.py15
2 files changed, 22 insertions, 6 deletions
diff --git a/src/dpdk/dpdk.py b/src/dpdk/dpdk.py
index 30f228f7..477c1de4 100644
--- a/src/dpdk/dpdk.py
+++ b/src/dpdk/dpdk.py
@@ -14,7 +14,7 @@
"""Automation of system configuration for DPDK use.
-Parts of this based on ``tools/dpdk_nic_bind.py`` script from Intel(R)
+Parts of this based on ``tools/dpdk*bind.py`` script from Intel(R)
DPDK.
"""
@@ -23,14 +23,15 @@ from sys import platform as _platform
import os
import subprocess
import logging
+import glob
from tools import tasks
from conf import settings
from tools.module_manager import ModuleManager
_LOGGER = logging.getLogger(__name__)
-RTE_PCI_TOOL = os.path.join(
- settings.getValue('RTE_SDK_USER'), 'tools', 'dpdk_nic_bind.py')
+RTE_PCI_TOOL = glob.glob(os.path.join(
+ settings.getValue('RTE_SDK_USER'), 'tools', 'dpdk*bind.py'))[0]
_DPDK_MODULE_MANAGER = ModuleManager()
@@ -168,7 +169,7 @@ def _vhost_user_cleanup():
def _bind_nics():
- """Bind NICs using the Intel DPDK ``dpdk_nic_bind.py`` tool.
+ """Bind NICs using the Intel DPDK ``dpdk*bind.py`` tool.
"""
try:
_driver = 'igb_uio'
@@ -189,7 +190,7 @@ def _bind_nics():
_LOGGER.error('Unable to bind NICs %s', str(_NICS_PCI))
def _unbind_nics():
- """Unbind NICs using the Intel DPDK ``dpdk_nic_bind.py`` tool.
+ """Unbind NICs using the Intel DPDK ``dpdk*bind.py`` tool.
"""
try:
tasks.run_task(['sudo', RTE_PCI_TOOL, '--unbind'] +
@@ -199,7 +200,7 @@ def _unbind_nics():
except subprocess.CalledProcessError:
_LOGGER.error('Unable to unbind NICs %s', str(_NICS_PCI))
# Rebind NICs to their original drivers
- # using the Intel DPDK ``dpdk_nic_bind.py`` tool.
+ # using the Intel DPDK ``dpdk*bind.py`` tool.
for nic in _NICS:
try:
if nic['driver']:
diff --git a/src/ovs/ofctl.py b/src/ovs/ofctl.py
index d7a2b320..a75d0be2 100644
--- a/src/ovs/ofctl.py
+++ b/src/ovs/ofctl.py
@@ -439,6 +439,21 @@ def flow_match(flow_dump, flow_src):
# perform unifications on both source and destination flows
flow_dump = flow_dump.replace('actions=', 'action=')
flow_src = flow_src.replace('actions=', 'action=')
+ # For complex flows the output of "ovs-ofctl dump-flows" can use the
+ # shorthand notation.
+ # eg if we set a flow with constraints on UDP ports like in the following
+ # {'dl_type': '0x0800', 'nw_proto': '17', 'in_port': '1', 'udp_dst': '0', 'actions': ['output:2']}
+ # dump-flows output can combine the first 2 constraints into 'udp' and translate
+ # 'udp_dst' into 'tp_dst' like
+ # "udp,in_port=1,tp_dst=0 actions=output:2".
+ # So the next replacements are needed.
+ flow_dump = flow_dump.replace('ip', 'dl_type=0x0800')
+ flow_dump = flow_dump.replace('tcp', 'nw_proto=6,dl_type=0x0800')
+ flow_dump = flow_dump.replace('udp', 'nw_proto=17,dl_type=0x0800')
+ flow_src = flow_src.replace('udp_src', 'tp_src')
+ flow_src = flow_src.replace('udp_dst', 'tp_dst')
+ flow_src = flow_src.replace('tcp_src', 'tp_src')
+ flow_src = flow_src.replace('tcp_dst', 'tp_dst')
# split flow strings into lists of comparable elements
flow_dump_list = re.findall(r"[\w.:=()]+", flow_dump)