Re: [ovs-dev] [PATCH ovn v6 13/13] northd: Add I-P for NB_Global and SB_Global.

2024-02-02 Thread Dumitru Ceara
On 1/30/24 22:23, num...@ovn.org wrote:
> From: Numan Siddique 
> 
> A new engine node "global_config" is added which handles the changes
> to NB_Global an SB_Global tables.  It also creates these rows if
> not present.
> 
> Without the I-P, any changes to the options column of these tables
> result in recompute of 'northd' and 'lflow' engine nodes.
> 
> Acked-by: Dumitru Ceara 
> Acked-by: Han Zhou 
> Signed-off-by: Numan Siddique 
> ---

[...]

> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index 929bb45aed..d8ec3eead5 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -8838,7 +8838,7 @@ AT_CHECK([grep "ls_in_lb " S1flows | sed 
> 's/table=../table=??/' | sort], [0], [d
>table=??(ls_in_lb   ), priority=0, match=(1), action=(next;)
>  ])
>  
> -ovn-nbctl --wait=sb set NB_Global . options:install_ls_lb_from_router=true
> +check ovn-nbctl --wait=sb set NB_Global . 
> options:install_ls_lb_from_router=true
>  
>  ovn-sbctl dump-flows S0 > S0flows
>  ovn-sbctl dump-flows S1 > S1flows
> @@ -8857,6 +8857,7 @@ AT_CHECK([grep "ls_in_lb " S1flows | sed 
> 's/table=../table=??/' | sort], [0], [d
>table=??(ls_in_lb   ), priority=120  , match=(ct.new && ip4.dst == 
> 172.16.0.11 && tcp.dst == 8080), action=(reg0[[1]] = 0; 
> ct_lb_mark(backends=10.0.0.2:8080);)
>  ])
>  
> +

Nit: unrelated.

With that addressed, my ack from v5 stands.

Regards,
Dumitru

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH ovn v6 13/13] northd: Add I-P for NB_Global and SB_Global.

2024-02-01 Thread Numan Siddique
On Thu, Feb 1, 2024 at 10:13 AM Numan Siddique  wrote:
>
> On Tue, Jan 30, 2024 at 4:25 PM  wrote:
> >
> > From: Numan Siddique 
> >
> > A new engine node "global_config" is added which handles the changes
> > to NB_Global an SB_Global tables.  It also creates these rows if
> > not present.
> >
> > Without the I-P, any changes to the options column of these tables
> > result in recompute of 'northd' and 'lflow' engine nodes.
> >
> > Acked-by: Dumitru Ceara 
> > Acked-by: Han Zhou 
> > Signed-off-by: Numan Siddique 
>
> Recheck-request: github-robot-_Build_and_Test

Recheck-request: github-robot-_Build_and_Test

