Signed-off-by: Han Zhou <[email protected]>
---
ovn/controller/ovn-controller.c | 48 ++++++++++++++++++++++++++++++++++++++++-
ovn/controller/physical.c | 23 ++++++++++++++++++++
ovn/controller/physical.h | 7 ++++++
3 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index ff3cb08..e19c29f 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -1145,6 +1145,52 @@ flow_output_sb_port_binding_handler(struct engine_node
*node)
return true;
}
+static bool
+flow_output_sb_multicast_group_handler(struct engine_node *node)
+{
+ struct ed_type_runtime_data *data =
+ (struct ed_type_runtime_data *)engine_get_input(
+ "runtime_data", node)->data;
+ struct hmap *local_datapaths = &data->local_datapaths;
+ struct simap *ct_zones = &data->ct_zones;
+
+ 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 = get_chassis_id(ovs_table);
+
+ 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 =
+ (struct ed_type_flow_output *)node->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));
+
+ enum mf_field_id mff_ovn_geneve = ofctrl_get_mf_field_id();
+ physical_handle_mc_group_changes(multicast_group_table,
+ mff_ovn_geneve, chassis, ct_zones, local_datapaths,
+ flow_table);
+
+ node->changed = true;
+ return true;
+
+}
+
int
main(int argc, char *argv[])
{
@@ -1240,7 +1286,7 @@ main(int argc, char *argv[])
engine_add_input(&en_flow_output, &en_sb_chassis, NULL);
engine_add_input(&en_flow_output, &en_sb_encap, NULL);
- engine_add_input(&en_flow_output, &en_sb_multicast_group, NULL);
+ engine_add_input(&en_flow_output, &en_sb_multicast_group,
flow_output_sb_multicast_group_handler);
engine_add_input(&en_flow_output, &en_sb_datapath_binding, NULL);
engine_add_input(&en_flow_output, &en_sb_port_binding,
flow_output_sb_port_binding_handler);
engine_add_input(&en_flow_output, &en_sb_mac_binding, NULL);
diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index e2c7f54..9405107 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -944,6 +944,29 @@ 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)
+{
+ const struct sbrec_multicast_group *mc;
+ SBREC_MULTICAST_GROUP_TABLE_FOR_EACH_TRACKED (mc, multicast_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);
+ }
+ }
+}
+
+void
physical_run(struct ovsdb_idl_index *sbrec_chassis_by_name,
struct ovsdb_idl_index *sbrec_port_binding_by_name,
const struct sbrec_multicast_group_table *multicast_group_table,
diff --git a/ovn/controller/physical.h b/ovn/controller/physical.h
index 097e9f5..0581669 100644
--- a/ovn/controller/physical.h
+++ b/ovn/controller/physical.h
@@ -67,4 +67,11 @@ void physical_handle_port_binding_changes(
struct sset *active_tunnels,
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 *);
#endif /* ovn/physical.h */
--
2.1.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev