From patchwork Fri Jan 24 11:03:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1228754 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=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 483x9Q6HjPz9sSN for ; Fri, 24 Jan 2020 22:04:26 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 62C982281C; Fri, 24 Jan 2020 11:04:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xSVvpf9Ge0z9; Fri, 24 Jan 2020 11:04:16 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id E9B752284F; Fri, 24 Jan 2020 11:04:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C7E0AC18DD; Fri, 24 Jan 2020 11:04:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id AB13CC0174 for ; Fri, 24 Jan 2020 11:04:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 911D3869D3 for ; Fri, 24 Jan 2020 11:04:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4o-CIz8ZwVLK for ; Fri, 24 Jan 2020 11:04:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by whitealder.osuosl.org (Postfix) with ESMTPS id E7A49877F5 for ; Fri, 24 Jan 2020 11:04:02 +0000 (UTC) X-Originating-IP: 27.7.144.66 Received: from nummac.local (unknown [27.7.144.66]) (Authenticated sender: numans@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id DE99B1C0010; Fri, 24 Jan 2020 11:03:58 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Fri, 24 Jan 2020 16:33:49 +0530 Message-Id: <20200124110349.1555678-1-numans@ovn.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200124110228.1555340-1-numans@ovn.org> References: <20200124110228.1555340-1-numans@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn 4/4] Refactor physical module functions to take context argument - physical_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" From: Numan Siddique No functional changes are introduced in this patch. Signed-off-by: Numan Siddique Acked-by: Han Zhou --- controller/ovn-controller.c | 183 ++++++++++++++---------------------- controller/physical.c | 104 +++++++++----------- controller/physical.h | 52 +++++----- 3 files changed, 136 insertions(+), 203 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index efd5d258d..cd6f57451 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -1214,6 +1214,66 @@ struct ed_type_flow_output { struct hmap lflow_expr_cache; }; +static void init_physical_ctx(struct engine_node *node, + struct ed_type_runtime_data *rt_data, + struct physical_ctx *p_ctx) +{ + struct ovsdb_idl_index *sbrec_port_binding_by_name = + engine_ovsdb_node_get_index( + engine_get_input("SB_port_binding", node), + "name"); + + struct sbrec_multicast_group_table *multicast_group_table = + (struct sbrec_multicast_group_table *)EN_OVSDB_GET( + engine_get_input("SB_multicast_group", node)); + + struct sbrec_port_binding_table *port_binding_table = + (struct sbrec_port_binding_table *)EN_OVSDB_GET( + engine_get_input("SB_port_binding", node)); + + struct sbrec_chassis_table *chassis_table = + (struct sbrec_chassis_table *)EN_OVSDB_GET( + engine_get_input("SB_chassis", node)); + + struct ed_type_mff_ovn_geneve *ed_mff_ovn_geneve = + engine_get_input_data("mff_ovn_geneve", node); + + struct ovsrec_open_vswitch_table *ovs_table = + (struct ovsrec_open_vswitch_table *)EN_OVSDB_GET( + engine_get_input("OVS_open_vswitch", node)); + struct ovsrec_bridge_table *bridge_table = + (struct ovsrec_bridge_table *)EN_OVSDB_GET( + engine_get_input("OVS_bridge", node)); + const struct ovsrec_bridge *br_int = get_br_int(bridge_table, ovs_table); + const char *chassis_id = chassis_get_id(); + const struct sbrec_chassis *chassis = NULL; + struct ovsdb_idl_index *sbrec_chassis_by_name = + engine_ovsdb_node_get_index( + engine_get_input("SB_chassis", node), + "name"); + if (chassis_id) { + chassis = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id); + } + + ovs_assert(br_int && chassis); + + struct ed_type_ct_zones *ct_zones_data = + engine_get_input_data("ct_zones", node); + struct simap *ct_zones = &ct_zones_data->current; + + p_ctx->sbrec_port_binding_by_name = sbrec_port_binding_by_name; + p_ctx->port_binding_table = port_binding_table; + p_ctx->mc_group_table = multicast_group_table; + p_ctx->br_int = br_int; + p_ctx->chassis_table = chassis_table; + p_ctx->chassis = chassis; + p_ctx->active_tunnels = &rt_data->active_tunnels; + p_ctx->local_datapaths = &rt_data->local_datapaths; + p_ctx->local_lports = &rt_data->local_lports; + p_ctx->ct_zones = ct_zones; + p_ctx->mff_ovn_geneve = ed_mff_ovn_geneve->mff_ovn_geneve; +} + static void init_lflow_ctx(struct engine_node *node, struct ed_type_runtime_data *rt_data, struct ed_type_flow_output *fo, @@ -1324,17 +1384,6 @@ en_flow_output_run(struct engine_node *node, void *data) { struct ed_type_runtime_data *rt_data = engine_get_input_data("runtime_data", node); - struct hmap *local_datapaths = &rt_data->local_datapaths; - struct sset *local_lports = &rt_data->local_lports; - struct sset *active_tunnels = &rt_data->active_tunnels; - - struct ed_type_ct_zones *ct_zones_data = - engine_get_input_data("ct_zones", node); - struct simap *ct_zones = &ct_zones_data->current; - - struct ed_type_mff_ovn_geneve *ed_mff_ovn_geneve = - engine_get_input_data("mff_ovn_geneve", node); - enum mf_field_id mff_ovn_geneve = ed_mff_ovn_geneve->mff_ovn_geneve; struct ovsrec_open_vswitch_table *ovs_table = (struct ovsrec_open_vswitch_table *)EN_OVSDB_GET( @@ -1374,38 +1423,16 @@ en_flow_output_run(struct engine_node *node, void *data) lflow_resource_clear(lfrr); } - struct ovsdb_idl_index *sbrec_port_binding_by_name = - engine_ovsdb_node_get_index( - engine_get_input("SB_port_binding", node), - "name"); - *conj_id_ofs = 1; struct lflow_ctx_in l_ctx_in; struct lflow_ctx_out l_ctx_out; init_lflow_ctx(node, rt_data, fo, &l_ctx_in, &l_ctx_out); lflow_run(&l_ctx_in, &l_ctx_out); - struct sbrec_multicast_group_table *multicast_group_table = - (struct sbrec_multicast_group_table *)EN_OVSDB_GET( - engine_get_input("SB_multicast_group", node)); - - struct sbrec_port_binding_table *port_binding_table = - (struct sbrec_port_binding_table *)EN_OVSDB_GET( - engine_get_input("SB_port_binding", node)); - - struct sbrec_chassis_table *chassis_table = - (struct sbrec_chassis_table *)EN_OVSDB_GET( - engine_get_input("SB_chassis", node)); + struct physical_ctx p_ctx; + init_physical_ctx(node, rt_data, &p_ctx); - physical_run(sbrec_port_binding_by_name, - multicast_group_table, - port_binding_table, - chassis_table, - mff_ovn_geneve, - br_int, chassis, ct_zones, - local_datapaths, local_lports, - active_tunnels, - flow_table); + physical_run(&p_ctx, &fo->flow_table); engine_set_node_state(node, EN_UPDATED); } @@ -1462,48 +1489,10 @@ flow_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 hmap *local_datapaths = &rt_data->local_datapaths; - struct sset *active_tunnels = &rt_data->active_tunnels; - - struct ed_type_ct_zones *ct_zones_data = - engine_get_input_data("ct_zones", node); - struct simap *ct_zones = &ct_zones_data->current; - - struct ed_type_mff_ovn_geneve *ed_mff_ovn_geneve = - engine_get_input_data("mff_ovn_geneve", node); - enum mf_field_id mff_ovn_geneve = ed_mff_ovn_geneve->mff_ovn_geneve; - - struct ovsrec_open_vswitch_table *ovs_table = - (struct ovsrec_open_vswitch_table *)EN_OVSDB_GET( - engine_get_input("OVS_open_vswitch", node)); - struct ovsrec_bridge_table *bridge_table = - (struct ovsrec_bridge_table *)EN_OVSDB_GET( - engine_get_input("OVS_bridge", node)); - const struct ovsrec_bridge *br_int = get_br_int(bridge_table, ovs_table); - const char *chassis_id = chassis_get_id(); - - struct ovsdb_idl_index *sbrec_chassis_by_name = - engine_ovsdb_node_get_index( - engine_get_input("SB_chassis", node), - "name"); - const struct sbrec_chassis *chassis = NULL; - if (chassis_id) { - chassis = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id); - } - ovs_assert(br_int && chassis); struct ed_type_flow_output *fo = data; struct ovn_desired_flow_table *flow_table = &fo->flow_table; - struct ovsdb_idl_index *sbrec_port_binding_by_name = - engine_ovsdb_node_get_index( - engine_get_input("SB_port_binding", node), - "name"); - - struct sbrec_port_binding_table *port_binding_table = - (struct sbrec_port_binding_table *)EN_OVSDB_GET( - engine_get_input("SB_port_binding", node)); - /* XXX: now we handle port-binding changes for physical flow processing * only, but port-binding change can have impact to logical flow * processing, too, in below circumstances: @@ -1551,11 +1540,10 @@ flow_output_sb_port_binding_handler(struct engine_node *node, void *data) * names and the lflows that uses them, and reprocess the related lflows * when related port-bindings change. */ - physical_handle_port_binding_changes( - sbrec_port_binding_by_name, - port_binding_table, mff_ovn_geneve, - chassis, ct_zones, local_datapaths, - active_tunnels, flow_table); + struct physical_ctx p_ctx; + init_physical_ctx(node, rt_data, &p_ctx); + + physical_handle_port_binding_changes(&p_ctx, flow_table); engine_set_node_state(node, EN_UPDATED); return true; @@ -1566,45 +1554,14 @@ flow_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 hmap *local_datapaths = &rt_data->local_datapaths; - - struct ed_type_ct_zones *ct_zones_data = - engine_get_input_data("ct_zones", node); - struct simap *ct_zones = &ct_zones_data->current; - - struct ed_type_mff_ovn_geneve *ed_mff_ovn_geneve = - engine_get_input_data("mff_ovn_geneve", node); - enum mf_field_id mff_ovn_geneve = ed_mff_ovn_geneve->mff_ovn_geneve; - - struct ovsrec_open_vswitch_table *ovs_table = - (struct ovsrec_open_vswitch_table *)EN_OVSDB_GET( - engine_get_input("OVS_open_vswitch", node)); - struct ovsrec_bridge_table *bridge_table = - (struct ovsrec_bridge_table *)EN_OVSDB_GET( - engine_get_input("OVS_bridge", node)); - const struct ovsrec_bridge *br_int = get_br_int(bridge_table, ovs_table); - const char *chassis_id = chassis_get_id(); - - struct ovsdb_idl_index *sbrec_chassis_by_name = - engine_ovsdb_node_get_index( - engine_get_input("SB_chassis", node), - "name"); - const struct sbrec_chassis *chassis = NULL; - if (chassis_id) { - chassis = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id); - } - ovs_assert(br_int && chassis); struct ed_type_flow_output *fo = data; struct ovn_desired_flow_table *flow_table = &fo->flow_table; - struct sbrec_multicast_group_table *multicast_group_table = - (struct sbrec_multicast_group_table *)EN_OVSDB_GET( - engine_get_input("SB_multicast_group", node)); + struct physical_ctx p_ctx; + init_physical_ctx(node, rt_data, &p_ctx); - physical_handle_mc_group_changes(multicast_group_table, - mff_ovn_geneve, chassis, ct_zones, local_datapaths, - flow_table); + physical_handle_mc_group_changes(&p_ctx, flow_table); engine_set_node_state(node, EN_UPDATED); return true; diff --git a/controller/physical.c b/controller/physical.c index af1d10f9b..a7edaddac 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -1396,30 +1396,26 @@ update_ofports(struct simap *old, struct simap *new) return changed; } -void physical_handle_port_binding_changes( - struct ovsdb_idl_index *sbrec_port_binding_by_name, - const struct sbrec_port_binding_table *pb_table, - enum mf_field_id mff_ovn_geneve, - const struct sbrec_chassis *chassis, - const struct simap *ct_zones, - struct hmap *local_datapaths, - struct sset *active_tunnels, - struct ovn_desired_flow_table *flow_table) +void +physical_handle_port_binding_changes(struct physical_ctx *p_ctx, + struct ovn_desired_flow_table *flow_table) { const struct sbrec_port_binding *binding; struct ofpbuf ofpacts; ofpbuf_init(&ofpacts, 0); - SBREC_PORT_BINDING_TABLE_FOR_EACH_TRACKED (binding, pb_table) { + SBREC_PORT_BINDING_TABLE_FOR_EACH_TRACKED (binding, + p_ctx->port_binding_table) { if (sbrec_port_binding_is_deleted(binding)) { ofctrl_remove_flows(flow_table, &binding->header_.uuid); } else { if (!sbrec_port_binding_is_new(binding)) { ofctrl_remove_flows(flow_table, &binding->header_.uuid); } - consider_port_binding(sbrec_port_binding_by_name, - mff_ovn_geneve, ct_zones, - active_tunnels, local_datapaths, - binding, chassis, + consider_port_binding(p_ctx->sbrec_port_binding_by_name, + p_ctx->mff_ovn_geneve, p_ctx->ct_zones, + p_ctx->active_tunnels, + p_ctx->local_datapaths, + binding, p_ctx->chassis, flow_table, &ofpacts); } } @@ -1427,40 +1423,26 @@ void physical_handle_port_binding_changes( } void -physical_handle_mc_group_changes( - const struct sbrec_multicast_group_table *multicast_group_table, - enum mf_field_id mff_ovn_geneve, - const struct sbrec_chassis *chassis, - const struct simap *ct_zones, - const struct hmap *local_datapaths, - struct ovn_desired_flow_table *flow_table) +physical_handle_mc_group_changes(struct physical_ctx *p_ctx, + struct ovn_desired_flow_table *flow_table) { const struct sbrec_multicast_group *mc; - SBREC_MULTICAST_GROUP_TABLE_FOR_EACH_TRACKED (mc, multicast_group_table) { + SBREC_MULTICAST_GROUP_TABLE_FOR_EACH_TRACKED (mc, p_ctx->mc_group_table) { if (sbrec_multicast_group_is_deleted(mc)) { ofctrl_remove_flows(flow_table, &mc->header_.uuid); } else { if (!sbrec_multicast_group_is_new(mc)) { ofctrl_remove_flows(flow_table, &mc->header_.uuid); } - consider_mc_group(mff_ovn_geneve, ct_zones, local_datapaths, - chassis, mc, flow_table); + consider_mc_group(p_ctx->mff_ovn_geneve, p_ctx->ct_zones, + p_ctx->local_datapaths, + p_ctx->chassis, mc, flow_table); } } } void -physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, - const struct sbrec_multicast_group_table *multicast_group_table, - const struct sbrec_port_binding_table *port_binding_table, - const struct sbrec_chassis_table *chassis_table, - enum mf_field_id mff_ovn_geneve, - const struct ovsrec_bridge *br_int, - const struct sbrec_chassis *chassis, - const struct simap *ct_zones, - const struct hmap *local_datapaths, - const struct sset *local_lports, - const struct sset *active_tunnels, +physical_run(struct physical_ctx *p_ctx, struct ovn_desired_flow_table *flow_table) { if (!hc_uuid) { @@ -1475,16 +1457,17 @@ physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, SIMAP_INITIALIZER(&new_localvif_to_ofport); struct simap new_tunnel_to_ofport = SIMAP_INITIALIZER(&new_tunnel_to_ofport); - for (int i = 0; i < br_int->n_ports; i++) { - const struct ovsrec_port *port_rec = br_int->ports[i]; - if (!strcmp(port_rec->name, br_int->name)) { + for (int i = 0; i < p_ctx->br_int->n_ports; i++) { + const struct ovsrec_port *port_rec = p_ctx->br_int->ports[i]; + if (!strcmp(port_rec->name, p_ctx->br_int->name)) { continue; } const char *tunnel_id = smap_get(&port_rec->external_ids, "ovn-chassis-id"); - if (tunnel_id && - encaps_tunnel_id_match(tunnel_id, chassis->name, NULL)) { + if (tunnel_id && encaps_tunnel_id_match(tunnel_id, + p_ctx->chassis->name, + NULL)) { continue; } @@ -1520,7 +1503,7 @@ physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, enum chassis_tunnel_type tunnel_type; if (!strcmp(iface_rec->type, "geneve")) { tunnel_type = GENEVE; - if (!mff_ovn_geneve) { + if (!p_ctx->mff_ovn_geneve) { continue; } } else if (!strcmp(iface_rec->type, "stt")) { @@ -1599,24 +1582,26 @@ physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, struct ofpbuf ofpacts; ofpbuf_init(&ofpacts, 0); - put_chassis_mac_conj_id_flow(chassis_table, chassis, &ofpacts, flow_table); + put_chassis_mac_conj_id_flow(p_ctx->chassis_table, p_ctx->chassis, + &ofpacts, flow_table); /* Set up flows in table 0 for physical-to-logical translation and in table * 64 for logical-to-physical translation. */ const struct sbrec_port_binding *binding; - SBREC_PORT_BINDING_TABLE_FOR_EACH (binding, port_binding_table) { - consider_port_binding(sbrec_port_binding_by_name, - mff_ovn_geneve, ct_zones, - active_tunnels, local_datapaths, - binding, chassis, + SBREC_PORT_BINDING_TABLE_FOR_EACH (binding, p_ctx->port_binding_table) { + consider_port_binding(p_ctx->sbrec_port_binding_by_name, + p_ctx->mff_ovn_geneve, p_ctx->ct_zones, + p_ctx->active_tunnels, p_ctx->local_datapaths, + binding, p_ctx->chassis, flow_table, &ofpacts); } /* Handle output to multicast groups, in tables 32 and 33. */ const struct sbrec_multicast_group *mc; - SBREC_MULTICAST_GROUP_TABLE_FOR_EACH (mc, multicast_group_table) { - consider_mc_group(mff_ovn_geneve, ct_zones, local_datapaths, - chassis, mc, flow_table); + SBREC_MULTICAST_GROUP_TABLE_FOR_EACH (mc, p_ctx->mc_group_table) { + consider_mc_group(p_ctx->mff_ovn_geneve, p_ctx->ct_zones, + p_ctx->local_datapaths, p_ctx->chassis, + mc, flow_table); } /* Table 0, priority 100. @@ -1637,9 +1622,9 @@ physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, ofpbuf_clear(&ofpacts); if (tun->type == GENEVE) { put_move(MFF_TUN_ID, 0, MFF_LOG_DATAPATH, 0, 24, &ofpacts); - put_move(mff_ovn_geneve, 16, MFF_LOG_INPORT, 0, 15, + put_move(p_ctx->mff_ovn_geneve, 16, MFF_LOG_INPORT, 0, 15, &ofpacts); - put_move(mff_ovn_geneve, 0, MFF_LOG_OUTPORT, 0, 16, + put_move(p_ctx->mff_ovn_geneve, 0, MFF_LOG_OUTPORT, 0, 16, &ofpacts); } else if (tun->type == STT) { put_move(MFF_TUN_ID, 40, MFF_LOG_INPORT, 0, 15, &ofpacts); @@ -1668,7 +1653,8 @@ physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, continue; } - SBREC_PORT_BINDING_TABLE_FOR_EACH (binding, port_binding_table) { + SBREC_PORT_BINDING_TABLE_FOR_EACH (binding, + p_ctx->port_binding_table) { struct match match = MATCH_CATCHALL_INITIALIZER; if (!binding->chassis || @@ -1738,12 +1724,12 @@ physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, ofpbuf_clear(&ofpacts); put_resubmit(OFTABLE_LOCAL_OUTPUT, &ofpacts); const char *localport; - SSET_FOR_EACH (localport, local_lports) { + SSET_FOR_EACH (localport, p_ctx->local_lports) { /* Iterate over all local logical ports and insert a drop * rule with higher priority for every localport in this * datapath. */ const struct sbrec_port_binding *pb = lport_lookup_by_name( - sbrec_port_binding_by_name, localport); + p_ctx->sbrec_port_binding_by_name, localport); if (pb && !strcmp(pb->type, "localport")) { match_set_reg(&match, MFF_LOG_INPORT - MFF_REG0, pb->tunnel_key); match_set_metadata(&match, htonll(pb->datapath->tunnel_key)); @@ -1761,8 +1747,8 @@ physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, match_init_catchall(&match); ofpbuf_clear(&ofpacts); put_resubmit(OFTABLE_LOCAL_OUTPUT, &ofpacts); - ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 0, 0, &match, &ofpacts, - hc_uuid); + ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 0, 0, &match, + &ofpacts, hc_uuid); /* Table 34, Priority 0. * ======================= @@ -1787,8 +1773,8 @@ physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, match_init_catchall(&match); ofpbuf_clear(&ofpacts); put_resubmit(OFTABLE_LOG_TO_PHY, &ofpacts); - ofctrl_add_flow(flow_table, OFTABLE_SAVE_INPORT, 0, 0, &match, &ofpacts, - hc_uuid); + ofctrl_add_flow(flow_table, OFTABLE_SAVE_INPORT, 0, 0, &match, + &ofpacts, hc_uuid); ofpbuf_uninit(&ofpacts); diff --git a/controller/physical.h b/controller/physical.h index c0e17cd21..dadf84ea1 100644 --- a/controller/physical.h +++ b/controller/physical.h @@ -42,38 +42,28 @@ struct sset; #define OVN_GENEVE_TYPE 0x80 /* Critical option. */ #define OVN_GENEVE_LEN 4 +struct physical_ctx { + struct ovsdb_idl_index *sbrec_port_binding_by_name; + const struct sbrec_port_binding_table *port_binding_table; + const struct sbrec_multicast_group_table *mc_group_table; + const struct ovsrec_bridge *br_int; + const struct sbrec_chassis_table *chassis_table; + const struct sbrec_chassis *chassis; + const struct sset *active_tunnels; + struct hmap *local_datapaths; + struct sset *local_lports; + const struct simap *ct_zones; + enum mf_field_id mff_ovn_geneve; +}; + void physical_register_ovs_idl(struct ovsdb_idl *); -void physical_run(struct ovsdb_idl_index *sbrec_port_binding_by_name, - const struct sbrec_multicast_group_table *, - const struct sbrec_port_binding_table *, - const struct sbrec_chassis_table *chassis_table, - enum mf_field_id mff_ovn_geneve, - const struct ovsrec_bridge *br_int, - const struct sbrec_chassis *chassis, - const struct simap *ct_zones, - const struct hmap *local_datapaths, - const struct sset *local_lports, - const struct sset *active_tunnels, +void physical_run(struct physical_ctx *, struct ovn_desired_flow_table *); -void physical_handle_port_binding_changes( - struct ovsdb_idl_index *sbrec_port_binding_by_name, - const struct sbrec_port_binding_table *, - enum mf_field_id mff_ovn_geneve, - const struct sbrec_chassis *, - const struct simap *ct_zones, - struct hmap *local_datapaths, - struct sset *active_tunnels, - struct ovn_desired_flow_table *); +void physical_handle_port_binding_changes(struct physical_ctx *, + struct ovn_desired_flow_table *); +void physical_handle_mc_group_changes(struct physical_ctx *, + struct ovn_desired_flow_table *); -void physical_handle_mc_group_changes( - const struct sbrec_multicast_group_table *, - enum mf_field_id mff_ovn_geneve, - const struct sbrec_chassis *, - const struct simap *ct_zones, - const struct hmap *local_datapaths, - struct ovn_desired_flow_table *); -bool get_tunnel_ofport( - const char *chassis_name, - char *encap_ip, - ofp_port_t *ofport); +bool get_tunnel_ofport(const char *chassis_name, char *encap_ip, + ofp_port_t *ofport); #endif /* controller/physical.h */