Skip to content

Commit

Permalink
controller: Omit alert for FDB and MAC binding timestamp.
Browse files Browse the repository at this point in the history
The timestamp column is read by ovn-controller only in order to
implement aging.  However, ovn-controller doesn't need to react to
changes in the timestamp value so we can disable change tracking and
alerting for these columns.  That allows us to remove the helper
function for checking if the only updated column is the timestamp.
The same applies to both FDB and MAC binding.

Fixes: b57f60a ("controller: Add MAC cache I-P node")
Fixes: 6d4c23a ("controller: Add FDB support to MAC cache I-P node")
Signed-off-by: Ales Musil <[email protected]>
Acked-by: Ilya Maximets <[email protected]>
Signed-off-by: Dumitru Ceara <[email protected]>
(cherry picked from commit a979db0)
  • Loading branch information
almusil authored and dceara committed Feb 5, 2025
1 parent e036f8d commit 5ea9b59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 43 deletions.
32 changes: 0 additions & 32 deletions controller/mac_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,6 @@ mac_cache_mac_binding_remove(struct mac_cache_data *data,
free(mc_mb);
}

bool
mac_cache_sb_mac_binding_updated(const struct sbrec_mac_binding *mb)
{
bool updated = false;
for (size_t i = 0; i < SBREC_MAC_BINDING_N_COLUMNS; i++) {
/* Ignore timestamp update as this does not affect the existing nodes
* at all. */
if (i == SBREC_MAC_BINDING_COL_TIMESTAMP) {
continue;
}
updated |= sbrec_mac_binding_is_updated(mb, i);
}

return updated || sbrec_mac_binding_is_deleted(mb);
}

void
mac_cache_mac_bindings_clear(struct mac_cache_data *data)
{
Expand Down Expand Up @@ -263,22 +247,6 @@ mac_cache_fdb_remove(struct mac_cache_data *data, const struct sbrec_fdb *fdb)
free(mc_fdb);
}

bool
mac_cache_sb_fdb_updated(const struct sbrec_fdb *fdb)
{
bool updated = false;
for (size_t i = 0; i < SBREC_FDB_N_COLUMNS; i++) {
/* Ignore timestamp update as this does not affect the existing nodes
* at all. */
if (i == SBREC_FDB_COL_TIMESTAMP) {
continue;
}
updated |= sbrec_fdb_is_updated(fdb, i);
}

return updated || sbrec_fdb_is_deleted(fdb);
}

void
mac_cache_fdbs_clear(struct mac_cache_data *data)
{
Expand Down
3 changes: 0 additions & 3 deletions controller/mac_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,10 @@ void mac_cache_mac_bindings_clear(struct mac_cache_data *data);
void mac_cache_mac_bindings_to_string(const struct hmap *map,
struct ds *out_data);

bool mac_cache_sb_mac_binding_updated(const struct sbrec_mac_binding *mb);

void mac_cache_fdb_add(struct mac_cache_data *data,
const struct sbrec_fdb *fdb, struct uuid dp_uuid);
void mac_cache_fdb_remove(struct mac_cache_data *data,
const struct sbrec_fdb *fdb);
bool mac_cache_sb_fdb_updated(const struct sbrec_fdb *fdb);
void mac_cache_fdbs_clear(struct mac_cache_data *data);

void
Expand Down
14 changes: 6 additions & 8 deletions controller/ovn-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -3474,10 +3474,6 @@ mac_cache_sb_mac_binding_handler(struct engine_node *node, void *data)

const struct sbrec_mac_binding *sbrec_mb;
SBREC_MAC_BINDING_TABLE_FOR_EACH_TRACKED (sbrec_mb, mb_table) {
if (!mac_cache_sb_mac_binding_updated(sbrec_mb)) {
continue;
}

if (!sbrec_mac_binding_is_new(sbrec_mb)) {
mac_cache_mac_binding_remove(cache_data, sbrec_mb);
}
Expand Down Expand Up @@ -3515,10 +3511,6 @@ mac_cache_sb_fdb_handler(struct engine_node *node, void *data)
struct local_datapath *local_dp;
const struct sbrec_fdb *sbrec_fdb;
SBREC_FDB_TABLE_FOR_EACH_TRACKED (sbrec_fdb, fdb_table) {
if (!mac_cache_sb_fdb_updated(sbrec_fdb)) {
continue;
}

if (!sbrec_fdb_is_new(sbrec_fdb)) {
mac_cache_fdb_remove(cache_data, sbrec_fdb);
}
Expand Down Expand Up @@ -5260,6 +5252,12 @@ main(int argc, char *argv[])
&sbrec_chassis_private_col_nb_cfg);
ovsdb_idl_omit_alert(ovnsb_idl_loop.idl,
&sbrec_chassis_private_col_nb_cfg_timestamp);
/* Omit the timestamp columns of the MAC_Binding and FDB tables.
* ovn-controller doesn't need to react to changes in timestamp
* values (it does read them to implement aging). Therefore we
* can disable change tracking and alerting for these columns. */
ovsdb_idl_omit_alert(ovnsb_idl_loop.idl, &sbrec_mac_binding_col_timestamp);
ovsdb_idl_omit_alert(ovnsb_idl_loop.idl, &sbrec_fdb_col_timestamp);

/* Omit the external_ids column of all the tables except for -
* - DNS. pinctrl.c uses the external_ids column of DNS,
Expand Down

0 comments on commit 5ea9b59

Please sign in to comment.