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 aac5263 commit 2f1279e
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 @@ -267,22 +267,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);
}

const struct sbrec_mac_binding *
mac_binding_lookup(struct ovsdb_idl_index *sbrec_mac_binding_by_lport_ip,
const char *logical_port, const char *ip) {
Expand Down Expand Up @@ -354,22 +338,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);

const struct sbrec_mac_binding *
mac_binding_lookup(struct ovsdb_idl_index *sbrec_mac_binding_by_lport_ip,
const char *logical_port, const char *ip);
Expand All @@ -179,8 +177,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 @@ -3163,10 +3163,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 @@ -3204,10 +3200,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 @@ -5034,6 +5026,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 2f1279e

Please sign in to comment.