This change avoids the unnecessary change handling in "lflow" when NB_Global:options:ignore_lsp_down is true (default) if the only change of the LSP is the column "up". This further reduces the number of recompute of "lflow" to zero for the VIF creation-and-binding scenario.
Signed-off-by: Han Zhou <[email protected]> --- northd/northd.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ tests/ovn-northd.at | 4 ++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index ce0912570afd..f35965b16582 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -5007,6 +5007,44 @@ check_ls_changes_other_than_lsp(const struct nbrec_logical_switch *ls) return false; } +static bool +check_lsp_changes_other_than_up(const struct nbrec_logical_switch_port *nbsp) +{ + /* Check if the columns are changed in this row. */ + enum nbrec_logical_switch_port_column_id col; + for (col = 0; col < NBREC_LOGICAL_SWITCH_PORT_N_COLUMNS; col++) { + if (nbrec_logical_switch_port_is_updated(nbsp, col) && + col != NBREC_LOGICAL_SWITCH_PORT_COL_UP) { + return true; + } + } + + /* Check if the referenced rows are changed. + XXX: Need a better OVSDB IDL interface for this check. */ + if (nbsp->dhcpv4_options && + nbrec_dhcp_options_row_get_seqno(nbsp->dhcpv4_options, + OVSDB_IDL_CHANGE_MODIFY) > 0) { + return true; + } + if (nbsp->dhcpv6_options && + nbrec_dhcp_options_row_get_seqno(nbsp->dhcpv6_options, + OVSDB_IDL_CHANGE_MODIFY) > 0) { + return true; + } + if (nbsp->ha_chassis_group && + nbrec_ha_chassis_group_row_get_seqno(nbsp->ha_chassis_group, + OVSDB_IDL_CHANGE_MODIFY) > 0) { + return true; + } + for (size_t i = 0; i < nbsp->n_mirror_rules; i++) { + if (nbrec_mirror_row_get_seqno(nbsp->mirror_rules[i], + OVSDB_IDL_CHANGE_MODIFY) > 0) { + return true; + } + } + return false; +} + /* Return true if changes are handled incrementally, false otherwise. * When there are any changes, try to track what's exactly changed and set * northd_data->change_tracked accordingly: change tracked - true, otherwise, @@ -5087,6 +5125,14 @@ northd_handle_ls_changes(struct ovsdb_idl_txn *ovnsb_idl_txn, * by this change. Fallback to recompute. */ goto fail; } + if (!check_lsp_is_up && + !check_lsp_changes_other_than_up(new_nbsp)) { + /* If the only change is the "up" column while the + * "ignore_lsp_down" is set to true, just ignore this + * change. */ + op->visited = true; + continue; + } ovn_port_destroy(&nd->ls_ports, op); op = ls_port_create(ovnsb_idl_txn, &nd->ls_ports, new_nbsp->name, new_nbsp, od, sb, diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index efe6073b6a2c..cfea065b8b84 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -9000,14 +9000,14 @@ check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats check ovn-nbctl --wait=hv lsp-add ls0 lsp0-1 -- lsp-set-addresses lsp0-1 "aa:aa:aa:00:00:01 192.168.0.11" AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats northd recompute], [0], [0 ]) -AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats lflow recompute], [0], [2 +AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats lflow recompute], [0], [0 ]) check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats check ovn-nbctl --wait=hv lsp-add ls0 lsp0-2 -- lsp-set-addresses lsp0-2 "aa:aa:aa:00:00:02 192.168.0.12" AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats northd recompute], [0], [0 ]) -AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats lflow recompute], [0], [2 +AT_CHECK([as northd ovn-appctl -t NORTHD_TYPE inc-engine/show-stats lflow recompute], [0], [0 ]) check as northd ovn-appctl -t NORTHD_TYPE inc-engine/clear-stats -- 2.30.2 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
