From patchwork Mon Oct 18 12:13:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Gray X-Patchwork-Id: 1542568 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YCqLM4Jf; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HXwlx1ntJz9sPf for ; Mon, 18 Oct 2021 23:14:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id EFDE740443; Mon, 18 Oct 2021 12:14:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GtRTWkmT5nev; Mon, 18 Oct 2021 12:14:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2B0574040E; Mon, 18 Oct 2021 12:14:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D2A3C0021; Mon, 18 Oct 2021 12:14:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1FFCCC000D for ; Mon, 18 Oct 2021 12:14:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 103AF80F0F for ; Mon, 18 Oct 2021 12:14:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LK7yJZpUZdn7 for ; Mon, 18 Oct 2021 12:14:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6A5F880EE1 for ; Mon, 18 Oct 2021 12:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634559250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ySbADeTA3Xcn6qf8Qmtz9o/NskVfRpSvddh3aet3CzY=; b=YCqLM4Jf2FXR5pEwWymhJ8fGDGJ6shexdNHcdl2p2rIHBYfcfpQbX8atShV8M/pKy4b5hh H5gNdeFzqFtMVKSCVPLIRknlYKl2BoDC6lZH9XKEmOEJ6GpULIeZpcTJAFlFbtkQ192euy KOgJcd7F8OnnkxrdVGu9jhJumEL+6eo= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-554-ZwrM8T9KMAa58Ysqeex2jQ-1; Mon, 18 Oct 2021 08:14:09 -0400 X-MC-Unique: ZwrM8T9KMAa58Ysqeex2jQ-1 Received: by mail-wr1-f72.google.com with SMTP id d13-20020adf9b8d000000b00160a94c235aso8798890wrc.2 for ; Mon, 18 Oct 2021 05:14:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ySbADeTA3Xcn6qf8Qmtz9o/NskVfRpSvddh3aet3CzY=; b=j/o+uefyR+xVL0fPmbHh+RYjfAZzZ/S+Kcg/18Sjr/bzUrb3Sj+VxHh8Qf7dPB1FwL imOmSNl9aaWiNkWqNS6YzKKtjFiuN7eCHjonyl4bmgEfcJekM43TUGb1JQwKdTg/BZpx Itvfznp0FKVt17Nj9Qe8ZnZHS35js5CzRuxQ8w99vA3TjeXZuLq2lm2jqmFO/LxCE+ib SPPc4qolnnvEgQ3A+kV/VkveaVU2ELOw0Ojd8sGwx1njBOOVJ+m7hrM+3FLp41rd4pKc GSXQ6oOLQFnUKuaprge802BPIG/zUxDnBas9Pr3DS3hDCeEQPkI7kuNrxTqrnRFWOpSB 5V9g== X-Gm-Message-State: AOAM532yvbFa/GI22waoX0o0ZzwdLIY5Dh2kEuhYEOdUobAqYC2qUG31 L6AIJwNlOJP4cokzi1xc+ILPel3Kp9yVVDNqw88W6OQZ+WEtGJyZNEd3hkzdu4GjnTwAdm0wVtG 3rZXLPdI8GkwiObTOHR5Az/iLmT2f4uxBZF7Kt8Ncl9ZOAUS4gh18BsQt33YEjgfmrGTF X-Received: by 2002:adf:ab03:: with SMTP id q3mr37305743wrc.396.1634559248148; Mon, 18 Oct 2021 05:14:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9SjGKpHI6DumYtkdUHn3Hh4c4VoJ4wo/eQAEQWfgPc4cZ26wvnYvSsKPFhHG8Y+UbNKF0eA== X-Received: by 2002:adf:ab03:: with SMTP id q3mr37305718wrc.396.1634559247874; Mon, 18 Oct 2021 05:14:07 -0700 (PDT) Received: from wsfd-netdev91.ntdv.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id s13sm18429034wmc.47.2021.10.18.05.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 05:14:07 -0700 (PDT) From: Mark Gray To: dev@openvswitch.org Date: Mon, 18 Oct 2021 08:13:57 -0400 Message-Id: <20211018121403.842185-2-mark.d.gray@redhat.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211018121403.842185-1-mark.d.gray@redhat.com> References: <20211018121403.842185-1-mark.d.gray@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mark.d.gray@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v3 1/7] inc-proc-eng: Allow definition of engine_node with global scope X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 as engine nodes can be defined. Allow this is not explicitly required for I-P it does allow for a cleaner code base as the node definitions can be kept together outside any functions. Additional function pointers (e.g. is_valid(), clear_tracked_data()), may be assigned later, if required. Signed-off-by: Mark Gray Acked-by: Han Zhou --- 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 4202f32ccaf6..48121ccce082 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -3219,7 +3219,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; \ ENGINE_NODE_DEF(NAME, NAME_STR) #define ENGINE_NODE_WITH_CLEAR_TRACK_DATA(NAME, NAME_STR) \