Skip to content

Commit

Permalink
northd: Add node for IGMP and Multicast data.
Browse files Browse the repository at this point in the history
Add new I-P node that will store all the data for IGMP and
Multicast groups. This node allows to avoid full recompute of lflow
node when IGMP or Multicast SB table changes.

The node itself still does full recompute for IGMP and Multicast
changes however this is a compromise between code complexity and
the time it takes for all lflow to be created. At the same time
thi brings the benefit of having the data available when there
is recompute of the lflow node.

As design choice there is only single lflow_ref for all IGMP
lflows, that makes them not being thread safe and only main thread
can generate them during full recompute of lflow node. This shouldn't
be an issue, because the computation of igmp lflow is pretty simple.

Reported-at: https://issues.redhat.com/browse/FDP-756
Co-authored-by: Jacob Tanenbaum <jtanenba@redhat.com>
Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
Suggested-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
2 people authored and ovsrobot committed Jan 16, 2025
1 parent 47e036e commit 89fa4d7
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 144 deletions.
52 changes: 48 additions & 4 deletions northd/en-lflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "en-lr-nat.h"
#include "en-lr-stateful.h"
#include "en-ls-stateful.h"
#include "en-multicast.h"
#include "en-northd.h"
#include "en-meters.h"
#include "en-sampling-app.h"
Expand Down Expand Up @@ -56,13 +57,11 @@ lflow_get_input_data(struct engine_node *node,
engine_get_input_data("lr_stateful", node);
struct ed_type_ls_stateful *ls_stateful_data =
engine_get_input_data("ls_stateful", node);
struct multicast_igmp_data *multicat_igmp_data =
engine_get_input_data("multicast_igmp", node);

lflow_input->sbrec_logical_flow_table =
EN_OVSDB_GET(engine_get_input("SB_logical_flow", node));
lflow_input->sbrec_multicast_group_table =
EN_OVSDB_GET(engine_get_input("SB_multicast_group", node));
lflow_input->sbrec_igmp_group_table =
EN_OVSDB_GET(engine_get_input("SB_igmp_group", node));
lflow_input->sbrec_logical_dp_group_table =
EN_OVSDB_GET(engine_get_input("SB_logical_dp_group", node));

Expand All @@ -85,6 +84,8 @@ lflow_get_input_data(struct engine_node *node,
lflow_input->parsed_routes = &routes_data->parsed_routes;
lflow_input->route_tables = &routes_data->route_tables;
lflow_input->route_policies = &route_policies_data->route_policies;
lflow_input->igmp_groups = &multicat_igmp_data->igmp_groups;
lflow_input->igmp_lflow_ref = multicat_igmp_data->lflow_ref;

struct ed_type_global_config *global_config =
engine_get_input_data("global_config", node);
Expand All @@ -110,6 +111,7 @@ void en_lflow_run(struct engine_node *node, void *data)
struct lflow_data *lflow_data = data;
lflow_table_clear(lflow_data->lflow_table);
lflow_reset_northd_refs(&lflow_input);
lflow_ref_clear(lflow_input.igmp_lflow_ref);

build_lflows(eng_ctx->ovnsb_idl_txn, &lflow_input,
lflow_data->lflow_table);
Expand Down Expand Up @@ -219,6 +221,48 @@ lflow_ls_stateful_handler(struct engine_node *node, void *data)
return true;
}

bool
lflow_multicast_igmp_handler(struct engine_node *node, void *data)
{
struct multicast_igmp_data *mcast_igmp_data =
engine_get_input_data("multicast_igmp", node);

const struct engine_context *eng_ctx = engine_get_context();
struct lflow_data *lflow_data = data;
struct lflow_input lflow_input;
lflow_get_input_data(node, &lflow_input);

if (!lflow_ref_resync_flows(mcast_igmp_data->lflow_ref,
lflow_data->lflow_table,
eng_ctx->ovnsb_idl_txn,
lflow_input.ls_datapaths,
lflow_input.lr_datapaths,
lflow_input.ovn_internal_version_changed,
lflow_input.sbrec_logical_flow_table,
lflow_input.sbrec_logical_dp_group_table)) {
return false;
}

build_igmp_lflows(&mcast_igmp_data->igmp_groups,
&lflow_input.ls_datapaths->datapaths,
lflow_data->lflow_table,
mcast_igmp_data->lflow_ref);

if (!lflow_ref_sync_lflows(mcast_igmp_data->lflow_ref,
lflow_data->lflow_table,
eng_ctx->ovnsb_idl_txn,
lflow_input.ls_datapaths,
lflow_input.lr_datapaths,
lflow_input.ovn_internal_version_changed,
lflow_input.sbrec_logical_flow_table,
lflow_input.sbrec_logical_dp_group_table)) {
return false;
}

engine_set_node_state(node, EN_UPDATED);
return true;
}

void *en_lflow_init(struct engine_node *node OVS_UNUSED,
struct engine_arg *arg OVS_UNUSED)
{
Expand Down
1 change: 1 addition & 0 deletions northd/en-lflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ bool lflow_northd_handler(struct engine_node *, void *data);
bool lflow_port_group_handler(struct engine_node *, void *data);
bool lflow_lr_stateful_handler(struct engine_node *, void *data);
bool lflow_ls_stateful_handler(struct engine_node *node, void *data);
bool lflow_multicast_igmp_handler(struct engine_node *node, void *data);

#endif /* EN_LFLOW_H */
Loading

0 comments on commit 89fa4d7

Please sign in to comment.