{"id":813031,"url":"http://patchwork.ozlabs.org/api/patches/813031/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/patch/1505245749-3402-5-git-send-email-azhou@ovn.org/","project":{"id":47,"url":"http://patchwork.ozlabs.org/api/projects/47/?format=json","name":"Open vSwitch","link_name":"openvswitch","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"git@github.com:openvswitch/ovs.git","webscm_url":"https://github.com/openvswitch/ovs","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505245749-3402-5-git-send-email-azhou@ovn.org>","list_archive_url":null,"date":"2017-09-12T19:49:07","name":"[ovs-dev,merge,native,tunneling,and,port,5/7] ofproto-dpif-xlate: Refactor xlate_table_actions()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"39aaf9305a7012151f14c2cb31a5d3a81186f64f","submitter":{"id":67699,"url":"http://patchwork.ozlabs.org/api/people/67699/?format=json","name":"Andy Zhou","email":"azhou@ovn.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/openvswitch/patch/1505245749-3402-5-git-send-email-azhou@ovn.org/mbox/","series":[{"id":2760,"url":"http://patchwork.ozlabs.org/api/series/2760/?format=json","web_url":"http://patchwork.ozlabs.org/project/openvswitch/list/?series=2760","date":"2017-09-12T19:49:03","name":"[ovs-dev,merge,native,tunneling,and,port,1/7] ofproto-dpif: Unfreeze within clone","version":1,"mbox":"http://patchwork.ozlabs.org/series/2760/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813031/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813031/checks/","tags":{},"related":[],"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>)","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 3xsFmm6Hf4z9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 05:51:52 +1000 (AEST)","from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 20369AE1;\n\tTue, 12 Sep 2017 19:50:05 +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 784567AA\n\tfor <dev@openvswitch.org>; Tue, 12 Sep 2017 19:50:02 +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 277E0159\n\tfor <dev@openvswitch.org>; Tue, 12 Sep 2017 19:50:02 +0000 (UTC)","by mail-pf0-f193.google.com with SMTP id e69so4820696pfg.4\n\tfor <dev@openvswitch.org>; Tue, 12 Sep 2017 12:50:02 -0700 (PDT)","from centos.eng.vmware.com ([208.91.1.34])\n\tby smtp.gmail.com with ESMTPSA id\n\tj13sm23739951pfk.107.2017.09.12.12.50.00\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 12 Sep 2017 12:50:01 -0700 (PDT)"],"X-Greylist":"whitelisted by SQLgrey-1.7.6","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:content-transfer-encoding;\n\tbh=KU3xELQohawMfeRLdtGgKh2/UC4VEnJFCOlYqhZkrVI=;\n\tb=BF/3bPIfUMB+bmg++I5Cr1c1Xoxi6EVenNteZu1uNgKY/IbiXyivv857gw948cKl9t\n\tHNtv0en6YNZB5C3bNqVTPRLPOvOWrl96WjqGbUvNoWJ4LqDGY9E2bsSKSR/CpZ9RYG0Q\n\tybCPFJQ0ZivEDjxGBJvqajYzC8O3ATIAx1WtpYqZr6Jpyp+AZhQGbPPMscRuRwej/uLP\n\t7PJGxEexqAPLalXdp1OeuC5amIhXYo43WcbhEFiZFJyHAcmKU6XT5JkT6473SNcUiO++\n\tH04sYCK4ZPlaKAh88YHSopMIGOepQpsloaNCSatKIv5EeYjsqk0W1w51r/59s1iOY6XN\n\tyDLA==","X-Gm-Message-State":"AHPjjUgV8NnxZXkT7QHID437k3WcYTHpwpTu9biqs9jTeDe1ZdsSLBCv\n\t0byrw0DIojIDGi3x","X-Google-Smtp-Source":"AOwi7QCSl/uKKJR4tsV2YQ4TQpwc3R7UxxIe/ghKjoPozb8D2RvohsI9h8HTuAyAfSnfFg05OgXJYg==","X-Received":"by 10.159.245.149 with SMTP id a21mr1896661pls.57.1505245801652; \n\tTue, 12 Sep 2017 12:50:01 -0700 (PDT)","From":"Andy Zhou <azhou@ovn.org>","To":"dev@openvswitch.org","Date":"Tue, 12 Sep 2017 12:49:07 -0700","Message-Id":"<1505245749-3402-5-git-send-email-azhou@ovn.org>","X-Mailer":"git-send-email 1.8.3.1","In-Reply-To":"<1505245749-3402-1-git-send-email-azhou@ovn.org>","References":"<1505245749-3402-1-git-send-email-azhou@ovn.org>","X-Spam-Status":"No, score=0.5 required=5.0 tests=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":"[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>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"ovs-dev-bounces@openvswitch.org","Errors-To":"ovs-dev-bounces@openvswitch.org"},"content":"Allow xlate_table_actions() to generate actions with or without\nenclosed in clone().\n\nSigned-off-by: Andy Zhou <azhou@ovn.org>\n---\n ofproto/ofproto-dpif-xlate.c | 32 +++++++++++++++++++++-----------\n 1 file changed, 21 insertions(+), 11 deletions(-)","diff":"diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c\nindex 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","prefixes":["ovs-dev","merge","native","tunneling","and","port","5/7"]}