From patchwork Wed Feb 9 17:54:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han Zhou X-Patchwork-Id: 1590643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jv6ws2l4gz9s0r for ; Thu, 10 Feb 2022 04:55:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 7DA57409DE; Wed, 9 Feb 2022 17:55:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pHmrBP4uJBdE; Wed, 9 Feb 2022 17:55:21 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 5309B400D0; Wed, 9 Feb 2022 17:55:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A8CABC007B; Wed, 9 Feb 2022 17:55:12 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id C5543C008C for ; Wed, 9 Feb 2022 17:55:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id AA9AB410A5 for ; Wed, 9 Feb 2022 17:55:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31B0jDmqpN_D for ; Wed, 9 Feb 2022 17:55:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by smtp4.osuosl.org (Postfix) with ESMTPS id 944C94093F for ; Wed, 9 Feb 2022 17:55:09 +0000 (UTC) Received: (Authenticated sender: hzhou@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id F1C45FF80E; Wed, 9 Feb 2022 17:55:06 +0000 (UTC) From: Han Zhou To: dev@openvswitch.org Date: Wed, 9 Feb 2022 09:54:44 -0800 Message-Id: <20220209175450.1179778-6-hzhou@ovn.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220209175450.1179778-1-hzhou@ovn.org> References: <20220209175450.1179778-1-hzhou@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v2 05/11] ovn-controller.c: Refactor init_lflow_ctx. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The function gets rt_data and non_vif_data from args but all the other data from engine inputs, which looks weird. Just unify the pattern and get all data from engine inputs in the function. Signed-off-by: Han Zhou --- controller/ovn-controller.c | 61 +++++++++---------------------------- 1 file changed, 14 insertions(+), 47 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 65642f4b7..e73523ce2 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -2191,8 +2191,6 @@ struct ed_type_lflow_output { static void init_lflow_ctx(struct engine_node *node, - struct ed_type_runtime_data *rt_data, - struct ed_type_non_vif_data *non_vif_data, struct ed_type_lflow_output *fo, struct lflow_ctx_in *l_ctx_in, struct lflow_ctx_out *l_ctx_out) @@ -2274,6 +2272,12 @@ init_lflow_ctx(struct engine_node *node, ovs_assert(chassis); + struct ed_type_runtime_data *rt_data = + engine_get_input_data("runtime_data", node); + + struct ed_type_non_vif_data *non_vif_data = + engine_get_input_data("non_vif_data", node); + struct ed_type_addr_sets *as_data = engine_get_input_data("addr_sets", node); struct shash *addr_sets = &as_data->addr_sets; @@ -2360,11 +2364,6 @@ en_lflow_output_cleanup(void *data) static void en_lflow_output_run(struct engine_node *node, void *data) { - struct ed_type_runtime_data *rt_data = - engine_get_input_data("runtime_data", node); - struct ed_type_non_vif_data *non_vif_data = - engine_get_input_data("non_vif_data", node); - struct ovsrec_open_vswitch_table *ovs_table = (struct ovsrec_open_vswitch_table *)EN_OVSDB_GET( engine_get_input("OVS_open_vswitch", node)); @@ -2409,7 +2408,7 @@ en_lflow_output_run(struct engine_node *node, void *data) struct lflow_ctx_in l_ctx_in; struct lflow_ctx_out l_ctx_out; - init_lflow_ctx(node, rt_data, non_vif_data, fo, &l_ctx_in, &l_ctx_out); + init_lflow_ctx(node, fo, &l_ctx_in, &l_ctx_out); lflow_run(&l_ctx_in, &l_ctx_out); engine_set_node_state(node, EN_UPDATED); @@ -2418,15 +2417,10 @@ en_lflow_output_run(struct engine_node *node, void *data) static bool lflow_output_sb_logical_flow_handler(struct engine_node *node, void *data) { - struct ed_type_runtime_data *rt_data = - engine_get_input_data("runtime_data", node); - struct ed_type_non_vif_data *non_vif_data = - engine_get_input_data("non_vif_data", node); - struct ed_type_lflow_output *fo = data; struct lflow_ctx_in l_ctx_in; struct lflow_ctx_out l_ctx_out; - init_lflow_ctx(node, rt_data, non_vif_data, fo, &l_ctx_in, &l_ctx_out); + init_lflow_ctx(node, fo, &l_ctx_in, &l_ctx_out); bool handled = lflow_handle_changed_flows(&l_ctx_in, &l_ctx_out); @@ -2462,16 +2456,11 @@ lflow_output_sb_mac_binding_handler(struct engine_node *node, void *data) static bool lflow_output_sb_multicast_group_handler(struct engine_node *node, void *data) { - struct ed_type_runtime_data *rt_data = - engine_get_input_data("runtime_data", node); - struct ed_type_non_vif_data *non_vif_data = - engine_get_input_data("non_vif_data", node); - struct ed_type_lflow_output *lfo = data; struct lflow_ctx_in l_ctx_in; struct lflow_ctx_out l_ctx_out; - init_lflow_ctx(node, rt_data, non_vif_data, lfo, &l_ctx_in, &l_ctx_out); + init_lflow_ctx(node, lfo, &l_ctx_in, &l_ctx_out); if (!lflow_handle_changed_mc_groups(&l_ctx_in, &l_ctx_out)) { return false; } @@ -2483,16 +2472,11 @@ lflow_output_sb_multicast_group_handler(struct engine_node *node, void *data) static bool lflow_output_sb_port_binding_handler(struct engine_node *node, void *data) { - struct ed_type_runtime_data *rt_data = - engine_get_input_data("runtime_data", node); - struct ed_type_non_vif_data *non_vif_data = - engine_get_input_data("non_vif_data", node); - struct ed_type_lflow_output *lfo = data; struct lflow_ctx_in l_ctx_in; struct lflow_ctx_out l_ctx_out; - init_lflow_ctx(node, rt_data, non_vif_data, lfo, &l_ctx_in, &l_ctx_out); + init_lflow_ctx(node, lfo, &l_ctx_in, &l_ctx_out); if (!lflow_handle_changed_port_bindings(&l_ctx_in, &l_ctx_out)) { return false; } @@ -2505,11 +2489,6 @@ static bool _lflow_output_resource_ref_handler(struct engine_node *node, void *data, enum ref_type ref_type) { - struct ed_type_runtime_data *rt_data = - engine_get_input_data("runtime_data", node); - struct ed_type_non_vif_data *non_vif_data = - engine_get_input_data("non_vif_data", node); - struct ed_type_addr_sets *as_data = engine_get_input_data("addr_sets", node); @@ -2520,7 +2499,7 @@ _lflow_output_resource_ref_handler(struct engine_node *node, void *data, struct lflow_ctx_in l_ctx_in; struct lflow_ctx_out l_ctx_out; - init_lflow_ctx(node, rt_data, non_vif_data, fo, &l_ctx_in, &l_ctx_out); + init_lflow_ctx(node, fo, &l_ctx_in, &l_ctx_out); bool changed; const char *ref_name; @@ -2607,8 +2586,6 @@ lflow_output_runtime_data_handler(struct engine_node *node, { struct ed_type_runtime_data *rt_data = engine_get_input_data("runtime_data", node); - struct ed_type_non_vif_data *non_vif_data = - engine_get_input_data("non_vif_data", node); /* There is no tracked data. Fall back to full recompute of * flow_output. */ @@ -2628,7 +2605,7 @@ lflow_output_runtime_data_handler(struct engine_node *node, struct lflow_ctx_out l_ctx_out; struct ed_type_lflow_output *fo = data; struct hmap *lbs = NULL; - init_lflow_ctx(node, rt_data, non_vif_data, fo, &l_ctx_in, &l_ctx_out); + init_lflow_ctx(node, fo, &l_ctx_in, &l_ctx_out); struct tracked_datapath *tdp; HMAP_FOR_EACH (tdp, node, tracked_dp_bindings) { @@ -2666,15 +2643,10 @@ lflow_output_runtime_data_handler(struct engine_node *node, static bool lflow_output_sb_load_balancer_handler(struct engine_node *node, void *data) { - struct ed_type_runtime_data *rt_data = - engine_get_input_data("runtime_data", node); - struct ed_type_non_vif_data *non_vif_data = - engine_get_input_data("non_vif_data", node); - struct ed_type_lflow_output *fo = data; struct lflow_ctx_in l_ctx_in; struct lflow_ctx_out l_ctx_out; - init_lflow_ctx(node, rt_data, non_vif_data, fo, &l_ctx_in, &l_ctx_out); + init_lflow_ctx(node, fo, &l_ctx_in, &l_ctx_out); bool handled = lflow_handle_changed_lbs(&l_ctx_in, &l_ctx_out); @@ -2685,15 +2657,10 @@ lflow_output_sb_load_balancer_handler(struct engine_node *node, void *data) static bool lflow_output_sb_fdb_handler(struct engine_node *node, void *data) { - struct ed_type_runtime_data *rt_data = - engine_get_input_data("runtime_data", node); - struct ed_type_non_vif_data *non_vif_data = - engine_get_input_data("non_vif_data", node); - struct ed_type_lflow_output *fo = data; struct lflow_ctx_in l_ctx_in; struct lflow_ctx_out l_ctx_out; - init_lflow_ctx(node, rt_data, non_vif_data, fo, &l_ctx_in, &l_ctx_out); + init_lflow_ctx(node, fo, &l_ctx_in, &l_ctx_out); bool handled = lflow_handle_changed_fdbs(&l_ctx_in, &l_ctx_out);