From: Eli Britstein <[email protected]>

All the calls to put_drop_action checks first if it is supported.
Instead, embed the check inside.

Signed-off-by: Eli Britstein <[email protected]>
Reviewed-by: Roi Dayan <[email protected]>
---
 ofproto/ofproto-dpif-xlate.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index e59ff17ade63..eeb1853efd29 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -6500,8 +6500,13 @@ put_ct_label(const struct flow *flow, struct ofpbuf 
*odp_actions,
 }
 
 static void
-put_drop_action(struct ofpbuf *odp_actions, enum xlate_error error)
+put_drop_action(struct ofproto_dpif *ofproto, struct ofpbuf *odp_actions,
+                enum xlate_error error)
 {
+    if (!ovs_explicit_drop_action_supported(ofproto)) {
+        return;
+    }
+
     nl_msg_put_u32(odp_actions, OVS_ACTION_ATTR_DROP, error);
 }
 
@@ -8129,9 +8134,7 @@ xlate_tweak_odp_actions(struct xlate_ctx *ctx)
     }
 
     if (!last_action) {
-        if (ovs_explicit_drop_action_supported(ctx->xbridge->ofproto)) {
-            put_drop_action(actions, XLATE_OK);
-        }
+        put_drop_action(ctx->xbridge->ofproto, actions, XLATE_OK);
         return;
     }
 
@@ -8161,11 +8164,10 @@ xlate_tweak_odp_actions(struct xlate_ctx *ctx)
     /* If the last action of the list is an observability action, add an
      * explicit drop action so that drop statistics remain reliable. */
     if (ctx->xbridge->ofproto->explicit_sampled_drops &&
-        ovs_explicit_drop_action_supported(ctx->xbridge->ofproto) &&
         last_observe_offset != UINT32_MAX &&
         (unsigned char *) last_action == (unsigned char *) actions->data +
                                          last_observe_offset) {
-        put_drop_action(actions, XLATE_OK);
+        put_drop_action(ctx->xbridge->ofproto, actions, XLATE_OK);
     }
 }
 
@@ -8613,9 +8615,7 @@ exit:
         if (xin->odp_actions) {
             ofpbuf_clear(xin->odp_actions);
             /* Make the drop explicit if the datapath supports it. */
-            if (ovs_explicit_drop_action_supported(ctx.xbridge->ofproto)) {
-                put_drop_action(xin->odp_actions, ctx.error);
-            }
+            put_drop_action(ctx.xbridge->ofproto, xin->odp_actions, ctx.error);
         }
     } else {
         /* In the non-error case, see if we can further optimize or tweak
-- 
2.21.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to