[{"id":1773031,"web_url":"http://patchwork.ozlabs.org/comment/1773031/","msgid":"<49b3aa2b-c66b-5700-9cf7-c2bcd2347a87@gmail.com>","list_archive_url":null,"date":"2017-09-21T17:47:33","subject":"Re: [ovs-dev] [merge native tunneling and patch port 5/7]\n\tofproto-dpif-xlate: Refactor xlate_table_actions()","submitter":{"id":69140,"url":"http://patchwork.ozlabs.org/api/people/69140/","name":"Gregory Rose","email":"gvrose8192@gmail.com"},"content":"On 09/12/2017 12:49 PM, Andy Zhou wrote:\n> Allow xlate_table_actions() to generate actions with or without\n> enclosed in clone().\n> \n> Signed-off-by: Andy Zhou <azhou@ovn.org>\n> ---\n>   ofproto/ofproto-dpif-xlate.c | 32 +++++++++++++++++++++-----------\n>   1 file changed, 21 insertions(+), 11 deletions(-)\n> \n> diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c\n> index 9e39a4ff7f49..81853c29afbf 100644\n> --- a/ofproto/ofproto-dpif-xlate.c\n> +++ b/ofproto/ofproto-dpif-xlate.c\n> @@ -505,14 +505,20 @@ struct xlate_cfg {\n>   static OVSRCU_TYPE(struct xlate_cfg *) xcfgp = OVSRCU_INITIALIZER(NULL);\n>   static struct xlate_cfg *new_xcfg = NULL;\n>   \n> +typedef void xlate_actions_handler(const struct ofpact *, size_t ofpacts_len,\n> +                                   struct xlate_ctx *, bool);\n> +\n>   static bool may_receive(const struct xport *, struct xlate_ctx *);\n>   static void do_xlate_actions(const struct ofpact *, size_t ofpacts_len,\n>                                struct xlate_ctx *, bool);\n> +static void clone_xlate_actions(const struct ofpact *, size_t ofpacts_len,\n> +                                struct xlate_ctx *, bool);\n>   static void xlate_normal(struct xlate_ctx *);\n>   static void xlate_table_action(struct xlate_ctx *, ofp_port_t in_port,\n>                                  uint8_t table_id, bool may_packet_in,\n>                                  bool honor_table_miss, bool with_ct_orig,\n> -                               bool is_last_action);\n> +                               bool is_last_action, xlate_actions_handler *);\n> +\n>   static bool input_vid_is_valid(const struct xlate_ctx *,\n>                                  uint16_t vid, struct xbundle *);\n>   static void xvlan_copy(struct xvlan *dst, const struct xvlan *src);\n> @@ -3560,7 +3566,7 @@ apply_nested_clone_actions(struct xlate_ctx *ctx, const struct xport *in_dev,\n>           if (xport_stp_forward_state(out_dev) &&\n>               xport_rstp_forward_state(out_dev)) {\n>               xlate_table_action(ctx, flow->in_port.ofp_port, 0, true, true,\n> -                               false, true);\n> +                               false, true, clone_xlate_actions);\n>               if (!ctx->freezing) {\n>                   xlate_action_set(ctx);\n>               }\n> @@ -3575,7 +3581,7 @@ apply_nested_clone_actions(struct xlate_ctx *ctx, const struct xport *in_dev,\n>               mirror_mask_t old_mirrors2 = ctx->mirrors;\n>   \n>               xlate_table_action(ctx, flow->in_port.ofp_port, 0, true, true,\n> -                               false, true);\n> +                               false, true, clone_xlate_actions);\n>               ctx->mirrors = old_mirrors2;\n>               ctx->base_flow = old_base_flow;\n>               ctx->odp_actions->size = old_size;\n> @@ -3894,7 +3900,8 @@ compose_output_action(struct xlate_ctx *ctx, ofp_port_t ofp_port,\n>   \n>   static void\n>   xlate_recursively(struct xlate_ctx *ctx, struct rule_dpif *rule,\n> -                  bool deepens, bool is_last_action)\n> +                  bool deepens, bool is_last_action,\n> +                  xlate_actions_handler *actions_xlator)\n>   {\n>       struct rule_dpif *old_rule = ctx->rule;\n>       ovs_be64 old_cookie = ctx->rule_cookie;\n> @@ -3910,8 +3917,8 @@ xlate_recursively(struct xlate_ctx *ctx, struct rule_dpif *rule,\n>       ctx->rule = rule;\n>       ctx->rule_cookie = rule->up.flow_cookie;\n>       actions = rule_get_actions(&rule->up);\n> -    do_xlate_actions(actions->ofpacts, actions->ofpacts_len, ctx,\n> -                     is_last_action);\n> +    actions_xlator(actions->ofpacts, actions->ofpacts_len, ctx,\n> +                   is_last_action);\n>       ctx->rule_cookie = old_cookie;\n>       ctx->rule = old_rule;\n>       ctx->depth -= deepens;\n> @@ -3986,7 +3993,8 @@ tuple_swap(struct flow *flow, struct flow_wildcards *wc)\n>   static void\n>   xlate_table_action(struct xlate_ctx *ctx, ofp_port_t in_port, uint8_t table_id,\n>                      bool may_packet_in, bool honor_table_miss,\n> -                   bool with_ct_orig, bool is_last_action)\n> +                   bool with_ct_orig, bool is_last_action,\n> +                   xlate_actions_handler *xlator)\n>   {\n>       /* Check if we need to recirculate before matching in a table. */\n>       if (ctx->was_mpls) {\n> @@ -4038,7 +4046,7 @@ xlate_table_action(struct xlate_ctx *ctx, ofp_port_t in_port, uint8_t table_id,\n>               struct ovs_list *old_trace = ctx->xin->trace;\n>               xlate_report_table(ctx, rule, table_id);\n>               xlate_recursively(ctx, rule, table_id <= old_table_id,\n> -                              is_last_action);\n> +                              is_last_action, xlator);\n>               ctx->xin->trace = old_trace;\n>           }\n>   \n> @@ -4341,7 +4349,7 @@ xlate_ofpact_resubmit(struct xlate_ctx *ctx,\n>   \n>       xlate_table_action(ctx, in_port, table_id, may_packet_in,\n>                          honor_table_miss, resubmit->with_ct_orig,\n> -                       is_last_action);\n> +                       is_last_action, do_xlate_actions);\n>   }\n>   \n>   static void\n> @@ -4888,7 +4896,8 @@ xlate_output_action(struct xlate_ctx *ctx,\n>           break;\n>       case OFPP_TABLE:\n>           xlate_table_action(ctx, ctx->xin->flow.in_port.ofp_port,\n> -                           0, may_packet_in, true, false, is_last_action);\n> +                           0, may_packet_in, true, false, is_last_action,\n> +                           do_xlate_actions);\n>           break;\n>       case OFPP_NORMAL:\n>           xlate_normal(ctx);\n> @@ -6554,7 +6563,8 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len,\n>               ovs_assert(ctx->table_id < ogt->table_id);\n>   \n>               xlate_table_action(ctx, ctx->xin->flow.in_port.ofp_port,\n> -                               ogt->table_id, true, true, false, last);\n> +                               ogt->table_id, true, true, false, last,\n> +                               do_xlate_actions);\n>               break;\n>           }\n>   \n> \n\nTested-by: Greg Rose <gvrose8192@gmail.com>\nReviewed-by: Greg Rose <gvrose8192@gmail.com>","headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","ovs-dev@mail.linuxfoundation.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=openvswitch.org\n\t(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;\n\tenvelope-from=ovs-dev-bounces@openvswitch.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"imxFA5IU\"; dkim-atps=neutral"],"Received":["from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xykbN2mVxz9t3Z\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 03:47:43 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id ECE31BF3;\n\tThu, 21 Sep 2017 17:47:39 +0000 (UTC)","from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id C87C39B9\n\tfor <dev@openvswitch.org>; Thu, 21 Sep 2017 17:47:37 +0000 (UTC)","from mail-pf0-f193.google.com (mail-pf0-f193.google.com\n\t[209.85.192.193])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4CCB217E\n\tfor <dev@openvswitch.org>; Thu, 21 Sep 2017 17:47:37 +0000 (UTC)","by mail-pf0-f193.google.com with SMTP id h4so2760809pfk.0\n\tfor <dev@openvswitch.org>; Thu, 21 Sep 2017 10:47:37 -0700 (PDT)","from gizo.bigblue.kilchis.com (67-5-132-83.ptld.qwest.net.\n\t[67.5.132.83]) by smtp.gmail.com with ESMTPSA id\n\td186sm3251479pfd.117.2017.09.21.10.47.34\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 21 Sep 2017 10:47:35 -0700 (PDT)"],"X-Greylist":"whitelisted by SQLgrey-1.7.6","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=subject:to:references:from:message-id:date:user-agent:mime-version\n\t:in-reply-to:content-language:content-transfer-encoding;\n\tbh=WlR0bPeKf+7A6lM0ucIxMzGDUs4vEM6DIi3JAJ+/SHg=;\n\tb=imxFA5IU5wNTKC+GJ/lgZEL/pJN+GAhw6xB55+m3vjYA5xhzuUlu4CUsa1u3nxof3m\n\trjeaK0tzCwNuCQt3/AYoY3Vw3HTw1uR4TLN0fFdwU5LPS8OaIoqHA2/t6Mqs0BoFsLM5\n\tE7DKM7z8XvnvOGhXD5g7c8SlE3VfYrR86DEKI5TNgvGpefJrfFq2xp8oeG0c/D1gJlqx\n\tIjJ80N/0cL2TQyv8g5qzc982JSHh0QBLffalLJt5bH3HHPswjucQxQh5o71UnVugXqvL\n\toPNv3m+qZw5RaCVdLXbiPKQVZDZJqjkWX0WwUYc7BYLD+PBn8h4f/hHnUrkznRvwUxVq\n\tc4rw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=WlR0bPeKf+7A6lM0ucIxMzGDUs4vEM6DIi3JAJ+/SHg=;\n\tb=NMTrbHyHoAkA2/Crvo/kaWwmiwS7GrCQdoswiG9q8A8ZXsw4WFySA7gi4YKw5gf9vP\n\tnvzZ4jHZv8nvdrBWq/RyIwsB+0TW0n/LxpsxcBIV4PydKuo1LLMNoKyKyaD10UrvIg1h\n\tAWJ3x3pIyYC6PMWFhjhs/56Tvs+PPBHJw954WKB1OGagNShYTfeKjV0j66xQkJbl1RGB\n\t8V1mxt9BIeMnn39m3U845HB0D7umytKJiSBRvYDKVgioyHFMz9ycbcEbHTQF4WBvNbkB\n\t/Qoa/Q2sCeGA9S12R8Ddqb3ukhNDiM1oRNr2AsBt/hL9zAzDlfgr8w4+v4mTig8kH7xF\n\tNDuw==","X-Gm-Message-State":"AHPjjUj8J0IFk0QoXU/wegJqSK67Dzp6I/AxKxUKR8sLU26Z+qvU1xET\n\tfMmHnfmc3BLpMynfiBNmQF6hkHwr","X-Google-Smtp-Source":"AOwi7QDiLgE7YaWk8bRQiNtTYET6niaeYLuiepw3Nk9KAjQ8cNtsr13gvGgHmV9ppAc2YK1/N0j/0w==","X-Received":"by 10.84.224.199 with SMTP id k7mr6293352pln.403.1506016056497; \n\tThu, 21 Sep 2017 10:47:36 -0700 (PDT)","To":"Andy Zhou <azhou@ovn.org>, dev@openvswitch.org","References":"<1505245749-3402-1-git-send-email-azhou@ovn.org>\n\t<1505245749-3402-5-git-send-email-azhou@ovn.org>","From":"Greg Rose <gvrose8192@gmail.com>","Message-ID":"<49b3aa2b-c66b-5700-9cf7-c2bcd2347a87@gmail.com>","Date":"Thu, 21 Sep 2017 10:47:33 -0700","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.1.0","MIME-Version":"1.0","In-Reply-To":"<1505245749-3402-5-git-send-email-azhou@ovn.org>","Content-Language":"en-US","X-Spam-Status":"No, score=0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, \n\tRCVD_IN_SORBS_SPAM autolearn=disabled version=3.3.1","X-Spam-Checker-Version":"SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org","Subject":"Re: [ovs-dev] [merge native tunneling and patch port 5/7]\n\tofproto-dpif-xlate: Refactor xlate_table_actions()","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.12","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=\"us-ascii\"; Format=\"flowed\"","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"}}]