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 <amusil@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
  • Loading branch information
almusil authored and dceara committed Feb 5, 2025
1 parent 7c3f7f4 commit a979db0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 44 deletions.
32 changes: 0 additions & 32 deletions controller/mac-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,22 +268,6 @@ mac_bindings_to_string(const struct hmap *map, struct ds *out_data)
}
}

bool
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);
}

/* FDB. */
struct fdb *
fdb_add(struct hmap *map, struct fdb_data fdb_data, long long timestamp)
Expand Down Expand Up @@ -339,22 +323,6 @@ fdb_find(const struct hmap *map, const struct fdb_data *fdb_data)
return NULL;
}

bool
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
fdbs_clear(struct hmap *map)
{
Expand Down
4 changes: 0 additions & 4 deletions controller/mac-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ bool mac_binding_data_from_sbrec(struct mac_binding_data *data,
void mac_bindings_clear(struct hmap *map);
void mac_bindings_to_string(const struct hmap *map, struct ds *out_data);

bool sb_mac_binding_updated(const struct sbrec_mac_binding *mb);

/* FDB. */
struct fdb *fdb_add(struct hmap *map, struct fdb_data fdb_data,
long long timestamp);
Expand All @@ -175,8 +173,6 @@ bool fdb_data_from_sbrec(struct fdb_data *data, const struct sbrec_fdb *fdb);

struct fdb *fdb_find(const struct hmap *map, const struct fdb_data *fdb_data);

bool sb_fdb_updated(const struct sbrec_fdb *fdb);

void fdbs_clear(struct hmap *map);

/* MAC binding stat processing. */
Expand Down
14 changes: 6 additions & 8 deletions controller/ovn-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -3183,10 +3183,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 (!sb_mac_binding_updated(sbrec_mb)) {
continue;
}

if (!sbrec_mac_binding_is_new(sbrec_mb)) {
mac_binding_remove_sb(cache_data, sbrec_mb);
}
Expand Down Expand Up @@ -3224,10 +3220,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 (!sb_fdb_updated(sbrec_fdb)) {
continue;
}

if (!sbrec_fdb_is_new(sbrec_fdb)) {
fdb_remove_sb(cache_data, sbrec_fdb);
}
Expand Down Expand Up @@ -5127,6 +5119,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 a979db0

Please sign in to comment.