diff mbox series

[ovs-dev,V3,2/4] dpif-netdev: Fix flow modification after failure

Message ID 20210726081455.10632-3-elibr@nvidia.com
State Accepted
Headers show
Series dpif-netdev offload transitions | expand

Commit Message

Eli Britstein July 26, 2021, 8:14 a.m. UTC
dp_netdev_flow_offload_main thread is asynchronous, by the cited commit.
There might be a case where there are modification requests of the same
flow submitted before handled. Then, if the first handling fails, the
rule for the flow is deleted, and the mark is freed. Then, the following
one should not be handled as a modification, but rather as an "add".

Fixes: 02bb2824e51d ("dpif-netdev: do hw flow offload in a thread")
Signed-off-by: Eli Britstein <elibr@nvidia.com>
---
 lib/dpif-netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index b1fffbac7..5fe06b996 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2573,7 +2573,8 @@  dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload)
     struct dp_netdev_flow *flow = offload->flow;
     odp_port_t in_port = flow->flow.in_port.odp_port;
     const char *dpif_type_str = dpif_normalize_type(pmd->dp->class->type);
-    bool modification = offload->op == DP_NETDEV_FLOW_OFFLOAD_OP_MOD;
+    bool modification = offload->op == DP_NETDEV_FLOW_OFFLOAD_OP_MOD
+                        && flow->mark != INVALID_FLOW_MARK;
     struct offload_info info;
     struct netdev *port;
     uint32_t mark;
@@ -2585,7 +2586,6 @@  dp_netdev_flow_offload_put(struct dp_flow_offload_item *offload)
 
     if (modification) {
         mark = flow->mark;
-        ovs_assert(mark != INVALID_FLOW_MARK);
     } else {
         /*
          * If a mega flow has already been offloaded (from other PMD