On 12/6/24 11:04 AM, Ales Musil wrote:
> Multichassis reprocessing could increase the time for processing
> the removal of ports. The issue is we could actually process
> multiple ports over and over if there did belong into single
> datapath. To prevent that create set of ports that were already
> reprocessed for the multichassis in the current I-P run and do
> not reprocess them again. This greatly reduces the amount of
> precessing during removal as shown below with the test that
> removes 1000 ports in a single transaction.
> 
> Without:
> physical_flow_output, handler for input runtime_data took 992ms
> 
> With:
> physical_flow_output, handler for input runtime_data took 58ms
> 
> Reported-at: https://issues.redhat.com/browse/FDP-1012
> Signed-off-by: Ales Musil <[email protected]>
> ---
>  controller/ovn-controller.c | 2 ++
>  controller/physical.c       | 5 +++++
>  controller/physical.h       | 3 +++
>  3 files changed, 10 insertions(+)
> 
> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> index 157def2a3..bce8dd1cd 100644
> --- a/controller/ovn-controller.c
> +++ b/controller/ovn-controller.c
> @@ -4447,6 +4447,7 @@ static void init_physical_ctx(struct engine_node *node,
>      p_ctx->if_mgr = ctrl_ctx->if_mgr;
>  
>      pflow_output_get_debug(node, &p_ctx->debug);
> +    sset_init(&p_ctx->reprocessed_pbs);
>  }
>  
>  static void
> @@ -4456,6 +4457,7 @@ destroy_physical_ctx(struct physical_ctx *p_ctx)
>          free((char *)(p_ctx->encap_ips[i]));
>      }
>      free(p_ctx->encap_ips);
> +    sset_destroy(&p_ctx->reprocessed_pbs);
>  }
>  
>  static void *
> diff --git a/controller/physical.c b/controller/physical.c
> index 3ca4e0783..d527de668 100644
> --- a/controller/physical.c
> +++ b/controller/physical.c
> @@ -2436,6 +2436,11 @@ physical_multichassis_reprocess(const struct 
> sbrec_port_binding *pb,
>      const struct sbrec_port_binding *port;
>      SBREC_PORT_BINDING_FOR_EACH_EQUAL (port, target,
>                                         
> p_ctx->sbrec_port_binding_by_datapath) {
> +        /* Ignore PBs that were already reprocessed. */
> +        if (!sset_add(&p_ctx->reprocessed_pbs, port->logical_port)) {
> +            continue;
> +        }
> +
>          ofctrl_remove_flows(flow_table, &port->header_.uuid);
>          physical_eval_port_binding(p_ctx, port, flow_table);
>      }
> diff --git a/controller/physical.h b/controller/physical.h
> index f0aecc852..b0f07fc55 100644
> --- a/controller/physical.h
> +++ b/controller/physical.h
> @@ -70,6 +70,9 @@ struct physical_ctx {
>      const char **encap_ips;
>      struct physical_debug debug;
>      bool always_tunnel;

Nit: missing empty line for readability.

> +    /* Set of port binding names that have been already reprocessed during
> +     * the I-P run. */
> +    struct sset reprocessed_pbs;
>  };
>  
>  void physical_register_ovs_idl(struct ovsdb_idl *);

Thanks, Ales!  I fixed up the minor nit above and pushed this to main,
24.09 and 24.03.

Regards,
Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to