ovs_be64 metadata; /* OpenFlow Metadata. */
uint64_t regs[FLOW_N_XREGS]; /* Registers. */
ofp_port_t in_port; /* Incoming port. */
- ofp_port_t actset_output; /* Output port in action set. */
};
static inline void
md->metadata = flow->metadata;
memcpy(md->regs, flow->regs, sizeof md->regs);
md->in_port = flow->in_port.ofp_port;
- md->actset_output = flow->actset_output;
}
static inline void
flow->metadata = md->metadata;
memcpy(flow->regs, md->regs, sizeof flow->regs);
flow->in_port.ofp_port = md->in_port;
- flow->actset_output = md->actset_output;
}
/* State that flow translation can save, to restore when recirculation
}
static void
-xlate_write_actions(struct xlate_ctx *ctx, const struct ofpact *a)
+xlate_write_actions__(struct xlate_ctx *ctx,
+ const struct ofpact *ofpacts, size_t ofpacts_len)
{
- const struct ofpact_nest *on = ofpact_get_WRITE_ACTIONS(a);
- size_t on_len = ofpact_nest_get_action_len(on);
- const struct ofpact *inner;
-
/* Maintain actset_output depending on the contents of the action set:
*
* - OFPP_UNSET, if there is no "output" action.
* - OFPP_UNSET, if there is a "group" action.
*/
if (!ctx->action_set_has_group) {
- OFPACT_FOR_EACH (inner, on->actions, on_len) {
- if (inner->type == OFPACT_OUTPUT) {
- ctx->xin->flow.actset_output = ofpact_get_OUTPUT(inner)->port;
- } else if (inner->type == OFPACT_GROUP) {
+ const struct ofpact *a;
+ OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) {
+ if (a->type == OFPACT_OUTPUT) {
+ ctx->xin->flow.actset_output = ofpact_get_OUTPUT(a)->port;
+ } else if (a->type == OFPACT_GROUP) {
ctx->xin->flow.actset_output = OFPP_UNSET;
ctx->action_set_has_group = true;
break;
}
}
- ofpbuf_put(&ctx->action_set, on->actions, on_len);
+ ofpbuf_put(&ctx->action_set, ofpacts, ofpacts_len);
+}
+
+static void
+xlate_write_actions(struct xlate_ctx *ctx, const struct ofpact_nest *a)
+{
+ xlate_write_actions__(ctx, a->actions, ofpact_nest_get_action_len(a));
}
static void
break;
case OFPACT_WRITE_ACTIONS:
- xlate_write_actions(ctx, a);
+ xlate_write_actions(ctx, ofpact_get_WRITE_ACTIONS(a));
break;
case OFPACT_WRITE_METADATA:
/* Restore action set, if any. */
if (state->action_set_len) {
- const struct ofpact *a;
-
xlate_report_actions(&ctx, "- Restoring action set",
state->action_set, state->action_set_len);
- ofpbuf_put(&ctx.action_set,
- state->action_set, state->action_set_len);
-
- OFPACT_FOR_EACH (a, state->action_set, state->action_set_len) {
- if (a->type == OFPACT_GROUP) {
- ctx.action_set_has_group = true;
- break;
- }
- }
+ flow->actset_output = OFPP_UNSET;
+ xlate_write_actions__(&ctx, state->action_set,
+ state->action_set_len);
}
/* Restore recirculation actions. If there are no actions, processing