Skip to content

Commit

Permalink
northd: Ignore "up" column change if ignore_lsp_down is true.
Browse files Browse the repository at this point in the history
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 <hzhou@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
hzhou8 authored and ovsrobot committed May 13, 2023
1 parent a29bd8a commit 73815b4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
46 changes: 46 additions & 0 deletions northd/northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/ovn-northd.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 73815b4

Please sign in to comment.