|
|
5f9769 |
From c6f4b3a47571d87149b86c999b78509185da7647 Mon Sep 17 00:00:00 2001
|
|
|
5f9769 |
From: Dumitru Ceara <dceara@redhat.com>
|
|
|
5f9769 |
Date: Wed, 13 Jan 2021 10:23:09 +0100
|
|
|
5f9769 |
Subject: [PATCH 1/3] ofctrl: Rename 'nb_cfg' to 'req_cfg'.
|
|
|
5f9769 |
|
|
|
5f9769 |
A future commit will extend the ofctrl OVS barrier sync mechanism to
|
|
|
5f9769 |
make it usable by multiple components. One of the use cases will be
|
|
|
5f9769 |
'nb_cfg' sync but it may not be the only one.
|
|
|
5f9769 |
|
|
|
5f9769 |
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
|
|
|
5f9769 |
Acked-by: Mark Michelson <mmichels@redhat.com>
|
|
|
5f9769 |
Acked-by: Numan Siddique <numans@ovn.org>
|
|
|
5f9769 |
Signed-off-by: Numan Siddique <numans@ovn.org>
|
|
|
5f9769 |
(cherry picked from upstream master commit 2f933fc560330022cfc816ed870da6e5847809c9)
|
|
|
5f9769 |
|
|
|
5f9769 |
Change-Id: Iddeeeb6aaee189a3e9918426e0dce3f1dbf6ff49
|
|
|
5f9769 |
---
|
|
|
5f9769 |
controller/ofctrl.c | 70 ++++++++++++++++++++++-----------------------
|
|
|
5f9769 |
controller/ofctrl.h | 4 +--
|
|
|
5f9769 |
controller/ovn-controller.c | 6 ++--
|
|
|
5f9769 |
3 files changed, 40 insertions(+), 40 deletions(-)
|
|
|
5f9769 |
|
|
|
5f9769 |
diff --git a/controller/ofctrl.c b/controller/ofctrl.c
|
|
|
5f9769 |
index a1ac695..9d62e12 100644
|
|
|
5f9769 |
--- a/controller/ofctrl.c
|
|
|
5f9769 |
+++ b/controller/ofctrl.c
|
|
|
5f9769 |
@@ -268,13 +268,14 @@ enum ofctrl_state {
|
|
|
5f9769 |
/* An in-flight update to the switch's flow table.
|
|
|
5f9769 |
*
|
|
|
5f9769 |
* When we receive a barrier reply from the switch with the given 'xid', we
|
|
|
5f9769 |
- * know that the switch is caught up to northbound database sequence number
|
|
|
5f9769 |
- * 'nb_cfg' (and make that available to the client via ofctrl_get_cur_cfg(), so
|
|
|
5f9769 |
- * that it can store it into our Chassis record's nb_cfg column). */
|
|
|
5f9769 |
+ * know that the switch is caught up to the requested sequence number
|
|
|
5f9769 |
+ * 'req_cfg' (and make that available to the client via ofctrl_get_cur_cfg(),
|
|
|
5f9769 |
+ * so that it can store it into external state, e.g., our Chassis record's
|
|
|
5f9769 |
+ * nb_cfg column). */
|
|
|
5f9769 |
struct ofctrl_flow_update {
|
|
|
5f9769 |
struct ovs_list list_node; /* In 'flow_updates'. */
|
|
|
5f9769 |
ovs_be32 xid; /* OpenFlow transaction ID for barrier. */
|
|
|
5f9769 |
- int64_t nb_cfg; /* Northbound database sequence number. */
|
|
|
5f9769 |
+ uint64_t req_cfg; /* Requested sequence number. */
|
|
|
5f9769 |
};
|
|
|
5f9769 |
|
|
|
5f9769 |
static struct ofctrl_flow_update *
|
|
|
5f9769 |
@@ -286,8 +287,8 @@ ofctrl_flow_update_from_list_node(const struct ovs_list *list_node)
|
|
|
5f9769 |
/* Currently in-flight updates. */
|
|
|
5f9769 |
static struct ovs_list flow_updates;
|
|
|
5f9769 |
|
|
|
5f9769 |
-/* nb_cfg of latest committed flow update. */
|
|
|
5f9769 |
-static int64_t cur_cfg;
|
|
|
5f9769 |
+/* req_cfg of latest committed flow update. */
|
|
|
5f9769 |
+static uint64_t cur_cfg;
|
|
|
5f9769 |
|
|
|
5f9769 |
/* Current state. */
|
|
|
5f9769 |
static enum ofctrl_state state;
|
|
|
5f9769 |
@@ -632,8 +633,8 @@ recv_S_UPDATE_FLOWS(const struct ofp_header *oh, enum ofptype type,
|
|
|
5f9769 |
struct ofctrl_flow_update *fup = ofctrl_flow_update_from_list_node(
|
|
|
5f9769 |
ovs_list_front(&flow_updates));
|
|
|
5f9769 |
if (fup->xid == oh->xid) {
|
|
|
5f9769 |
- if (fup->nb_cfg >= cur_cfg) {
|
|
|
5f9769 |
- cur_cfg = fup->nb_cfg;
|
|
|
5f9769 |
+ if (fup->req_cfg >= cur_cfg) {
|
|
|
5f9769 |
+ cur_cfg = fup->req_cfg;
|
|
|
5f9769 |
}
|
|
|
5f9769 |
ovs_list_remove(&fup->list_node);
|
|
|
5f9769 |
free(fup);
|
|
|
5f9769 |
@@ -763,7 +764,7 @@ ofctrl_destroy(void)
|
|
|
5f9769 |
shash_destroy(&symtab);
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
-int64_t
|
|
|
5f9769 |
+uint64_t
|
|
|
5f9769 |
ofctrl_get_cur_cfg(void)
|
|
|
5f9769 |
{
|
|
|
5f9769 |
return cur_cfg;
|
|
|
5f9769 |
@@ -2024,28 +2025,28 @@ void
|
|
|
5f9769 |
ofctrl_put(struct ovn_desired_flow_table *flow_table,
|
|
|
5f9769 |
struct shash *pending_ct_zones,
|
|
|
5f9769 |
const struct sbrec_meter_table *meter_table,
|
|
|
5f9769 |
- int64_t nb_cfg,
|
|
|
5f9769 |
+ uint64_t req_cfg,
|
|
|
5f9769 |
bool flow_changed)
|
|
|
5f9769 |
{
|
|
|
5f9769 |
static bool skipped_last_time = false;
|
|
|
5f9769 |
- static int64_t old_nb_cfg = 0;
|
|
|
5f9769 |
+ static uint64_t old_req_cfg = 0;
|
|
|
5f9769 |
bool need_put = false;
|
|
|
5f9769 |
if (flow_changed || skipped_last_time || need_reinstall_flows) {
|
|
|
5f9769 |
need_put = true;
|
|
|
5f9769 |
- old_nb_cfg = nb_cfg;
|
|
|
5f9769 |
- } else if (nb_cfg != old_nb_cfg) {
|
|
|
5f9769 |
- /* nb_cfg changed since last ofctrl_put() call */
|
|
|
5f9769 |
- if (cur_cfg == old_nb_cfg) {
|
|
|
5f9769 |
+ old_req_cfg = req_cfg;
|
|
|
5f9769 |
+ } else if (req_cfg != old_req_cfg) {
|
|
|
5f9769 |
+ /* req_cfg changed since last ofctrl_put() call */
|
|
|
5f9769 |
+ if (cur_cfg == old_req_cfg) {
|
|
|
5f9769 |
/* If there are no updates pending, we were up-to-date already,
|
|
|
5f9769 |
- * update with the new nb_cfg.
|
|
|
5f9769 |
+ * update with the new req_cfg.
|
|
|
5f9769 |
*/
|
|
|
5f9769 |
if (ovs_list_is_empty(&flow_updates)) {
|
|
|
5f9769 |
- cur_cfg = nb_cfg;
|
|
|
5f9769 |
- old_nb_cfg = nb_cfg;
|
|
|
5f9769 |
+ cur_cfg = req_cfg;
|
|
|
5f9769 |
+ old_req_cfg = req_cfg;
|
|
|
5f9769 |
}
|
|
|
5f9769 |
} else {
|
|
|
5f9769 |
need_put = true;
|
|
|
5f9769 |
- old_nb_cfg = nb_cfg;
|
|
|
5f9769 |
+ old_req_cfg = req_cfg;
|
|
|
5f9769 |
}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
@@ -2187,24 +2188,23 @@ ofctrl_put(struct ovn_desired_flow_table *flow_table,
|
|
|
5f9769 |
/* Track the flow update. */
|
|
|
5f9769 |
struct ofctrl_flow_update *fup, *prev;
|
|
|
5f9769 |
LIST_FOR_EACH_REVERSE_SAFE (fup, prev, list_node, &flow_updates) {
|
|
|
5f9769 |
- if (nb_cfg < fup->nb_cfg) {
|
|
|
5f9769 |
+ if (req_cfg < fup->req_cfg) {
|
|
|
5f9769 |
/* This ofctrl_flow_update is for a configuration later than
|
|
|
5f9769 |
- * 'nb_cfg'. This should not normally happen, because it means
|
|
|
5f9769 |
- * that 'nb_cfg' in the SB_Global table of the southbound
|
|
|
5f9769 |
- * database decreased, and it should normally be monotonically
|
|
|
5f9769 |
- * increasing. */
|
|
|
5f9769 |
- VLOG_WARN("nb_cfg regressed from %"PRId64" to %"PRId64,
|
|
|
5f9769 |
- fup->nb_cfg, nb_cfg);
|
|
|
5f9769 |
+ * 'req_cfg'. This should not normally happen, because it
|
|
|
5f9769 |
+ * means that the local seqno decreased and it should normally
|
|
|
5f9769 |
+ * be monotonically increasing. */
|
|
|
5f9769 |
+ VLOG_WARN("req_cfg regressed from %"PRId64" to %"PRId64,
|
|
|
5f9769 |
+ fup->req_cfg, req_cfg);
|
|
|
5f9769 |
ovs_list_remove(&fup->list_node);
|
|
|
5f9769 |
free(fup);
|
|
|
5f9769 |
- } else if (nb_cfg == fup->nb_cfg) {
|
|
|
5f9769 |
+ } else if (req_cfg == fup->req_cfg) {
|
|
|
5f9769 |
/* This ofctrl_flow_update is for the same configuration as
|
|
|
5f9769 |
- * 'nb_cfg'. Probably, some change to the physical topology
|
|
|
5f9769 |
+ * 'req_cfg'. Probably, some change to the physical topology
|
|
|
5f9769 |
* means that we had to revise the OpenFlow flow table even
|
|
|
5f9769 |
* though the logical topology did not change. Update fp->xid,
|
|
|
5f9769 |
* so that we don't send a notification that we're up-to-date
|
|
|
5f9769 |
* until we're really caught up. */
|
|
|
5f9769 |
- VLOG_DBG("advanced xid target for nb_cfg=%"PRId64, nb_cfg);
|
|
|
5f9769 |
+ VLOG_DBG("advanced xid target for req_cfg=%"PRId64, req_cfg);
|
|
|
5f9769 |
fup->xid = xid_;
|
|
|
5f9769 |
goto done;
|
|
|
5f9769 |
} else {
|
|
|
5f9769 |
@@ -2216,18 +2216,18 @@ ofctrl_put(struct ovn_desired_flow_table *flow_table,
|
|
|
5f9769 |
fup = xmalloc(sizeof *fup);
|
|
|
5f9769 |
ovs_list_push_back(&flow_updates, &fup->list_node);
|
|
|
5f9769 |
fup->xid = xid_;
|
|
|
5f9769 |
- fup->nb_cfg = nb_cfg;
|
|
|
5f9769 |
+ fup->req_cfg = req_cfg;
|
|
|
5f9769 |
done:;
|
|
|
5f9769 |
} else if (!ovs_list_is_empty(&flow_updates)) {
|
|
|
5f9769 |
- /* Getting up-to-date with 'nb_cfg' didn't require any extra flow table
|
|
|
5f9769 |
- * changes, so whenever we get up-to-date with the most recent flow
|
|
|
5f9769 |
- * table update, we're also up-to-date with 'nb_cfg'. */
|
|
|
5f9769 |
+ /* Getting up-to-date with 'req_cfg' didn't require any extra flow
|
|
|
5f9769 |
+ * table changes, so whenever we get up-to-date with the most recent
|
|
|
5f9769 |
+ * flow table update, we're also up-to-date with 'req_cfg'. */
|
|
|
5f9769 |
struct ofctrl_flow_update *fup = ofctrl_flow_update_from_list_node(
|
|
|
5f9769 |
ovs_list_back(&flow_updates));
|
|
|
5f9769 |
- fup->nb_cfg = nb_cfg;
|
|
|
5f9769 |
+ fup->req_cfg = req_cfg;
|
|
|
5f9769 |
} else {
|
|
|
5f9769 |
/* We were completely up-to-date before and still are. */
|
|
|
5f9769 |
- cur_cfg = nb_cfg;
|
|
|
5f9769 |
+ cur_cfg = req_cfg;
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
flow_table->change_tracked = true;
|
|
|
5f9769 |
diff --git a/controller/ofctrl.h b/controller/ofctrl.h
|
|
|
5f9769 |
index 64b0ea5..8876956 100644
|
|
|
5f9769 |
--- a/controller/ofctrl.h
|
|
|
5f9769 |
+++ b/controller/ofctrl.h
|
|
|
5f9769 |
@@ -55,12 +55,12 @@ enum mf_field_id ofctrl_get_mf_field_id(void);
|
|
|
5f9769 |
void ofctrl_put(struct ovn_desired_flow_table *,
|
|
|
5f9769 |
struct shash *pending_ct_zones,
|
|
|
5f9769 |
const struct sbrec_meter_table *,
|
|
|
5f9769 |
- int64_t nb_cfg,
|
|
|
5f9769 |
+ uint64_t nb_cfg,
|
|
|
5f9769 |
bool flow_changed);
|
|
|
5f9769 |
bool ofctrl_can_put(void);
|
|
|
5f9769 |
void ofctrl_wait(void);
|
|
|
5f9769 |
void ofctrl_destroy(void);
|
|
|
5f9769 |
-int64_t ofctrl_get_cur_cfg(void);
|
|
|
5f9769 |
+uint64_t ofctrl_get_cur_cfg(void);
|
|
|
5f9769 |
|
|
|
5f9769 |
void ofctrl_ct_flush_zone(uint16_t zone_id);
|
|
|
5f9769 |
|
|
|
5f9769 |
diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
|
|
|
5f9769 |
index 7551287..42883b4 100644
|
|
|
5f9769 |
--- a/controller/ovn-controller.c
|
|
|
5f9769 |
+++ b/controller/ovn-controller.c
|
|
|
5f9769 |
@@ -798,11 +798,11 @@ restore_ct_zones(const struct ovsrec_bridge_table *bridge_table,
|
|
|
5f9769 |
}
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
-static int64_t
|
|
|
5f9769 |
+static uint64_t
|
|
|
5f9769 |
get_nb_cfg(const struct sbrec_sb_global_table *sb_global_table,
|
|
|
5f9769 |
unsigned int cond_seqno, unsigned int expected_cond_seqno)
|
|
|
5f9769 |
{
|
|
|
5f9769 |
- static int64_t nb_cfg = 0;
|
|
|
5f9769 |
+ static uint64_t nb_cfg = 0;
|
|
|
5f9769 |
|
|
|
5f9769 |
/* Delay getting nb_cfg if there are monitor condition changes
|
|
|
5f9769 |
* in flight. It might be that those changes would instruct the
|
|
|
5f9769 |
@@ -826,7 +826,7 @@ store_nb_cfg(struct ovsdb_idl_txn *sb_txn, struct ovsdb_idl_txn *ovs_txn,
|
|
|
5f9769 |
const struct sbrec_chassis_private *chassis,
|
|
|
5f9769 |
const struct ovsrec_bridge *br_int,
|
|
|
5f9769 |
unsigned int delay_nb_cfg_report,
|
|
|
5f9769 |
- int64_t cur_cfg)
|
|
|
5f9769 |
+ uint64_t cur_cfg)
|
|
|
5f9769 |
{
|
|
|
5f9769 |
if (!cur_cfg) {
|
|
|
5f9769 |
return;
|
|
|
5f9769 |
--
|
|
|
5f9769 |
1.8.3.1
|
|
|
5f9769 |
|