@@ -174,6 +174,7 @@ struct pinctrl {
/* Latch to destroy the 'pinctrl_thread' */
struct latch pinctrl_thread_exit;
bool mac_binding_can_timestamp;
+ bool fdb_can_timestamp;
};
static struct pinctrl pinctrl;
@@ -3448,15 +3449,25 @@ pinctrl_update(const struct ovsdb_idl *idl, const char *br_int_name)
ovs_mutex_lock(&pinctrl_mutex);
pinctrl_set_br_int_name_(br_int_name);
- bool can_timestamp = sbrec_server_has_mac_binding_table_col_timestamp(idl);
- if (can_timestamp != pinctrl.mac_binding_can_timestamp) {
- pinctrl.mac_binding_can_timestamp = can_timestamp;
+ bool can_mb_timestamp =
+ sbrec_server_has_mac_binding_table_col_timestamp(idl);
+ if (can_mb_timestamp != pinctrl.mac_binding_can_timestamp) {
+ pinctrl.mac_binding_can_timestamp = can_mb_timestamp;
/* Notify pinctrl_handler that mac binding timestamp column
* availability has changed. */
notify_pinctrl_handler();
}
+ bool can_fdb_timestamp = sbrec_server_has_fdb_table_col_timestamp(idl);
+ if (can_fdb_timestamp != pinctrl.fdb_can_timestamp) {
+ pinctrl.fdb_can_timestamp = can_fdb_timestamp;
+
+ /* Notify pinctrl_handler that fdb timestamp column
+ * availability has changed. */
+ notify_pinctrl_handler();
+ }
+
ovs_mutex_unlock(&pinctrl_mutex);
}
@@ -8102,6 +8113,12 @@ run_put_fdb(struct ovsdb_idl_txn *ovnsb_idl_txn,
sbrec_fdb_set_mac(sb_fdb, mac_string);
}
sbrec_fdb_set_port_key(sb_fdb, fdb_e->port_key);
+
+ /* For backward compatibility check if timestamp column is available
+ * in SB DB. */
+ if (pinctrl.fdb_can_timestamp) {
+ sbrec_fdb_set_timestamp(sb_fdb, time_wall_msec());
+ }
}
static void
@@ -96,7 +96,7 @@ static const char *rbac_controller_event_update[] =
static const char *rbac_fdb_auth[] =
{""};
static const char *rbac_fdb_update[] =
- {"dp_key", "mac", "port_key"};
+ {"dp_key", "mac", "port_key", "timestamp"};
static const char *rbac_port_binding_auth[] =
{""};
@@ -1,7 +1,7 @@
{
"name": "OVN_Southbound",
- "version": "20.27.2",
- "cksum": "1291808617 30462",
+ "version": "20.27.3",
+ "cksum": "800899756 30521",
"tables": {
"SB_Global": {
"columns": {
@@ -576,7 +576,8 @@
"port_key": {
"type": {"key": {"type": "integer",
"minInteger": 1,
- "maxInteger": 16777215}}}},
+ "maxInteger": 16777215}}},
+ "timestamp": {"type": {"key": "integer"}}},
"indexes": [["mac", "dp_key"]],
"isRoot": true},
"Static_MAC_Binding": {
@@ -5001,6 +5001,11 @@ tcp.flags = RST;
<column name="port_key">
The key of the port binding on which this FDB was learnt.
</column>
+
+ <column name="timestamp">
+ The timestamp in msec when the FDB was added or updated.
+ Records that existed before this column will have 0.
+ </column>
</table>
<table name="Static_MAC_Binding" title="IP to MAC bindings">
Add timestamp column which will store timestamp when the FDB row is created or updated. This can be utilized by FDB aging mechanism. Signed-off-by: Ales Musil <amusil@redhat.com> --- controller/pinctrl.c | 23 ++++++++++++++++++++--- northd/ovn-northd.c | 2 +- ovn-sb.ovsschema | 7 ++++--- ovn-sb.xml | 5 +++++ 4 files changed, 30 insertions(+), 7 deletions(-)