[ovs-dev] [PATCH ovn v4 3/7] inc-proc-eng: Allow definition of engine_node with global scope

Han Zhou hzhou at ovn.org
Thu Sep 16 06:42:21 UTC 2021


On Fri, Sep 3, 2021 at 5:22 AM Mark Gray <mark.d.gray at redhat.com> wrote:
>
> Refactor ENGINE_NODE() macro to not assign function pointers. This
> allows ENGINE_NODE() to be used outside functions, creating an
> engine_node with global scope (but can be statically defined within a
file).
> This allows more flexibility in how the I-P engine can be used.
>
> Additional function pointers (e.g. is_valid(), clear_tracked_data()),
> may be assigned later, if required.
>
> Signed-off-by: Mark Gray <mark.d.gray at redhat.com>
> ---
>  controller/ovn-controller.c | 2 +-
>  lib/inc-proc-eng.h          | 8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> index 0031a103566a..c79b6c32158b 100644
> --- a/controller/ovn-controller.c
> +++ b/controller/ovn-controller.c
> @@ -3213,7 +3213,7 @@ main(int argc, char *argv[])
>      stopwatch_create(BFD_RUN_STOPWATCH_NAME, SW_MS);
>
>      /* Define inc-proc-engine nodes. */
> -    ENGINE_NODE_CUSTOM_WITH_CLEAR_TRACK_DATA(ct_zones, "ct_zones");
> +    ENGINE_NODE_CUSTOM_WITH_CLEAR_TRACK_DATA_IS_VALID(ct_zones,
"ct_zones");
>      ENGINE_NODE_WITH_CLEAR_TRACK_DATA(runtime_data, "runtime_data");
>      ENGINE_NODE(non_vif_data, "non_vif_data");
>      ENGINE_NODE(mff_ovn_geneve, "mff_ovn_geneve");
> diff --git a/lib/inc-proc-eng.h b/lib/inc-proc-eng.h
> index 859b30a71c86..1ccae559dff6 100644
> --- a/lib/inc-proc-eng.h
> +++ b/lib/inc-proc-eng.h
> @@ -295,19 +295,19 @@ void engine_ovsdb_node_add_index(struct engine_node
*, const char *name,
>          .init = en_##NAME##_init, \
>          .run = en_##NAME##_run, \
>          .cleanup = en_##NAME##_cleanup, \
> -        .is_valid = en_##NAME##_is_valid, \
> +        .is_valid = NULL, \
>          .clear_tracked_data = NULL, \
>      };
>
>  #define ENGINE_NODE_CUSTOM_DATA(NAME, NAME_STR) \
>      ENGINE_NODE_DEF(NAME, NAME_STR)
>
> -#define ENGINE_NODE_CUSTOM_WITH_CLEAR_TRACK_DATA(NAME, NAME_STR) \
> +#define ENGINE_NODE_CUSTOM_WITH_CLEAR_TRACK_DATA_IS_VALID(NAME,
NAME_STR) \
>      ENGINE_NODE_CUSTOM_DATA(NAME, NAME_STR) \
> -    en_##NAME.clear_tracked_data = en_##NAME##_clear_tracked_data;
> +    en_##NAME.clear_tracked_data = en_##NAME##_clear_tracked_data; \
> +    en_##NAME.is_valid = en_##NAME##_is_valid;
>
>  #define ENGINE_NODE(NAME, NAME_STR) \
> -    static bool (*en_##NAME##_is_valid)(struct engine_node *node) =
NULL; \

Sorry that I am not quite clear about the motivation of this patch, but at
least it seems ENGINE_NODE is now identical to ENGINE_NODE_CUSTOM_DATA (so
one of them is useless).


>      ENGINE_NODE_DEF(NAME, NAME_STR)
>
>  #define ENGINE_NODE_WITH_CLEAR_TRACK_DATA(NAME, NAME_STR) \
> --
> 2.27.0
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list