Add odp_put_recirc_action() helper and use it in compose_output_action__().
This is in preparation for using the same helper as part of support for using recirculation in conjunction series of actions including with MPLS actions that are currently not able to be translated. Signed-off-by: Simon Horman <ho...@verge.net.au> --- lib/odp-util.c | 16 ++++++++++++++++ lib/odp-util.h | 2 ++ ofproto/ofproto-dpif-xlate.c | 11 ++--------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/odp-util.c b/lib/odp-util.c index 956fef1..a9694a8 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -3479,6 +3479,22 @@ odp_put_tunnel_action(const struct flow_tnl *tunnel, tun_key_to_attr(odp_actions, tunnel); nl_msg_end_nested(odp_actions, offset); } + +void +odp_put_recirc_action(uint32_t recirc_id, uint8_t hash_alg, + uint32_t hash_bias, struct ofpbuf *odp_actions) +{ + struct ovs_action_recirc *act_recirc; + + act_recirc = nl_msg_put_unspec_uninit(odp_actions, OVS_ACTION_ATTR_RECIRC, + sizeof *act_recirc); + act_recirc->hash_alg = hash_alg; + act_recirc->pad[0] = 0; + act_recirc->pad[1] = 0; + act_recirc->pad[2] = 0; + act_recirc->hash_bias = hash_bias; + act_recirc->recirc_id = recirc_id; +} /* The commit_odp_actions() function and its helpers. */ diff --git a/lib/odp-util.h b/lib/odp-util.h index 7bc64c7..ed6b5b6 100644 --- a/lib/odp-util.h +++ b/lib/odp-util.h @@ -235,6 +235,8 @@ size_t odp_put_userspace_action(uint32_t pid, struct ofpbuf *odp_actions); void odp_put_tunnel_action(const struct flow_tnl *tunnel, struct ofpbuf *odp_actions); +void odp_put_recirc_action(uint32_t recirc_id, uint8_t hash_alg, + uint32_t hash_bias, struct ofpbuf *odp_actions); void odp_put_pkt_mark_action(const uint32_t pkt_mark, struct ofpbuf *odp_actions); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 64c25b7..8011b8d 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -1839,17 +1839,10 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, &ctx->xout->wc); if (ctx->xout->use_recirc) { - struct ovs_action_recirc *act_recirc; struct xlate_recirc *xr = &ctx->xout->recirc; - act_recirc = nl_msg_put_unspec_uninit(&ctx->xout->odp_actions, - OVS_ACTION_ATTR_RECIRC, sizeof *act_recirc); - act_recirc->recirc_id = xr->recirc_id; - act_recirc->hash_alg = xr->hash_alg; - act_recirc->pad[0] = 0; - act_recirc->pad[1] = 0; - act_recirc->pad[2] = 0; - act_recirc->hash_bias = xr->hash_bias; + odp_put_recirc_action(xr->recirc_id, xr->hash_alg, xr->hash_bias, + &ctx->xout->odp_actions); } else { nl_msg_put_odp_port(&ctx->xout->odp_actions, OVS_ACTION_ATTR_OUTPUT, out_port); -- 1.8.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev