diff mbox series

[ovs-dev] northd: Avoid sending equal port_binding option values.

Message ID 20210726150057.30465-1-dceara@redhat.com
State Accepted
Headers show
Series [ovs-dev] northd: Avoid sending equal port_binding option values. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success

Commit Message

Dumitru Ceara July 26, 2021, 3 p.m. UTC
If the Port_Binding.options map already has the correct values set for
the 'ipv6_prefix_delegation' and 'ipv6_prefix' keys, don't update the
map as it will trigger unnecessary jsonrpc messages to be sent on the
wire towards OVN_Southbound.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
---
 northd/ovn-northd.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Numan Siddique July 29, 2021, 3:32 p.m. UTC | #1
On Mon, Jul 26, 2021 at 11:01 AM Dumitru Ceara <dceara@redhat.com> wrote:
>
> If the Port_Binding.options map already has the correct values set for
> the 'ipv6_prefix_delegation' and 'ipv6_prefix' keys, don't update the
> map as it will trigger unnecessary jsonrpc messages to be sent on the
> wire towards OVN_Southbound.
>
> Signed-off-by: Dumitru Ceara <dceara@redhat.com>

Thanks.   I applied to the main branch.

Numan

> ---
>  northd/ovn-northd.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index ebe12cace..c20c98d00 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -10199,16 +10199,21 @@ build_ND_RA_flows_for_lrouter_port(
>      if (!lrport_is_enabled(op->nbrp)) {
>          prefix_delegation = false;
>      }
> -    smap_add(&options, "ipv6_prefix_delegation",
> -             prefix_delegation ? "true" : "false");
> +    if (smap_get_bool(&options, "ipv6_prefix_delegation",
> +                      false) != prefix_delegation) {
> +        smap_add(&options, "ipv6_prefix_delegation",
> +                 prefix_delegation ? "true" : "false");
> +    }
>
>      bool ipv6_prefix = smap_get_bool(&op->nbrp->options,
>                                       "prefix", false);
>      if (!lrport_is_enabled(op->nbrp)) {
>          ipv6_prefix = false;
>      }
> -    smap_add(&options, "ipv6_prefix",
> -             ipv6_prefix ? "true" : "false");
> +    if (smap_get_bool(&options, "ipv6_prefix", false) != ipv6_prefix) {
> +        smap_add(&options, "ipv6_prefix",
> +                 ipv6_prefix ? "true" : "false");
> +    }
>      sbrec_port_binding_set_options(op->sb, &options);
>
>      smap_destroy(&options);
> --
> 2.27.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index ebe12cace..c20c98d00 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -10199,16 +10199,21 @@  build_ND_RA_flows_for_lrouter_port(
     if (!lrport_is_enabled(op->nbrp)) {
         prefix_delegation = false;
     }
-    smap_add(&options, "ipv6_prefix_delegation",
-             prefix_delegation ? "true" : "false");
+    if (smap_get_bool(&options, "ipv6_prefix_delegation",
+                      false) != prefix_delegation) {
+        smap_add(&options, "ipv6_prefix_delegation",
+                 prefix_delegation ? "true" : "false");
+    }
 
     bool ipv6_prefix = smap_get_bool(&op->nbrp->options,
                                      "prefix", false);
     if (!lrport_is_enabled(op->nbrp)) {
         ipv6_prefix = false;
     }
-    smap_add(&options, "ipv6_prefix",
-             ipv6_prefix ? "true" : "false");
+    if (smap_get_bool(&options, "ipv6_prefix", false) != ipv6_prefix) {
+        smap_add(&options, "ipv6_prefix",
+                 ipv6_prefix ? "true" : "false");
+    }
     sbrec_port_binding_set_options(op->sb, &options);
 
     smap_destroy(&options);