We changed datapath port lookup to netdev-offload API usage, but
forgot that port mutex was there not only to protect datapath
port hash map. It was there also as a workaround solution for
complete unsafety of netdev-offload-dpdk functions.
Turning it back to fix the behaviour and adding a comment to prevent
removing it in the future unless netdev-offload-dpdk fixed.
For the thread safety notice see the top of netdev-offload-dpdk.c.
Fixes: 30115809da2e ("dpif-netdev: Use netdev-offload API for port lookup while
offloading")
Signed-off-by: Ilya Maximets <[email protected]>
---
Shame on me, I forgot about the documentation that I wrote 9 months ago.
lib/dpif-netdev.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 7ebf4ef87..c57458b62 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2271,7 +2271,12 @@ mark_to_flow_disassociate(struct dp_netdev_pmd_thread
*pmd,
port = netdev_ports_get(in_port, pmd->dp->class);
if (port) {
+ /* Taking a global 'port_mutex' to fulfill thread safety
+ * restrictions for the netdev-offload-dpdk module. */
+ ovs_mutex_lock(&pmd->dp->port_mutex);
ret = netdev_flow_del(port, &flow->mega_ufid, NULL);
+ ovs_mutex_unlock(&pmd->dp->port_mutex);
+
netdev_close(port);
}
@@ -2415,10 +2420,14 @@ dp_netdev_flow_offload_put(struct dp_flow_offload_item
*offload)
netdev_close(port);
goto err_free;
}
+ /* Taking a global 'port_mutex' to fulfill thread safety restrictions for
+ * the netdev-offload-dpdk module. */
+ ovs_mutex_lock(&pmd->dp->port_mutex);
ret = netdev_flow_put(port, &offload->match,
CONST_CAST(struct nlattr *, offload->actions),
offload->actions_len, &flow->mega_ufid, &info,
NULL);
+ ovs_mutex_unlock(&pmd->dp->port_mutex);
netdev_close(port);
if (ret) {
--
2.17.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev