summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorRosemarie O'Riorden <roriorden@redhat.com>2022-06-03 11:31:46 -0400
committerIlya Maximets <i.maximets@ovn.org>2022-06-29 23:27:32 +0200
commitc8bff848aeca5d1f5b6fabb9a88a3d04686608ed (patch)
tree07e2f0cf7a685a21763b8c78bfe48354f836fb60 /ofproto
parent22ac9d6aac9d60f9fc5c6b75b59f8dd0339cd86a (diff)
downloadopenvswitch-c8bff848aeca5d1f5b6fabb9a88a3d04686608ed.tar.gz
ofproto-dpif-xlate: No clone when tunnel push is last action.
When OVS sees a tunnel push with a nested list next, it will not clone the packet, as a clone is not needed. However, a clone action will still be created with the tunnel push encapsulated inside. There is no need to create the clone action in this case, as extra parsing will need to be performed, which is less efficient. Signed-off-by: Rosemarie O'Riorden <roriorden@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif-xlate.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 7716c22f4..fda802e83 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -3736,10 +3736,12 @@ native_tunnel_output(struct xlate_ctx *ctx, const struct xport *xport,
s_ip, tnl_params.is_ipv6,
tnl_push_data.tnl_type);
- size_t clone_ofs = 0;
+ size_t offset;
size_t push_action_size;
- clone_ofs = nl_msg_start_nested(ctx->odp_actions, OVS_ACTION_ATTR_CLONE);
+ offset = is_last_action
+ ? ctx->odp_actions->size
+ : nl_msg_start_nested(ctx->odp_actions, OVS_ACTION_ATTR_CLONE);
odp_put_tnl_push_action(ctx->odp_actions, &tnl_push_data);
push_action_size = ctx->odp_actions->size;
@@ -3783,9 +3785,17 @@ native_tunnel_output(struct xlate_ctx *ctx, const struct xport *xport,
xlate_cache_steal_entries(backup_xcache, ctx->xin->xcache);
if (ctx->odp_actions->size > push_action_size) {
- nl_msg_end_non_empty_nested(ctx->odp_actions, clone_ofs);
+ if (!is_last_action) {
+ nl_msg_end_non_empty_nested(ctx->odp_actions, offset);
+ }
} else {
- nl_msg_cancel_nested(ctx->odp_actions, clone_ofs);
+ if (is_last_action) {
+ /* Reset size since no actions added in patch port output. */
+ nl_msg_reset_size(ctx->odp_actions, offset);
+ } else {
+ /* Cancel nested clone action. */
+ nl_msg_cancel_nested(ctx->odp_actions, offset);
+ }
}
/* Restore context status. */
@@ -3797,9 +3807,11 @@ native_tunnel_output(struct xlate_ctx *ctx, const struct xport *xport,
ctx->wc = backup_wc;
} else {
/* In order to maintain accurate stats, use recirc for
- * natvie tunneling. */
+ * native tunneling. */
nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_RECIRC, 0);
- nl_msg_end_nested(ctx->odp_actions, clone_ofs);
+ if (!is_last_action) {
+ nl_msg_end_nested(ctx->odp_actions, offset);
+ }
}
/* Restore the flows after the translation. */