diff mbox series

[ovs-dev,v4,2/2] ofctrl: Wait for OVS updates to be processed before updating cur_cfg.

Message ID 20201202153111.19937.15995.stgit@dceara.remote.csb
State Accepted
Headers show
Series ovn-controller: Fix nb_cfg update with changes in flight. | expand

Commit Message

Dumitru Ceara Dec. 2, 2020, 3:31 p.m. UTC
Fixes: ca278d98a4f5 ("ovn-controller: Initial use of incremental
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
---
 controller/ofctrl.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Han Zhou Dec. 3, 2020, 8:31 a.m. UTC | #1
On Wed, Dec 2, 2020 at 7:31 AM Dumitru Ceara <dceara@redhat.com> wrote:
>
> Fixes: ca278d98a4f5 ("ovn-controller: Initial use of incremental
> Signed-off-by: Dumitru Ceara <dceara@redhat.com>
> ---
>  controller/ofctrl.c |   14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/controller/ofctrl.c b/controller/ofctrl.c
> index c1bbc58..a1ac695 100644
> --- a/controller/ofctrl.c
> +++ b/controller/ofctrl.c
> @@ -2032,19 +2032,23 @@ ofctrl_put(struct ovn_desired_flow_table
*flow_table,
>      bool need_put = false;
>      if (flow_changed || skipped_last_time || need_reinstall_flows) {
>          need_put = true;
> +        old_nb_cfg = nb_cfg;
>      } else if (nb_cfg != old_nb_cfg) {
>          /* nb_cfg changed since last ofctrl_put() call */
>          if (cur_cfg == old_nb_cfg) {
> -            /* we were up-to-date already, so just update with the
> -             * new nb_cfg */
> -            cur_cfg = nb_cfg;
> +            /* If there are no updates pending, we were up-to-date
already,
> +             * update with the new nb_cfg.
> +             */
> +            if (ovs_list_is_empty(&flow_updates)) {
> +                cur_cfg = nb_cfg;
> +                old_nb_cfg = nb_cfg;
> +            }
>          } else {
>              need_put = true;
> +            old_nb_cfg = nb_cfg;
>          }
>      }
>
> -    old_nb_cfg = nb_cfg;
> -
>      if (!need_put) {
>          VLOG_DBG("ofctrl_put not needed");
>          return;
>

Thanks! I applied this to master.
diff mbox series

Patch

diff --git a/controller/ofctrl.c b/controller/ofctrl.c
index c1bbc58..a1ac695 100644
--- a/controller/ofctrl.c
+++ b/controller/ofctrl.c
@@ -2032,19 +2032,23 @@  ofctrl_put(struct ovn_desired_flow_table *flow_table,
     bool need_put = false;
     if (flow_changed || skipped_last_time || need_reinstall_flows) {
         need_put = true;
+        old_nb_cfg = nb_cfg;
     } else if (nb_cfg != old_nb_cfg) {
         /* nb_cfg changed since last ofctrl_put() call */
         if (cur_cfg == old_nb_cfg) {
-            /* we were up-to-date already, so just update with the
-             * new nb_cfg */
-            cur_cfg = nb_cfg;
+            /* If there are no updates pending, we were up-to-date already,
+             * update with the new nb_cfg.
+             */
+            if (ovs_list_is_empty(&flow_updates)) {
+                cur_cfg = nb_cfg;
+                old_nb_cfg = nb_cfg;
+            }
         } else {
             need_put = true;
+            old_nb_cfg = nb_cfg;
         }
     }
 
-    old_nb_cfg = nb_cfg;
-
     if (!need_put) {
         VLOG_DBG("ofctrl_put not needed");
         return;