>
> > ---
> >  northd/aging.c|  21 +-
> >  northd/automake.mk|   2 +
> >  northd/en-global-config.c | 576 ++
> >  northd/en-global-config.h |  65 +
> >  northd/en-lflow.c |  11 +-
> >  northd/en-northd.c|  52 ++--
> >  northd/en-northd.h|   2 +-
> >  northd/en-sync-sb.c   |  21 +-
> >  northd/inc-proc-northd.c  |  38 ++-
> >  northd/northd.c   | 230 +++
> >  northd/northd.h   |  24 +-
> >  tests/ovn-northd.at   | 256 +++--
> >  12 files changed, 1001 insertions(+), 297 deletions(-)
> >  create mode 100644 northd/en-global-config.c
> >  create mode 100644 northd/en-global-config.h
> >
> > diff --git a/northd/aging.c b/northd/aging.c
> > index cdf5f4464e..b76963a2dd 100644
> > --- a/northd/aging.c
> > +++ b/northd/aging.c
> > @@ -15,6 +15,7 @@
> >
> >  #include 
> >
> > +#include "en-global-config.h"
> >  #include "lib/inc-proc-eng.h"
> >  #include "lib/ovn-nb-idl.h"
> >  #include "lib/ovn-sb-idl.h"
> > @@ -347,15 +348,10 @@ aging_context_handle_timestamp(struct aging_context 
> > *ctx, int64_t timestamp,
> >  static uint32_t
> >  get_removal_limit(struct engine_node *node, const char *name)
> >  {
> > -const struct nbrec_nb_global_table *nb_global_table =
> > -EN_OVSDB_GET(engine_get_input("NB_nb_global", node));
> > -const struct nbrec_nb_global *nb =
> > -nbrec_nb_global_table_first(nb_global_table);
> > -if (!nb) {
> > -return 0;
> > -}
> > +struct ed_type_global_config *global_config =
> > +engine_get_input_data("global_config", node);
> >
> > -return smap_get_uint(>options, name, 0);
> > +return smap_get_uint(_config->nb_options, name, 0);
> >  }
> >
> >  /* MAC binding aging */
> > @@ -394,11 +390,14 @@ en_mac_binding_aging_run(struct engine_node *node, 
> > void *data OVS_UNUSED)
> >  {
> >  const struct engine_context *eng_ctx = engine_get_context();
> >  struct northd_data *northd_data = engine_get_input_data("northd", 
> > node);
> > +struct ed_type_global_config *global_config =
> > +engine_get_input_data("global_config", node);
> > +
> >  struct aging_waker *waker =
> >  engine_get_input_data("mac_binding_aging_waker", node);
> >
> >  if (!eng_ctx->ovnsb_idl_txn ||
> > -!northd_data->features.mac_binding_timestamp ||
> > +!global_config->features.mac_binding_timestamp ||
> >  time_msec() < waker->next_wake_msec) {
> >  return;
> >  }
> > @@ -530,9 +529,11 @@ en_fdb_aging_run(struct engine_node *node, void *data 
> > OVS_UNUSED)
> >  const struct engine_context *eng_ctx = engine_get_context();
> >  struct northd_data *northd_data = engine_get_input_data("northd", 
> > node);
> >  struct aging_waker *waker = engine_get_input_data("fdb_aging_waker", 
> > node);
> > +struct ed_type_global_config *global_config =
> > +engine_get_input_data("global_config", node);
> >
> >  if (!eng_ctx->ovnsb_idl_txn ||
> > -!northd_data->features.fdb_timestamp ||
> > +!global_config->features.fdb_timestamp ||
> >  time_msec() < waker->next_wake_msec) {
> >  return;
> >  }
> > diff --git a/northd/automake.mk b/northd/automake.mk
> > index 19abb0dece..d491973a8b 100644
> > --- a/northd/automake.mk
> > +++ b/northd/automake.mk
> > @@ -8,6 +8,8 @@ northd_ovn_northd_SOURCES = \
> > northd/northd.c \
> > northd/northd.h \
> > northd/ovn-northd.c \
> > +   northd/en-global-config.c \
> > +   northd/en-global-config.h \
> > northd/en-northd.c \
> > northd/en-northd.h \
> > northd/en-lflow.c \
> > diff --git a/northd/en-global-config.c b/northd/en-global-config.c
> > new file mode 100644
> > index 00..9ac5faf995
> > --- /dev/null
> > +++ b/northd/en-global-config.c
> > @@ -0,0 +1,576 @@
> > +/*
> > + * Licensed under the Apache License, Version 2.0 (the "License");
> > + * you may not use this file except in compliance with the License.
> > + * You may obtain a copy of the License at:
> > + *
> > + * http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing, software
> > + * distributed under the License is distributed on an "AS IS" BASIS,
> > + * WITHOUT 

Re: [ovs-dev] [PATCH ovn v6 13/13] northd: Add I-P for NB_Global and SB_Global.

2024-02-01 Thread Numan Siddique
On Tue, Jan 30, 2024 at 4:25 PM  wrote:
>
> From: Numan Siddique 
>
> A new engine node "global_config" is added which handles the changes
> to NB_Global an SB_Global tables.  It also creates these rows if
> not present.
>
> Without the I-P, any changes to the options column of these tables
> result in recompute of 'northd' and 'lflow' engine nodes.
>
> Acked-by: Dumitru Ceara 
> Acked-by: Han Zhou 
> Signed-off-by: Numan Siddique 

Recheck-request: github-robot-_Build_and_Test

> ---
>  northd/aging.c|  21 +-
>  northd/automake.mk|   2 +
>  northd/en-global-config.c | 576 ++
>  northd/en-global-config.h |  65 +
>  northd/en-lflow.c |  11 +-
>  northd/en-northd.c|  52 ++--
>  northd/en-northd.h|   2 +-
>  northd/en-sync-sb.c   |  21 +-
>  northd/inc-proc-northd.c  |  38 ++-
>  northd/northd.c   | 230 +++
>  northd/northd.h   |  24 +-
>  tests/ovn-northd.at   | 256 +++--
>  12 files changed, 1001 insertions(+), 297 deletions(-)
>  create mode 100644 northd/en-global-config.c
>  create mode 100644 northd/en-global-config.h
>
> diff --git a/northd/aging.c b/northd/aging.c
> index cdf5f4464e..b76963a2dd 100644
> --- a/northd/aging.c
> +++ b/northd/aging.c
> @@ -15,6 +15,7 @@
>
>  #include 
>
> +#include "en-global-config.h"
>  #include "lib/inc-proc-eng.h"
>  #include "lib/ovn-nb-idl.h"
>  #include "lib/ovn-sb-idl.h"
> @@ -347,15 +348,10 @@ aging_context_handle_timestamp(struct aging_context 
> *ctx, int64_t timestamp,
>  static uint32_t
>  get_removal_limit(struct engine_node *node, const char *name)
>  {
> -const struct nbrec_nb_global_table *nb_global_table =
> -EN_OVSDB_GET(engine_get_input("NB_nb_global", node));
> -const struct nbrec_nb_global *nb =
> -nbrec_nb_global_table_first(nb_global_table);
> -if (!nb) {
> -return 0;
> -}
> +struct ed_type_global_config *global_config =
> +engine_get_input_data("global_config", node);
>
> -return smap_get_uint(>options, name, 0);
> +return smap_get_uint(_config->nb_options, name, 0);
>  }
>
>  /* MAC binding aging */
> @@ -394,11 +390,14 @@ en_mac_binding_aging_run(struct engine_node *node, void 
> *data OVS_UNUSED)
>  {
>  const struct engine_context *eng_ctx = engine_get_context();
>  struct northd_data *northd_data = engine_get_input_data("northd", node);
> +struct ed_type_global_config *global_config =
> +engine_get_input_data("global_config", node);
> +
>  struct aging_waker *waker =
>  engine_get_input_data("mac_binding_aging_waker", node);
>
>  if (!eng_ctx->ovnsb_idl_txn ||
> -!northd_data->features.mac_binding_timestamp ||
> +!global_config->features.mac_binding_timestamp ||
>  time_msec() < waker->next_wake_msec) {
>  return;
>  }
> @@ -530,9 +529,11 @@ en_fdb_aging_run(struct engine_node *node, void *data 
> OVS_UNUSED)
>  const struct engine_context *eng_ctx = engine_get_context();
>  struct northd_data *northd_data = engine_get_input_data("northd", node);
>  struct aging_waker *waker = engine_get_input_data("fdb_aging_waker", 
> node);
> +struct ed_type_global_config *global_config =
> +engine_get_input_data("global_config", node);
>
>  if (!eng_ctx->ovnsb_idl_txn ||
> -!northd_data->features.fdb_timestamp ||
> +!global_config->features.fdb_timestamp ||
>  time_msec() < waker->next_wake_msec) {
>  return;
>  }
> diff --git a/northd/automake.mk b/northd/automake.mk
> index 19abb0dece..d491973a8b 100644
> --- a/northd/automake.mk
> +++ b/northd/automake.mk
> @@ -8,6 +8,8 @@ northd_ovn_northd_SOURCES = \
> northd/northd.c \
> northd/northd.h \
> northd/ovn-northd.c \
> +   northd/en-global-config.c \
> +   northd/en-global-config.h \
> northd/en-northd.c \
> northd/en-northd.h \
> northd/en-lflow.c \
> diff --git a/northd/en-global-config.c b/northd/en-global-config.c
> new file mode 100644
> index 00..9ac5faf995
> --- /dev/null
> +++ b/northd/en-global-config.c
> @@ -0,0 +1,576 @@
> +/*
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +/* OVS includes */
> +#include "openvswitch/vlog.h"
> +
> +/* OVN includes */
> +#include "debug.h"
> +#include 

[ovs-dev] [PATCH ovn v6 13/13] northd: Add I-P for NB_Global and SB_Global.

2024-01-30 Thread numans
From: Numan Siddique 

A new engine node "global_config" is added which handles the changes
to NB_Global an SB_Global tables.  It also creates these rows if
not present.

Without the I-P, any changes to the options column of these tables
result in recompute of 'northd' and 'lflow' engine nodes.

Acked-by: Dumitru Ceara 
Acked-by: Han Zhou 
Signed-off-by: Numan Siddique 
---
 northd/aging.c|  21 +-
 northd/automake.mk|   2 +
 northd/en-global-config.c | 576 ++
 northd/en-global-config.h |  65 +
 northd/en-lflow.c |  11 +-
 northd/en-northd.c|  52 ++--
 northd/en-northd.h|   2 +-
 northd/en-sync-sb.c   |  21 +-
 northd/inc-proc-northd.c  |  38 ++-
 northd/northd.c   | 230 +++
 northd/northd.h   |  24 +-
 tests/ovn-northd.at   | 256 +++--
 12 files changed, 1001 insertions(+), 297 deletions(-)
 create mode 100644 northd/en-global-config.c
 create mode 100644 northd/en-global-config.h

diff --git a/northd/aging.c b/northd/aging.c
index cdf5f4464e..b76963a2dd 100644
--- a/northd/aging.c
+++ b/northd/aging.c
@@ -15,6 +15,7 @@
 
 #include 
 
+#include "en-global-config.h"
 #include "lib/inc-proc-eng.h"
 #include "lib/ovn-nb-idl.h"
 #include "lib/ovn-sb-idl.h"
@@ -347,15 +348,10 @@ aging_context_handle_timestamp(struct aging_context *ctx, 
int64_t timestamp,
 static uint32_t
 get_removal_limit(struct engine_node *node, const char *name)
 {
-const struct nbrec_nb_global_table *nb_global_table =
-EN_OVSDB_GET(engine_get_input("NB_nb_global", node));
-const struct nbrec_nb_global *nb =
-nbrec_nb_global_table_first(nb_global_table);
-if (!nb) {
-return 0;
-}
+struct ed_type_global_config *global_config =
+engine_get_input_data("global_config", node);
 
-return smap_get_uint(>options, name, 0);
+return smap_get_uint(_config->nb_options, name, 0);
 }
 
 /* MAC binding aging */
@@ -394,11 +390,14 @@ en_mac_binding_aging_run(struct engine_node *node, void 
*data OVS_UNUSED)
 {
 const struct engine_context *eng_ctx = engine_get_context();
 struct northd_data *northd_data = engine_get_input_data("northd", node);
+struct ed_type_global_config *global_config =
+engine_get_input_data("global_config", node);
+
 struct aging_waker *waker =
 engine_get_input_data("mac_binding_aging_waker", node);
 
 if (!eng_ctx->ovnsb_idl_txn ||
-!northd_data->features.mac_binding_timestamp ||
+!global_config->features.mac_binding_timestamp ||
 time_msec() < waker->next_wake_msec) {
 return;
 }
@@ -530,9 +529,11 @@ en_fdb_aging_run(struct engine_node *node, void *data 
OVS_UNUSED)
 const struct engine_context *eng_ctx = engine_get_context();
 struct northd_data *northd_data = engine_get_input_data("northd", node);
 struct aging_waker *waker = engine_get_input_data("fdb_aging_waker", node);
+struct ed_type_global_config *global_config =
+engine_get_input_data("global_config", node);
 
 if (!eng_ctx->ovnsb_idl_txn ||
-!northd_data->features.fdb_timestamp ||
+!global_config->features.fdb_timestamp ||
 time_msec() < waker->next_wake_msec) {
 return;
 }
diff --git a/northd/automake.mk b/northd/automake.mk
index 19abb0dece..d491973a8b 100644
--- a/northd/automake.mk
+++ b/northd/automake.mk
@@ -8,6 +8,8 @@ northd_ovn_northd_SOURCES = \
northd/northd.c \
northd/northd.h \
northd/ovn-northd.c \
+   northd/en-global-config.c \
+   northd/en-global-config.h \
northd/en-northd.c \
northd/en-northd.h \
northd/en-lflow.c \
diff --git a/northd/en-global-config.c b/northd/en-global-config.c
new file mode 100644
index 00..9ac5faf995
--- /dev/null
+++ b/northd/en-global-config.c
@@ -0,0 +1,576 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+
+/* OVS includes */
+#include "openvswitch/vlog.h"
+
+/* OVN includes */
+#include "debug.h"
+#include "en-global-config.h"
+#include "include/ovn/features.h"
+#include "ipam.h"
+#include "lib/ovn-nb-idl.h"
+#include "lib/ovn-sb-idl.h"
+#include "northd.h"
+
+
+VLOG_DEFINE_THIS_MODULE(en_global_config);
+
+/* static function declarations. */
+static void northd_enable_all_features(struct ed_type_global_config *);
+static void build_chassis_features(const struct