diff mbox series

[ovs-dev,ovs-dev,v1,1/4] ofproto-dpif-upcall: fix push_dp_ops

Message ID 20220604143530.65815-1-hepeng.0320@bytedance.com
State Superseded
Headers show
Series [ovs-dev,ovs-dev,v1,1/4] ofproto-dpif-upcall: fix push_dp_ops | expand

Commit Message

Peng He June 4, 2022, 2:35 p.m. UTC
push_dp_ops only handles delete ops errors but ignores the modify
ops results. While currently the modify ops would not report any errors,
it's better to handle all the dp operation errors in a consistent way.

Signed-off-by: Peng He <hepeng.0320@bytedance.com>
---
 ofproto/ofproto-dpif-upcall.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 57f94df54..4f68f14f2 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -2407,23 +2407,26 @@  push_dp_ops(struct udpif *udpif, struct ukey_op *ops, size_t n_ops)
 
     for (i = 0; i < n_ops; i++) {
         struct ukey_op *op = &ops[i];
-        struct dpif_flow_stats *push, *stats, push_buf;
-
-        stats = op->dop.flow_del.stats;
-        push = &push_buf;
-
-        if (op->dop.type != DPIF_OP_FLOW_DEL) {
-            /* Only deleted flows need their stats pushed. */
-            continue;
-        }
 
         if (op->dop.error) {
-            /* flow_del error, 'stats' is unusable. */
             if (op->ukey) {
                 ovs_mutex_lock(&op->ukey->mutex);
                 transition_ukey(op->ukey, UKEY_EVICTED);
                 ovs_mutex_unlock(&op->ukey->mutex);
             }
+            /* if it's a flow_del error, 'stats' is unusable, it's ok
+             * to discard the stats.
+             */
+            continue;
+        }
+
+        struct dpif_flow_stats *push, *stats, push_buf;
+
+        stats = op->dop.flow_del.stats;
+        push = &push_buf;
+
+        if (op->dop.type != DPIF_OP_FLOW_DEL) {
+            /* Only deleted flows need their stats pushed. */
             continue;
         }