Skip to content

Commit

Permalink
northd: Split switch ports and router ports.
Browse files Browse the repository at this point in the history
The hmap 'ports' includes both logical switch ports and logical router
ports. Although most of the code handles these two different types of port
differently, we always have to iterate through the whole hmap, and skip
one type of ports in the loop. More importantly, this hides dependency
from the interfaces - it is not clear from the function prototypes what
are the real input, switch ports or router ports, or both.

With this patch, it splits the two types of ports in different hmap
tables, and all the related functions are refactored, most of them only
accept one of the types. This helps for future incremental processing
implementation. As a byproduct, it improves the performance slightly.

Note: This patch didn't change the ovn_port data structure, which is
used by both switch ports and router ports. It may be a followup
improvement in the future if necessary, e.g. to reduce memory footprint.

Signed-off-by: Han Zhou <hzhou@ovn.org>
Acked-by: Mark Michelson <mmichels@redhat.com>
  • Loading branch information
hzhou8 committed Mar 24, 2023
1 parent b257cb9 commit b2f09ac
Show file tree
Hide file tree
Showing 3 changed files with 368 additions and 266 deletions.
5 changes: 3 additions & 2 deletions northd/en-lflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ void en_lflow_run(struct engine_node *node, void *data OVS_UNUSED)
"sbrec_mcast_group_by_name");

lflow_input.datapaths = &northd_data->datapaths;
lflow_input.ports = &northd_data->ports;
lflow_input.ls_ports = &northd_data->ls_ports;
lflow_input.lr_ports = &northd_data->lr_ports;
lflow_input.port_groups = &northd_data->port_groups;
lflow_input.meter_groups = &northd_data->meter_groups;
lflow_input.lbs = &northd_data->lbs;
Expand All @@ -67,7 +68,7 @@ void en_lflow_run(struct engine_node *node, void *data OVS_UNUSED)
stopwatch_start(BUILD_LFLOWS_STOPWATCH_NAME, time_msec());
build_bfd_table(&lflow_input, eng_ctx->ovnsb_idl_txn,
&northd_data->bfd_connections,
&northd_data->ports);
&northd_data->lr_ports);
build_lflows(&lflow_input, eng_ctx->ovnsb_idl_txn);
bfd_cleanup_connections(&lflow_input, &northd_data->bfd_connections);
stopwatch_stop(BUILD_LFLOWS_STOPWATCH_NAME, time_msec());
Expand Down

0 comments on commit b2f09ac

Please sign in to comment.